@wraps.dev/cli 3.17.0 → 3.17.2

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
@@ -22265,6 +22265,12 @@ Saved regions: ${savedRegions.join(", ")}` : "Pass --region or set AWS_REGION.\n
22265
22265
  `Usage: ${usage}`,
22266
22266
  "https://wraps.dev/docs/cli-reference"
22267
22267
  ),
22268
+ invalidFlagUsage: (message, suggestion) => new WrapsError(
22269
+ message,
22270
+ "INVALID_FLAG_USAGE",
22271
+ suggestion,
22272
+ "https://wraps.dev/docs/cli-reference"
22273
+ ),
22268
22274
  pulumiError: (message) => new WrapsError(
22269
22275
  `Infrastructure deployment failed: ${message}`,
22270
22276
  "PULUMI_ERROR",
@@ -47105,6 +47111,9 @@ async function provisionTrackingHttps(args) {
47105
47111
  init_esm_shims();
47106
47112
  import mri from "mri";
47107
47113
  var STRING_FLAGS = [
47114
+ "name",
47115
+ "max-per-hour",
47116
+ "max-per-day",
47108
47117
  "provider",
47109
47118
  "region",
47110
47119
  "domain",
@@ -47149,6 +47158,8 @@ var STRING_FLAGS = [
47149
47158
  "validation-threshold"
47150
47159
  ];
47151
47160
  var BOOLEAN_FLAGS = [
47161
+ "clear-allowlist",
47162
+ "all",
47152
47163
  "yes",
47153
47164
  "force",
47154
47165
  "preview",
@@ -47195,6 +47206,12 @@ var NEGATED_BOOLEANS = [
47195
47206
  { positive: "example", camelKey: "noExample" },
47196
47207
  { positive: "claude", camelKey: "noClaude" }
47197
47208
  ];
47209
+ var toCamel = (name) => name.replace(/-([a-z])/g, (_, ch) => ch.toUpperCase());
47210
+ var LIST_FLAGS = ["allow-recipient", "allow-domain"];
47211
+ var KNOWN_FLAG_KEYS = /* @__PURE__ */ new Set([
47212
+ ...[...STRING_FLAGS, ...LIST_FLAGS, ...BOOLEAN_FLAGS].map(toCamel),
47213
+ ...NEGATED_BOOLEANS.map((n3) => n3.camelKey)
47214
+ ]);
47198
47215
  var ALIAS = {
47199
47216
  p: "provider",
47200
47217
  r: "region",
@@ -47213,12 +47230,11 @@ function resolveNegatableFlag(value, negatedArg, argv = process.argv) {
47213
47230
  }
47214
47231
  return argv.includes(negatedArg) ? false : void 0;
47215
47232
  }
47216
- var toCamel = (name) => name.replace(/-([a-z])/g, (_, ch) => ch.toUpperCase());
47217
47233
  function parseCliArgs(argv) {
47218
47234
  const userArgs = argv.slice(2);
47219
47235
  const parsed = mri(userArgs, {
47220
47236
  boolean: [...BOOLEAN_FLAGS, ...NEGATED_BOOLEANS.map((n3) => n3.positive)],
47221
- string: [...STRING_FLAGS],
47237
+ string: [...STRING_FLAGS, ...LIST_FLAGS],
47222
47238
  alias: ALIAS
47223
47239
  });
47224
47240
  const flags2 = {};
@@ -47228,6 +47244,15 @@ function parseCliArgs(argv) {
47228
47244
  flags2[toCamel(key)] = value;
47229
47245
  }
47230
47246
  }
47247
+ for (const key of LIST_FLAGS) {
47248
+ const raw = parsed[key];
47249
+ const values = (Array.isArray(raw) ? raw : [raw]).filter(
47250
+ (v) => typeof v === "string" && v.length > 0
47251
+ );
47252
+ if (values.length > 0) {
47253
+ flags2[toCamel(key)] = values;
47254
+ }
47255
+ }
47231
47256
  for (const key of BOOLEAN_FLAGS) {
47232
47257
  if (parsed[key] === true) {
47233
47258
  flags2[toCamel(key)] = true;
@@ -47240,7 +47265,8 @@ function parseCliArgs(argv) {
47240
47265
  }
47241
47266
  return {
47242
47267
  flags: flags2,
47243
- sub: parsed._
47268
+ sub: parsed._,
47269
+ extraPositionals: parsed._.slice(4)
47244
47270
  };
47245
47271
  }
47246
47272
 
@@ -50191,7 +50217,22 @@ function reportInboundDNSCleanup(result, domain) {
50191
50217
  console.log();
50192
50218
  }
50193
50219
  }
50220
+ function assertValidInboundFlags(options) {
50221
+ if (options.unexpectedArg) {
50222
+ throw errors.invalidFlagUsage(
50223
+ `Unexpected argument: ${options.unexpectedArg}`,
50224
+ `--root takes no value: "--root ${options.unexpectedArg}" (or "--root=${options.unexpectedArg}") sets --root and discards "${options.unexpectedArg}". To name the parent domain use --domain (inbound add); to pick the label use --subdomain <label> (inbound add) or --domain <label> (inbound init).`
50225
+ );
50226
+ }
50227
+ if (options.root && options.subdomain) {
50228
+ throw errors.invalidFlagUsage(
50229
+ "--root and --subdomain cannot be used together",
50230
+ "--root receives mail on the parent domain itself; --subdomain <label> receives mail on <label>.<parent>. Pick one."
50231
+ );
50232
+ }
50233
+ }
50194
50234
  async function inboundInit(options) {
50235
+ assertValidInboundFlags(options);
50195
50236
  if (!isJsonMode()) {
50196
50237
  clack27.intro(
50197
50238
  pc28.bold(
@@ -51097,6 +51138,7 @@ Enable it: ${pc28.cyan("wraps email inbound init")}
51097
51138
  console.log();
51098
51139
  }
51099
51140
  async function inboundAdd(options) {
51141
+ assertValidInboundFlags(options);
51100
51142
  if (!isJsonMode()) {
51101
51143
  clack27.intro(pc28.bold("Add Inbound Receiving Domain"));
51102
51144
  }
@@ -55853,6 +55895,30 @@ import { join as join19 } from "path";
55853
55895
  import * as clack41 from "@clack/prompts";
55854
55896
  import pc42 from "picocolors";
55855
55897
 
55898
+ // src/utils/email/template-push-state.ts
55899
+ init_esm_shims();
55900
+ function isTemplateUnchanged(input) {
55901
+ const { entry, sourceHash, existsRemotely, dashboardConfigured, force } = input;
55902
+ if (force || !entry || entry.localHash !== sourceHash || !existsRemotely) {
55903
+ return false;
55904
+ }
55905
+ return !dashboardConfigured || entry.remoteHash === sourceHash;
55906
+ }
55907
+ function nextTemplateEntry(input) {
55908
+ const { previous, sourceHash, sesTemplateName, sesOk, apiResult, now } = input;
55909
+ const apiOk = apiResult?.success === true;
55910
+ if (!(sesOk || apiOk)) {
55911
+ return;
55912
+ }
55913
+ return {
55914
+ id: apiOk ? apiResult?.id : previous?.id,
55915
+ localHash: sourceHash,
55916
+ remoteHash: apiOk ? sourceHash : previous?.remoteHash,
55917
+ sesTemplateName,
55918
+ lastPushed: now
55919
+ };
55920
+ }
55921
+
55856
55922
  // src/utils/email/template-render.ts
55857
55923
  init_esm_shims();
55858
55924
  async function renderTemplateWithProxy(Component) {
@@ -56054,14 +56120,20 @@ async function templatesPush(options) {
56054
56120
  const compiled = [];
56055
56121
  const unchanged = [];
56056
56122
  const compileErrors = [];
56123
+ const dashboardConfigured = checkApiTarget(target).ok;
56057
56124
  for (const file of templateFiles) {
56058
56125
  const slug = file.replace(/\.tsx?$/, "");
56059
56126
  const filePath = join19(templatesDir, file);
56060
56127
  const source = await readFile8(filePath, "utf-8");
56061
56128
  const sourceHash = sha256(source);
56062
- const localHashMatches = lockfile.templates[slug]?.localHash === sourceHash;
56063
56129
  const existsRemotely = remoteTemplateSlugs === null || remoteTemplateSlugs.has(slug);
56064
- if (!options.force && localHashMatches && existsRemotely) {
56130
+ if (isTemplateUnchanged({
56131
+ entry: lockfile.templates[slug],
56132
+ sourceHash,
56133
+ existsRemotely,
56134
+ dashboardConfigured,
56135
+ force: options.force === true
56136
+ })) {
56065
56137
  unchanged.push(slug);
56066
56138
  continue;
56067
56139
  }
@@ -56135,17 +56207,16 @@ async function templatesPush(options) {
56135
56207
  const sesSucceeded = compiled.filter((t) => !sesFailed.has(t.slug));
56136
56208
  const apiResults = sesSucceeded.length > 0 ? await pushToAPI(sesSucceeded, target, progress, options.force, org?.id) : [];
56137
56209
  for (const t of compiled) {
56138
- const sesOk = sesResults.find((r6) => r6.slug === t.slug)?.success;
56139
- const apiResult = apiResults.find((r6) => r6.slug === t.slug);
56140
- const apiOk = apiResult?.success;
56141
- if (sesOk || apiOk) {
56142
- lockfile.templates[t.slug] = {
56143
- id: apiResult?.id,
56144
- localHash: t.sourceHash,
56145
- remoteHash: t.sourceHash,
56146
- sesTemplateName: t.sesTemplateName,
56147
- lastPushed: (/* @__PURE__ */ new Date()).toISOString()
56148
- };
56210
+ const entry = nextTemplateEntry({
56211
+ previous: lockfile.templates[t.slug],
56212
+ sourceHash: t.sourceHash,
56213
+ sesTemplateName: t.sesTemplateName,
56214
+ sesOk: sesResults.find((r6) => r6.slug === t.slug)?.success === true,
56215
+ apiResult: apiResults.find((r6) => r6.slug === t.slug),
56216
+ now: (/* @__PURE__ */ new Date()).toISOString()
56217
+ });
56218
+ if (entry) {
56219
+ lockfile.templates[t.slug] = entry;
56149
56220
  }
56150
56221
  }
56151
56222
  lockfile.lastSync = (/* @__PURE__ */ new Date()).toISOString();
@@ -60509,7 +60580,8 @@ async function workflowsPush(options) {
60509
60580
  pushed: pushed.map((r6) => ({
60510
60581
  slug: r6.slug,
60511
60582
  id: r6.id,
60512
- status: r6.status
60583
+ status: r6.status,
60584
+ scheduleError: r6.scheduleError
60513
60585
  })),
60514
60586
  unchanged,
60515
60587
  conflicts: []
@@ -60542,6 +60614,11 @@ async function workflowsPush(options) {
60542
60614
  `${r6.slug} updated but left paused (it was paused in the dashboard). Resume it there.`
60543
60615
  );
60544
60616
  }
60617
+ for (const r6 of pushed.filter((p3) => p3.scheduleError)) {
60618
+ clack46.log.warn(
60619
+ `${r6.slug} was saved as draft: its schedule could not be registered (${r6.scheduleError}). Fix it and push again.`
60620
+ );
60621
+ }
60545
60622
  if (failed.length > 0) {
60546
60623
  clack46.log.error(`${failed.length} workflow(s) failed to sync`);
60547
60624
  }
@@ -60644,6 +60721,7 @@ async function pushToAPI2(workflows, target, progress, options, orgId) {
60644
60721
  slug: r6.slug,
60645
60722
  id: r6.id,
60646
60723
  status: r6.status,
60724
+ scheduleError: r6.scheduleError,
60647
60725
  success: true
60648
60726
  });
60649
60727
  }
@@ -60698,6 +60776,7 @@ async function pushToAPI2(workflows, target, progress, options, orgId) {
60698
60776
  slug: data.slug,
60699
60777
  id: data.id,
60700
60778
  status: data.status,
60779
+ scheduleError: data.scheduleError,
60701
60780
  success: true
60702
60781
  });
60703
60782
  progress.succeed(`Synced ${pc46.cyan(w.slug)} to dashboard`);
@@ -71915,7 +71994,7 @@ if (process.argv.includes("--help") || process.argv.includes("-h")) {
71915
71994
  }
71916
71995
  var parsedCli = parseCliArgs(process.argv);
71917
71996
  var flags = parsedCli.flags;
71918
- var { sub } = parsedCli;
71997
+ var { sub, extraPositionals } = parsedCli;
71919
71998
  var [primaryCommand, subCommand] = sub;
71920
71999
  setJsonMode(flags.json === true);
71921
72000
  if (!primaryCommand) {
@@ -72099,6 +72178,12 @@ async function run() {
72099
72178
  telemetry.markNotificationShown();
72100
72179
  }
72101
72180
  try {
72181
+ if (extraPositionals.length > 0) {
72182
+ throw errors.invalidFlagUsage(
72183
+ `Unrecognized argument${extraPositionals.length > 1 ? "s" : ""}: ${extraPositionals.join(" ")}`,
72184
+ "A boolean flag (such as --root or --json) takes no value, so a value after it is discarded. Check the flags before these arguments, or run the command with --help."
72185
+ );
72186
+ }
72102
72187
  if (primaryCommand === "email" && subCommand) {
72103
72188
  switch (subCommand) {
72104
72189
  case "init":
@@ -72236,7 +72321,8 @@ async function run() {
72236
72321
  root: flags.root,
72237
72322
  yes: flags.yes,
72238
72323
  preview: flags.preview,
72239
- json: flags.json
72324
+ json: flags.json,
72325
+ unexpectedArg: sub[3]
72240
72326
  });
72241
72327
  break;
72242
72328
  case "destroy":
@@ -72273,7 +72359,8 @@ async function run() {
72273
72359
  root: flags.root,
72274
72360
  domain: flags.domain,
72275
72361
  yes: flags.yes,
72276
- json: flags.json
72362
+ json: flags.json,
72363
+ unexpectedArg: sub[3]
72277
72364
  });
72278
72365
  break;
72279
72366
  case "remove":
@@ -72324,11 +72411,11 @@ async function run() {
72324
72411
  await agentPolicy({
72325
72412
  // baseline:allow-no-region — API-backed like agentList/agentKill, not direct AWS
72326
72413
  name: sub[3] || flags.name,
72327
- maxPerHour: flags["max-per-hour"],
72328
- maxPerDay: flags["max-per-day"],
72329
- allowRecipient: flags["allow-recipient"],
72330
- allowDomain: flags["allow-domain"],
72331
- clearAllowlist: flags["clear-allowlist"] === true,
72414
+ maxPerHour: flags.maxPerHour,
72415
+ maxPerDay: flags.maxPerDay,
72416
+ allowRecipient: flags.allowRecipient,
72417
+ allowDomain: flags.allowDomain,
72418
+ clearAllowlist: flags.clearAllowlist === true,
72332
72419
  token: flags.token,
72333
72420
  json: flags.json
72334
72421
  });