chofex-cli 0.1.17 → 0.1.19

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 +13 -0
  2. package/dist/index.js +50 -13
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -17,6 +17,19 @@ chofex status
17
17
  chofex requirements
18
18
  ```
19
19
 
20
+ For agent or script input, `chofex schema --stage application` and
21
+ `chofex schema --stage acceptance` print complete templates containing every
22
+ accepted JSON key. Validate a completed input file locally before submitting it:
23
+
24
+ ```sh
25
+ chofex --output json validate --stage application --input application.json
26
+ ```
27
+
28
+ Validation does not contact the API, and a successful result does not echo input
29
+ values. Local validation errors include `acceptedFields` in JSON mode. The
30
+ `status` response already includes both the registration and its requirements;
31
+ use `requirements` only when requirements-only human output is preferred.
32
+
20
33
  Run `chofex login` to authenticate. For automation, provide an OAuth access
21
34
  token with `CHOFEX_TOKEN`.
22
35
 
package/dist/index.js CHANGED
@@ -30822,7 +30822,7 @@ var ShirtSize = exports_Schema.Literals([
30822
30822
  "3xl",
30823
30823
  "prefer_not_to_say"
30824
30824
  ]);
30825
- var ApplicationInput = exports_Schema.Struct({
30825
+ var applicationInputFields = {
30826
30826
  firstName: nonBlank(100),
30827
30827
  lastName: nonBlank(100),
30828
30828
  pronouns: optionalText(50),
@@ -30842,8 +30842,10 @@ var ApplicationInput = exports_Schema.Struct({
30842
30842
  codeOfConductAccepted: exports_Schema.Literal(true),
30843
30843
  privacyPolicyAccepted: exports_Schema.Literal(true),
30844
30844
  mediaConsent: exports_Schema.optional(exports_Schema.Boolean)
30845
- });
30846
- var AcceptedDetailsInput = exports_Schema.Struct({
30845
+ };
30846
+ var applicationInputFieldNames = Object.keys(applicationInputFields);
30847
+ var ApplicationInput = exports_Schema.Struct(applicationInputFields);
30848
+ var acceptedDetailsInputFields = {
30847
30849
  phone: nonBlank(32),
30848
30850
  dateOfBirth: exports_Schema.String.pipe(exports_Schema.check(exports_Schema.isPattern(/^\d{4}-\d{2}-\d{2}$/, {
30849
30851
  message: "Must use YYYY-MM-DD format"
@@ -30855,7 +30857,9 @@ var AcceptedDetailsInput = exports_Schema.Struct({
30855
30857
  emergencyContactName: nonBlank(200),
30856
30858
  emergencyContactPhone: nonBlank(32),
30857
30859
  mediaConsent: exports_Schema.optional(exports_Schema.Boolean)
30858
- });
30860
+ };
30861
+ var acceptedDetailsInputFieldNames = Object.keys(acceptedDetailsInputFields);
30862
+ var AcceptedDetailsInput = exports_Schema.Struct(acceptedDetailsInputFields);
30859
30863
  var RequirementSchema = exports_Schema.Struct({
30860
30864
  field: exports_Schema.String,
30861
30865
  reason: exports_Schema.String
@@ -31590,8 +31594,9 @@ var readJsonInput = (path4) => exports_Effect.tryPromise({
31590
31594
  },
31591
31595
  catch: (error2) => cliError("INVALID_INPUT_FILE", `Could not read JSON input from ${path4}: ${String(error2)}`)
31592
31596
  });
31593
- var decode2 = (schema, input) => exports_Schema.decodeUnknownEffect(schema, { onExcessProperty: "error" })(input).pipe(exports_Effect.mapError((error2) => cliError("VALIDATION_ERROR", "Input validation failed", false, {
31594
- issues: String(error2)
31597
+ var decode2 = (schema, input, acceptedFields) => exports_Schema.decodeUnknownEffect(schema, { onExcessProperty: "error" })(input).pipe(exports_Effect.mapError((error2) => cliError("VALIDATION_ERROR", "Input validation failed", false, {
31598
+ issues: String(error2),
31599
+ acceptedFields
31595
31600
  })));
31596
31601
  var validateSemantics = (input, requirements) => {
31597
31602
  if (requirements.length === 0)
@@ -31719,8 +31724,8 @@ var inputOrInteractive = (path4, interactive) => {
31719
31724
  return cliError("PROMPT_CANCELLED", "Interactive input was cancelled");
31720
31725
  }));
31721
31726
  };
31722
- var applicationInput = (path4, publicBaseUrl) => inputOrInteractive(path4, interactiveApplication(publicBaseUrl)).pipe(exports_Effect.flatMap((input) => decode2(ApplicationInput, input)), exports_Effect.flatMap((input) => validateSemantics(input, applicationSemanticRequirements(input))));
31723
- var acceptedDetailsInput = (path4, participationMode) => inputOrInteractive(path4, interactiveAcceptedDetails(participationMode)).pipe(exports_Effect.flatMap((input) => decode2(AcceptedDetailsInput, input)), exports_Effect.flatMap((input) => validateSemantics(input, acceptedDetailsSemanticRequirements(input, participationMode))));
31727
+ var applicationInput = (path4, publicBaseUrl) => inputOrInteractive(path4, interactiveApplication(publicBaseUrl)).pipe(exports_Effect.flatMap((input) => decode2(ApplicationInput, input, applicationInputFieldNames)), exports_Effect.flatMap((input) => validateSemantics(input, applicationSemanticRequirements(input))));
31728
+ var acceptedDetailsInput = (path4, participationMode) => inputOrInteractive(path4, interactiveAcceptedDetails(participationMode)).pipe(exports_Effect.flatMap((input) => decode2(AcceptedDetailsInput, input, acceptedDetailsInputFieldNames)), exports_Effect.flatMap((input) => validateSemantics(input, acceptedDetailsSemanticRequirements(input, participationMode))));
31724
31729
 
31725
31730
  // src/output.ts
31726
31731
  var printJson = (value3) => exports_Effect.sync(() => {
@@ -31815,6 +31820,7 @@ var requirementsOnlyText = (result3) => requirementsText(result3);
31815
31820
 
31816
31821
  // src/commands.ts
31817
31822
  var inputFlag = exports_Flag.string("input").pipe(exports_Flag.optional, exports_Flag.withDescription("Read JSON from a file, or use - for stdin"));
31823
+ var stageFlag = exports_Flag.choice("stage", ["application", "acceptance"]).pipe(exports_Flag.withDefault("application"));
31818
31824
  var root = exports_Command.make("chofex").pipe(exports_Command.withSharedFlags({
31819
31825
  apiUrl: exports_Flag.string("api-url").pipe(exports_Flag.withDefault(config.apiUrl), exports_Flag.withDescription("Registration API base URL")),
31820
31826
  output: exports_Flag.choice("output", ["human", "json"]).pipe(exports_Flag.withDefault("human"), exports_Flag.withDescription("Output format")),
@@ -31938,14 +31944,44 @@ var whoamiCommand = exports_Command.make("whoami", {}, exports_Effect.fn("whoami
31938
31944
  const operation = getCurrentUser({ apiUrl: options.apiUrl, token });
31939
31945
  yield* execute(options.output, operation, (result3) => `Authenticated as ${result3.email} (${result3.userId}, ${result3.tokenType}).`);
31940
31946
  })).pipe(exports_Command.withDescription("Verify the current Clerk authentication"));
31947
+ var inputValidation = (stage, path4) => {
31948
+ if (stage === "application") {
31949
+ return applicationInput(path4, config.publicSiteUrl).pipe(exports_Effect.asVoid);
31950
+ }
31951
+ return acceptedDetailsInput(path4, "in_person").pipe(exports_Effect.asVoid);
31952
+ };
31953
+ var validateCommand = exports_Command.make("validate", { input: inputFlag, stage: stageFlag }, exports_Effect.fn("validateCommand")(function* ({ input, stage }) {
31954
+ const options = yield* root;
31955
+ const operation = inputValidation(stage, exports_Option.getOrUndefined(input)).pipe(exports_Effect.map(() => ({
31956
+ version: 1,
31957
+ ok: true,
31958
+ requestId: crypto.randomUUID(),
31959
+ data: { valid: true, stage }
31960
+ })));
31961
+ yield* execute(options.output, operation, (result3) => `${result3.stage} input is valid.`);
31962
+ })).pipe(exports_Command.withDescription("Validate input without submitting it"), exports_Command.withExamples([
31963
+ {
31964
+ command: "chofex --output json validate --stage application --input application.json",
31965
+ description: "Validate an application file locally"
31966
+ }
31967
+ ]));
31941
31968
  var applicationTemplate = {
31942
31969
  firstName: "Ada",
31943
31970
  lastName: "Lovelace",
31971
+ pronouns: "she/her",
31944
31972
  city: "Lima",
31973
+ organization: "Analytical Engines",
31974
+ role: "Programmer",
31975
+ fieldOfStudy: "Computer Science",
31976
+ graduationYear: 2026,
31945
31977
  experienceLevel: "advanced",
31946
31978
  skills: ["TypeScript", "AI"],
31947
31979
  bio: "What I hope to build and contribute.",
31948
- teamPreference: "looking_for_team",
31980
+ githubUrl: "https://github.com/ada-lovelace",
31981
+ linkedInUrl: "https://linkedin.com/in/ada-lovelace",
31982
+ portfolioUrl: "https://example.com",
31983
+ teamPreference: "have_team",
31984
+ teamName: "Analytical Engines",
31949
31985
  codeOfConductAccepted: true,
31950
31986
  privacyPolicyAccepted: true,
31951
31987
  mediaConsent: false
@@ -31955,6 +31991,8 @@ var acceptanceTemplate = {
31955
31991
  dateOfBirth: "1990-01-01",
31956
31992
  nationalIdNumber: "passport-or-national-id",
31957
31993
  shirtSize: "m",
31994
+ dietaryRestrictions: "Vegetarian",
31995
+ accessibilityNeeds: "Wheelchair-accessible workspace",
31958
31996
  emergencyContactName: "Grace Hopper",
31959
31997
  emergencyContactPhone: "+1 555 0100",
31960
31998
  mediaConsent: false
@@ -31964,11 +32002,9 @@ var templateFor = (stage) => {
31964
32002
  return applicationTemplate;
31965
32003
  return acceptanceTemplate;
31966
32004
  };
31967
- var schemaCommand = exports_Command.make("schema", {
31968
- stage: exports_Flag.choice("stage", ["application", "acceptance"]).pipe(exports_Flag.withDefault("application"))
31969
- }, exports_Effect.fn("schemaCommand")(function* ({ stage }) {
32005
+ var schemaCommand = exports_Command.make("schema", { stage: stageFlag }, exports_Effect.fn("schemaCommand")(function* ({ stage }) {
31970
32006
  yield* printJson(templateFor(stage));
31971
- })).pipe(exports_Command.withDescription("Print a machine-readable input template"), exports_Command.withExamples([
32007
+ })).pipe(exports_Command.withDescription("Print a complete machine-readable input template"), exports_Command.withExamples([
31972
32008
  {
31973
32009
  command: "chofex schema --stage acceptance",
31974
32010
  description: "Print the post-acceptance input template"
@@ -31978,6 +32014,7 @@ var command = root.pipe(exports_Command.withSubcommands([
31978
32014
  loginCommand,
31979
32015
  logoutCommand,
31980
32016
  whoamiCommand,
32017
+ validateCommand,
31981
32018
  registerCommand,
31982
32019
  statusCommand,
31983
32020
  requirementsCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Command-line client for the Chofex Hackathon",
5
5
  "type": "module",
6
6
  "bin": {