chofex-cli 0.1.121 → 0.1.123

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 +5 -5
  2. package/dist/index.js +16 -40
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -25,11 +25,11 @@ chofex challenge ranking
25
25
  chofex confirm
26
26
  ```
27
27
 
28
- `chofex register` saves an application draft with full name, role, optional
29
- LinkedIn and GitHub URLs, and Terms and Conditions. Use `--input` to save a
30
- JSON draft and `--submit` to submit a completed draft. The Black Box is
31
- optional: its progress and score give organizers another review metric, but
32
- never decide admission or block an application submission.
28
+ `chofex register` collects and submits an application with full name, role,
29
+ optional LinkedIn and GitHub URLs, and Terms and Conditions. Use `--input` to
30
+ submit a completed JSON application. The Black Box is optional: its progress
31
+ and score give organizers another review metric, but never decide admission or
32
+ block an application submission.
33
33
 
34
34
  The public ranking is read-only at `https://andes.crafter.run/challenges`.
35
35
 
package/dist/index.js CHANGED
@@ -59583,17 +59583,16 @@ var decodeChallengeQuery = exports_Schema.decodeUnknownEffect(ApiSuccessSchema(C
59583
59583
  var decodeChallengeTest = exports_Schema.decodeUnknownEffect(ApiSuccessSchema(ChallengeLocalTestResultSchema));
59584
59584
  var decodeChallengeEvaluation = exports_Schema.decodeUnknownEffect(ApiSuccessSchema(ChallengeEvaluationResultSchema));
59585
59585
  var decodeChallengeRanking = exports_Schema.decodeUnknownEffect(ApiSuccessSchema(ChallengeRankingSchema));
59586
+ var register = (options, input) => request3(options, "/api/v1/registrations", {
59587
+ method: "POST",
59588
+ body: JSON.stringify(input)
59589
+ }, decodeCreatedRegistration);
59586
59590
  var getCurrentUser = (options) => request3(options, "/api/v1/me", { method: "GET" }, decodeCurrentUser);
59587
59591
  var getRegistration = (options) => request3(options, "/api/v1/registration", { method: "GET" }, decodeRegistrationResult);
59588
59592
  var getBadge = (options) => request3(options, "/api/v1/badge", { method: "GET" }, decodeBadgeResult);
59589
59593
  var confirmAttendance = (options, input) => request3(options, "/api/v1/registration/attendance", { method: "PUT", body: JSON.stringify(input) }, decodeRegistrationResult);
59590
59594
  var beginPictureUpload = (options, input) => request3(options, "/api/v1/profile-picture", { method: "POST", body: JSON.stringify(input) }, decodePictureUploadGrant);
59591
59595
  var completePictureUpload = (options, input) => request3(options, "/api/v1/profile-picture", { method: "PUT", body: JSON.stringify(input) }, decodePictureUpload);
59592
- var saveRegistrationDraft = (options, input) => request3(options, "/api/v1/registration", {
59593
- method: "PUT",
59594
- body: JSON.stringify(input)
59595
- }, decodeRegistrationResult);
59596
- var submitRegistration = (options) => request3(options, "/api/v1/registration/submit", { method: "POST" }, decodeCreatedRegistration);
59597
59596
  var listChallenges = (options) => publicRequest(options, "/api/v1/challenges", { method: "GET" }, decodeChallengeCatalog);
59598
59597
  var getChallengeAttempt = (options, slug) => request3(options, `/api/v1/challenges/${slug}`, { method: "GET" }, decodeChallengeAttempt);
59599
59598
  var queryChallenge = (options, slug, input) => request3(options, `/api/v1/challenges/${slug}/query`, { method: "POST", body: JSON.stringify(input) }, decodeChallengeQuery);
@@ -59915,8 +59914,6 @@ var challengeRankingText = (ranking) => {
59915
59914
  return lines2.join(`
59916
59915
  `);
59917
59916
  };
59918
- var draftSavedText = (result3) => ["Application draft saved.", registrationPartsText(result3)].join(`
59919
- `);
59920
59917
  var registrationPartsText = (result3) => {
59921
59918
  const parts = result3.requirements.parts ?? [];
59922
59919
  if (parts.length === 0)
@@ -59931,9 +59928,9 @@ var registrationPartsText = (result3) => {
59931
59928
  lines2.push(` ${mark} ${part.title}${detail}`);
59932
59929
  }
59933
59930
  if (result3.requirements.canSubmitApplication) {
59934
- lines2.push("", "Ready to submit: chofex register --submit");
59931
+ lines2.push("", "Ready to submit: chofex register");
59935
59932
  } else if (result3.requirements.stage === "draft") {
59936
- lines2.push("", "Continue later with `chofex register`. Progress is saved.");
59933
+ lines2.push("", "Complete and submit with `chofex register`.");
59937
59934
  }
59938
59935
  return lines2.join(`
59939
59936
  `);
@@ -60754,12 +60751,6 @@ var inputOrInteractive = (path4, interactive) => {
60754
60751
  }));
60755
60752
  };
60756
60753
  var applicationInput = (path4, publicBaseUrl, defaults2 = {}) => inputOrInteractive(path4, collectApplicationFields(publicBaseUrl, defaults2).pipe(exports_Effect.map((input) => withoutEmptyStrings(input)))).pipe(exports_Effect.flatMap((input) => decode2(ApplicationInput, input, applicationInputFieldNames)), exports_Effect.flatMap((input) => validateSemantics(input, applicationSemanticRequirements(input))));
60757
- var applicationDraftInput = (path4) => {
60758
- if (!path4) {
60759
- return exports_Effect.fail(cliError("INPUT_REQUIRED", "Non-interactive use requires --input <file>, or --input - for stdin"));
60760
- }
60761
- return readJsonInput(path4).pipe(exports_Effect.flatMap((input) => decode2(ApplicationDraftInput, input, applicationDraftInputFieldNames)));
60762
- };
60763
60754
  var acceptedDetailsInput = (path4, participationMode, pictures = {}) => inputOrInteractive(path4, interactiveAcceptedDetails(participationMode, pictures)).pipe(exports_Effect.flatMap((input) => decode2(AcceptedDetailsInput, input, acceptedDetailsInputFieldNames)), exports_Effect.flatMap((input) => validateSemantics(input, acceptedDetailsSemanticRequirements(input, participationMode))));
60764
60755
  var picturePathInput = (suppliedPath) => {
60765
60756
  if (suppliedPath)
@@ -62436,7 +62427,6 @@ var uploadPicture = exports_Effect.fn("uploadPicture")(function* (options, path4
62436
62427
  // src/commands.ts
62437
62428
  var inputFlag2 = exports_Flag.string("input").pipe(exports_Flag.optional, exports_Flag.withDescription("Read JSON from a file, or use - for stdin"));
62438
62429
  var stageFlag = exports_Flag.choice("stage", ["application", "acceptance"]).pipe(exports_Flag.withDefault("application"));
62439
- var submitFlag = exports_Flag.boolean("submit").pipe(exports_Flag.withDefault(false), exports_Flag.withDescription("Submit the saved application draft"));
62440
62430
  var currentRegistration = (client) => getRegistration(client).pipe(exports_Effect.map(exports_Option.some), exports_Effect.catch((error2) => {
62441
62431
  if (error2.code === "REGISTRATION_NOT_FOUND") {
62442
62432
  return exports_Effect.succeed(exports_Option.none());
@@ -62462,45 +62452,31 @@ var rejectIfApplicationLocked = exports_Effect.fn("rejectIfApplicationLocked")(f
62462
62452
  currentStatus: status
62463
62453
  });
62464
62454
  });
62465
- var registerCommand = exports_Command.make("register", { input: inputFlag2, submit: submitFlag }, exports_Effect.fn("registerCommand")(function* ({ input, submit }) {
62455
+ var registerCommand = exports_Command.make("register", { input: inputFlag2 }, exports_Effect.fn("registerCommand")(function* ({ input }) {
62466
62456
  const options = yield* root;
62467
62457
  const operation = exports_Effect.gen(function* () {
62468
62458
  const token = exports_Option.getOrUndefined(options.token);
62469
62459
  const client = { apiUrl: options.apiUrl, token };
62470
62460
  const current = yield* currentRegistration(client);
62471
62461
  yield* rejectIfApplicationLocked(current);
62472
- if (exports_Option.isSome(input) || submit) {
62473
- if (exports_Option.isSome(input)) {
62474
- const body = yield* applicationDraftInput(input.value);
62475
- const saved = yield* saveRegistrationDraft(client, body);
62476
- if (submit)
62477
- return yield* submitRegistration(client);
62478
- return saved;
62479
- }
62480
- return yield* submitRegistration(client);
62462
+ if (exports_Option.isSome(input)) {
62463
+ const body = yield* applicationInput(input.value, config.publicSiteUrl);
62464
+ return yield* register(client, body);
62481
62465
  }
62482
62466
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
62483
62467
  return yield* cliError("INPUT_REQUIRED", "Non-interactive use requires --input <file>, or --input - for stdin");
62484
62468
  }
62485
62469
  return yield* interactiveRegister(client, current);
62486
62470
  });
62487
- yield* execute(options.output, operation, (result3) => {
62488
- if (result3.registration.status === "submitted")
62489
- return createdText(result3);
62490
- return draftSavedText(result3);
62491
- });
62492
- })).pipe(exports_Command.withDescription("Save an application draft, then submit it for review"), exports_Command.withExamples([
62471
+ yield* execute(options.output, operation, createdText);
62472
+ })).pipe(exports_Command.withDescription("Complete and submit an application for review"), exports_Command.withExamples([
62493
62473
  {
62494
62474
  command: "chofex register",
62495
62475
  description: "Fill or resume the application interactively"
62496
62476
  },
62497
62477
  {
62498
62478
  command: "chofex --output json register --input application.json",
62499
- description: "Save a draft from JSON without submitting it"
62500
- },
62501
- {
62502
- command: "chofex register --submit",
62503
- description: "Submit a completed draft"
62479
+ description: "Submit an application from an agent or script"
62504
62480
  }
62505
62481
  ]));
62506
62482
  var interactiveRegister = (client, initial) => exports_Effect.gen(function* () {
@@ -62508,14 +62484,14 @@ var interactiveRegister = (client, initial) => exports_Effect.gen(function* () {
62508
62484
  if (latest) {
62509
62485
  yield* exports_Console.log(registrationPartsText(latest));
62510
62486
  } else {
62511
- yield* exports_Console.log("No draft yet. Answers are saved on the server after you finish.");
62487
+ yield* exports_Console.log("No application yet. Your application will be submitted after you finish.");
62512
62488
  }
62513
62489
  let defaults2 = {};
62514
62490
  if (latest) {
62515
62491
  defaults2 = applicationDefaultsFromRegistration(latest.registration);
62516
62492
  }
62517
- const body = yield* collectApplicationFields(config.publicSiteUrl, defaults2);
62518
- return yield* saveRegistrationDraft(client, body);
62493
+ const body = yield* applicationInput(undefined, config.publicSiteUrl, defaults2);
62494
+ return yield* register(client, body);
62519
62495
  });
62520
62496
  var statusCommand = exports_Command.make("status", {}, exports_Effect.fn("statusCommand")(function* () {
62521
62497
  const options = yield* root;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.121",
3
+ "version": "0.1.123",
4
4
  "description": "Command-line client for the Chofex Hackathon",
5
5
  "type": "module",
6
6
  "bin": {