chofex-cli 0.1.177 → 0.1.178

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 (3) hide show
  1. package/README.md +10 -0
  2. package/dist/index.js +295 -17
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -30,15 +30,25 @@ chofex challenge test --challenge broken-agent --source ./scheduler.js
30
30
  chofex challenge evaluate --challenge broken-agent --source ./scheduler.js
31
31
  chofex challenge ranking --challenge broken-agent
32
32
  chofex confirm
33
+ chofex badge
34
+ chofex badge regenerate
33
35
  ```
34
36
 
35
37
  `chofex update` and `chofex upgrade` are interchangeable; both update the CLI
36
38
  to the latest published version.
37
39
 
40
+ Las copias instaladas también consultan npm cada vez que se inicia `chofex` e
41
+ instalan una versión publicada más reciente antes de ejecutar el comando. Si
42
+ npm o la red no están disponibles temporalmente, se continúa con la versión
43
+ actual. Usa `CHOFEX_AUTO_UPDATE=0` para desactivar esta comprobación.
44
+
38
45
  `chofex register` collects and submits an application with full name, role,
39
46
  optional phone number, bio, portfolio URL, shipped project, LinkedIn and GitHub
40
47
  URLs, and Terms and Conditions. Use `--input` to submit a completed JSON
41
48
  application.
49
+ After attendance confirmation, `chofex badge regenerate` updates the public
50
+ badge name, one-line description, picture, and QR destination without changing
51
+ the submitted application.
42
52
  The technical challenges do not block submission, but every challenge winner must submit
43
53
  an application before being accepted. Top results receive a direct pass; other
44
54
  scores give organizers another review metric.
package/dist/index.js CHANGED
@@ -27645,6 +27645,7 @@ var require_throttleit = __commonJS((exports, module) => {
27645
27645
 
27646
27646
  // src/index.ts
27647
27647
  import { readFileSync } from "node:fs";
27648
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
27648
27649
  // ../../node_modules/@effect/platform-node/dist/NodeRuntime.js
27649
27650
  var exports_NodeRuntime = {};
27650
27651
  __export(exports_NodeRuntime, {
@@ -59191,10 +59192,25 @@ var BadgeStatus = exports_Schema.Literals([
59191
59192
  "completed",
59192
59193
  "failed"
59193
59194
  ]);
59195
+ var BadgeProfileSchema = exports_Schema.Struct({
59196
+ fullName: nonBlank(200),
59197
+ oneLiner: nonBlank(30),
59198
+ linkUrl: url,
59199
+ placement: exports_Schema.String
59200
+ });
59194
59201
  var BadgeResultSchema = exports_Schema.Struct({
59195
59202
  status: BadgeStatus,
59196
- url: exports_Schema.optional(exports_Schema.String)
59203
+ url: exports_Schema.optional(exports_Schema.String),
59204
+ profile: exports_Schema.optional(BadgeProfileSchema)
59197
59205
  });
59206
+ var badgeRegenerationInputFields = {
59207
+ fullName: nonBlank(200),
59208
+ oneLiner: nonBlank(30),
59209
+ linkUrl: url,
59210
+ pictureSource: exports_Schema.optional(PictureSource)
59211
+ };
59212
+ var BadgeRegenerationInput = exports_Schema.Struct(badgeRegenerationInputFields);
59213
+ var badgeRegenerationInputFieldNames = Object.keys(badgeRegenerationInputFields);
59198
59214
  var PictureUploadSchema = exports_Schema.Struct({
59199
59215
  url: exports_Schema.String,
59200
59216
  contentType: PictureContentType,
@@ -59732,6 +59748,7 @@ var register = (options, input) => request3(options, "/api/v1/registrations", {
59732
59748
  var getCurrentUser = (options) => request3(options, "/api/v1/me", { method: "GET" }, decodeCurrentUser);
59733
59749
  var getRegistration = (options) => request3(options, "/api/v1/registration", { method: "GET" }, decodeRegistrationResult);
59734
59750
  var getBadge = (options) => request3(options, "/api/v1/badge", { method: "GET" }, decodeBadgeResult);
59751
+ var regenerateBadge = (options, input) => request3(options, "/api/v1/badge", { method: "PATCH", body: JSON.stringify(input) }, decodeBadgeResult);
59735
59752
  var confirmAttendance = (options, input) => request3(options, "/api/v1/registration/attendance", { method: "PUT", body: JSON.stringify(input) }, decodeRegistrationResult);
59736
59753
  var beginPictureUpload = (options, input) => request3(options, "/api/v1/profile-picture", { method: "POST", body: JSON.stringify(input) }, decodePictureUploadGrant);
59737
59754
  var completePictureUpload = (options, input) => request3(options, "/api/v1/profile-picture", { method: "PUT", body: JSON.stringify(input) }, decodePictureUpload);
@@ -60489,10 +60506,15 @@ var createChallengeScaffold = exports_Effect.fn("createChallengeScaffold")(funct
60489
60506
  });
60490
60507
 
60491
60508
  // src/cli-root.ts
60509
+ var rootValueFlagNames = {
60510
+ apiUrl: "api-url",
60511
+ output: "output",
60512
+ token: "token"
60513
+ };
60492
60514
  var root = exports_Command.make("chofex").pipe(exports_Command.withSharedFlags({
60493
- apiUrl: exports_Flag.string("api-url").pipe(exports_Flag.withDefault(config.apiUrl), exports_Flag.withDescription("Chofex API base URL")),
60494
- output: exports_Flag.choice("output", ["human", "json"]).pipe(exports_Flag.withDefault("human"), exports_Flag.withDescription("Output format")),
60495
- token: exports_Flag.string("token").pipe(exports_Flag.optional, exports_Flag.withDescription("Clerk OAuth token (prefer CHOFEX_TOKEN to avoid shell history)"))
60515
+ apiUrl: exports_Flag.string(rootValueFlagNames.apiUrl).pipe(exports_Flag.withDefault(config.apiUrl), exports_Flag.withDescription("Chofex API base URL")),
60516
+ output: exports_Flag.choice(rootValueFlagNames.output, ["human", "json"]).pipe(exports_Flag.withDefault("human"), exports_Flag.withDescription("Output format")),
60517
+ token: exports_Flag.string(rootValueFlagNames.token).pipe(exports_Flag.optional, exports_Flag.withDescription("Clerk OAuth token (prefer CHOFEX_TOKEN to avoid shell history)"))
60496
60518
  }), exports_Command.withDescription(`Register for and manage your ${eventName} application`));
60497
60519
 
60498
60520
  // src/output.ts
@@ -60614,7 +60636,13 @@ var requirementsOnlyText = (result3) => requirementsText(result3);
60614
60636
  var badgeText = (result3) => {
60615
60637
  if (result3.url)
60616
60638
  return result3.url;
60617
- return "You don't have a badge yet.";
60639
+ if (result3.status === "pending" || result3.status === "running") {
60640
+ return "Tu carnet se está generando.";
60641
+ }
60642
+ if (result3.status === "failed") {
60643
+ return "No se pudo generar tu carnet. Ejecuta `chofex badge regenerate` para intentarlo de nuevo.";
60644
+ }
60645
+ return "Todavía no tienes un carnet.";
60618
60646
  };
60619
60647
 
60620
60648
  // src/challenge-commands.ts
@@ -61365,6 +61393,34 @@ var picturePathInput = (suppliedPath) => {
61365
61393
  }
61366
61394
  return exports_Prompt.run(requiredText("Path to a JPEG, PNG, or WebP picture (5 MB maximum)", exports_Schema.String.pipe(exports_Schema.check(exports_Schema.isMinLength(1))))).pipe(exports_Effect.mapError(() => cliError("PROMPT_CANCELLED", "Interactive input was cancelled")));
61367
61395
  };
61396
+ var badgeProfileInput = (path4, defaults2, pictures) => {
61397
+ const interactive = exports_Effect.gen(function* () {
61398
+ const publicFields = yield* exports_Prompt.run(exports_Prompt.all({
61399
+ fullName: requiredText("Nombre impreso en el carnet", exports_Schema.Trim.pipe(exports_Schema.check(exports_Schema.isMinLength(1), exports_Schema.isMaxLength(200))), defaults2.fullName),
61400
+ oneLiner: requiredText("Presentación de una línea", exports_Schema.Trim.pipe(exports_Schema.check(exports_Schema.isMinLength(1), exports_Schema.isMaxLength(30))), defaults2.oneLiner),
61401
+ linkUrl: requiredText("Destino del QR", exports_Schema.Trim.pipe(exports_Schema.check(exports_Schema.isMinLength(1), exports_Schema.isMaxLength(2048))), defaults2.linkUrl)
61402
+ }));
61403
+ const pictureChoices = [{ title: "Mantener mi foto actual", value: "keep" }];
61404
+ if (pictures.clerkPictureUrl) {
61405
+ pictureChoices.push({ title: "Usar mi foto de Clerk", value: "clerk" });
61406
+ }
61407
+ if (pictures.githubUrl) {
61408
+ pictureChoices.push({ title: "Usar mi foto de GitHub", value: "github" });
61409
+ }
61410
+ pictureChoices.push({
61411
+ title: "Subir otra foto",
61412
+ value: "upload"
61413
+ });
61414
+ const pictureChoice = yield* exports_Prompt.run(exports_Prompt.select({
61415
+ message: "Foto impresa en el carnet",
61416
+ choices: pictureChoices
61417
+ }));
61418
+ if (pictureChoice === "keep")
61419
+ return publicFields;
61420
+ return { ...publicFields, pictureSource: pictureChoice };
61421
+ });
61422
+ return inputOrInteractive(path4, interactive).pipe(exports_Effect.flatMap((input) => decode2(BadgeRegenerationInput, input, badgeRegenerationInputFieldNames)));
61423
+ };
61368
61424
 
61369
61425
  // src/picture-upload.ts
61370
61426
  import { readFile as readFile5, stat as stat3 } from "node:fs/promises";
@@ -63033,13 +63089,14 @@ var uploadPicture = exports_Effect.fn("uploadPicture")(function* (options, path4
63033
63089
  import { spawn as spawn3 } from "node:child_process";
63034
63090
  import { mkdtemp as mkdtemp2, rm as rm2 } from "node:fs/promises";
63035
63091
  import { tmpdir as tmpdir2 } from "node:os";
63036
- import { dirname as dirname2, join as join3 } from "node:path";
63092
+ import { dirname as dirname2, isAbsolute, join as join3, relative, sep } from "node:path";
63037
63093
  var cliPackageName = "chofex-cli";
63038
63094
  var upgradeVersion = "latest";
63039
- var npmUpgradeArguments = (cacheDirectory) => [
63095
+ var npmRegistryUrl = `https://registry.npmjs.org/${cliPackageName}/latest`;
63096
+ var npmUpgradeArguments = (cacheDirectory, version) => [
63040
63097
  "install",
63041
63098
  "--global",
63042
- `${cliPackageName}@${upgradeVersion}`,
63099
+ `${cliPackageName}@${version}`,
63043
63100
  "--force",
63044
63101
  "--prefer-online",
63045
63102
  `--cache=${cacheDirectory}`
@@ -63047,22 +63104,32 @@ var npmUpgradeArguments = (cacheDirectory) => [
63047
63104
  var runProcess = (executable, arguments_, input) => new Promise((resolve4, reject) => {
63048
63105
  const stdin = input === undefined ? "ignore" : "pipe";
63049
63106
  const child = spawn3(executable, arguments_, {
63050
- stdio: [stdin, "ignore", "pipe"]
63107
+ stdio: [stdin, "pipe", "pipe"]
63051
63108
  });
63109
+ let stdout = "";
63052
63110
  let stderr = "";
63111
+ const stdoutStream = child.stdout;
63053
63112
  const stderrStream = child.stderr;
63054
- if (stderrStream === null) {
63113
+ if (stdoutStream === null || stderrStream === null) {
63055
63114
  child.kill();
63056
- reject(new Error(`Could not capture stderr from ${executable}`));
63115
+ reject(new Error(`Could not capture output from ${executable}`));
63057
63116
  return;
63058
63117
  }
63118
+ stdoutStream.setEncoding("utf8");
63119
+ stdoutStream.on("data", (chunk) => {
63120
+ stdout += chunk;
63121
+ });
63059
63122
  stderrStream.setEncoding("utf8");
63060
63123
  stderrStream.on("data", (chunk) => {
63061
63124
  stderr += chunk;
63062
63125
  });
63063
63126
  child.on("error", reject);
63064
63127
  child.on("close", (exitCode) => {
63065
- resolve4({ exitCode: exitCode ?? 1, stderr: stderr.trim() });
63128
+ resolve4({
63129
+ exitCode: exitCode ?? 1,
63130
+ stdout: stdout.trim(),
63131
+ stderr: stderr.trim()
63132
+ });
63066
63133
  });
63067
63134
  if (input !== undefined) {
63068
63135
  const stdinStream = child.stdin;
@@ -63079,7 +63146,7 @@ var runNpm = (arguments_) => {
63079
63146
  return runProcess(executable, arguments_);
63080
63147
  };
63081
63148
  var installerUrl = "https://hacktheandes.com/install";
63082
- var runInstaller = async (installDirectory) => {
63149
+ var runInstaller = async (installDirectory, version) => {
63083
63150
  const response = await fetch(installerUrl);
63084
63151
  if (!response.ok) {
63085
63152
  throw new Error(`installer download returned HTTP ${response.status}`);
@@ -63088,6 +63155,8 @@ var runInstaller = async (installDirectory) => {
63088
63155
  const arguments_ = [
63089
63156
  "-s",
63090
63157
  "--",
63158
+ "--version",
63159
+ version,
63091
63160
  "--install-dir",
63092
63161
  installDirectory,
63093
63162
  "--no-modify-path"
@@ -63107,22 +63176,160 @@ var assertSuccessful = (result3, program) => {
63107
63176
  throw new Error(`${program} exited with code ${result3.exitCode}${detail}`);
63108
63177
  };
63109
63178
  var upgradeCli = async (options = {}) => {
63179
+ const version = options.version ?? upgradeVersion;
63110
63180
  const standalone = options.standalone ?? isStandaloneExecutable();
63111
63181
  if (standalone) {
63112
63182
  const runner2 = options.installerRunner ?? runInstaller;
63113
- const result3 = await runner2(dirname2(process.execPath));
63183
+ const result3 = await runner2(dirname2(process.execPath), version);
63114
63184
  assertSuccessful(result3, "installer");
63115
63185
  return;
63116
63186
  }
63117
63187
  const runner = options.npmRunner ?? runNpm;
63118
63188
  const cacheDirectory = await mkdtemp2(join3(tmpdir2(), "chofex-npm-cache-"));
63119
63189
  try {
63120
- const result3 = await runner(npmUpgradeArguments(cacheDirectory));
63190
+ const result3 = await runner(npmUpgradeArguments(cacheDirectory, version));
63121
63191
  assertSuccessful(result3, "npm");
63122
63192
  } finally {
63123
63193
  await rm2(cacheDirectory, { recursive: true, force: true });
63124
63194
  }
63125
63195
  };
63196
+ var parseVersion = (version) => {
63197
+ const match9 = version.match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);
63198
+ if (match9 === null)
63199
+ throw new Error(`Invalid CLI version: ${version}`);
63200
+ return {
63201
+ core: [Number(match9[1]), Number(match9[2]), Number(match9[3])],
63202
+ prerelease: match9[4]?.split(".") ?? []
63203
+ };
63204
+ };
63205
+ var comparePrereleaseIdentifier = (left, right) => {
63206
+ const leftNumber = /^\d+$/.test(left) ? Number(left) : undefined;
63207
+ const rightNumber = /^\d+$/.test(right) ? Number(right) : undefined;
63208
+ if (leftNumber !== undefined && rightNumber !== undefined) {
63209
+ return leftNumber - rightNumber;
63210
+ }
63211
+ if (leftNumber !== undefined)
63212
+ return -1;
63213
+ if (rightNumber !== undefined)
63214
+ return 1;
63215
+ return left.localeCompare(right);
63216
+ };
63217
+ var compareVersions = (left, right) => {
63218
+ const parsedLeft = parseVersion(left);
63219
+ const parsedRight = parseVersion(right);
63220
+ const [leftMajor, leftMinor, leftPatch] = parsedLeft.core;
63221
+ const [rightMajor, rightMinor, rightPatch] = parsedRight.core;
63222
+ for (const difference3 of [
63223
+ leftMajor - rightMajor,
63224
+ leftMinor - rightMinor,
63225
+ leftPatch - rightPatch
63226
+ ]) {
63227
+ if (difference3 !== 0)
63228
+ return difference3;
63229
+ }
63230
+ if (parsedLeft.prerelease.length === 0) {
63231
+ return parsedRight.prerelease.length === 0 ? 0 : 1;
63232
+ }
63233
+ if (parsedRight.prerelease.length === 0)
63234
+ return -1;
63235
+ const identifierCount = Math.max(parsedLeft.prerelease.length, parsedRight.prerelease.length);
63236
+ for (let index2 = 0;index2 < identifierCount; index2 += 1) {
63237
+ const leftIdentifier = parsedLeft.prerelease[index2];
63238
+ const rightIdentifier = parsedRight.prerelease[index2];
63239
+ if (leftIdentifier === undefined)
63240
+ return -1;
63241
+ if (rightIdentifier === undefined)
63242
+ return 1;
63243
+ const difference3 = comparePrereleaseIdentifier(leftIdentifier, rightIdentifier);
63244
+ if (difference3 !== 0)
63245
+ return difference3;
63246
+ }
63247
+ return 0;
63248
+ };
63249
+ var fetchLatestVersion = async () => {
63250
+ const response = await fetch(npmRegistryUrl, {
63251
+ headers: { accept: "application/json" },
63252
+ signal: AbortSignal.timeout(5000)
63253
+ });
63254
+ if (!response.ok) {
63255
+ throw new Error(`npm registry returned HTTP ${response.status}`);
63256
+ }
63257
+ const metadata = await response.json();
63258
+ if (typeof metadata !== "object" || metadata === null || !("version" in metadata) || typeof metadata.version !== "string") {
63259
+ throw new Error("npm registry returned an invalid package version");
63260
+ }
63261
+ parseVersion(metadata.version);
63262
+ return metadata.version;
63263
+ };
63264
+ var autoUpdateCli = async (currentVersion, options = {}) => {
63265
+ const latestVersion = await (options.fetchLatestVersion ?? fetchLatestVersion)();
63266
+ if (compareVersions(latestVersion, currentVersion) <= 0) {
63267
+ return { status: "current", version: currentVersion };
63268
+ }
63269
+ const upgrade = options.upgrade ?? ((version) => upgradeCli({ version }));
63270
+ await upgrade(latestVersion);
63271
+ return {
63272
+ status: "updated",
63273
+ previousVersion: currentVersion,
63274
+ version: latestVersion
63275
+ };
63276
+ };
63277
+ var npmGlobalNodeModulesPath = async (runner = runNpm) => {
63278
+ const result3 = await runner(["root", "--global"]);
63279
+ assertSuccessful(result3, "npm");
63280
+ if (!result3.stdout)
63281
+ throw new Error("npm did not report its global root");
63282
+ return result3.stdout;
63283
+ };
63284
+ var pathIsInside = (parent, child) => {
63285
+ const pathFromParent = relative(parent, child);
63286
+ return pathFromParent !== "" && pathFromParent !== ".." && !pathFromParent.startsWith(`..${sep}`) && !isAbsolute(pathFromParent);
63287
+ };
63288
+ var rootFlagsWithValues = new Set(Object.values(rootValueFlagNames).map((name) => `--${name}`));
63289
+ var requestedCommand = (arguments_) => {
63290
+ for (let index2 = 0;index2 < arguments_.length; index2 += 1) {
63291
+ const argument = arguments_[index2];
63292
+ if (argument === undefined)
63293
+ continue;
63294
+ if (rootFlagsWithValues.has(argument)) {
63295
+ index2 += 1;
63296
+ continue;
63297
+ }
63298
+ if (argument.startsWith("-"))
63299
+ continue;
63300
+ return argument;
63301
+ }
63302
+ return;
63303
+ };
63304
+ var shouldAutoUpdateCli = async ({
63305
+ arguments: arguments_,
63306
+ entryPath,
63307
+ environmentValue,
63308
+ globalNodeModulesPath,
63309
+ npmRunner,
63310
+ standalone
63311
+ }) => {
63312
+ if (environmentValue === "0" || environmentValue === "false")
63313
+ return false;
63314
+ const command = requestedCommand(arguments_);
63315
+ if (command === "update" || command === "upgrade") {
63316
+ return false;
63317
+ }
63318
+ if (standalone)
63319
+ return true;
63320
+ if (!entryPath.split(/[\\/]/).includes("node_modules"))
63321
+ return false;
63322
+ const npmRoot = globalNodeModulesPath ?? await npmGlobalNodeModulesPath(npmRunner);
63323
+ return pathIsInside(join3(npmRoot, cliPackageName), entryPath);
63324
+ };
63325
+ var runUpdatedCli = () => new Promise((resolve4, reject) => {
63326
+ const child = spawn3(process.execPath, process.argv.slice(1), {
63327
+ env: { ...process.env, CHOFEX_AUTO_UPDATE: "0" },
63328
+ stdio: "inherit"
63329
+ });
63330
+ child.on("error", reject);
63331
+ child.on("close", (exitCode) => resolve4(exitCode ?? 1));
63332
+ });
63126
63333
 
63127
63334
  // src/commands.ts
63128
63335
  var inputFlag2 = exports_Flag.string("input").pipe(exports_Flag.optional, exports_Flag.withDescription("Read JSON from a file, or use - for stdin"));
@@ -63209,12 +63416,50 @@ var requirementsCommand = exports_Command.make("requirements", {}, exports_Effec
63209
63416
  });
63210
63417
  yield* execute(options.output, operation, requirementsOnlyText, registrationLookupErrorText);
63211
63418
  })).pipe(exports_Command.withDescription("Show information you still need to provide"));
63419
+ var badgeRegenerateCommand = exports_Command.make("regenerate", {
63420
+ input: inputFlag2,
63421
+ picture: exports_Flag.string("picture").pipe(exports_Flag.optional, exports_Flag.withDescription("Ruta a una foto JPEG, PNG o WebP (máximo 5 MB)"))
63422
+ }, exports_Effect.fn("badgeRegenerateCommand")(function* ({ input, picture }) {
63423
+ const options = yield* root;
63424
+ const operation = exports_Effect.gen(function* () {
63425
+ const inputPath = exports_Option.getOrUndefined(input);
63426
+ if (options.output === "json" && inputPath === undefined) {
63427
+ return yield* exports_Effect.fail(cliError("INPUT_REQUIRED", "El modo JSON requiere --input <archivo> o --input -"));
63428
+ }
63429
+ const token = exports_Option.getOrUndefined(options.token);
63430
+ const client = { apiUrl: options.apiUrl, token };
63431
+ const badge = yield* getBadge(client);
63432
+ if (!badge.data.profile) {
63433
+ return yield* exports_Effect.fail(cliError("INVALID_APPLICATION_STATE", "Confirma tu asistencia antes de regenerar tu carnet"));
63434
+ }
63435
+ const [current, currentUser] = yield* exports_Effect.all([
63436
+ getRegistration(client),
63437
+ getCurrentUser(client)
63438
+ ]);
63439
+ const body = yield* badgeProfileInput(inputPath, badge.data.profile, {
63440
+ clerkPictureUrl: currentUser.data.clerkPictureUrl,
63441
+ githubUrl: current.data.registration.githubUrl
63442
+ });
63443
+ const picturePath = exports_Option.getOrUndefined(picture);
63444
+ if (body.pictureSource === "upload") {
63445
+ if (options.output === "json" && picturePath === undefined) {
63446
+ return yield* exports_Effect.fail(cliError("PICTURE_PATH_REQUIRED", "Usa --picture <ruta> cuando pictureSource es upload"));
63447
+ }
63448
+ const path4 = yield* picturePathInput(picturePath);
63449
+ yield* uploadPicture(client, path4);
63450
+ } else if (picturePath) {
63451
+ return yield* exports_Effect.fail(cliError("UNEXPECTED_PICTURE_PATH", "--picture solo se puede usar cuando pictureSource es upload"));
63452
+ }
63453
+ return yield* regenerateBadge(client, body);
63454
+ });
63455
+ yield* execute(options.output, operation, badgeText);
63456
+ })).pipe(exports_Command.withDescription("Actualiza la foto, el nombre, la presentación y el enlace QR del carnet"));
63212
63457
  var badgeCommand = exports_Command.make("badge", {}, exports_Effect.fn("badgeCommand")(function* () {
63213
63458
  const options = yield* root;
63214
63459
  const token = exports_Option.getOrUndefined(options.token);
63215
63460
  const operation = getBadge({ apiUrl: options.apiUrl, token });
63216
63461
  yield* execute(options.output, operation, badgeText);
63217
- })).pipe(exports_Command.withDescription("Show your generated participant badge"));
63462
+ })).pipe(exports_Command.withDescription("Muestra o regenera tu carnet de participante"), exports_Command.withSubcommands([badgeRegenerateCommand]));
63218
63463
  var confirmCommand = exports_Command.make("confirm", {
63219
63464
  input: inputFlag2,
63220
63465
  picture: exports_Flag.string("picture").pipe(exports_Flag.optional, exports_Flag.withDescription("Path to a JPEG, PNG, or WebP picture (5 MB max)"))
@@ -63649,4 +63894,37 @@ var programForArguments = () => {
63649
63894
  }
63650
63895
  return commandProgram;
63651
63896
  };
63652
- programForArguments().pipe(exports_Effect.provide(exports_NodeServices.layer), (program) => exports_NodeRuntime.runMain(program, { disableErrorReporting: true }));
63897
+ var runAutomaticUpdate = async () => {
63898
+ try {
63899
+ const standalone = isStandaloneExecutable();
63900
+ const enabled = await shouldAutoUpdateCli({
63901
+ arguments: arguments_,
63902
+ entryPath: fileURLToPath2(import.meta.url),
63903
+ environmentValue: process.env.CHOFEX_AUTO_UPDATE,
63904
+ standalone
63905
+ });
63906
+ if (!enabled)
63907
+ return "continue";
63908
+ const result3 = await autoUpdateCli(cliVersion);
63909
+ if (result3.status === "current")
63910
+ return "continue";
63911
+ process.stderr.write(`${cliPackageName} se actualizó de ${result3.previousVersion} a ${result3.version}.
63912
+ `);
63913
+ if (standalone && process.platform === "win32") {
63914
+ process.stderr.write(`La actualización se aplicará cuando termine este comando.
63915
+ `);
63916
+ return "continue";
63917
+ }
63918
+ process.exitCode = await runUpdatedCli();
63919
+ return "command-completed";
63920
+ } catch {
63921
+ process.stderr.write(`No se pudo comprobar o instalar una actualización de ${cliPackageName}; se continuará con ${cliVersion}.
63922
+ `);
63923
+ return "continue";
63924
+ }
63925
+ };
63926
+ exports_Effect.promise(runAutomaticUpdate).pipe(exports_Effect.flatMap((outcome) => {
63927
+ if (outcome === "command-completed")
63928
+ return exports_Effect.void;
63929
+ return programForArguments();
63930
+ }), exports_Effect.provide(exports_NodeServices.layer), (program) => exports_NodeRuntime.runMain(program, { disableErrorReporting: true }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.177",
3
+ "version": "0.1.178",
4
4
  "description": "Command-line client for Hack the Andes",
5
5
  "type": "module",
6
6
  "bin": {