chofex-cli 0.1.139 → 0.1.141

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
@@ -13,6 +13,7 @@ The installed command is `chofex`:
13
13
  ```sh
14
14
  chofex
15
15
  chofex whoami
16
+ chofex upgrade
16
17
  chofex register
17
18
  chofex status
18
19
  chofex requirements
@@ -31,7 +32,7 @@ submit a completed JSON application. The Black Box is optional: its progress
31
32
  and score give organizers another review metric, but never decide admission or
32
33
  block an application submission.
33
34
 
34
- The public ranking is read-only at `https://andes.crafter.run/challenges`.
35
+ The public ranking is read-only at `https://hacktheandes.com/challenges`.
35
36
 
36
37
  Run `chofex` for a compact retro welcome screen with a pixel Sacred Valley and
37
38
  the main commands. Run `chofex --help` for the full command reference. The
@@ -66,8 +67,8 @@ confirmation prompts for the choice and local file path. For JSON input, set
66
67
  `pictureSource` and pass `--picture /path/to/image` when its value is `upload`.
67
68
  Uploads show percentage progress and accept JPEG, PNG, or WebP files up to 5 MB.
68
69
 
69
- API requests use `https://andes.crafter.run` by default. Use `CHOFEX_API_URL` to
70
+ API requests use `https://hacktheandes.com` by default. Use `CHOFEX_API_URL` to
70
71
  override the API URL when running against a local or preview Chofex instance.
71
72
 
72
- Registration links use `https://andes.crafter.run` by default. Local or preview
73
+ Registration links use `https://hacktheandes.com` by default. Local or preview
73
74
  environments can override that origin with `CHOFEX_PUBLIC_SITE_URL`.
package/dist/index.js CHANGED
@@ -59130,8 +59130,8 @@ import { createServer } from "node:http";
59130
59130
  // src/config.ts
59131
59131
  var oauthIssuer = process.env.CHOFEX_OAUTH_ISSUER ?? "https://close-newt-8265.clerk.accounts.dev";
59132
59132
  var config = {
59133
- apiUrl: process.env.CHOFEX_API_URL ?? "https://andes.crafter.run",
59134
- publicSiteUrl: process.env.CHOFEX_PUBLIC_SITE_URL ?? "https://andes.crafter.run",
59133
+ apiUrl: process.env.CHOFEX_API_URL ?? "https://hacktheandes.com",
59134
+ publicSiteUrl: process.env.CHOFEX_PUBLIC_SITE_URL ?? "https://hacktheandes.com",
59135
59135
  oauthClientId: process.env.CHOFEX_OAUTH_CLIENT_ID ?? "1YfuXKgOXkdH094s",
59136
59136
  authorizationUrl: `${oauthIssuer}/oauth/authorize`,
59137
59137
  tokenUrl: `${oauthIssuer}/oauth/token`,
@@ -62434,6 +62434,51 @@ var uploadPicture = exports_Effect.fn("uploadPicture")(function* (options, path4
62434
62434
  });
62435
62435
  });
62436
62436
 
62437
+ // src/upgrade.ts
62438
+ import { spawn as spawn3 } from "node:child_process";
62439
+ import { mkdtemp as mkdtemp2, rm as rm2 } from "node:fs/promises";
62440
+ import { tmpdir as tmpdir2 } from "node:os";
62441
+ import { join as join3 } from "node:path";
62442
+ var cliPackageName = "chofex-cli";
62443
+ var upgradeVersion = "latest";
62444
+ var npmUpgradeArguments = (cacheDirectory) => [
62445
+ "install",
62446
+ "--global",
62447
+ `${cliPackageName}@${upgradeVersion}`,
62448
+ "--force",
62449
+ "--prefer-online",
62450
+ `--cache=${cacheDirectory}`
62451
+ ];
62452
+ var runNpm = (arguments_) => new Promise((resolve4, reject) => {
62453
+ const executable = process.platform === "win32" ? "npm.cmd" : "npm";
62454
+ const child = spawn3(executable, arguments_, {
62455
+ stdio: ["ignore", "ignore", "pipe"]
62456
+ });
62457
+ let stderr = "";
62458
+ child.stderr.setEncoding("utf8");
62459
+ child.stderr.on("data", (chunk) => {
62460
+ stderr += chunk;
62461
+ });
62462
+ child.on("error", reject);
62463
+ child.on("close", (exitCode) => {
62464
+ resolve4({ exitCode: exitCode ?? 1, stderr: stderr.trim() });
62465
+ });
62466
+ });
62467
+ var upgradeCli = async (runner = runNpm) => {
62468
+ const cacheDirectory = await mkdtemp2(join3(tmpdir2(), "chofex-npm-cache-"));
62469
+ try {
62470
+ const result3 = await runner(npmUpgradeArguments(cacheDirectory));
62471
+ if (result3.exitCode === 0)
62472
+ return;
62473
+ let detail = "";
62474
+ if (result3.stderr)
62475
+ detail = `: ${result3.stderr}`;
62476
+ throw new Error(`npm exited with code ${result3.exitCode}${detail}`);
62477
+ } finally {
62478
+ await rm2(cacheDirectory, { recursive: true, force: true });
62479
+ }
62480
+ };
62481
+
62437
62482
  // src/commands.ts
62438
62483
  var inputFlag2 = exports_Flag.string("input").pipe(exports_Flag.optional, exports_Flag.withDescription("Read JSON from a file, or use - for stdin"));
62439
62484
  var stageFlag = exports_Flag.choice("stage", ["application", "acceptance"]).pipe(exports_Flag.withDefault("application"));
@@ -62610,6 +62655,25 @@ var whoamiCommand = exports_Command.make("whoami", {}, exports_Effect.fn("whoami
62610
62655
  const operation = getCurrentUser({ apiUrl: options.apiUrl, token });
62611
62656
  yield* execute(options.output, operation, (result3) => `Authenticated as ${result3.email} (${result3.userId}, ${result3.tokenType}).`);
62612
62657
  })).pipe(exports_Command.withDescription("Verify the current Clerk authentication"));
62658
+ var upgradeCommand = exports_Command.make("upgrade", {}, exports_Effect.fn("upgradeCommand")(function* () {
62659
+ const options = yield* root;
62660
+ const operation = exports_Effect.tryPromise({
62661
+ try: async () => {
62662
+ await upgradeCli();
62663
+ return {
62664
+ version: 1,
62665
+ ok: true,
62666
+ requestId: crypto.randomUUID(),
62667
+ data: {
62668
+ packageName: cliPackageName,
62669
+ requestedVersion: upgradeVersion
62670
+ }
62671
+ };
62672
+ },
62673
+ catch: (error2) => cliError("UPGRADE_FAILED", `npm could not update ${cliPackageName}`, false, String(error2))
62674
+ });
62675
+ yield* execute(options.output, operation, () => `Updated ${cliPackageName} to the ${upgradeVersion} version.`);
62676
+ })).pipe(exports_Command.withDescription("Update chofex-cli to the latest version"));
62613
62677
  var inputValidation = (stage, path4) => {
62614
62678
  if (stage === "application") {
62615
62679
  return applicationInput(path4, config.publicSiteUrl).pipe(exports_Effect.asVoid);
@@ -62668,6 +62732,7 @@ var command = root.pipe(exports_Command.withSubcommands([
62668
62732
  loginCommand,
62669
62733
  logoutCommand,
62670
62734
  whoamiCommand,
62735
+ upgradeCommand,
62671
62736
  validateCommand,
62672
62737
  registerCommand,
62673
62738
  statusCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.139",
3
+ "version": "0.1.141",
4
4
  "description": "Command-line client for the Chofex Hackathon",
5
5
  "type": "module",
6
6
  "bin": {