chofex-cli 0.1.112 → 0.1.114

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 +67 -30
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -58557,7 +58557,7 @@ var challengeCatalog = [
58557
58557
  coreSkill: "Reverse engineering & experimentation",
58558
58558
  format: "accuracy",
58559
58559
  formatLabel: "Accuracy score",
58560
- opensAt: "2026-09-18T05:00:00.000Z",
58560
+ opensAt: "2026-09-17T05:00:00.000Z",
58561
58561
  queryLimit: 25,
58562
58562
  evaluationLimit: 3,
58563
58563
  hiddenSampleSize: 1000,
@@ -58634,6 +58634,35 @@ var challengeCatalog = [
58634
58634
  }
58635
58635
  ];
58636
58636
  var playableChallenges = challengeCatalog.filter((challenge) => challenge.playable);
58637
+ var challengeBySlug = (slug) => challengeCatalog.find((challenge) => challenge.slug === slug);
58638
+ var challengeTimeZoneOffsetMs = 5 * 60 * 60 * 1000;
58639
+ var monthNames = [
58640
+ "January",
58641
+ "February",
58642
+ "March",
58643
+ "April",
58644
+ "May",
58645
+ "June",
58646
+ "July",
58647
+ "August",
58648
+ "September",
58649
+ "October",
58650
+ "November",
58651
+ "December"
58652
+ ];
58653
+ var formatChallengeOpeningInPeru = (opensAt) => {
58654
+ const localTime = new Date(Date.parse(opensAt) - challengeTimeZoneOffsetMs);
58655
+ const month = monthNames[localTime.getUTCMonth()];
58656
+ if (!month || Number.isNaN(localTime.getTime())) {
58657
+ throw new Error("Challenge opening time is invalid");
58658
+ }
58659
+ const day = localTime.getUTCDate();
58660
+ const year = localTime.getUTCFullYear();
58661
+ const hour = String(localTime.getUTCHours()).padStart(2, "0");
58662
+ const minute = String(localTime.getUTCMinutes()).padStart(2, "0");
58663
+ return `${month} ${day}, ${year} at ${hour}:${minute} (UTC-5)`;
58664
+ };
58665
+ var challengeOpeningNotice = (title, opensAt) => `${title} opens ${formatChallengeOpeningInPeru(opensAt)}. Queries and evaluations are disabled until then; no attempts will be consumed.`;
58637
58666
  var ChallengeSlugSchema = exports_Schema.Literals([
58638
58667
  "black-box",
58639
58668
  "last-mile",
@@ -58642,8 +58671,8 @@ var ChallengeSlugSchema = exports_Schema.Literals([
58642
58671
  "agent-arena"
58643
58672
  ]);
58644
58673
  var ShipmentSchema = exports_Schema.Struct({
58645
- distanceKm: exports_Schema.Number.pipe(exports_Schema.check(exports_Schema.isBetween({ minimum: 0.1, maximum: 2000 }))),
58646
- weightKg: exports_Schema.Number.pipe(exports_Schema.check(exports_Schema.isBetween({ minimum: 0.1, maximum: 500 }))),
58674
+ distanceKm: exports_Schema.Int.pipe(exports_Schema.check(exports_Schema.isBetween({ minimum: 1, maximum: 2000 }))),
58675
+ weightKg: exports_Schema.Int.pipe(exports_Schema.check(exports_Schema.isBetween({ minimum: 1, maximum: 500 }))),
58647
58676
  hour: exports_Schema.Int.pipe(exports_Schema.check(exports_Schema.isBetween({ minimum: 0, maximum: 23 }))),
58648
58677
  fragile: exports_Schema.Boolean,
58649
58678
  express: exports_Schema.Boolean
@@ -59589,19 +59618,19 @@ var javascriptSourceFromPath = (path4) => {
59589
59618
  }
59590
59619
  return readTextFile(path4).pipe(exports_Effect.map((source) => ({ kind: "javascript_source", source })));
59591
59620
  };
59592
- var requiredNumber = (message) => exports_Prompt.text({
59621
+ var requiredInteger = (message) => exports_Prompt.text({
59593
59622
  message,
59594
59623
  validate: (value3) => {
59595
- if (value3.trim() === "" || Number.isNaN(Number(value3))) {
59596
- return exports_Effect.fail("Must be a number");
59624
+ if (value3.trim() === "" || !Number.isInteger(Number(value3))) {
59625
+ return exports_Effect.fail("Must be a whole number");
59597
59626
  }
59598
59627
  return exports_Effect.succeed(value3);
59599
59628
  }
59600
59629
  });
59601
59630
  var interactiveShipment = () => exports_Prompt.run(exports_Prompt.all({
59602
- distanceKm: requiredNumber("Distance (km)"),
59603
- weightKg: requiredNumber("Weight (kg)"),
59604
- hour: requiredNumber("Hour (0-23)"),
59631
+ distanceKm: requiredInteger("Distance (whole km)"),
59632
+ weightKg: requiredInteger("Weight (whole kg)"),
59633
+ hour: requiredInteger("Hour (0-23)"),
59605
59634
  fragile: exports_Prompt.confirm({ message: "Fragile?" }),
59606
59635
  express: exports_Prompt.confirm({ message: "Express?" })
59607
59636
  })).pipe(exports_Effect.map((input) => ({
@@ -59649,12 +59678,18 @@ var remainingBar = (used, limit) => {
59649
59678
  return `${"█".repeat(filled)}${"░".repeat(width - filled)}`;
59650
59679
  };
59651
59680
  var percent = (value3) => `${(value3 * 100).toFixed(2)}%`;
59681
+ var challengeLaunchNotice = (title, opensAt, now3 = new Date) => {
59682
+ if (now3.getTime() >= Date.parse(opensAt))
59683
+ return;
59684
+ return challengeOpeningNotice(title, opensAt);
59685
+ };
59652
59686
  var challengeListText = (catalog) => {
59653
59687
  const lines2 = ["Hack the Andes challenges", ""];
59654
59688
  for (const challenge of catalog.challenges) {
59655
59689
  let state = "open";
59656
- if (!challenge.open)
59657
- state = `opens ${challenge.opensAt.slice(0, 10)}`;
59690
+ if (!challenge.open) {
59691
+ state = `opens ${formatChallengeOpeningInPeru(challenge.opensAt)}`;
59692
+ }
59658
59693
  const playable = challenge.playable ? "" : " (coming later)";
59659
59694
  lines2.push(`${challenge.code} ${challenge.theme} — ${challenge.title}${playable}`);
59660
59695
  lines2.push(` ${challenge.coreSkill} · ${challenge.formatLabel} · ${state}`);
@@ -60134,21 +60169,17 @@ var challengeQuickstart = {
60134
60169
  ],
60135
60170
  helpCommand: "chofex challenge query --help"
60136
60171
  };
60137
- var challengeQuickstartText = () => {
60138
- const lines2 = [
60139
- challengeQuickstart.title,
60140
- "",
60141
- ...challengeQuickstart.story,
60142
- "",
60143
- "YOUR MISSION",
60144
- challengeQuickstart.mission,
60145
- "",
60146
- "RULES OF THE GAME",
60147
- ...challengeQuickstart.rules.map((rule) => `• ${rule}`),
60148
- "",
60149
- "FIELD GUIDE",
60150
- ""
60151
- ];
60172
+ var launchNoticeFor = (slug) => {
60173
+ const challenge = challengeBySlug(slug);
60174
+ if (!challenge)
60175
+ return;
60176
+ return challengeLaunchNotice(challenge.theme, challenge.opensAt);
60177
+ };
60178
+ var challengeQuickstartText = (launchNotice) => {
60179
+ const lines2 = [challengeQuickstart.title];
60180
+ if (launchNotice)
60181
+ lines2.push("", "LAUNCH NOTICE", launchNotice);
60182
+ lines2.push("", ...challengeQuickstart.story, "", "YOUR MISSION", challengeQuickstart.mission, "", "RULES OF THE GAME", ...challengeQuickstart.rules.map((rule) => `• ${rule}`), "", "FIELD GUIDE", "");
60152
60183
  for (const item of challengeQuickstart.workflow) {
60153
60184
  lines2.push(`${item.step}. ${item.action}`);
60154
60185
  lines2.push(` ${item.command}`);
@@ -60236,8 +60267,8 @@ var showCommand = exports_Command.make("show", { challenge: challengeFlag }, exp
60236
60267
  var queryCommand = exports_Command.make("query", {
60237
60268
  challenge: challengeFlag,
60238
60269
  input: inputFlag,
60239
- distance: optionalString("distance", "Shipment distance in km"),
60240
- weight: optionalString("weight", "Shipment weight in kg"),
60270
+ distance: optionalString("distance", "Shipment distance in whole km"),
60271
+ weight: optionalString("weight", "Shipment weight in whole kg"),
60241
60272
  hour: optionalString("hour", "Hour of day, 0-23"),
60242
60273
  fragile: exports_Flag.choice("fragile", ["true", "false"]).pipe(exports_Flag.optional, exports_Flag.withDescription("Fragile surcharge flag")),
60243
60274
  express: exports_Flag.choice("express", ["true", "false"]).pipe(exports_Flag.optional, exports_Flag.withDescription("Express surcharge flag"))
@@ -60334,16 +60365,22 @@ var rankingCommand = exports_Command.make("ranking", { challenge: challengeFlag
60334
60365
  ]));
60335
60366
  var challengeCommand = exports_Command.make("challenge", {}, exports_Effect.fn("challengeQuickstartCommand")(function* () {
60336
60367
  const options = yield* root;
60368
+ const launchNotice = launchNoticeFor(defaultChallengeSlug);
60337
60369
  if (options.output === "json") {
60370
+ const data = {
60371
+ ...challengeQuickstart
60372
+ };
60373
+ if (launchNotice)
60374
+ data.notice = launchNotice;
60338
60375
  yield* printJson({
60339
60376
  version: 1,
60340
60377
  ok: true,
60341
60378
  requestId: crypto.randomUUID(),
60342
- data: challengeQuickstart
60379
+ data
60343
60380
  });
60344
60381
  return;
60345
60382
  }
60346
- yield* exports_Console.log(challengeQuickstartText());
60383
+ yield* exports_Console.log(challengeQuickstartText(launchNotice));
60347
60384
  })).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([
60348
60385
  {
60349
60386
  command: "chofex challenge",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.112",
3
+ "version": "0.1.114",
4
4
  "description": "Command-line client for the Chofex Hackathon",
5
5
  "type": "module",
6
6
  "bin": {