@sherwoodagent/cli 0.59.12 → 0.59.13

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/index.js CHANGED
@@ -4291,7 +4291,7 @@ function registerProposalCommands(program2) {
4291
4291
  );
4292
4292
  console.error(
4293
4293
  DIM2(
4294
- "\n Other states have their own recovery path:\n Draft/Pending \u2192 sherwood proposal cancel --id <id>\n Approved \u2192 sherwood proposal veto <id>\n Expired \u2192 vault is not locked, nothing to do\n Settled \u2192 already settled\n Cancelled \u2192 governor upgrade required (issue #177)\n"
4294
+ "\n Other states have their own recovery path:\n Draft/Pending/GuardianReview/Approved \u2192 sherwood proposal cancel --id <id> (proposer)\n Draft/Pending (vault owner) \u2192 sherwood proposal cancel --id <id> --emergency\n Pending (vault owner) \u2192 sherwood proposal veto --id <id>\n Expired \u2192 vault is not locked, nothing to do\n Settled \u2192 already settled\n Cancelled \u2192 governor upgrade required (issue #177)\n"
4295
4295
  )
4296
4296
  );
4297
4297
  process.exit(1);
@@ -4406,14 +4406,32 @@ function registerProposalCommands(program2) {
4406
4406
  spinner.fail(`Proposal is already ${PROPOSAL_STATES[state]}`);
4407
4407
  process.exit(1);
4408
4408
  }
4409
+ const PROPOSER_CANCELLABLE = /* @__PURE__ */ new Set([
4410
+ PROPOSAL_STATE.Draft,
4411
+ PROPOSAL_STATE.Pending,
4412
+ PROPOSAL_STATE.GuardianReview,
4413
+ PROPOSAL_STATE.Approved
4414
+ ]);
4415
+ const OWNER_EMERGENCY_CANCELLABLE = /* @__PURE__ */ new Set([
4416
+ PROPOSAL_STATE.Draft,
4417
+ PROPOSAL_STATE.Pending
4418
+ ]);
4409
4419
  let hash;
4410
4420
  if (opts.emergency) {
4421
+ if (!OWNER_EMERGENCY_CANCELLABLE.has(state)) {
4422
+ spinner.fail(
4423
+ `Proposal is ${PROPOSAL_STATES[state] || "Unknown"} \u2014 emergencyCancel only works in Draft or Pending. For GuardianReview / Approved, the proposer can run: sherwood proposal cancel --id ${proposalId}`
4424
+ );
4425
+ process.exit(1);
4426
+ }
4411
4427
  spinner.text = W2("Emergency cancelling...");
4412
4428
  hash = await emergencyCancel(proposalId);
4413
4429
  spinner.succeed(G2("Emergency cancelled"));
4414
4430
  } else {
4415
- if (state !== PROPOSAL_STATE.Draft && state !== PROPOSAL_STATE.Pending) {
4416
- spinner.fail(`Proposal is ${PROPOSAL_STATES[state] || "Unknown"} \u2014 use --emergency for non-pending/approved`);
4431
+ if (!PROPOSER_CANCELLABLE.has(state)) {
4432
+ spinner.fail(
4433
+ `Proposal is ${PROPOSAL_STATES[state] || "Unknown"} \u2014 not cancellable in this state. cancelProposal accepts Draft / Pending / GuardianReview / Approved (proposer only).`
4434
+ );
4417
4435
  process.exit(1);
4418
4436
  }
4419
4437
  spinner.text = W2("Cancelling proposal...");