@warmhub/cli 0.57.0 → 0.59.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.
Files changed (2) hide show
  1. package/dist/wh.js +245 -107
  2. package/package.json +1 -1
package/dist/wh.js CHANGED
@@ -18531,6 +18531,12 @@ var DEFAULT_MAX_OPS_PER_STREAM = 1e6;
18531
18531
  var DEFAULT_STREAM_APPEND_CHUNK_SIZE = 1000;
18532
18532
  var MAX_STREAM_APPEND_OPERATION_COUNT = 1e4;
18533
18533
  // ../../packages/rules/src/commit-types.ts
18534
+ var COMMIT_OPERATION_KINDS = [
18535
+ "shape",
18536
+ "thing",
18537
+ "assertion",
18538
+ "collection"
18539
+ ];
18534
18540
  function inferOperationKind(op) {
18535
18541
  if (op.kind === "shape" || op.kind === "thing" || op.kind === "assertion" || op.kind === "collection") {
18536
18542
  return op.kind;
@@ -18631,7 +18637,8 @@ var REPO_AUTH_SCOPES = [
18631
18637
  "repo:read",
18632
18638
  "repo:write",
18633
18639
  "repo:configure",
18634
- "repo:admin"
18640
+ "repo:admin",
18641
+ "repo:action-callback"
18635
18642
  ];
18636
18643
 
18637
18644
  // ../../packages/rules/src/component-manifest-contract.ts
@@ -18909,7 +18916,7 @@ function validateCliMethod(method, methodIndex, seen) {
18909
18916
  if (requiresPermission !== undefined && (typeof requiresPermission !== "string" || !VALID_REQUIRES_PERMISSION.has(requiresPermission))) {
18910
18917
  findings.push({
18911
18918
  code: "INVALID_CLI_REQUIRES_PERMISSION",
18912
- message: `${basePath}.requiresPermission must be one of "repo:read" | "repo:write" | "repo:configure" | "repo:admin"`
18919
+ message: `${basePath}.requiresPermission must be one of ${REPO_AUTH_SCOPES.map((scope) => `"${scope}"`).join(" | ")}`
18913
18920
  });
18914
18921
  }
18915
18922
  return findings;
@@ -21378,6 +21385,15 @@ function nestedObjectFields(typeDef) {
21378
21385
  }
21379
21386
  return fields;
21380
21387
  }
21388
+ // ../../packages/rules/src/subscribable-events.ts
21389
+ var COMMIT_EVENT_TYPE = "commit";
21390
+ var REPO_RENAMED_EVENT_TYPE = "repo.renamed";
21391
+ var ORG_RENAMED_EVENT_TYPE = "org.renamed";
21392
+ var SUBSCRIBABLE_EVENT_TYPES = [
21393
+ COMMIT_EVENT_TYPE,
21394
+ REPO_RENAMED_EVENT_TYPE,
21395
+ ORG_RENAMED_EVENT_TYPE
21396
+ ];
21381
21397
  // ../../packages/rules/src/system-components/system.ts
21382
21398
  var SYSTEM_COMPONENT_ID = "com.warmhub.system";
21383
21399
  var SYSTEM_REGISTERED_COMPONENT_REF = "warmhub/system";
@@ -21441,7 +21457,7 @@ function findSystemComponent(componentId) {
21441
21457
  // ../../packages/sdk-ts/package.json
21442
21458
  var package_default = {
21443
21459
  name: "@warmhub/sdk-ts",
21444
- version: "0.57.0",
21460
+ version: "0.59.0",
21445
21461
  private: false,
21446
21462
  type: "module",
21447
21463
  description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -22051,6 +22067,27 @@ function chunkArray(items, chunkSize) {
22051
22067
  }
22052
22068
  return chunks;
22053
22069
  }
22070
+ function toSubscriptionRef(args) {
22071
+ const [first, repoName, name] = args;
22072
+ return typeof first === "string" ? { orgName: first, repoName, name } : first;
22073
+ }
22074
+ function toSubscriptionListRef(args) {
22075
+ const [first, repoName] = args;
22076
+ return typeof first === "string" ? { orgName: first, repoName } : first;
22077
+ }
22078
+ function toSubscriptionBindRef(args) {
22079
+ const [first, repoName, subscriptionName, credentialSetName] = args;
22080
+ return typeof first === "string" ? {
22081
+ orgName: first,
22082
+ repoName,
22083
+ subscriptionName,
22084
+ credentialSetName
22085
+ } : first;
22086
+ }
22087
+ function toSubscriptionUnbindRef(args) {
22088
+ const [first, repoName, subscriptionName] = args;
22089
+ return typeof first === "string" ? { orgName: first, repoName, subscriptionName } : first;
22090
+ }
22054
22091
  function sanitizeSubscriptionCreateInput(input) {
22055
22092
  const {
22056
22093
  actionContainer: _actionContainer,
@@ -23018,35 +23055,24 @@ class WarmHubClient {
23018
23055
  throw toWarmHubError(error);
23019
23056
  }
23020
23057
  },
23021
- get: async (orgName, repoName, name) => {
23058
+ get: async (...args) => {
23022
23059
  try {
23023
- const result = await this.trpc.subscription.get.query({
23024
- orgName,
23025
- repoName,
23026
- name
23027
- });
23060
+ const result = await this.trpc.subscription.get.query(toSubscriptionRef(args));
23028
23061
  return normalizeSubscriptionInfo(result);
23029
23062
  } catch (error) {
23030
23063
  throw toWarmHubError(error);
23031
23064
  }
23032
23065
  },
23033
- reveal: async (orgName, repoName, name) => {
23066
+ reveal: async (...args) => {
23034
23067
  try {
23035
- return await this.trpc.subscription.reveal.query({
23036
- orgName,
23037
- repoName,
23038
- name
23039
- });
23068
+ return await this.trpc.subscription.reveal.query(toSubscriptionRef(args));
23040
23069
  } catch (error) {
23041
23070
  throw toWarmHubError(error);
23042
23071
  }
23043
23072
  },
23044
- list: async (orgName, repoName) => {
23073
+ list: async (...args) => {
23045
23074
  try {
23046
- const result = await this.trpc.subscription.list.query({
23047
- orgName,
23048
- repoName
23049
- });
23075
+ const result = await this.trpc.subscription.list.query(toSubscriptionListRef(args));
23050
23076
  return normalizeSubscriptionList(result);
23051
23077
  } catch (error) {
23052
23078
  throw toWarmHubError(error);
@@ -23060,58 +23086,37 @@ class WarmHubClient {
23060
23086
  throw toWarmHubError(error);
23061
23087
  }
23062
23088
  },
23063
- pause: async (orgName, repoName, name) => {
23089
+ pause: async (...args) => {
23064
23090
  try {
23065
- return await this.trpc.subscription.pause.mutate({
23066
- orgName,
23067
- repoName,
23068
- name
23069
- });
23091
+ return await this.trpc.subscription.pause.mutate(toSubscriptionRef(args));
23070
23092
  } catch (error) {
23071
23093
  throw toWarmHubError(error);
23072
23094
  }
23073
23095
  },
23074
- resume: async (orgName, repoName, name) => {
23096
+ resume: async (...args) => {
23075
23097
  try {
23076
- return await this.trpc.subscription.resume.mutate({
23077
- orgName,
23078
- repoName,
23079
- name
23080
- });
23098
+ return await this.trpc.subscription.resume.mutate(toSubscriptionRef(args));
23081
23099
  } catch (error) {
23082
23100
  throw toWarmHubError(error);
23083
23101
  }
23084
23102
  },
23085
- remove: async (orgName, repoName, name) => {
23103
+ remove: async (...args) => {
23086
23104
  try {
23087
- return await this.trpc.subscription.remove.mutate({
23088
- orgName,
23089
- repoName,
23090
- name
23091
- });
23105
+ return await this.trpc.subscription.remove.mutate(toSubscriptionRef(args));
23092
23106
  } catch (error) {
23093
23107
  throw toWarmHubError(error);
23094
23108
  }
23095
23109
  },
23096
- bindCredentials: async (orgName, repoName, subscriptionName, credentialSetName) => {
23110
+ bindCredentials: async (...args) => {
23097
23111
  try {
23098
- return await this.trpc.subscription.bindCredentials.mutate({
23099
- orgName,
23100
- repoName,
23101
- subscriptionName,
23102
- credentialSetName
23103
- });
23112
+ return await this.trpc.subscription.bindCredentials.mutate(toSubscriptionBindRef(args));
23104
23113
  } catch (error) {
23105
23114
  throw toWarmHubError(error);
23106
23115
  }
23107
23116
  },
23108
- unbindCredentials: async (orgName, repoName, subscriptionName) => {
23117
+ unbindCredentials: async (...args) => {
23109
23118
  try {
23110
- return await this.trpc.subscription.unbindCredentials.mutate({
23111
- orgName,
23112
- repoName,
23113
- subscriptionName
23114
- });
23119
+ return await this.trpc.subscription.unbindCredentials.mutate(toSubscriptionUnbindRef(args));
23115
23120
  } catch (error) {
23116
23121
  throw toWarmHubError(error);
23117
23122
  }
@@ -31086,7 +31091,7 @@ var handleTemplate = async (ctx, { flags, args }) => {
31086
31091
  if (operationType !== "add" && operationType !== "revise" && operationType !== "retract") {
31087
31092
  throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid --operation "${operationType}". Must be "add", "revise", or "retract".`);
31088
31093
  }
31089
- const validKinds = operationType === "retract" ? ["thing", "assertion", "shape", "collection"] : ["thing", "assertion"];
31094
+ const validKinds = operationType === "retract" ? COMMIT_OPERATION_KINDS : ["thing", "assertion"];
31090
31095
  if (!validKinds.includes(flags.kind ?? "thing")) {
31091
31096
  throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid --kind "${flags.kind}". Must be one of: ${validKinds.join(", ")}.`);
31092
31097
  }
@@ -31431,7 +31436,11 @@ var GLOBAL_FLAGS = [
31431
31436
  description: "Output mode: pretty|json (default: pretty)"
31432
31437
  },
31433
31438
  { long: "json", type: "boolean", description: "Alias for --format json" },
31434
- { long: "live", type: "boolean", description: "Reactive WebSocket mode" },
31439
+ {
31440
+ long: "live",
31441
+ type: "boolean",
31442
+ description: "Live mode (polls for updates)"
31443
+ },
31435
31444
  {
31436
31445
  long: "max-updates",
31437
31446
  type: "number",
@@ -36470,10 +36479,19 @@ function renderSubscriptionLog(out, statusOut, c, subscriptionName, result) {
36470
36479
  }
36471
36480
  }
36472
36481
  }
36482
+ var orgScopeFlag = flag.string({
36483
+ description: "Org slug for an org-scoped subscription (org.renamed); use instead of --repo"
36484
+ });
36473
36485
  var createFlags8 = {
36474
36486
  on: flag.string({
36475
36487
  description: "Shape to subscribe to"
36476
36488
  }),
36489
+ event: flag.string({
36490
+ description: "Event to watch: commit (default), repo.renamed, or org.renamed"
36491
+ }),
36492
+ org: flag.string({
36493
+ description: "Org slug for an org-scoped subscription (org.renamed)"
36494
+ }),
36477
36495
  kind: flag.string({
36478
36496
  description: "Subscription kind (webhook; the default)"
36479
36497
  }),
@@ -36518,18 +36536,34 @@ var updateFlags4 = {
36518
36536
  description: "Clear the fallback webhook URL"
36519
36537
  }),
36520
36538
  "allow-trace-reentry": createFlags8["allow-trace-reentry"],
36521
- name: createFlags8.name
36539
+ name: createFlags8.name,
36540
+ org: orgScopeFlag
36522
36541
  };
36523
36542
  var logFlags = {
36524
36543
  limit: flag.number({ description: "Max deliveries to return" })
36525
36544
  };
36526
36545
  var listFlags5 = {
36527
- limit: flag.number({ description: "Max subscriptions to return" })
36546
+ limit: flag.number({ description: "Max subscriptions to return" }),
36547
+ org: orgScopeFlag
36548
+ };
36549
+ function resolveSubScope(ctx, flags) {
36550
+ if (typeof flags.org === "string" && flags.org) {
36551
+ return { orgName: flags.org };
36552
+ }
36553
+ const { org, repo } = resolveRepoContext(ctx);
36554
+ return { orgName: org, repoName: repo };
36555
+ }
36556
+ function scopeLabel(scope) {
36557
+ return scope.repoName ? `${scope.orgName}/${scope.repoName}` : scope.orgName;
36558
+ }
36559
+ var scopeFlags = {
36560
+ org: orgScopeFlag
36528
36561
  };
36529
36562
  var viewFlags5 = {
36530
36563
  "show-secrets": flag.boolean({
36531
36564
  description: "Reveal the raw webhook URL(s) instead of the redacted origin (audit-logged)"
36532
- })
36565
+ }),
36566
+ org: orgScopeFlag
36533
36567
  };
36534
36568
  function buildSubscriptionPatchArgs(flags, usage, example) {
36535
36569
  const args = {};
@@ -36575,22 +36609,83 @@ function buildSubscriptionMutationArgs(flags, usage, example) {
36575
36609
  }
36576
36610
  return mutationArgs;
36577
36611
  }
36612
+ function parseEventType(raw, _usage, example) {
36613
+ if (raw === undefined) {
36614
+ return COMMIT_EVENT_TYPE;
36615
+ }
36616
+ if (SUBSCRIBABLE_EVENT_TYPES.includes(raw)) {
36617
+ return raw;
36618
+ }
36619
+ usageError(`--event must be one of: ${SUBSCRIBABLE_EVENT_TYPES.join(", ")}`, example);
36620
+ }
36621
+ function rejectCommitFlags(flags, eventType) {
36622
+ for (const f of ["on", "filter", "source"]) {
36623
+ const v = flags[f];
36624
+ if (typeof v === "string" && v.length > 0) {
36625
+ usageError(`--${f} is not valid for ${eventType} subscriptions — rename events have no shape or filter`, `wh sub create rename-hook --event ${eventType} --webhook-url https://example.com/hook`);
36626
+ }
36627
+ }
36628
+ }
36578
36629
  var handleCreate7 = async (ctx, { flags, args }) => {
36579
36630
  const name = args[0] ?? flags.name;
36580
- const usage = "Usage: wh sub create <name> --repo org/repo [--kind webhook] [options]";
36631
+ const usage = "Usage: wh sub create <name> (--repo org/repo | --org org) [--event commit|repo.renamed|org.renamed] [options]";
36581
36632
  const example = `wh sub create signal-hook --repo myorg/myrepo --on Signal --filter '{"shape":"Signal"}' --webhook-url https://example.com/hook`;
36582
36633
  if (!name) {
36583
36634
  usageError(usage, example);
36584
36635
  }
36585
36636
  rejectRemovedCronFlags(flags);
36586
36637
  const kind = parseKind(flags.kind, usage, example);
36587
- const { org, repo } = resolveRepoContext(ctx);
36588
- const createArgs = buildSubscriptionMutationArgs(flags, usage, example);
36589
- const sourceRepoRef = typeof flags.source === "string" ? flags.source : undefined;
36590
- const webhookUrl = createArgs.webhookUrl;
36638
+ const eventType = parseEventType(flags.event, usage, example);
36639
+ const webhookUrl = typeof flags["webhook-url"] === "string" ? flags["webhook-url"] : typeof flags.url === "string" ? flags.url : undefined;
36591
36640
  if (!webhookUrl) {
36592
36641
  usageError(usage, example);
36593
36642
  }
36643
+ const fallbackWebhookUrl = typeof flags["fallback-webhook-url"] === "string" ? flags["fallback-webhook-url"] : undefined;
36644
+ const allowTraceReentry = flags["allow-trace-reentry"] === true;
36645
+ const renameExtras = {
36646
+ ...fallbackWebhookUrl ? { fallbackWebhookUrl } : {},
36647
+ ...allowTraceReentry ? { allowTraceReentry: true } : {}
36648
+ };
36649
+ if (eventType === "org.renamed") {
36650
+ const orgName = typeof flags.org === "string" ? flags.org : undefined;
36651
+ if (!orgName) {
36652
+ usageError("org.renamed subscriptions are org-scoped — pass --org <org> (not --repo)", "wh sub create org-rename-hook --org myorg --event org.renamed --webhook-url https://example.com/hook");
36653
+ }
36654
+ rejectCommitFlags(flags, eventType);
36655
+ const result2 = await ctx.client.subscription.create({
36656
+ orgName,
36657
+ name,
36658
+ eventType,
36659
+ kind,
36660
+ webhookUrl,
36661
+ ...renameExtras
36662
+ });
36663
+ writeOutput(ctx, result2, () => {
36664
+ const c = ctx.colors;
36665
+ ctx.status(`${c.green}Created subscription${c.reset} ${c.cyan}${name}${c.reset} on org ${c.cyan}${orgName}${c.reset} (org.renamed)`);
36666
+ });
36667
+ return;
36668
+ }
36669
+ const { org, repo } = resolveRepoContext(ctx);
36670
+ if (eventType === "repo.renamed") {
36671
+ rejectCommitFlags(flags, eventType);
36672
+ const result2 = await ctx.client.subscription.create({
36673
+ orgName: org,
36674
+ repoName: repo,
36675
+ name,
36676
+ eventType,
36677
+ kind,
36678
+ webhookUrl,
36679
+ ...renameExtras
36680
+ });
36681
+ writeOutput(ctx, result2, () => {
36682
+ const c = ctx.colors;
36683
+ ctx.status(`${c.green}Created subscription${c.reset} ${c.cyan}${name}${c.reset} on ${c.cyan}${org}/${repo}${c.reset} (repo.renamed)`);
36684
+ });
36685
+ return;
36686
+ }
36687
+ const createArgs = buildSubscriptionMutationArgs(flags, usage, example);
36688
+ const sourceRepoRef = typeof flags.source === "string" ? flags.source : undefined;
36594
36689
  const result = await ctx.client.subscription.create({
36595
36690
  orgName: org,
36596
36691
  repoName: repo,
@@ -36610,24 +36705,24 @@ var handleCreate7 = async (ctx, { flags, args }) => {
36610
36705
  };
36611
36706
  var handleUpdate4 = async (ctx, { flags, args }) => {
36612
36707
  const name = args[0] ?? flags.name;
36613
- const usage = "Usage: wh sub update <name> --repo org/repo [options]";
36708
+ const usage = "Usage: wh sub update <name> (--repo org/repo | --org org) [options]";
36614
36709
  const example = "wh sub update signal-hook --repo myorg/myrepo";
36615
36710
  if (!name) {
36616
36711
  usageError(usage, example);
36617
36712
  }
36618
36713
  rejectRemovedCronFlags(flags);
36619
- const { org, repo } = resolveRepoContext(ctx);
36620
- const existing = await ctx.client.subscription.get(org, repo, name);
36714
+ const scope = resolveSubScope(ctx, flags);
36715
+ const scopeArg = scope.repoName ? `--repo ${scopeLabel(scope)}` : `--org ${scope.orgName}`;
36716
+ const existing = await ctx.client.subscription.get({ ...scope, name });
36621
36717
  if (existing.kind !== "webhook") {
36622
- throw new CliError(2 /* UserInput */, "USER_INPUT", `Subscription "${name}" has kind "${existing.kind}", which is no longer supported and cannot be updated`, undefined, `Delete it with: wh sub delete ${name} --repo ${org}/${repo}`);
36718
+ throw new CliError(2 /* UserInput */, "USER_INPUT", `Subscription "${name}" has kind "${existing.kind}", which is no longer supported and cannot be updated`, undefined, `Delete it with: wh sub delete ${name} ${scopeArg}`);
36623
36719
  }
36624
36720
  if (flags.kind && flags.kind !== existing.kind) {
36625
36721
  usageError(usage, example);
36626
36722
  }
36627
36723
  const patchArgs = buildSubscriptionPatchArgs(flags, usage, example);
36628
36724
  const result = await ctx.client.subscription.update({
36629
- orgName: org,
36630
- repoName: repo,
36725
+ ...scope,
36631
36726
  name,
36632
36727
  ...patchArgs.shapeName != null ? { shapeName: patchArgs.shapeName } : {},
36633
36728
  ...patchArgs.filterJson != null ? {
@@ -36641,17 +36736,17 @@ var handleUpdate4 = async (ctx, { flags, args }) => {
36641
36736
  });
36642
36737
  writeOutput(ctx, result, () => {
36643
36738
  const c = ctx.colors;
36644
- ctx.status(`${c.green}Updated subscription${c.reset} ${c.cyan}${name}${c.reset} on ${c.cyan}${org}/${repo}${c.reset}`);
36739
+ ctx.status(`${c.green}Updated subscription${c.reset} ${c.cyan}${name}${c.reset} on ${c.cyan}${scopeLabel(scope)}${c.reset}`);
36645
36740
  });
36646
36741
  };
36647
36742
  var handleView8 = async (ctx, { args, flags }) => {
36648
36743
  const name = args[0];
36649
36744
  if (!name) {
36650
- usageError("Usage: wh sub view <name> [--show-secrets] [--repo org/repo]", "wh sub view signal-hook --repo myorg/myrepo");
36745
+ usageError("Usage: wh sub view <name> [--show-secrets] (--repo org/repo | --org org)", "wh sub view signal-hook --repo myorg/myrepo");
36651
36746
  }
36652
- const { org, repo } = resolveRepoContext(ctx);
36653
- const sub = await ctx.client.subscription.get(org, repo, name);
36654
- const revealed = flags["show-secrets"] ? await ctx.client.subscription.reveal(org, repo, name) : undefined;
36747
+ const scope = resolveSubScope(ctx, flags);
36748
+ const sub = await ctx.client.subscription.get({ ...scope, name });
36749
+ const revealed = flags["show-secrets"] ? await ctx.client.subscription.reveal({ ...scope, name }) : undefined;
36655
36750
  writeOutput(ctx, revealed ? { ...sub, ...revealed } : sub, () => {
36656
36751
  const c = ctx.colors;
36657
36752
  ctx.out(`${c.bold}${sub.name}${c.reset}`);
@@ -36678,16 +36773,17 @@ var handleView8 = async (ctx, { args, flags }) => {
36678
36773
  });
36679
36774
  };
36680
36775
  var handleList7 = async (ctx, { flags }) => {
36681
- const { org, repo } = resolveRepoContext(ctx);
36682
- const all = await ctx.client.subscription.list(org, repo);
36776
+ const scope = resolveSubScope(ctx, flags);
36777
+ const label = scopeLabel(scope);
36778
+ const all = await ctx.client.subscription.list(scope);
36683
36779
  const items = all.slice(0, flags.limit ?? all.length);
36684
36780
  writePageOutput(ctx, items, { limit: flags.limit ?? all.length, nextCursor: null }, () => {
36685
36781
  const c = ctx.colors;
36686
36782
  if (!items.length) {
36687
- ctx.status(`${c.dim}No subscriptions in ${org}/${repo}${c.reset}`);
36783
+ ctx.status(`${c.dim}No subscriptions in ${label}${c.reset}`);
36688
36784
  return;
36689
36785
  }
36690
- ctx.out(`${c.bold}Subscriptions:${c.reset} ${c.cyan}${org}/${repo}${c.reset}`);
36786
+ ctx.out(`${c.bold}Subscriptions:${c.reset} ${c.cyan}${label}${c.reset}`);
36691
36787
  for (const sub of items) {
36692
36788
  const active = sub.active ? `${c.green}active` : `${c.yellow}paused`;
36693
36789
  let line = ` ${c.cyan}${sub.name}${c.reset} ${c.dim}[${sub.kind}]${c.reset} ${active}${c.reset}`;
@@ -36698,37 +36794,37 @@ var handleList7 = async (ctx, { flags }) => {
36698
36794
  }
36699
36795
  });
36700
36796
  };
36701
- var handlePause = async (ctx, { args }) => {
36797
+ var handlePause = async (ctx, { args, flags }) => {
36702
36798
  const name = args[0];
36703
36799
  if (!name) {
36704
- usageError("Usage: wh sub pause <name> [--repo org/repo]", "wh sub pause signal-hook --repo myorg/myrepo");
36800
+ usageError("Usage: wh sub pause <name> (--repo org/repo | --org org)", "wh sub pause signal-hook --repo myorg/myrepo");
36705
36801
  }
36706
- const { org, repo } = resolveRepoContext(ctx);
36707
- const result = await ctx.client.subscription.pause(org, repo, name);
36802
+ const scope = resolveSubScope(ctx, flags);
36803
+ const result = await ctx.client.subscription.pause({ ...scope, name });
36708
36804
  writeOutput(ctx, result, () => {
36709
36805
  const c = ctx.colors;
36710
36806
  ctx.status(`${c.yellow}Paused subscription${c.reset} ${c.cyan}${name}${c.reset}`);
36711
36807
  });
36712
36808
  };
36713
- var handleResume = async (ctx, { args }) => {
36809
+ var handleResume = async (ctx, { args, flags }) => {
36714
36810
  const name = args[0];
36715
36811
  if (!name) {
36716
- usageError("Usage: wh sub resume <name> [--repo org/repo]", "wh sub resume signal-hook --repo myorg/myrepo");
36812
+ usageError("Usage: wh sub resume <name> (--repo org/repo | --org org)", "wh sub resume signal-hook --repo myorg/myrepo");
36717
36813
  }
36718
- const { org, repo } = resolveRepoContext(ctx);
36719
- const result = await ctx.client.subscription.resume(org, repo, name);
36814
+ const scope = resolveSubScope(ctx, flags);
36815
+ const result = await ctx.client.subscription.resume({ ...scope, name });
36720
36816
  writeOutput(ctx, result, () => {
36721
36817
  const c = ctx.colors;
36722
36818
  ctx.status(`${c.green}Resumed subscription${c.reset} ${c.cyan}${name}${c.reset}`);
36723
36819
  });
36724
36820
  };
36725
- var handleDelete3 = async (ctx, { args }) => {
36821
+ var handleDelete3 = async (ctx, { args, flags }) => {
36726
36822
  const name = args[0];
36727
36823
  if (!name) {
36728
- usageError("Usage: wh sub delete <name> [--repo org/repo]", "wh sub delete signal-hook --repo myorg/myrepo");
36824
+ usageError("Usage: wh sub delete <name> (--repo org/repo | --org org)", "wh sub delete signal-hook --repo myorg/myrepo");
36729
36825
  }
36730
- const { org, repo } = resolveRepoContext(ctx);
36731
- const result = await ctx.client.subscription.remove(org, repo, name);
36826
+ const scope = resolveSubScope(ctx, flags);
36827
+ const result = await ctx.client.subscription.remove({ ...scope, name });
36732
36828
  writeOutput(ctx, result, () => {
36733
36829
  const c = ctx.colors;
36734
36830
  ctx.status(`${c.red}Deleted subscription${c.reset} ${c.cyan}${name}${c.reset}`);
@@ -36737,28 +36833,36 @@ var handleDelete3 = async (ctx, { args }) => {
36737
36833
  var bindFlags = {
36738
36834
  credentials: flag.string({
36739
36835
  description: "Name of the credential set to bind"
36740
- })
36836
+ }),
36837
+ org: orgScopeFlag
36741
36838
  };
36742
36839
  var handleBind = async (ctx, { flags, args }) => {
36743
36840
  const name = args[0];
36744
36841
  const setName = flags.credentials;
36745
36842
  if (!name || !setName) {
36746
- usageError("Usage: wh sub bind <name> --credentials <setName> [--repo org/repo]", "wh sub bind signal-hook --credentials webhook-keys --repo myorg/myrepo");
36843
+ usageError("Usage: wh sub bind <name> --credentials <setName> (--repo org/repo | --org org)", "wh sub bind signal-hook --credentials webhook-keys --repo myorg/myrepo");
36747
36844
  }
36748
- const { org, repo } = resolveRepoContext(ctx);
36749
- const result = await ctx.client.subscription.bindCredentials(org, repo, name, setName);
36845
+ const scope = resolveSubScope(ctx, flags);
36846
+ const result = await ctx.client.subscription.bindCredentials({
36847
+ ...scope,
36848
+ subscriptionName: name,
36849
+ credentialSetName: setName
36850
+ });
36750
36851
  writeOutput(ctx, result, () => {
36751
36852
  const c = ctx.colors;
36752
36853
  ctx.status(`${c.green}Bound${c.reset} ${c.cyan}${setName}${c.reset} to ${c.cyan}${name}${c.reset}`);
36753
36854
  });
36754
36855
  };
36755
- var handleUnbind = async (ctx, { args }) => {
36856
+ var handleUnbind = async (ctx, { args, flags }) => {
36756
36857
  const name = args[0];
36757
36858
  if (!name) {
36758
- usageError("Usage: wh sub unbind <name> [--repo org/repo]", "wh sub unbind signal-hook --repo myorg/myrepo");
36859
+ usageError("Usage: wh sub unbind <name> (--repo org/repo | --org org)", "wh sub unbind signal-hook --repo myorg/myrepo");
36759
36860
  }
36760
- const { org, repo } = resolveRepoContext(ctx);
36761
- const result = await ctx.client.subscription.unbindCredentials(org, repo, name);
36861
+ const scope = resolveSubScope(ctx, flags);
36862
+ const result = await ctx.client.subscription.unbindCredentials({
36863
+ ...scope,
36864
+ subscriptionName: name
36865
+ });
36762
36866
  writeOutput(ctx, result, () => {
36763
36867
  const c = ctx.colors;
36764
36868
  ctx.status(`${c.yellow}Unbound${c.reset} credentials from ${c.cyan}${name}${c.reset}`);
@@ -36843,6 +36947,12 @@ var SUB_DOMAIN = defineDomain({
36843
36947
  "# Subscribe to shape retracts only",
36844
36948
  ` $ wh sub create shape-retracts --repo myorg/myrepo --kind webhook --filter '{"all":[{"kind":"shape"},{"operation":"retract"}]}' --webhook-url https://hooks.example.com/shapes`,
36845
36949
  "",
36950
+ "# Subscribe to repo renames (metadata event — no shape/filter)",
36951
+ " $ wh sub create repo-rename-hook --repo myorg/myrepo --event repo.renamed --webhook-url https://example.com/hook",
36952
+ "",
36953
+ "# Subscribe to org renames (org-scoped — use --org, not --repo)",
36954
+ " $ wh sub create org-rename-hook --org myorg --event org.renamed --webhook-url https://example.com/hook",
36955
+ "",
36846
36956
  "# Webhook auth: create a credential set with WEBHOOK_* keys, then bind it to the subscription.",
36847
36957
  "# See `wh credential set --help` for supported key names and `wh sub bind --help`.",
36848
36958
  " $ wh credential create webhook-keys --repo myorg/myrepo",
@@ -36859,7 +36969,9 @@ var SUB_DOMAIN = defineDomain({
36859
36969
  flags: updateFlags4,
36860
36970
  examples: [
36861
36971
  "# Update only the webhook URL",
36862
- " $ wh sub update signal-hook --repo myorg/myrepo --webhook-url https://example.com/v2/hook"
36972
+ " $ wh sub update signal-hook --repo myorg/myrepo --webhook-url https://example.com/v2/hook",
36973
+ "# Repoint an org-scoped (org.renamed) rename hook in place",
36974
+ " $ wh sub update org-rename-hook --org myorg --webhook-url https://example.com/v2/hook"
36863
36975
  ],
36864
36976
  handler: handleUpdate4
36865
36977
  },
@@ -36871,7 +36983,9 @@ var SUB_DOMAIN = defineDomain({
36871
36983
  flags: viewFlags5,
36872
36984
  examples: [
36873
36985
  "wh sub view signal-hook --repo myorg/myrepo",
36874
- "wh sub view signal-hook --show-secrets --repo myorg/myrepo"
36986
+ "wh sub view signal-hook --show-secrets --repo myorg/myrepo",
36987
+ "# Org-scoped (org.renamed) subscription",
36988
+ " $ wh sub view org-rename-hook --org myorg"
36875
36989
  ],
36876
36990
  handler: handleView8
36877
36991
  },
@@ -36881,7 +36995,12 @@ var SUB_DOMAIN = defineDomain({
36881
36995
  summary: "List all subscriptions",
36882
36996
  args: "",
36883
36997
  flags: listFlags5,
36884
- examples: ["wh sub list --repo myorg/myrepo", "wh sub list --limit 10"],
36998
+ examples: [
36999
+ "wh sub list --repo myorg/myrepo",
37000
+ "wh sub list --limit 10",
37001
+ "# Org-scoped (org.renamed) subscriptions",
37002
+ " $ wh sub list --org myorg"
37003
+ ],
36885
37004
  handler: handleList7
36886
37005
  },
36887
37006
  log: {
@@ -36921,7 +37040,12 @@ var SUB_DOMAIN = defineDomain({
36921
37040
  prime: true,
36922
37041
  summary: "Pause a subscription",
36923
37042
  args: "<name>",
36924
- examples: ["wh sub pause signal-hook --repo myorg/myrepo"],
37043
+ flags: scopeFlags,
37044
+ examples: [
37045
+ "wh sub pause signal-hook --repo myorg/myrepo",
37046
+ "# Org-scoped (org.renamed) subscription",
37047
+ " $ wh sub pause org-rename-hook --org myorg"
37048
+ ],
36925
37049
  handler: handlePause
36926
37050
  },
36927
37051
  resume: {
@@ -36929,7 +37053,11 @@ var SUB_DOMAIN = defineDomain({
36929
37053
  prime: true,
36930
37054
  summary: "Resume a paused subscription",
36931
37055
  args: "<name>",
36932
- examples: ["wh sub resume signal-hook --repo myorg/myrepo"],
37056
+ flags: scopeFlags,
37057
+ examples: [
37058
+ "wh sub resume signal-hook --repo myorg/myrepo",
37059
+ " $ wh sub resume org-rename-hook --org myorg"
37060
+ ],
36933
37061
  handler: handleResume
36934
37062
  },
36935
37063
  bind: {
@@ -36940,7 +37068,9 @@ var SUB_DOMAIN = defineDomain({
36940
37068
  flags: bindFlags,
36941
37069
  examples: [
36942
37070
  "# Bind credentials to inject auth headers on webhook delivery",
36943
- " $ wh sub bind signal-hook --credentials webhook-keys --repo myorg/myrepo"
37071
+ " $ wh sub bind signal-hook --credentials webhook-keys --repo myorg/myrepo",
37072
+ "# Org-scoped (org.renamed) subscription + org-scoped credential set",
37073
+ " $ wh sub bind org-rename-hook --credentials org-webhook-keys --org myorg"
36944
37074
  ],
36945
37075
  handler: handleBind
36946
37076
  },
@@ -36949,7 +37079,11 @@ var SUB_DOMAIN = defineDomain({
36949
37079
  prime: true,
36950
37080
  summary: "Remove credential binding from a subscription",
36951
37081
  args: "<name>",
36952
- examples: ["wh sub unbind signal-hook --repo myorg/myrepo"],
37082
+ flags: scopeFlags,
37083
+ examples: [
37084
+ "wh sub unbind signal-hook --repo myorg/myrepo",
37085
+ " $ wh sub unbind org-rename-hook --org myorg"
37086
+ ],
36953
37087
  handler: handleUnbind
36954
37088
  },
36955
37089
  delete: {
@@ -36957,7 +37091,11 @@ var SUB_DOMAIN = defineDomain({
36957
37091
  prime: true,
36958
37092
  summary: "Delete a subscription",
36959
37093
  args: "<name>",
36960
- examples: ["wh sub delete signal-hook --repo myorg/myrepo"],
37094
+ flags: scopeFlags,
37095
+ examples: [
37096
+ "wh sub delete signal-hook --repo myorg/myrepo",
37097
+ " $ wh sub delete org-rename-hook --org myorg"
37098
+ ],
36961
37099
  handler: handleDelete3
36962
37100
  }
36963
37101
  }
@@ -37713,7 +37851,7 @@ var GLOBAL_FLAGS2 = [
37713
37851
  {
37714
37852
  long: "live",
37715
37853
  type: "boolean",
37716
- description: "Reactive WebSocket mode"
37854
+ description: "Live mode (polls for updates)"
37717
37855
  },
37718
37856
  {
37719
37857
  long: "max-updates",
@@ -38736,7 +38874,7 @@ function resolveLogLevel(flags, env) {
38736
38874
  // package.json
38737
38875
  var package_default3 = {
38738
38876
  name: "@warmhub/cli",
38739
- version: "0.57.0",
38877
+ version: "0.59.0",
38740
38878
  private: false,
38741
38879
  type: "module",
38742
38880
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -39377,4 +39515,4 @@ if (!updateCheckSuppressedByArgv && shouldRunUpdateCheck(updateEligibility)) {
39377
39515
  var interceptedExitCode = await maybeHandleComponentShellBoundary(dispatchArgv);
39378
39516
  process.exitCode = interceptedExitCode === undefined ? await runCli(dispatchArgv, { version: package_default3.version }) : interceptedExitCode;
39379
39517
 
39380
- //# debugId=C665F4BA94FD1E0F64756E2164756E21
39518
+ //# debugId=133777AA8F34C0BB64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmhub/cli",
3
- "version": "0.57.0",
3
+ "version": "0.59.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",