chofex-cli 0.1.78 → 0.1.79
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.
- package/dist/index.js +151 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59698,7 +59698,7 @@ var registrationPartsText = (result3) => {
|
|
|
59698
59698
|
|
|
59699
59699
|
// src/cli-root.ts
|
|
59700
59700
|
var root = exports_Command.make("chofex").pipe(exports_Command.withSharedFlags({
|
|
59701
|
-
apiUrl: exports_Flag.string("api-url").pipe(exports_Flag.withDefault(config.apiUrl), exports_Flag.withDescription("
|
|
59701
|
+
apiUrl: exports_Flag.string("api-url").pipe(exports_Flag.withDefault(config.apiUrl), exports_Flag.withDescription("Chofex API base URL")),
|
|
59702
59702
|
output: exports_Flag.choice("output", ["human", "json"]).pipe(exports_Flag.withDefault("human"), exports_Flag.withDescription("Output format")),
|
|
59703
59703
|
token: exports_Flag.string("token").pipe(exports_Flag.optional, exports_Flag.withDescription("Clerk OAuth token (prefer CHOFEX_TOKEN to avoid shell history)"))
|
|
59704
59704
|
}), exports_Command.withDescription("Register for and manage your Chofex hackathon application"));
|
|
@@ -59826,9 +59826,87 @@ var badgeText = (result3) => {
|
|
|
59826
59826
|
};
|
|
59827
59827
|
|
|
59828
59828
|
// src/challenge-commands.ts
|
|
59829
|
+
var challengeQuickstart = {
|
|
59830
|
+
title: "Black Box quickstart",
|
|
59831
|
+
goal: "Reverse-engineer the shipping price function, then submit a compatible JavaScript replacement.",
|
|
59832
|
+
workflow: [
|
|
59833
|
+
{
|
|
59834
|
+
step: 1,
|
|
59835
|
+
action: "Sign in",
|
|
59836
|
+
command: "chofex login",
|
|
59837
|
+
note: "Opens Clerk authentication in your browser."
|
|
59838
|
+
},
|
|
59839
|
+
{
|
|
59840
|
+
step: 2,
|
|
59841
|
+
action: "Check your budget",
|
|
59842
|
+
command: "chofex challenge show",
|
|
59843
|
+
note: "Shows remaining oracle queries and official evaluations."
|
|
59844
|
+
},
|
|
59845
|
+
{
|
|
59846
|
+
step: 3,
|
|
59847
|
+
action: "Probe the Black Box",
|
|
59848
|
+
command: "chofex challenge query --distance 10 --weight 3 --hour 14 --fragile false --express false",
|
|
59849
|
+
note: "A successful query reveals one shipping price and consumes one query."
|
|
59850
|
+
},
|
|
59851
|
+
{
|
|
59852
|
+
step: 4,
|
|
59853
|
+
action: "Study your observations",
|
|
59854
|
+
command: "chofex challenge notebook",
|
|
59855
|
+
note: "Compare inputs and outputs to infer the pricing rules."
|
|
59856
|
+
},
|
|
59857
|
+
{
|
|
59858
|
+
step: 5,
|
|
59859
|
+
action: "Build shipping.js",
|
|
59860
|
+
file: "shipping.js",
|
|
59861
|
+
source: [
|
|
59862
|
+
"function calculateShipping(input) {",
|
|
59863
|
+
" // Return your predicted shipping price.",
|
|
59864
|
+
" return input.distanceKm + input.weightKg;",
|
|
59865
|
+
"}"
|
|
59866
|
+
].join(`
|
|
59867
|
+
`),
|
|
59868
|
+
note: "Define calculateShipping and return one finite number."
|
|
59869
|
+
},
|
|
59870
|
+
{
|
|
59871
|
+
step: 6,
|
|
59872
|
+
action: "Test your replacement safely",
|
|
59873
|
+
command: "chofex challenge test --source ./shipping.js",
|
|
59874
|
+
note: "Checks your solution against your notebook without consuming an official evaluation."
|
|
59875
|
+
},
|
|
59876
|
+
{
|
|
59877
|
+
step: 7,
|
|
59878
|
+
action: "Submit to the hidden test set",
|
|
59879
|
+
command: "chofex challenge evaluate --source ./shipping.js",
|
|
59880
|
+
note: "Official evaluations are limited. Use test as often as needed, then evaluate when your solution is ready."
|
|
59881
|
+
},
|
|
59882
|
+
{
|
|
59883
|
+
step: 8,
|
|
59884
|
+
action: "Check the leaderboard",
|
|
59885
|
+
command: "chofex challenge ranking",
|
|
59886
|
+
note: "Shows the public ranking without consuming budget."
|
|
59887
|
+
}
|
|
59888
|
+
],
|
|
59889
|
+
helpCommand: "chofex challenge query --help"
|
|
59890
|
+
};
|
|
59891
|
+
var challengeQuickstartText = () => {
|
|
59892
|
+
const lines2 = [challengeQuickstart.title, challengeQuickstart.goal, ""];
|
|
59893
|
+
for (const item of challengeQuickstart.workflow) {
|
|
59894
|
+
lines2.push(`${item.step}. ${item.action}`);
|
|
59895
|
+
if ("command" in item)
|
|
59896
|
+
lines2.push(` ${item.command}`);
|
|
59897
|
+
if ("source" in item) {
|
|
59898
|
+
lines2.push(...item.source.split(`
|
|
59899
|
+
`).map((line) => ` ${line}`));
|
|
59900
|
+
}
|
|
59901
|
+
lines2.push(` ${item.note}`, "");
|
|
59902
|
+
}
|
|
59903
|
+
lines2.push(`More detail: ${challengeQuickstart.helpCommand}`);
|
|
59904
|
+
return lines2.join(`
|
|
59905
|
+
`);
|
|
59906
|
+
};
|
|
59829
59907
|
var optionalString = (name, description) => exports_Flag.string(name).pipe(exports_Flag.optional, exports_Flag.withDescription(description));
|
|
59830
59908
|
var challengeFlag = exports_Flag.string("challenge").pipe(exports_Flag.withDefault(defaultChallengeSlug), exports_Flag.withDescription("Challenge slug (default: black-box)"));
|
|
59831
|
-
var sourceFlag = optionalString("source", "JavaScript file
|
|
59909
|
+
var sourceFlag = optionalString("source", "JavaScript file defining function calculateShipping(input)");
|
|
59832
59910
|
var inputFlag = optionalString("input", "JSON file, or - for stdin");
|
|
59833
59911
|
var formatFlag = exports_Flag.choice("format", ["table", "json", "csv"]).pipe(exports_Flag.withDefault("table"), exports_Flag.withDescription("Notebook format"));
|
|
59834
59912
|
var numberFromOption = (value3) => {
|
|
@@ -59847,12 +59925,22 @@ var booleanFromOption = (value3) => {
|
|
|
59847
59925
|
var listCommand = exports_Command.make("list", {}, exports_Effect.fn("challengeListCommand")(function* () {
|
|
59848
59926
|
const options = yield* root;
|
|
59849
59927
|
yield* execute(options.output, listChallenges({ apiUrl: options.apiUrl }), challengeListText);
|
|
59850
|
-
})).pipe(exports_Command.withDescription("
|
|
59928
|
+
})).pipe(exports_Command.withDescription("Discover available challenges, opening dates, and scoring formats. No login required."), exports_Command.withExamples([
|
|
59929
|
+
{
|
|
59930
|
+
command: "chofex challenge list",
|
|
59931
|
+
description: "See which challenge is currently playable"
|
|
59932
|
+
}
|
|
59933
|
+
]));
|
|
59851
59934
|
var showCommand = exports_Command.make("show", { challenge: challengeFlag }, exports_Effect.fn("challengeShowCommand")(function* ({ challenge }) {
|
|
59852
59935
|
const options = yield* root;
|
|
59853
59936
|
const token = exports_Option.getOrUndefined(options.token);
|
|
59854
59937
|
yield* execute(options.output, getChallengeAttempt({ apiUrl: options.apiUrl, token }, challenge), challengeShowText);
|
|
59855
|
-
})).pipe(exports_Command.withDescription("
|
|
59938
|
+
})).pipe(exports_Command.withDescription("Check your Black Box query budget, evaluation budget, score, and saved observations. Requires sign-in."), exports_Command.withExamples([
|
|
59939
|
+
{
|
|
59940
|
+
command: "chofex challenge show",
|
|
59941
|
+
description: "Check your progress before spending limited attempts"
|
|
59942
|
+
}
|
|
59943
|
+
]));
|
|
59856
59944
|
var queryCommand = exports_Command.make("query", {
|
|
59857
59945
|
challenge: challengeFlag,
|
|
59858
59946
|
input: inputFlag,
|
|
@@ -59883,10 +59971,14 @@ var queryCommand = exports_Command.make("query", {
|
|
|
59883
59971
|
return yield* queryChallenge({ apiUrl: options.apiUrl, token }, challenge, shipment);
|
|
59884
59972
|
});
|
|
59885
59973
|
yield* execute(options.output, operation, challengeQueryText);
|
|
59886
|
-
})).pipe(exports_Command.withDescription("
|
|
59974
|
+
})).pipe(exports_Command.withDescription("Send one shipment to the undocumented oracle. A successful query consumes one limited request. Requires sign-in."), exports_Command.withExamples([
|
|
59887
59975
|
{
|
|
59888
59976
|
command: "chofex challenge query --distance 10 --weight 3 --hour 14 --fragile false --express false",
|
|
59889
59977
|
description: "Spend one oracle query"
|
|
59978
|
+
},
|
|
59979
|
+
{
|
|
59980
|
+
command: "chofex challenge query --input shipment.json",
|
|
59981
|
+
description: "Read the shipment fields from a JSON file"
|
|
59890
59982
|
}
|
|
59891
59983
|
]));
|
|
59892
59984
|
var notebookCommand = exports_Command.make("notebook", { challenge: challengeFlag, format: formatFlag }, exports_Effect.fn("challengeNotebookCommand")(function* ({ challenge, format: format6 }) {
|
|
@@ -59901,7 +59993,16 @@ var notebookCommand = exports_Command.make("notebook", { challenge: challengeFla
|
|
|
59901
59993
|
}
|
|
59902
59994
|
return notebookTableText(attempt.observations);
|
|
59903
59995
|
});
|
|
59904
|
-
})).pipe(exports_Command.withDescription("
|
|
59996
|
+
})).pipe(exports_Command.withDescription("Review every input and price you observed. Export table, JSON, or CSV for analysis. Requires sign-in."), exports_Command.withExamples([
|
|
59997
|
+
{
|
|
59998
|
+
command: "chofex challenge notebook",
|
|
59999
|
+
description: "Read observations in a terminal table"
|
|
60000
|
+
},
|
|
60001
|
+
{
|
|
60002
|
+
command: "chofex challenge notebook --format csv > observations.csv",
|
|
60003
|
+
description: "Save observations for a spreadsheet"
|
|
60004
|
+
}
|
|
60005
|
+
]));
|
|
59905
60006
|
var testCommand = exports_Command.make("test", { challenge: challengeFlag, source: sourceFlag }, exports_Effect.fn("challengeTestCommand")(function* ({ challenge, source }) {
|
|
59906
60007
|
const options = yield* root;
|
|
59907
60008
|
const token = exports_Option.getOrUndefined(options.token);
|
|
@@ -59910,7 +60011,12 @@ var testCommand = exports_Command.make("test", { challenge: challengeFlag, sourc
|
|
|
59910
60011
|
return yield* testChallenge({ apiUrl: options.apiUrl, token }, challenge, solution);
|
|
59911
60012
|
});
|
|
59912
60013
|
yield* execute(options.output, operation, challengeTestText);
|
|
59913
|
-
})).pipe(exports_Command.withDescription("
|
|
60014
|
+
})).pipe(exports_Command.withDescription("Check calculateShipping against your saved observations. Safe to repeat; official evaluations are not consumed. Requires sign-in."), exports_Command.withExamples([
|
|
60015
|
+
{
|
|
60016
|
+
command: "chofex challenge test --source ./shipping.js",
|
|
60017
|
+
description: "Test a JavaScript replacement against your notebook"
|
|
60018
|
+
}
|
|
60019
|
+
]));
|
|
59914
60020
|
var evaluateCommand = exports_Command.make("evaluate", { challenge: challengeFlag, source: sourceFlag }, exports_Effect.fn("challengeEvaluateCommand")(function* ({ challenge, source }) {
|
|
59915
60021
|
const options = yield* root;
|
|
59916
60022
|
const token = exports_Option.getOrUndefined(options.token);
|
|
@@ -59919,12 +60025,47 @@ var evaluateCommand = exports_Command.make("evaluate", { challenge: challengeFla
|
|
|
59919
60025
|
return yield* evaluateChallenge({ apiUrl: options.apiUrl, token }, challenge, solution);
|
|
59920
60026
|
});
|
|
59921
60027
|
yield* execute(options.output, operation, challengeEvaluateText);
|
|
59922
|
-
})).pipe(exports_Command.withDescription("
|
|
60028
|
+
})).pipe(exports_Command.withDescription("Score calculateShipping on hidden cases. This consumes one limited official evaluation. Requires sign-in."), exports_Command.withExamples([
|
|
60029
|
+
{
|
|
60030
|
+
command: "chofex challenge evaluate --source ./shipping.js",
|
|
60031
|
+
description: "Spend one official evaluation when your solution is ready"
|
|
60032
|
+
}
|
|
60033
|
+
]));
|
|
59923
60034
|
var rankingCommand = exports_Command.make("ranking", { challenge: challengeFlag }, exports_Effect.fn("challengeRankingCommand")(function* ({ challenge }) {
|
|
59924
60035
|
const options = yield* root;
|
|
59925
60036
|
yield* execute(options.output, getChallengeRanking({ apiUrl: options.apiUrl }, challenge), challengeRankingText);
|
|
59926
|
-
})).pipe(exports_Command.withDescription("
|
|
59927
|
-
|
|
60037
|
+
})).pipe(exports_Command.withDescription("View the public leaderboard. No login required and no challenge budget consumed."), exports_Command.withExamples([
|
|
60038
|
+
{
|
|
60039
|
+
command: "chofex challenge ranking",
|
|
60040
|
+
description: "Compare official hidden-set scores"
|
|
60041
|
+
}
|
|
60042
|
+
]));
|
|
60043
|
+
var challengeCommand = exports_Command.make("challenge", {}, exports_Effect.fn("challengeQuickstartCommand")(function* () {
|
|
60044
|
+
const options = yield* root;
|
|
60045
|
+
if (options.output === "json") {
|
|
60046
|
+
yield* printJson({
|
|
60047
|
+
version: 1,
|
|
60048
|
+
ok: true,
|
|
60049
|
+
requestId: crypto.randomUUID(),
|
|
60050
|
+
data: challengeQuickstart
|
|
60051
|
+
});
|
|
60052
|
+
return;
|
|
60053
|
+
}
|
|
60054
|
+
yield* exports_Console.log(challengeQuickstartText());
|
|
60055
|
+
})).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([
|
|
60056
|
+
{
|
|
60057
|
+
command: "chofex challenge",
|
|
60058
|
+
description: "Open the guided Black Box quickstart"
|
|
60059
|
+
},
|
|
60060
|
+
{
|
|
60061
|
+
command: "chofex challenge query --distance 10 --weight 3 --hour 14 --fragile false --express false",
|
|
60062
|
+
description: "Make your first oracle query"
|
|
60063
|
+
},
|
|
60064
|
+
{
|
|
60065
|
+
command: "chofex challenge query --help",
|
|
60066
|
+
description: "See flags and examples for the query step"
|
|
60067
|
+
}
|
|
60068
|
+
]), exports_Command.withSubcommands([
|
|
59928
60069
|
listCommand,
|
|
59929
60070
|
showCommand,
|
|
59930
60071
|
queryCommand,
|