chofex-cli 0.1.28 → 0.1.29

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/index.js +26 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -59548,6 +59548,7 @@ var requirementsOnlyText = (result3) => requirementsText(result3);
59548
59548
 
59549
59549
  // src/picture-upload.ts
59550
59550
  import { readFile as readFile4, stat as stat3 } from "node:fs/promises";
59551
+ import { homedir } from "node:os";
59551
59552
 
59552
59553
  // ../../node_modules/is-node-process/lib/index.mjs
59553
59554
  function isNodeProcess() {
@@ -61148,8 +61149,22 @@ function isAbsoluteUrl(url2) {
61148
61149
  }
61149
61150
 
61150
61151
  // src/picture-upload.ts
61151
- var readPicture = (path4) => exports_Effect.tryPromise({
61152
+ var normalizePicturePath = (input) => {
61153
+ let path4 = input.trim();
61154
+ const first = path4.at(0);
61155
+ const last = path4.at(-1);
61156
+ const wrappedInQuotes = path4.length >= 2 && (first === '"' && last === '"' || first === "'" && last === "'");
61157
+ if (wrappedInQuotes)
61158
+ path4 = path4.slice(1, -1);
61159
+ if (process.platform === "win32")
61160
+ return path4;
61161
+ if (path4.startsWith("~/"))
61162
+ path4 = `${homedir()}${path4.slice(1)}`;
61163
+ return path4.replace(/\\([\\\s"'()[\]{}&;!#$?*|<>])/g, "$1");
61164
+ };
61165
+ var readPicture = (inputPath) => exports_Effect.tryPromise({
61152
61166
  try: async () => {
61167
+ const path4 = normalizePicturePath(inputPath);
61153
61168
  const metadata = await stat3(path4);
61154
61169
  if (!metadata.isFile())
61155
61170
  throw new Error("Path is not a regular file");
@@ -61162,7 +61177,7 @@ var readPicture = (path4) => exports_Effect.tryPromise({
61162
61177
  throw new Error("Picture must be JPEG, PNG, or WebP");
61163
61178
  return { contents, contentType, size: metadata.size };
61164
61179
  },
61165
- catch: (error2) => cliError("INVALID_PICTURE_FILE", `Could not use ${path4}: ${String(error2)}`)
61180
+ catch: (error2) => cliError("INVALID_PICTURE_FILE", `Could not use ${normalizePicturePath(inputPath)}: ${String(error2)}`)
61166
61181
  });
61167
61182
  var progressLine = (percentage) => exports_Effect.sync(() => {
61168
61183
  const rounded = Math.min(100, Math.max(0, Math.round(percentage)));
@@ -61215,9 +61230,15 @@ var registerCommand = exports_Command.make("register", { input: inputFlag }, exp
61215
61230
  }));
61216
61231
  if (exports_Option.isSome(current)) {
61217
61232
  const { status } = current.value.data.registration;
61218
- const isAwaitingApproval = status === "submitted" || status === "under_review" || status === "waitlisted";
61219
- if (isAwaitingApproval) {
61220
- return yield* cliError("ACTIVE_APPLICATION_EXISTS", "Already registered. Wait for approval.", false, { currentStatus: status });
61233
+ const registrationAlreadyExists = status === "submitted" || status === "under_review" || status === "waitlisted" || status === "accepted";
61234
+ if (registrationAlreadyExists) {
61235
+ let message = "Already registered. Wait for approval.";
61236
+ if (status === "accepted") {
61237
+ message = "Already accepted. Use `chofex status` to view your next steps.";
61238
+ }
61239
+ return yield* cliError("ACTIVE_APPLICATION_EXISTS", message, false, {
61240
+ currentStatus: status
61241
+ });
61221
61242
  }
61222
61243
  }
61223
61244
  const body = yield* applicationInput(exports_Option.getOrUndefined(input), config.publicSiteUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Command-line client for the Chofex Hackathon",
5
5
  "type": "module",
6
6
  "bin": {