chofex-cli 0.1.18 → 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 +10 -4
  2. package/dist/index.js +24 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -19,10 +19,16 @@ chofex requirements
19
19
 
20
20
  For agent or script input, `chofex schema --stage application` and
21
21
  `chofex schema --stage acceptance` print complete templates containing every
22
- accepted JSON key. Local validation errors include `acceptedFields` in JSON
23
- mode. The `status` response already includes both the registration and its
24
- requirements; use `requirements` only when requirements-only human output is
25
- preferred.
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.
26
32
 
27
33
  Run `chofex login` to authenticate. For automation, provide an OAuth access
28
34
  token with `CHOFEX_TOKEN`.
package/dist/index.js CHANGED
@@ -31820,6 +31820,7 @@ var requirementsOnlyText = (result3) => requirementsText(result3);
31820
31820
 
31821
31821
  // src/commands.ts
31822
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"));
31823
31824
  var root = exports_Command.make("chofex").pipe(exports_Command.withSharedFlags({
31824
31825
  apiUrl: exports_Flag.string("api-url").pipe(exports_Flag.withDefault(config.apiUrl), exports_Flag.withDescription("Registration API base URL")),
31825
31826
  output: exports_Flag.choice("output", ["human", "json"]).pipe(exports_Flag.withDefault("human"), exports_Flag.withDescription("Output format")),
@@ -31943,6 +31944,27 @@ var whoamiCommand = exports_Command.make("whoami", {}, exports_Effect.fn("whoami
31943
31944
  const operation = getCurrentUser({ apiUrl: options.apiUrl, token });
31944
31945
  yield* execute(options.output, operation, (result3) => `Authenticated as ${result3.email} (${result3.userId}, ${result3.tokenType}).`);
31945
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
+ ]));
31946
31968
  var applicationTemplate = {
31947
31969
  firstName: "Ada",
31948
31970
  lastName: "Lovelace",
@@ -31980,9 +32002,7 @@ var templateFor = (stage) => {
31980
32002
  return applicationTemplate;
31981
32003
  return acceptanceTemplate;
31982
32004
  };
31983
- var schemaCommand = exports_Command.make("schema", {
31984
- stage: exports_Flag.choice("stage", ["application", "acceptance"]).pipe(exports_Flag.withDefault("application"))
31985
- }, exports_Effect.fn("schemaCommand")(function* ({ stage }) {
32005
+ var schemaCommand = exports_Command.make("schema", { stage: stageFlag }, exports_Effect.fn("schemaCommand")(function* ({ stage }) {
31986
32006
  yield* printJson(templateFor(stage));
31987
32007
  })).pipe(exports_Command.withDescription("Print a complete machine-readable input template"), exports_Command.withExamples([
31988
32008
  {
@@ -31994,6 +32014,7 @@ var command = root.pipe(exports_Command.withSubcommands([
31994
32014
  loginCommand,
31995
32015
  logoutCommand,
31996
32016
  whoamiCommand,
32017
+ validateCommand,
31997
32018
  registerCommand,
31998
32019
  statusCommand,
31999
32020
  requirementsCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Command-line client for the Chofex Hackathon",
5
5
  "type": "module",
6
6
  "bin": {