chofex-cli 0.1.172 → 0.1.173

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 +130 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3053,17 +3053,17 @@ var require_exec = __commonJS((exports, module) => {
3053
3053
  var import_node_path = __toESM2(__require("node:path"));
3054
3054
  var import_execa = __toESM2(require_execa());
3055
3055
  var import_envpath = require_envpath();
3056
- var import_errors8 = require_errors();
3056
+ var import_errors9 = require_errors();
3057
3057
  var import_lookup = require_lookup();
3058
3058
  async function execVercelCli2(args2, options = {}) {
3059
3059
  const cwd = import_node_path.default.resolve(options.cwd ?? process.cwd());
3060
- await (0, import_errors8.assertValidCwd)(cwd);
3060
+ await (0, import_errors9.assertValidCwd)(cwd);
3061
3061
  const env = mergeExecEnv(options.env);
3062
3062
  const pathValue = (0, import_envpath.getEnvPath)(env);
3063
3063
  try {
3064
3064
  return await execResolvedVercelCli(args2, options, cwd, env, pathValue);
3065
3065
  } catch (error2) {
3066
- if (error2 instanceof import_errors8.VercelCliError && error2.code === "VERCEL_CLI_NOT_FOUND") {
3066
+ if (error2 instanceof import_errors9.VercelCliError && error2.code === "VERCEL_CLI_NOT_FOUND") {
3067
3067
  (0, import_lookup.clearCachedCliInvocation)(cwd, pathValue);
3068
3068
  return await execResolvedVercelCli(args2, options, cwd, env, pathValue);
3069
3069
  }
@@ -3090,15 +3090,15 @@ var require_exec = __commonJS((exports, module) => {
3090
3090
  const { stdout, stderr } = await (0, import_execa.default)(invocation.command, [...invocation.commandArgs, ...args2], execaOptions);
3091
3091
  return { stdout, stderr, invocation };
3092
3092
  } catch (error2) {
3093
- throw (0, import_errors8.toVercelCliError)(invocation, error2);
3093
+ throw (0, import_errors9.toVercelCliError)(invocation, error2);
3094
3094
  }
3095
3095
  }
3096
3096
  async function resolveInvocationOrThrow(cwd, pathValue) {
3097
3097
  const resolution = await (0, import_lookup.resolveCachedCliInvocation)(cwd, pathValue);
3098
3098
  if (!resolution.found) {
3099
- throw new import_errors8.VercelCliError({
3099
+ throw new import_errors9.VercelCliError({
3100
3100
  code: "VERCEL_CLI_NOT_FOUND",
3101
- message: (0, import_errors8.getCliNotFoundMessage)(resolution.diagnostics)
3101
+ message: (0, import_errors9.getCliNotFoundMessage)(resolution.diagnostics)
3102
3102
  });
3103
3103
  }
3104
3104
  return (0, import_lookup.toVercelCliInvocation)(resolution);
@@ -3139,13 +3139,13 @@ var require_dist = __commonJS((exports, module) => {
3139
3139
  var __toCommonJS = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
3140
3140
  var src_exports = {};
3141
3141
  __export2(src_exports, {
3142
- VercelCliError: () => import_errors8.VercelCliError,
3142
+ VercelCliError: () => import_errors9.VercelCliError,
3143
3143
  clearVercelCliLookupCache: () => import_lookup.clearVercelCliLookupCache,
3144
3144
  execVercelCli: () => import_exec.execVercelCli,
3145
3145
  findVercelCli: () => import_lookup.findVercelCli
3146
3146
  });
3147
3147
  module.exports = __toCommonJS(src_exports);
3148
- var import_errors8 = require_errors();
3148
+ var import_errors9 = require_errors();
3149
3149
  var import_exec = require_exec();
3150
3150
  var import_lookup = require_lookup();
3151
3151
  });
@@ -58564,6 +58564,7 @@ var challengeCatalog = [
58564
58564
  format: "accuracy",
58565
58565
  formatLabel: "Accuracy score",
58566
58566
  opensAt: "2026-09-17T14:00:00.000Z",
58567
+ closesAt: "2026-09-24T17:20:00.000Z",
58567
58568
  rankingVisibleAt: "2026-09-23T20:00:00.000Z",
58568
58569
  queryLimit: 25,
58569
58570
  evaluationLimit: 3,
@@ -58642,6 +58643,18 @@ var challengeCatalog = [
58642
58643
  ];
58643
58644
  var playableChallenges = challengeCatalog.filter((challenge) => challenge.playable);
58644
58645
  var challengeBySlug = (slug) => challengeCatalog.find((challenge) => challenge.slug === slug);
58646
+ var isChallengeOpenAt = (challenge, now3, forceOpen = false) => {
58647
+ if (forceOpen && challenge.playable)
58648
+ return true;
58649
+ if (now3.getTime() < Date.parse(challenge.opensAt))
58650
+ return false;
58651
+ return !isChallengeClosedAt(challenge, now3);
58652
+ };
58653
+ var isChallengeClosedAt = (challenge, now3) => {
58654
+ if (!challenge.closesAt)
58655
+ return false;
58656
+ return now3.getTime() >= Date.parse(challenge.closesAt);
58657
+ };
58645
58658
  var isChallengeRankingVisibleAt = (challenge, now3) => {
58646
58659
  if (!challenge.rankingVisibleAt)
58647
58660
  return true;
@@ -58718,6 +58731,7 @@ var ParticipantChallengeProgressSchema = exports_Schema.Struct({
58718
58731
  theme: exports_Schema.String,
58719
58732
  status: ChallengeProgressStatus,
58720
58733
  open: exports_Schema.Boolean,
58734
+ closed: exports_Schema.optional(exports_Schema.Boolean),
58721
58735
  playable: exports_Schema.Boolean,
58722
58736
  queriesUsed: exports_Schema.Number,
58723
58737
  queriesLimit: exports_Schema.Number,
@@ -58752,11 +58766,13 @@ var ChallengeCatalogItemSchema = exports_Schema.Struct({
58752
58766
  ]),
58753
58767
  formatLabel: exports_Schema.String,
58754
58768
  opensAt: exports_Schema.String,
58769
+ closesAt: exports_Schema.optional(exports_Schema.String),
58755
58770
  rankingVisibleAt: exports_Schema.optional(exports_Schema.String),
58756
58771
  queryLimit: exports_Schema.Number,
58757
58772
  evaluationLimit: exports_Schema.Number,
58758
58773
  playable: exports_Schema.Boolean,
58759
58774
  open: exports_Schema.Boolean,
58775
+ closed: exports_Schema.optional(exports_Schema.Boolean),
58760
58776
  rankingPath: exports_Schema.String
58761
58777
  });
58762
58778
  var ChallengeEvaluationSummarySchema = exports_Schema.Struct({
@@ -59782,20 +59798,35 @@ var challengeLaunchNotice = (title, opensAt, now3 = new Date) => {
59782
59798
  return;
59783
59799
  return challengeOpeningNotice(title, opensAt);
59784
59800
  };
59801
+ var challengeParticipationNotice = (title, opensAt, closesAt, now3 = new Date) => {
59802
+ if (closesAt && now3.getTime() >= Date.parse(closesAt)) {
59803
+ return `${title} está cerrado. Las consultas, pruebas locales y evaluaciones oficiales están deshabilitadas.`;
59804
+ }
59805
+ return challengeLaunchNotice(title, opensAt, now3);
59806
+ };
59785
59807
  var challengeListText = (catalog) => {
59786
59808
  const lines2 = [`${eventName} challenges`, ""];
59787
59809
  for (const challenge of catalog.challenges) {
59788
- let state = "open";
59789
- if (!challenge.open) {
59790
- state = `opens ${formatChallengeOpeningInPeru(challenge.opensAt)}`;
59791
- }
59792
- const playable = challenge.playable ? "" : " (coming later)";
59810
+ let state = `abre ${formatChallengeOpeningInPeru(challenge.opensAt)}`;
59811
+ if (challenge.closed) {
59812
+ state = "cerrado";
59813
+ } else if (challenge.open && challenge.playable) {
59814
+ state = "abierto";
59815
+ } else if (!challenge.playable) {
59816
+ state = "próximamente";
59817
+ }
59818
+ const playable = challenge.playable ? "" : " (próximamente)";
59793
59819
  lines2.push(`${challenge.code} ${challenge.theme} — ${challenge.title}${playable}`);
59794
59820
  lines2.push(` ${challenge.coreSkill} · ${challenge.formatLabel} · ${state}`);
59795
59821
  lines2.push(` Ranking: ${challenge.rankingPath}`);
59796
59822
  lines2.push("");
59797
59823
  }
59798
- lines2.push("Start the open challenge: chofex challenge");
59824
+ const hasOpenChallenge = catalog.challenges.some((challenge) => challenge.open && challenge.playable);
59825
+ if (hasOpenChallenge) {
59826
+ lines2.push("Empieza el challenge abierto: chofex challenge");
59827
+ } else {
59828
+ lines2.push("No hay un challenge abierto. Los rankings finales siguen visibles.");
59829
+ }
59799
59830
  return lines2.join(`
59800
59831
  `);
59801
59832
  };
@@ -59811,6 +59842,8 @@ var challengeShowText = (attempt) => {
59811
59842
  caseStatus = "INVESTIGATING";
59812
59843
  if (attempt.latestEvaluation !== undefined)
59813
59844
  caseStatus = "EVALUATED";
59845
+ if (challenge.closed)
59846
+ caseStatus = "CERRADO";
59814
59847
  const lines2 = [
59815
59848
  `${challenge.title.toUpperCase()} — CASE #${challenge.code}`,
59816
59849
  challenge.summary,
@@ -59832,6 +59865,11 @@ var challengeShowText = (attempt) => {
59832
59865
  if (progress.shareCode)
59833
59866
  lines2.push(`Share code #${progress.shareCode}`);
59834
59867
  }
59868
+ if (challenge.closed) {
59869
+ lines2.push("", "SIGUIENTE PASO", "Revisa tu historial y el ranking final.", " chofex challenge notebook", " chofex challenge ranking");
59870
+ return lines2.join(`
59871
+ `);
59872
+ }
59835
59873
  lines2.push("", "YOUR NEXT MOVE");
59836
59874
  if (attempt.observations.length === 0) {
59837
59875
  lines2.push("Ask the machine to price one ordinary shipment.", " chofex challenge query");
@@ -59882,8 +59920,17 @@ var shipmentCells = (observation) => {
59882
59920
  express: String(record2.express ?? "")
59883
59921
  };
59884
59922
  };
59885
- var notebookTableText = (observations) => {
59923
+ var notebookTableText = (observations, challengeClosed = false) => {
59886
59924
  if (observations.length === 0) {
59925
+ if (challengeClosed) {
59926
+ return [
59927
+ "CASE FILE: no observations",
59928
+ "El challenge está cerrado. Revisa el ranking final.",
59929
+ "",
59930
+ "Siguiente: chofex challenge ranking"
59931
+ ].join(`
59932
+ `);
59933
+ }
59887
59934
  return [
59888
59935
  "CASE FILE: no observations yet",
59889
59936
  "The machine has not revealed anything. Start with one ordinary shipment.",
@@ -59917,6 +59964,11 @@ var notebookTableText = (observations) => {
59917
59964
  ].join("");
59918
59965
  });
59919
59966
  const lines2 = [`CASE FILE: ${observationLabel}`, "", header, ...rows, ""];
59967
+ if (challengeClosed) {
59968
+ lines2.push("El challenge está cerrado. Este cuaderno queda disponible como historial.", "Siguiente: chofex challenge ranking");
59969
+ return lines2.join(`
59970
+ `);
59971
+ }
59920
59972
  if (observations.length === 1) {
59921
59973
  lines2.push("One answer is a clue, not a rule.", "Next: run a controlled experiment. Change one field and keep the other four fixed.", " chofex challenge query", "");
59922
59974
  } else {
@@ -60273,12 +60325,33 @@ var launchNoticeFor = (slug) => {
60273
60325
  const challenge = challengeBySlug(slug);
60274
60326
  if (!challenge)
60275
60327
  return;
60276
- return challengeLaunchNotice(challenge.theme, challenge.opensAt);
60328
+ return challengeParticipationNotice(challenge.theme, challenge.opensAt, challenge.closesAt);
60277
60329
  };
60278
- var challengeQuickstartText = (launchNotice) => {
60330
+ var participationStateFor = (slug) => {
60331
+ const challenge = challengeBySlug(slug);
60332
+ if (!challenge)
60333
+ return "scheduled";
60334
+ const now3 = new Date;
60335
+ if (isChallengeClosedAt(challenge, now3))
60336
+ return "closed";
60337
+ if (isChallengeOpenAt(challenge, now3))
60338
+ return "open";
60339
+ return "scheduled";
60340
+ };
60341
+ var challengeQuickstartText = (participationState, launchNotice) => {
60279
60342
  const lines2 = [challengeQuickstart.title];
60280
60343
  if (launchNotice)
60281
60344
  lines2.push("", "LAUNCH NOTICE", launchNotice);
60345
+ if (participationState === "closed") {
60346
+ lines2.push("", "RANKING FINAL", " chofex challenge ranking");
60347
+ return lines2.join(`
60348
+ `);
60349
+ }
60350
+ if (participationState === "scheduled") {
60351
+ lines2.push("", "PRÓXIMAMENTE", " chofex challenge list");
60352
+ return lines2.join(`
60353
+ `);
60354
+ }
60282
60355
  lines2.push("", ...challengeQuickstart.story, "", "YOUR MISSION", challengeQuickstart.mission, "", "RULES OF THE GAME", ...challengeQuickstart.rules.map((rule) => `• ${rule}`), "", "FIELD GUIDE", "");
60283
60356
  for (const item of challengeQuickstart.workflow) {
60284
60357
  lines2.push(`${item.step}. ${item.action}`);
@@ -60341,6 +60414,15 @@ var listCommand = exports_Command.make("list", {}, exports_Effect.fn("challengeL
60341
60414
  ]));
60342
60415
  var initCommand = exports_Command.make("init", {}, exports_Effect.fn("challengeInitCommand")(function* () {
60343
60416
  const options = yield* root;
60417
+ const participationState = participationStateFor(defaultChallengeSlug);
60418
+ if (participationState !== "open") {
60419
+ const message = launchNoticeFor(defaultChallengeSlug) ?? "El challenge todavía no está disponible.";
60420
+ let code = "CHALLENGE_NOT_OPEN";
60421
+ if (participationState === "closed")
60422
+ code = "CHALLENGE_CLOSED";
60423
+ yield* execute(options.output, exports_Effect.fail(cliError(code, message)), challengeInitText);
60424
+ return;
60425
+ }
60344
60426
  const operation = createChallengeScaffold().pipe(exports_Effect.map((data) => ({
60345
60427
  version: 1,
60346
60428
  ok: true,
@@ -60414,7 +60496,7 @@ var notebookCommand = exports_Command.make("notebook", { challenge: challengeFla
60414
60496
  if (format6 === "json") {
60415
60497
  return JSON.stringify(attempt.observations, null, 2);
60416
60498
  }
60417
- return notebookTableText(attempt.observations);
60499
+ return notebookTableText(attempt.observations, Boolean(attempt.challenge.closed));
60418
60500
  });
60419
60501
  })).pipe(exports_Command.withDescription("Review every input and price you observed. Export table, JSON, or CSV for analysis. Requires sign-in."), exports_Command.withExamples([
60420
60502
  {
@@ -60465,10 +60547,38 @@ var rankingCommand = exports_Command.make("ranking", { challenge: challengeFlag
60465
60547
  ]));
60466
60548
  var challengeCommand = exports_Command.make("challenge", {}, exports_Effect.fn("challengeQuickstartCommand")(function* () {
60467
60549
  const options = yield* root;
60550
+ const participationState = participationStateFor(defaultChallengeSlug);
60551
+ const participationOpen = participationState === "open";
60468
60552
  const launchNotice = launchNoticeFor(defaultChallengeSlug);
60469
60553
  if (options.output === "json") {
60554
+ let workflow = challengeQuickstart.workflow;
60555
+ let helpCommand = challengeQuickstart.helpCommand;
60556
+ let story = challengeQuickstart.story;
60557
+ let mission = challengeQuickstart.mission;
60558
+ let rules = challengeQuickstart.rules;
60559
+ if (participationState === "closed") {
60560
+ const rankingStep = challengeQuickstart.workflow.at(-1);
60561
+ workflow = rankingStep ? [rankingStep] : [];
60562
+ helpCommand = "chofex challenge ranking --help";
60563
+ story = [];
60564
+ mission = "El Challenge 1 terminó. El ranking final sigue disponible.";
60565
+ rules = [];
60566
+ } else if (participationState === "scheduled") {
60567
+ workflow = [];
60568
+ helpCommand = "chofex challenge list --help";
60569
+ story = [];
60570
+ mission = "El challenge todavía no está disponible.";
60571
+ rules = [];
60572
+ }
60470
60573
  const data = {
60471
- ...challengeQuickstart
60574
+ ...challengeQuickstart,
60575
+ story,
60576
+ mission,
60577
+ rules,
60578
+ workflow,
60579
+ helpCommand,
60580
+ open: participationOpen,
60581
+ state: participationState
60472
60582
  };
60473
60583
  if (launchNotice)
60474
60584
  data.notice = launchNotice;
@@ -60480,7 +60590,7 @@ var challengeCommand = exports_Command.make("challenge", {}, exports_Effect.fn("
60480
60590
  });
60481
60591
  return;
60482
60592
  }
60483
- yield* exports_Console.log(challengeQuickstartText(launchNotice));
60593
+ yield* exports_Console.log(challengeQuickstartText(participationState, launchNotice));
60484
60594
  })).pipe(exports_Command.withDescription("Play mini technical challenges. Start here: learn the Black Box workflow from first query to leaderboard. Run without a subcommand for the guided quickstart."), exports_Command.withExamples([
60485
60595
  {
60486
60596
  command: "chofex challenge",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.172",
3
+ "version": "0.1.173",
4
4
  "description": "Command-line client for Hack the Andes",
5
5
  "type": "module",
6
6
  "bin": {