@openape/apes 0.18.0 → 0.19.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 consola33 from "consola";
66
+ import consola35 from "consola";
67
67
 
68
68
  // src/ape-shell.ts
69
69
  import path from "path";
@@ -93,7 +93,7 @@ function rewriteApeShellArgs(argv, argv0) {
93
93
  }
94
94
 
95
95
  // src/cli.ts
96
- import { defineCommand as defineCommand41, runMain } from "citty";
96
+ import { defineCommand as defineCommand44, runMain } from "citty";
97
97
 
98
98
  // src/commands/auth/login.ts
99
99
  import { Buffer } from "buffer";
@@ -3701,7 +3701,7 @@ var mcpCommand = defineCommand32({
3701
3701
  if (transport !== "stdio" && transport !== "sse") {
3702
3702
  throw new Error('Transport must be "stdio" or "sse"');
3703
3703
  }
3704
- const { startMcpServer } = await import("./server-RPC46G4J.js");
3704
+ const { startMcpServer } = await import("./server-GYHLAJXV.js");
3705
3705
  await startMcpServer(transport, port);
3706
3706
  }
3707
3707
  });
@@ -4172,11 +4172,81 @@ var utilsCommand = defineCommand37({
4172
4172
  }
4173
4173
  });
4174
4174
 
4175
- // src/commands/dns-check.ts
4175
+ // src/commands/sessions/index.ts
4176
+ import { defineCommand as defineCommand40 } from "citty";
4177
+
4178
+ // src/commands/sessions/list.ts
4176
4179
  import { defineCommand as defineCommand38 } from "citty";
4177
4180
  import consola31 from "consola";
4181
+ var sessionsListCommand = defineCommand38({
4182
+ meta: {
4183
+ name: "list",
4184
+ description: "List your active refresh-token families (one per logged-in device)."
4185
+ },
4186
+ args: {
4187
+ json: { type: "boolean", description: "JSON output" },
4188
+ limit: { type: "string", description: "Max rows (default 50)" }
4189
+ },
4190
+ async run({ args }) {
4191
+ const path2 = args.limit ? `/api/me/sessions?limit=${encodeURIComponent(String(args.limit))}` : "/api/me/sessions";
4192
+ const result = await apiFetch(path2);
4193
+ if (args.json) {
4194
+ process.stdout.write(`${JSON.stringify(result, null, 2)}
4195
+ `);
4196
+ return;
4197
+ }
4198
+ if (result.data.length === 0) {
4199
+ consola31.info("No active sessions.");
4200
+ return;
4201
+ }
4202
+ for (const f of result.data) {
4203
+ const created = new Date(f.createdAt).toISOString();
4204
+ const expires = new Date(f.expiresAt).toISOString();
4205
+ console.log(`${f.familyId} client=${f.clientId} created=${created} expires=${expires}`);
4206
+ }
4207
+ }
4208
+ });
4209
+
4210
+ // src/commands/sessions/remove.ts
4211
+ import { defineCommand as defineCommand39 } from "citty";
4212
+ import consola32 from "consola";
4213
+ var sessionsRemoveCommand = defineCommand39({
4214
+ meta: {
4215
+ name: "remove",
4216
+ description: "Revoke one of your active refresh-token families by id."
4217
+ },
4218
+ args: {
4219
+ familyId: {
4220
+ type: "positional",
4221
+ required: true,
4222
+ description: "Family id (from `apes sessions list`)."
4223
+ }
4224
+ },
4225
+ async run({ args }) {
4226
+ const id = String(args.familyId).trim();
4227
+ if (!id) throw new CliError("familyId required");
4228
+ await apiFetch(`/api/me/sessions/${encodeURIComponent(id)}`, { method: "DELETE" });
4229
+ consola32.success(`Session ${id} revoked. The device using it will need to \`apes login\` again on its next refresh.`);
4230
+ }
4231
+ });
4232
+
4233
+ // src/commands/sessions/index.ts
4234
+ var sessionsCommand = defineCommand40({
4235
+ meta: {
4236
+ name: "sessions",
4237
+ description: "Manage your active refresh-token sessions across devices"
4238
+ },
4239
+ subCommands: {
4240
+ list: sessionsListCommand,
4241
+ remove: sessionsRemoveCommand
4242
+ }
4243
+ });
4244
+
4245
+ // src/commands/dns-check.ts
4246
+ import { defineCommand as defineCommand41 } from "citty";
4247
+ import consola33 from "consola";
4178
4248
  import { resolveDDISA as resolveDDISA3 } from "@openape/core";
4179
- var dnsCheckCommand = defineCommand38({
4249
+ var dnsCheckCommand = defineCommand41({
4180
4250
  meta: {
4181
4251
  name: "dns-check",
4182
4252
  description: "Validate DDISA DNS TXT records for a domain"
@@ -4190,7 +4260,7 @@ var dnsCheckCommand = defineCommand38({
4190
4260
  },
4191
4261
  async run({ args }) {
4192
4262
  const domain = args.domain;
4193
- consola31.start(`Checking _ddisa.${domain}...`);
4263
+ consola33.start(`Checking _ddisa.${domain}...`);
4194
4264
  try {
4195
4265
  const result = await resolveDDISA3(domain);
4196
4266
  if (!result) {
@@ -4199,7 +4269,7 @@ var dnsCheckCommand = defineCommand38({
4199
4269
  console.log(` _ddisa.${domain} TXT "v=ddisa1 idp=https://id.${domain}"`);
4200
4270
  throw new CliError(`No DDISA record found for ${domain}`);
4201
4271
  }
4202
- consola31.success(`_ddisa.${domain} \u2192 ${result.idp}`);
4272
+ consola33.success(`_ddisa.${domain} \u2192 ${result.idp}`);
4203
4273
  console.log("");
4204
4274
  console.log(` Version: ${result.version || "ddisa1"}`);
4205
4275
  console.log(` IdP URL: ${result.idp}`);
@@ -4208,14 +4278,14 @@ var dnsCheckCommand = defineCommand38({
4208
4278
  if (result.priority !== void 0)
4209
4279
  console.log(` Priority: ${result.priority}`);
4210
4280
  console.log("");
4211
- consola31.start(`Verifying IdP at ${result.idp}...`);
4281
+ consola33.start(`Verifying IdP at ${result.idp}...`);
4212
4282
  const discoResp = await fetch(`${result.idp}/.well-known/openid-configuration`);
4213
4283
  if (!discoResp.ok) {
4214
- consola31.warn(`IdP discovery failed (${discoResp.status}). Is the IdP running at ${result.idp}?`);
4284
+ consola33.warn(`IdP discovery failed (${discoResp.status}). Is the IdP running at ${result.idp}?`);
4215
4285
  return;
4216
4286
  }
4217
4287
  const disco = await discoResp.json();
4218
- consola31.success(`IdP is reachable`);
4288
+ consola33.success(`IdP is reachable`);
4219
4289
  console.log(` Issuer: ${disco.issuer}`);
4220
4290
  console.log(` DDISA: v${disco.ddisa_version || "?"}`);
4221
4291
  if (disco.ddisa_auth_methods_supported) {
@@ -4233,7 +4303,7 @@ var dnsCheckCommand = defineCommand38({
4233
4303
  // src/commands/health.ts
4234
4304
  import { exec } from "child_process";
4235
4305
  import { promisify } from "util";
4236
- import { defineCommand as defineCommand39 } from "citty";
4306
+ import { defineCommand as defineCommand42 } from "citty";
4237
4307
  var execAsync = promisify(exec);
4238
4308
  async function resolveApeShellPath() {
4239
4309
  try {
@@ -4269,7 +4339,7 @@ async function bestEffortGrantCount(idp) {
4269
4339
  }
4270
4340
  }
4271
4341
  async function runHealth(args) {
4272
- const version = true ? "0.18.0" : "0.0.0";
4342
+ const version = true ? "0.19.0" : "0.0.0";
4273
4343
  const auth = loadAuth();
4274
4344
  if (!auth) {
4275
4345
  throw new CliError("Not logged in. Run `apes login` first.", 1);
@@ -4332,7 +4402,7 @@ async function runHealth(args) {
4332
4402
  throw new CliError(`IdP ${auth.idp} unreachable: ${idpProbe.error}`, 1);
4333
4403
  }
4334
4404
  }
4335
- var healthCommand = defineCommand39({
4405
+ var healthCommand = defineCommand42({
4336
4406
  meta: {
4337
4407
  name: "health",
4338
4408
  description: "Report CLI diagnostic state (auth, IdP, grants, binaries)"
@@ -4350,8 +4420,8 @@ var healthCommand = defineCommand39({
4350
4420
  });
4351
4421
 
4352
4422
  // src/commands/workflows.ts
4353
- import { defineCommand as defineCommand40 } from "citty";
4354
- import consola32 from "consola";
4423
+ import { defineCommand as defineCommand43 } from "citty";
4424
+ import consola34 from "consola";
4355
4425
 
4356
4426
  // src/guides/index.ts
4357
4427
  var guides = [
@@ -4401,7 +4471,7 @@ var guides = [
4401
4471
  ];
4402
4472
 
4403
4473
  // src/commands/workflows.ts
4404
- var workflowsCommand = defineCommand40({
4474
+ var workflowsCommand = defineCommand43({
4405
4475
  meta: {
4406
4476
  name: "workflows",
4407
4477
  description: "Discover workflow guides"
@@ -4422,7 +4492,7 @@ var workflowsCommand = defineCommand40({
4422
4492
  if (args.id) {
4423
4493
  const guide = guides.find((g) => g.id === String(args.id));
4424
4494
  if (!guide) {
4425
- consola32.info(`Available: ${guides.map((g) => g.id).join(", ")}`);
4495
+ consola34.info(`Available: ${guides.map((g) => g.id).join(", ")}`);
4426
4496
  throw new CliError(`Guide not found: ${args.id}`);
4427
4497
  }
4428
4498
  if (args.json) {
@@ -4471,10 +4541,10 @@ if (shellRewrite) {
4471
4541
  if (shellRewrite.action === "rewrite") {
4472
4542
  process.argv = shellRewrite.argv;
4473
4543
  } else if (shellRewrite.action === "version") {
4474
- console.log(`ape-shell ${"0.18.0"} (OpenApe DDISA shell wrapper)`);
4544
+ console.log(`ape-shell ${"0.19.0"} (OpenApe DDISA shell wrapper)`);
4475
4545
  process.exit(0);
4476
4546
  } else if (shellRewrite.action === "help") {
4477
- console.log(`ape-shell ${"0.18.0"} \u2014 OpenApe DDISA shell wrapper`);
4547
+ console.log(`ape-shell ${"0.19.0"} \u2014 OpenApe DDISA shell wrapper`);
4478
4548
  console.log("");
4479
4549
  console.log("Usage:");
4480
4550
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -4498,7 +4568,7 @@ if (shellRewrite) {
4498
4568
  }
4499
4569
  }
4500
4570
  var debug = process.argv.includes("--debug");
4501
- var grantsCommand = defineCommand41({
4571
+ var grantsCommand = defineCommand44({
4502
4572
  meta: {
4503
4573
  name: "grants",
4504
4574
  description: "Grant management"
@@ -4519,7 +4589,7 @@ var grantsCommand = defineCommand41({
4519
4589
  "delegation-revoke": delegationRevokeCommand
4520
4590
  }
4521
4591
  });
4522
- var configCommand = defineCommand41({
4592
+ var configCommand = defineCommand44({
4523
4593
  meta: {
4524
4594
  name: "config",
4525
4595
  description: "Configuration management"
@@ -4529,10 +4599,10 @@ var configCommand = defineCommand41({
4529
4599
  set: configSetCommand
4530
4600
  }
4531
4601
  });
4532
- var main = defineCommand41({
4602
+ var main = defineCommand44({
4533
4603
  meta: {
4534
4604
  name: "apes",
4535
- version: "0.18.0",
4605
+ version: "0.19.0",
4536
4606
  description: "Unified CLI for OpenApe"
4537
4607
  },
4538
4608
  subCommands: {
@@ -4541,6 +4611,7 @@ var main = defineCommand41({
4541
4611
  "register-user": registerUserCommand,
4542
4612
  "dns-check": dnsCheckCommand,
4543
4613
  utils: utilsCommand,
4614
+ sessions: sessionsCommand,
4544
4615
  login: loginCommand,
4545
4616
  logout: logoutCommand,
4546
4617
  whoami: whoamiCommand,
@@ -4591,13 +4662,13 @@ runMain(main).catch((err) => {
4591
4662
  process.exit(err.exitCode);
4592
4663
  }
4593
4664
  if (err instanceof CliError) {
4594
- consola33.error(err.message);
4665
+ consola35.error(err.message);
4595
4666
  process.exit(err.exitCode);
4596
4667
  }
4597
4668
  if (debug) {
4598
- consola33.error(err);
4669
+ consola35.error(err);
4599
4670
  } else {
4600
- consola33.error(err instanceof ApiError ? err.message : err instanceof Error ? err.message : String(err));
4671
+ consola35.error(err instanceof ApiError ? err.message : err instanceof Error ? err.message : String(err));
4601
4672
  }
4602
4673
  process.exit(1);
4603
4674
  });