@dropthis/cli 0.21.0 → 0.23.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/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ <p align="center"><img src="https://dropthis.app/icon-512.png" width="76" height="76" alt="dropthis" /></p>
2
+
1
3
  # @dropthis/cli
2
4
 
3
5
  Official CLI for [dropthis](https://dropthis.app) -- the publish layer between AI and the internet. Built for humans, AI agents, and CI/CD pipelines.
@@ -35,6 +37,8 @@ dropthis login request --email you@example.com
35
37
  dropthis login verify --email you@example.com --otp 123456
36
38
  ```
37
39
 
40
+ > A failed verify prints `Your code has expired` (`otp_expired`) or `That code is incorrect` (`otp_invalid`) and exits non-zero.
41
+
38
42
  Or pass both flags directly:
39
43
 
40
44
  ```bash
package/dist/cli.cjs CHANGED
@@ -916,13 +916,13 @@ async function runDoctor(_input, deps) {
916
916
  const authSource = credential?.source ?? "missing";
917
917
  const storageBackend = stored?.storage ?? "none";
918
918
  const pairs = [
919
- ["Version", "0.21.0"],
919
+ ["Version", "0.23.0"],
920
920
  ["Auth", authSource],
921
921
  ["Storage", storageBackend]
922
922
  ];
923
923
  writeKv(deps, pairs, {
924
924
  ok: true,
925
- version: "0.21.0",
925
+ version: "0.23.0",
926
926
  auth: { source: authSource },
927
927
  storage: { backend: storageBackend }
928
928
  });
@@ -1506,6 +1506,15 @@ async function runLoginInteractive(deps) {
1506
1506
  session = result;
1507
1507
  break;
1508
1508
  }
1509
+ if (result.error.code === "otp_expired" && attempt < maxAttempts) {
1510
+ const resend = await deps.client.auth.requestEmailOtp({ email });
1511
+ if (resend.error) {
1512
+ prompts4.cancel(resend.error.message);
1513
+ return { exitCode: exitCodeFor("api_error") };
1514
+ }
1515
+ prompts4.log.info("That code expired \u2014 we sent a new one.");
1516
+ continue;
1517
+ }
1509
1518
  if (attempt < maxAttempts) {
1510
1519
  prompts4.log.warning(result.error.message);
1511
1520
  } else {
@@ -2059,6 +2068,15 @@ function contentOptions(options) {
2059
2068
  if (options.path !== void 0) out.path = options.path;
2060
2069
  return out;
2061
2070
  }
2071
+ function partialOptions(raw) {
2072
+ const out = {};
2073
+ if (raw.replace) out.mode = "replace";
2074
+ else if (raw.mode !== void 0) out.mode = raw.mode;
2075
+ if (raw.deletePaths !== void 0 && raw.deletePaths.length > 0) {
2076
+ out.deletePaths = raw.deletePaths;
2077
+ }
2078
+ return out;
2079
+ }
2062
2080
  async function runUpdateContent(target, input, raw, deps) {
2063
2081
  const apiKey = raw.apiKey ?? deps.apiKey;
2064
2082
  try {
@@ -2116,7 +2134,11 @@ async function runUpdateContent(target, input, raw, deps) {
2116
2134
  dropId,
2117
2135
  input,
2118
2136
  withIdempotencyKey(
2119
- { ...contentOptions(parsed), ...revisionOptions },
2137
+ {
2138
+ ...contentOptions(parsed),
2139
+ ...partialOptions(raw),
2140
+ ...revisionOptions
2141
+ },
2120
2142
  "upd"
2121
2143
  )
2122
2144
  );
@@ -2767,7 +2789,7 @@ function buildProgram(options = {}) {
2767
2789
  ` ${import_picocolors6.default.cyan("dropthis login")}`,
2768
2790
  ` ${import_picocolors6.default.cyan("dropthis publish ./dist")}`
2769
2791
  ].join("\n")
2770
- ).version("0.21.0").configureHelp({
2792
+ ).version("0.23.0").configureHelp({
2771
2793
  subcommandTerm(cmd) {
2772
2794
  const args = cmd.registeredArguments.map((a) => {
2773
2795
  const name = a.name();
@@ -2925,6 +2947,15 @@ ${import_picocolors6.default.bold("Canonical vs raw URLs:")}`,
2925
2947
  ).option("--path <name>", "Set filename for stdin content").option(
2926
2948
  "--manifest <file>",
2927
2949
  "Update content from a multi-file bundle defined in a JSON file (path, content/source_url/content_base64 per file). Cannot combine with a positional input."
2950
+ ).option(
2951
+ "--mode <mode>",
2952
+ "patch (default: provided files upsert, the rest carry forward) or replace (provided files become the whole content set)",
2953
+ parseMode
2954
+ ).option("--replace", "Shortcut for --mode replace (full content swap)").option(
2955
+ "--delete-path <path>",
2956
+ "Remove a file by path (patch-mode only; repeatable). Invalid with --replace.",
2957
+ collect,
2958
+ []
2928
2959
  ).option(
2929
2960
  "--if-revision <n>",
2930
2961
  "Fail if current revision doesn't match (optimistic lock)",
@@ -2965,10 +2996,16 @@ ${import_picocolors6.default.bold("Canonical vs raw URLs:")}`,
2965
2996
  process.exitCode = writeError(deps, "invalid_usage", msg).exitCode;
2966
2997
  return;
2967
2998
  }
2999
+ const deletePaths = commandOptions.deletePath ?? [];
3000
+ const updateOpts = {
3001
+ ...dropOpts,
3002
+ ...commandOptions.replace ? { mode: "replace" } : commandOptions.mode !== void 0 ? { mode: commandOptions.mode } : {},
3003
+ ...deletePaths.length > 0 ? { deletePaths } : {}
3004
+ };
2968
3005
  const result = await runUpdateContent(
2969
3006
  dropId,
2970
3007
  updateInput,
2971
- dropOpts,
3008
+ updateOpts,
2972
3009
  deps
2973
3010
  );
2974
3011
  process.exitCode = result.exitCode;
@@ -3354,7 +3391,7 @@ ${import_picocolors6.default.bold("Canonical vs raw URLs:")}`,
3354
3391
  );
3355
3392
  const result = await runUpgrade(commandOptions, {
3356
3393
  ...deps,
3357
- currentVersion: "0.21.0"
3394
+ currentVersion: "0.23.0"
3358
3395
  });
3359
3396
  process.exitCode = result.exitCode;
3360
3397
  });
@@ -3477,6 +3514,15 @@ function parseInteger(value) {
3477
3514
  if (Number.isNaN(n)) throw new import_commander.InvalidArgumentError("Expected an integer.");
3478
3515
  return n;
3479
3516
  }
3517
+ function parseMode(value) {
3518
+ if (value !== "patch" && value !== "replace") {
3519
+ throw new import_commander.InvalidArgumentError('Use "patch" or "replace".');
3520
+ }
3521
+ return value;
3522
+ }
3523
+ function collect(value, previous) {
3524
+ return [...previous, value];
3525
+ }
3480
3526
  async function resolvePublishInputs(inputs, stdin, stdinIsTTY) {
3481
3527
  if (inputs.length === 0) {
3482
3528
  if (stdinIsTTY) return void 0;
@@ -3599,7 +3645,7 @@ var showNotice = shouldShowNotice({
3599
3645
  if (showNotice) {
3600
3646
  const notice = noticeFromCache({
3601
3647
  cache: updateCache,
3602
- currentVersion: "0.21.0"
3648
+ currentVersion: "0.23.0"
3603
3649
  });
3604
3650
  if (notice) {
3605
3651
  process.stderr.write(`