@toon-protocol/rig 5.0.1 → 5.1.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.
@@ -52,19 +52,19 @@ import {
52
52
  updateRef,
53
53
  writeGitObjects,
54
54
  writeToonConfig
55
- } from "./chunk-4WVH2ITA.js";
55
+ } from "./chunk-J6GNB54J.js";
56
56
  import {
57
57
  PREFERRED_GATEWAY,
58
58
  mirrorGatewaysFor,
59
59
  readGateways,
60
60
  shaResolverFor
61
- } from "./chunk-CHVOXCDV.js";
61
+ } from "./chunk-P5ZKJN6B.js";
62
62
  import {
63
63
  COMMENT_KIND,
64
64
  DEFAULT_KEYSTORE_PASSWORD,
65
65
  LEGACY_COMMENT_KIND,
66
66
  MissingIdentityError,
67
- authorizedStatusAuthors,
67
+ authorizedAuthors,
68
68
  buildComment,
69
69
  buildIssue,
70
70
  buildPatch,
@@ -82,7 +82,7 @@ import {
82
82
  readClientConfigFile,
83
83
  resolveAccountIndex,
84
84
  resolveIdentity
85
- } from "./chunk-QKL53YZS.js";
85
+ } from "./chunk-ITC7ESTZ.js";
86
86
  import {
87
87
  ChannelMapStore,
88
88
  channelStatus,
@@ -311,7 +311,7 @@ function loadPaidSession(deps, relayUrl) {
311
311
  });
312
312
  }
313
313
  var defaultLoadStandalone = async (options) => {
314
- const mod = await import("./standalone-mode-AT4S5EZG.js");
314
+ const mod = await import("./standalone-mode-IETLYVCE.js");
315
315
  return mod.createStandaloneContext(options);
316
316
  };
317
317
  function identityReport(ctx) {
@@ -2493,7 +2493,7 @@ async function runCi(args, deps) {
2493
2493
  case "status":
2494
2494
  return runCiStatus(rest, deps);
2495
2495
  case "serve":
2496
- return (await import("./ci-serve-BU7NDT7O.js")).runCiServe(rest, deps);
2496
+ return (await import("./ci-serve-MPJ2WPCC.js")).runCiServe(rest, deps);
2497
2497
  case "--help":
2498
2498
  case "-h":
2499
2499
  case "help":
@@ -2985,7 +2985,7 @@ async function fetchAuthorizedAuthors(ctx, ownerPubkey, repoId) {
2985
2985
  if (latest) announceTags = latest.tags;
2986
2986
  } catch {
2987
2987
  }
2988
- return authorizedStatusAuthors(ownerPubkey, announceTags);
2988
+ return authorizedAuthors(ownerPubkey, announceTags);
2989
2989
  }
2990
2990
  function parseTrackerItem(event, status) {
2991
2991
  const item = {
@@ -3100,7 +3100,11 @@ async function fetchItem(ctx, eventId, expectedKind) {
3100
3100
  }));
3101
3101
  const repoATag2 = tagValue(event.tags, "a") ?? null;
3102
3102
  const parsedAddr = parseRepoATag(repoATag2) ?? ctx.repoAddr;
3103
- const authorized = parsedAddr ? await fetchAuthorizedAuthors(ctx, parsedAddr.ownerPubkey, parsedAddr.repoId) : /* @__PURE__ */ new Set();
3103
+ const authorized = parsedAddr ? await fetchAuthorizedAuthors(
3104
+ ctx,
3105
+ parsedAddr.ownerPubkey,
3106
+ parsedAddr.repoId
3107
+ ) : /* @__PURE__ */ new Set();
3104
3108
  return {
3105
3109
  item: parseTrackerItem(
3106
3110
  event,
@@ -3341,7 +3345,11 @@ ${COMMON_FLAGS_USAGE2}
3341
3345
 
3342
3346
  Related (FREE reads \u2014 no payment):
3343
3347
  rig issue list [--state open|closed|all] list the repo's issues
3344
- rig issue show <event-id> one issue + its comments`;
3348
+ rig issue show <event-id> one issue + its comments
3349
+
3350
+ Related (paid status \u2014 see \`rig issue status --help\`):
3351
+ rig issue status <event-id> <open|closed> set an issue's status
3352
+ rig issue close | reopen <event-id> shortcuts for closed / open`;
3345
3353
  var COMMENT_USAGE = `Usage: rig comment <target-event-id> --body <text> [options]
3346
3354
 
3347
3355
  Comment (NIP-22 kind:1111) on an issue or patch \u2014 a paid publish; writes are
@@ -3396,6 +3404,18 @@ with the repo a-tag attached so readers can scope a status stream to the
3396
3404
  repository. (This command was \`rig status\` before v2 \u2014 bare \`rig status\`
3397
3405
  now passes through to \`git status\`.)
3398
3406
 
3407
+ Options:
3408
+ ${COMMON_FLAGS_USAGE2}`;
3409
+ var ISSUE_STATUS_USAGE = `Usage: rig issue status <issue-event-id> <open|closed> [options]
3410
+ rig issue close <issue-event-id> [options]
3411
+ rig issue reopen <issue-event-id> [options]
3412
+
3413
+ Set the status of an issue \u2014 a paid publish; writes are permanent and
3414
+ non-refundable. Aliases over \`rig pr status\`: \`closed\` / \`close\` publish
3415
+ kind:1632, \`open\` / \`reopen\` publish kind:1630, against the 64-char hex id
3416
+ of the issue, with the repo a-tag attached. \`applied\` and \`draft\` apply to
3417
+ patches only and are rejected for issues (use \`rig pr status\`).
3418
+
3399
3419
  Options:
3400
3420
  ${COMMON_FLAGS_USAGE2}`;
3401
3421
  var PR_USAGE = `${PR_CREATE_USAGE}
@@ -3578,13 +3598,22 @@ async function runIssue(args, deps) {
3578
3598
  io.out(ISSUE_LIST_USAGE);
3579
3599
  io.out("");
3580
3600
  io.out(ISSUE_SHOW_USAGE);
3601
+ io.out("");
3602
+ io.out(ISSUE_STATUS_USAGE);
3581
3603
  return 0;
3582
3604
  }
3605
+ if (sub === "status") return runStatusCommand(rest, deps, ISSUE_STATUS_SPEC);
3606
+ if (sub === "close") {
3607
+ return runStatusCommand(rest, deps, ISSUE_STATUS_SPEC, "closed");
3608
+ }
3609
+ if (sub === "reopen") {
3610
+ return runStatusCommand(rest, deps, ISSUE_STATUS_SPEC, "open");
3611
+ }
3583
3612
  if (sub === "list") return runIssueList(rest, deps);
3584
3613
  if (sub === "show") return runIssueShow(rest, deps);
3585
3614
  if (sub !== "create") {
3586
3615
  io.err(
3587
- sub === void 0 ? "missing subcommand: rig issue <create|list|show>" : `unknown rig issue subcommand: ${sub}`
3616
+ sub === void 0 ? "missing subcommand: rig issue <create|list|show|status|close|reopen>" : `unknown rig issue subcommand: ${sub}`
3588
3617
  );
3589
3618
  io.err(ISSUE_USAGE);
3590
3619
  return 2;
@@ -3797,7 +3826,7 @@ async function runPr(args, deps) {
3797
3826
  case "create":
3798
3827
  return runPrCreate(rest, deps);
3799
3828
  case "status":
3800
- return runPrStatus(rest, deps);
3829
+ return runStatusCommand(rest, deps, PR_STATUS_SPEC);
3801
3830
  // FREE read subcommands (#278): relay queries only, no payment path.
3802
3831
  case "list":
3803
3832
  return runPrList(rest, deps);
@@ -3908,7 +3937,9 @@ async function runPrCreate(rest, deps) {
3908
3937
  } else {
3909
3938
  patchText = await readFile(patchFile, "utf-8");
3910
3939
  if (patchText.trim() === "") {
3911
- throw new Error(`--patch-file ${patchFile} is empty \u2014 nothing to publish`);
3940
+ throw new Error(
3941
+ `--patch-file ${patchFile} is empty \u2014 nothing to publish`
3942
+ );
3912
3943
  }
3913
3944
  commits = [];
3914
3945
  }
@@ -3948,7 +3979,21 @@ var STATUS_KIND_BY_VALUE = {
3948
3979
  function isStatusValue(value) {
3949
3980
  return Object.hasOwn(STATUS_KIND_BY_VALUE, value);
3950
3981
  }
3951
- async function runPrStatus(args, deps) {
3982
+ var PR_STATUS_SPEC = {
3983
+ command: "pr status",
3984
+ usage: PR_STATUS_USAGE,
3985
+ allowed: ["open", "applied", "closed", "draft"],
3986
+ shape: "<target-event-id> <open|applied|closed|draft>",
3987
+ targetLabel: "<target-event-id>"
3988
+ };
3989
+ var ISSUE_STATUS_SPEC = {
3990
+ command: "issue status",
3991
+ usage: ISSUE_STATUS_USAGE,
3992
+ allowed: ["open", "closed"],
3993
+ shape: "<issue-event-id> <open|closed>",
3994
+ targetLabel: "<issue-event-id>"
3995
+ };
3996
+ async function runStatusCommand(args, deps, spec, fixedStatus) {
3952
3997
  const { io } = deps;
3953
3998
  let flags;
3954
3999
  let targetEventId;
@@ -3961,30 +4006,31 @@ async function runPrStatus(args, deps) {
3961
4006
  });
3962
4007
  flags = pickCommon2(values);
3963
4008
  if (flags.help) {
3964
- io.out(PR_STATUS_USAGE);
4009
+ io.out(spec.usage);
3965
4010
  return 0;
3966
4011
  }
3967
- if (positionals.length !== 2) {
4012
+ const want = fixedStatus === void 0 ? 2 : 1;
4013
+ if (positionals.length !== want) {
3968
4014
  throw new Error(
3969
- "expected exactly two arguments: <target-event-id> <open|applied|closed|draft>"
4015
+ fixedStatus === void 0 ? `expected exactly two arguments: ${spec.shape}` : `expected exactly one argument: ${spec.targetLabel}`
3970
4016
  );
3971
4017
  }
3972
4018
  targetEventId = positionals[0];
3973
- assertHex64(targetEventId, "<target-event-id>");
3974
- const rawStatus = positionals[1];
3975
- if (!isStatusValue(rawStatus)) {
4019
+ assertHex64(targetEventId, spec.targetLabel);
4020
+ const rawStatus = fixedStatus ?? positionals[1];
4021
+ if (!isStatusValue(rawStatus) || !spec.allowed.includes(rawStatus)) {
3976
4022
  throw new Error(
3977
- `status must be one of open | applied | closed | draft (got ${JSON.stringify(rawStatus)})`
4023
+ `status must be one of ${spec.allowed.join(" | ")} (got ${JSON.stringify(rawStatus)})`
3978
4024
  );
3979
4025
  }
3980
4026
  status = rawStatus;
3981
4027
  } catch (err) {
3982
4028
  io.err(err instanceof Error ? err.message : String(err));
3983
- io.err(PR_STATUS_USAGE);
4029
+ io.err(spec.usage);
3984
4030
  return 2;
3985
4031
  }
3986
4032
  return runEvent({
3987
- command: "pr status",
4033
+ command: spec.command,
3988
4034
  flags,
3989
4035
  deps,
3990
4036
  actionLabel: `status ${status} on ${targetEventId.slice(0, 8)}\u2026`,
@@ -4021,7 +4067,7 @@ async function warnIfNotMaintainer(deps, args) {
4021
4067
  repoId: addr.repoId,
4022
4068
  ...deps.webSocketFactory ? { webSocketFactory: deps.webSocketFactory } : {}
4023
4069
  });
4024
- const authorized = authorizedStatusAuthors(
4070
+ const authorized = authorizedAuthors(
4025
4071
  addr.ownerPubkey,
4026
4072
  remote.announceEvent?.tags ?? []
4027
4073
  );
@@ -5603,6 +5649,7 @@ async function runInit(args, deps) {
5603
5649
  // src/cli/maintainers.ts
5604
5650
  import { parseArgs as parseArgs14 } from "util";
5605
5651
  var HEX64_RE4 = /^[0-9a-f]{64}$/;
5652
+ var REF_AUTHORITY_NOTICE = "Note: maintainers can move refs (publish honored repo state), not only set status.";
5606
5653
  var MAINTAINERS_USAGE = `Usage: rig maintainers <list|add|remove> [<pubkey>] [options]
5607
5654
 
5608
5655
  Manage a repo's declared maintainers (#287). Status authority is consumer-side:
@@ -5736,7 +5783,9 @@ async function runMutate(op, args, deps) {
5736
5783
  }
5737
5784
  pubkey = ownerToHex(positionals[0]).toLowerCase();
5738
5785
  if (!HEX64_RE4.test(pubkey)) {
5739
- throw new Error(`<pubkey> must resolve to 64-char hex (got ${JSON.stringify(positionals[0])})`);
5786
+ throw new Error(
5787
+ `<pubkey> must resolve to 64-char hex (got ${JSON.stringify(positionals[0])})`
5788
+ );
5740
5789
  }
5741
5790
  } catch (err) {
5742
5791
  io.err(err instanceof Error ? err.message : String(err));
@@ -5781,11 +5830,14 @@ async function runMutate(op, args, deps) {
5781
5830
  if (!flags.json) {
5782
5831
  io.out(`Republish ${action}`);
5783
5832
  io.out(`Repo: 30617:${ctx.owner}:${ctx.repoId}`);
5784
- io.out(`Maintainers after: ${next.length === 0 ? "(none)" : next.join(", ")}`);
5833
+ io.out(
5834
+ `Maintainers after: ${next.length === 0 ? "(none)" : next.join(", ")}`
5835
+ );
5785
5836
  if (!diff.unchanged) {
5786
5837
  io.out("Tags changed:");
5787
5838
  for (const line of describeAnnouncementDiff(diff)) io.out(line);
5788
5839
  }
5840
+ io.out(REF_AUTHORITY_NOTICE);
5789
5841
  io.out(`Fee: ${feeLabel(fee)}. Writes are permanent and non-refundable.`);
5790
5842
  }
5791
5843
  if (!flags.yes) {
@@ -5835,6 +5887,7 @@ async function runMutate(op, args, deps) {
5835
5887
  io.out(
5836
5888
  `Published ${action}: ${result.eventId} paid ${result.feePaid} base units`
5837
5889
  );
5890
+ io.out(REF_AUTHORITY_NOTICE);
5838
5891
  }
5839
5892
  return 0;
5840
5893
  } catch (err) {
@@ -7821,6 +7874,8 @@ Commands rig owns:
7821
7874
  site url [ref] print the last-published site URL for a ref (free)
7822
7875
  issue create file an issue (kind:1621) against a repo
7823
7876
  issue list | show <id> read the repo's issues + comments (free)
7877
+ issue status <id> <open|closed> set an issue's status (kind:1630/1632);
7878
+ close | reopen <id> are shortcuts
7824
7879
  pr list | show <id> read the repo's patches; show prints the full
7825
7880
  patch text (free)
7826
7881
  comment <target-event-id> comment (NIP-22 kind:1111) on an issue or patch,
@@ -7889,7 +7944,8 @@ Any other command is passed through to git verbatim: \`rig status\` runs
7889
7944
  Run \`rig <command> --help\` for a rig command's flags. \`rig init\`,
7890
7945
  \`rig remote\`, \`rig clone\`, \`rig fetch\`, \`rig issue list/show\`,
7891
7946
  \`rig pr list/show\`, \`rig fund\`, \`rig balance\`, and \`rig channel list\`
7892
- are free; push/issue create/comment/pr create/pr status are paid writes \u2014
7947
+ are free; push/issue create/issue status/close/reopen/comment/pr create/pr
7948
+ status are paid writes \u2014
7893
7949
  permanent and non-refundable \u2014
7894
7950
  and channel open/close/settle are on-chain wallet transactions; each states
7895
7951
  what it will spend and asks for confirmation before doing so (--yes skips,
@@ -8006,4 +8062,4 @@ export {
8006
8062
  rigVersion,
8007
8063
  dispatch
8008
8064
  };
8009
- //# sourceMappingURL=chunk-2TG4YHEC.js.map
8065
+ //# sourceMappingURL=chunk-ANVDRW5F.js.map