chofex-cli 0.1.114 → 0.1.115
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/README.md +8 -0
- package/dist/index.js +192 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ npm install --global chofex-cli@latest
|
|
|
11
11
|
The installed command is `chofex`:
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
+
chofex
|
|
14
15
|
chofex whoami
|
|
15
16
|
chofex register
|
|
16
17
|
chofex status
|
|
@@ -32,6 +33,13 @@ never decide admission or block an application submission.
|
|
|
32
33
|
|
|
33
34
|
The public ranking is read-only at `https://andes.crafter.run/challenges`.
|
|
34
35
|
|
|
36
|
+
Run `chofex` for a compact retro welcome screen with a pixel Sacred Valley and
|
|
37
|
+
the main commands. Run `chofex --help` for the full command reference. The
|
|
38
|
+
landscape uses colored terminal cells, with readable text that works with your
|
|
39
|
+
terminal's line spacing. It adapts to the terminal width and has a plain ASCII
|
|
40
|
+
fallback when color is disabled with `NO_COLOR`. JSON output and individual
|
|
41
|
+
command results omit the welcome screen.
|
|
42
|
+
|
|
35
43
|
For agent or script input, `chofex schema --stage application` and
|
|
36
44
|
`chofex schema --stage acceptance` print complete templates containing every
|
|
37
45
|
accepted JSON key. Validate a completed input file locally before submitting it:
|
package/dist/index.js
CHANGED
|
@@ -51213,35 +51213,17 @@ var withTime = /* @__PURE__ */ dual((args2) => isEffect(args2[0]), (self, label)
|
|
|
51213
51213
|
}), () => self, () => sync(() => {
|
|
51214
51214
|
console2.timeEnd(label);
|
|
51215
51215
|
}))));
|
|
51216
|
-
// ../../node_modules/effect/dist/unstable/cli/Command.js
|
|
51217
|
-
var exports_Command = {};
|
|
51218
|
-
__export(exports_Command, {
|
|
51219
|
-
wizard: () => wizard,
|
|
51220
|
-
withSubcommands: () => withSubcommands,
|
|
51221
|
-
withShortDescription: () => withShortDescription,
|
|
51222
|
-
withSharedFlags: () => withSharedFlags,
|
|
51223
|
-
withHandler: () => withHandler,
|
|
51224
|
-
withGlobalFlags: () => withGlobalFlags,
|
|
51225
|
-
withExamples: () => withExamples,
|
|
51226
|
-
withDescription: () => withDescription3,
|
|
51227
|
-
withAlias: () => withAlias3,
|
|
51228
|
-
unlisted: () => unlisted,
|
|
51229
|
-
runWith: () => runWith2,
|
|
51230
|
-
run: () => run5,
|
|
51231
|
-
provideSync: () => provideSync,
|
|
51232
|
-
provideEffectDiscard: () => provideEffectDiscard,
|
|
51233
|
-
provideEffect: () => provideEffect,
|
|
51234
|
-
provide: () => provide6,
|
|
51235
|
-
make: () => make37,
|
|
51236
|
-
isCommand: () => isCommand,
|
|
51237
|
-
annotateMerge: () => annotateMerge,
|
|
51238
|
-
annotate: () => annotate4
|
|
51239
|
-
});
|
|
51240
|
-
|
|
51241
51216
|
// ../../node_modules/effect/dist/unstable/cli/CliOutput.js
|
|
51217
|
+
var exports_CliOutput = {};
|
|
51218
|
+
__export(exports_CliOutput, {
|
|
51219
|
+
layer: () => layer13,
|
|
51220
|
+
defaultFormatter: () => defaultFormatter2,
|
|
51221
|
+
Formatter: () => Formatter2
|
|
51222
|
+
});
|
|
51242
51223
|
var Formatter2 = /* @__PURE__ */ Reference("effect/cli/CliOutput", {
|
|
51243
51224
|
defaultValue: () => defaultFormatter2()
|
|
51244
51225
|
});
|
|
51226
|
+
var layer13 = (formatter) => succeed5(Formatter2)(formatter);
|
|
51245
51227
|
var escapeControlCharacters = (text) => text.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, (character) => `\\x${character.charCodeAt(0).toString(16).padStart(2, "0")}`);
|
|
51246
51228
|
var defaultFormatter2 = (options) => {
|
|
51247
51229
|
const globalProcess = globalThis.process;
|
|
@@ -51436,6 +51418,30 @@ var formatHelpDocImpl = (doc, colors2) => {
|
|
|
51436
51418
|
return sections.join(`
|
|
51437
51419
|
`);
|
|
51438
51420
|
};
|
|
51421
|
+
// ../../node_modules/effect/dist/unstable/cli/Command.js
|
|
51422
|
+
var exports_Command = {};
|
|
51423
|
+
__export(exports_Command, {
|
|
51424
|
+
wizard: () => wizard,
|
|
51425
|
+
withSubcommands: () => withSubcommands,
|
|
51426
|
+
withShortDescription: () => withShortDescription,
|
|
51427
|
+
withSharedFlags: () => withSharedFlags,
|
|
51428
|
+
withHandler: () => withHandler,
|
|
51429
|
+
withGlobalFlags: () => withGlobalFlags,
|
|
51430
|
+
withExamples: () => withExamples,
|
|
51431
|
+
withDescription: () => withDescription3,
|
|
51432
|
+
withAlias: () => withAlias3,
|
|
51433
|
+
unlisted: () => unlisted,
|
|
51434
|
+
runWith: () => runWith2,
|
|
51435
|
+
run: () => run5,
|
|
51436
|
+
provideSync: () => provideSync,
|
|
51437
|
+
provideEffectDiscard: () => provideEffectDiscard,
|
|
51438
|
+
provideEffect: () => provideEffect,
|
|
51439
|
+
provide: () => provide6,
|
|
51440
|
+
make: () => make37,
|
|
51441
|
+
isCommand: () => isCommand,
|
|
51442
|
+
annotateMerge: () => annotateMerge,
|
|
51443
|
+
annotate: () => annotate4
|
|
51444
|
+
});
|
|
51439
51445
|
|
|
51440
51446
|
// ../../node_modules/effect/dist/unstable/cli/internal/completions/bash.js
|
|
51441
51447
|
var escapeForBash = (s) => s.replace(/'/g, "'\\''");
|
|
@@ -58383,7 +58389,7 @@ var mapHandler = (self, f) => {
|
|
|
58383
58389
|
handle: (input, path4) => f(impl.handle(input, path4), input)
|
|
58384
58390
|
});
|
|
58385
58391
|
};
|
|
58386
|
-
var provide6 = /* @__PURE__ */ dual((args2) => isCommand(args2[0]), (self,
|
|
58392
|
+
var provide6 = /* @__PURE__ */ dual((args2) => isCommand(args2[0]), (self, layer14, options) => mapHandler(self, (handler, input) => provide4(handler, typeof layer14 === "function" ? layer14(input) : layer14, options)));
|
|
58387
58393
|
var provideSync = /* @__PURE__ */ dual(3, (self, service3, implementation) => mapHandler(self, (handler, input) => provideService2(handler, service3, typeof implementation === "function" ? implementation(input) : implementation)));
|
|
58388
58394
|
var provideEffect = /* @__PURE__ */ dual(3, (self, service3, effect2) => mapHandler(self, (handler, input) => provideServiceEffect2(handler, service3, typeof effect2 === "function" ? effect2(input) : effect2)));
|
|
58389
58395
|
var provideEffectDiscard = /* @__PURE__ */ dual(2, (self, effect2) => mapHandler(self, (handler, input) => andThen4(typeof effect2 === "function" ? effect2(input) : effect2, handler)));
|
|
@@ -62686,6 +62692,161 @@ var command = root.pipe(exports_Command.withSubcommands([
|
|
|
62686
62692
|
challengeCommand
|
|
62687
62693
|
]));
|
|
62688
62694
|
|
|
62695
|
+
// src/welcome.ts
|
|
62696
|
+
var valley = [
|
|
62697
|
+
" 11 55 ",
|
|
62698
|
+
" 11 1111 5555 11 ",
|
|
62699
|
+
" 1111 111111 11 55 1111 ",
|
|
62700
|
+
" 11112222111111 111111 111111 ",
|
|
62701
|
+
"111222222211111111111111111122221111",
|
|
62702
|
+
"112223333222111111111111112223332222",
|
|
62703
|
+
"222333333322211114411111222333333333",
|
|
62704
|
+
"333333333332222144442222233333333333",
|
|
62705
|
+
"333333333333322244422223333333333333"
|
|
62706
|
+
];
|
|
62707
|
+
var palette = {
|
|
62708
|
+
sky: "12;24;24",
|
|
62709
|
+
distant: "28;62;61",
|
|
62710
|
+
ridge: "44;101;85",
|
|
62711
|
+
terrace: "84;143;111",
|
|
62712
|
+
river: "141;200;190",
|
|
62713
|
+
sun: "234;183;108",
|
|
62714
|
+
border: "66;101;85",
|
|
62715
|
+
text: "243;241;217",
|
|
62716
|
+
muted: "183;201;181",
|
|
62717
|
+
accent: "214;255;0"
|
|
62718
|
+
};
|
|
62719
|
+
var pixels = {
|
|
62720
|
+
" ": { color: palette.sky, character: " " },
|
|
62721
|
+
"1": { color: palette.distant, character: "." },
|
|
62722
|
+
"2": { color: palette.ridge, character: ":" },
|
|
62723
|
+
"3": { color: palette.terrace, character: "#" },
|
|
62724
|
+
"4": { color: palette.river, character: "~" },
|
|
62725
|
+
"5": { color: palette.sun, character: "o" }
|
|
62726
|
+
};
|
|
62727
|
+
var wrap = (text2, width) => {
|
|
62728
|
+
const lines2 = [];
|
|
62729
|
+
let line = "";
|
|
62730
|
+
for (const word of text2.split(" ")) {
|
|
62731
|
+
if (line && line.length + word.length + 1 > width) {
|
|
62732
|
+
lines2.push(line);
|
|
62733
|
+
line = "";
|
|
62734
|
+
}
|
|
62735
|
+
line = line ? `${line} ${word}` : word;
|
|
62736
|
+
while (line.length > width) {
|
|
62737
|
+
lines2.push(line.slice(0, width));
|
|
62738
|
+
line = line.slice(width);
|
|
62739
|
+
}
|
|
62740
|
+
}
|
|
62741
|
+
if (line)
|
|
62742
|
+
lines2.push(line);
|
|
62743
|
+
return lines2;
|
|
62744
|
+
};
|
|
62745
|
+
var center = (text2, width) => (" ".repeat(Math.max(0, Math.floor((width - text2.length) / 2))) + text2).padEnd(width);
|
|
62746
|
+
var renderWelcome = ({
|
|
62747
|
+
columns = 80,
|
|
62748
|
+
colors: colors2 = false
|
|
62749
|
+
} = {}) => {
|
|
62750
|
+
const width = Math.max(1, Math.min(Math.floor(columns), 72));
|
|
62751
|
+
if (width < 24) {
|
|
62752
|
+
return [
|
|
62753
|
+
"The Andes Hackathon",
|
|
62754
|
+
"by Chofex",
|
|
62755
|
+
"S/8,000 in prizes",
|
|
62756
|
+
"Only for the best engineers from Peru."
|
|
62757
|
+
].flatMap((line) => wrap(line, width)).join(`
|
|
62758
|
+
`);
|
|
62759
|
+
}
|
|
62760
|
+
const innerWidth = width - 4;
|
|
62761
|
+
const paint = (text2, foreground = palette.text, background = palette.sky, bold2 = false) => {
|
|
62762
|
+
if (!colors2)
|
|
62763
|
+
return text2;
|
|
62764
|
+
const weight = bold2 ? "1;" : "";
|
|
62765
|
+
return `\x1B[${weight}38;2;${foreground};48;2;${background}m${text2}\x1B[0m`;
|
|
62766
|
+
};
|
|
62767
|
+
let horizontal = "-";
|
|
62768
|
+
let vertical = "|";
|
|
62769
|
+
let corners = ["+", "+", "+", "+"];
|
|
62770
|
+
if (colors2) {
|
|
62771
|
+
horizontal = "─";
|
|
62772
|
+
vertical = "│";
|
|
62773
|
+
corners = ["╭", "╮", "╰", "╯"];
|
|
62774
|
+
}
|
|
62775
|
+
const frame = (content) => ` ${paint(vertical, palette.border)}${content}${paint(vertical, palette.border)}`;
|
|
62776
|
+
const rule = (left, right) => ` ${paint(left + horizontal.repeat(innerWidth) + right, palette.border)}`;
|
|
62777
|
+
const label = (text2, foreground, bold2 = false) => frame(paint(center(text2, innerWidth), foreground, palette.sky, bold2));
|
|
62778
|
+
const sourceWidth = Math.max(...valley.map((row) => row.length));
|
|
62779
|
+
const scene = valley.map((row, y) => {
|
|
62780
|
+
const cells = Array.from({ length: innerWidth }, (_, x) => {
|
|
62781
|
+
const sourceX = Math.floor(x / innerWidth * sourceWidth);
|
|
62782
|
+
return row[sourceX] ?? " ";
|
|
62783
|
+
});
|
|
62784
|
+
let heading = "";
|
|
62785
|
+
let foreground = palette.text;
|
|
62786
|
+
if (y === 3)
|
|
62787
|
+
heading = "The Andes Hackathon";
|
|
62788
|
+
if (y === 4) {
|
|
62789
|
+
heading = "by Chofex";
|
|
62790
|
+
foreground = palette.sun;
|
|
62791
|
+
}
|
|
62792
|
+
const headingStart = Math.floor((innerWidth - heading.length) / 2);
|
|
62793
|
+
let rendered = "";
|
|
62794
|
+
for (let x = 0;x < cells.length; x += 1) {
|
|
62795
|
+
if (heading && x >= headingStart - 1 && x <= headingStart + heading.length) {
|
|
62796
|
+
const character = heading[x - headingStart] ?? " ";
|
|
62797
|
+
rendered += paint(character, foreground, palette.sky, y === 3);
|
|
62798
|
+
continue;
|
|
62799
|
+
}
|
|
62800
|
+
const pixel = pixels[cells[x] ?? " "] ?? pixels[" "];
|
|
62801
|
+
if (!pixel)
|
|
62802
|
+
continue;
|
|
62803
|
+
if (colors2) {
|
|
62804
|
+
rendered += paint(" ", pixel.color, pixel.color);
|
|
62805
|
+
} else {
|
|
62806
|
+
rendered += pixel.character;
|
|
62807
|
+
}
|
|
62808
|
+
}
|
|
62809
|
+
return frame(rendered);
|
|
62810
|
+
});
|
|
62811
|
+
return [
|
|
62812
|
+
"",
|
|
62813
|
+
rule(corners[0] ?? "+", corners[1] ?? "+"),
|
|
62814
|
+
...scene,
|
|
62815
|
+
label("", palette.text),
|
|
62816
|
+
label("S/8,000 in prizes", palette.accent, true),
|
|
62817
|
+
...wrap("Only for the best engineers from Peru.", innerWidth - 2).map((line) => label(line, palette.muted)),
|
|
62818
|
+
rule(corners[2] ?? "+", corners[3] ?? "+"),
|
|
62819
|
+
""
|
|
62820
|
+
].join(`
|
|
62821
|
+
`);
|
|
62822
|
+
};
|
|
62823
|
+
var welcomeFormatter = (options) => {
|
|
62824
|
+
const formatter = exports_CliOutput.defaultFormatter({ colors: options.colors });
|
|
62825
|
+
return {
|
|
62826
|
+
...formatter,
|
|
62827
|
+
formatHelpDoc: (doc) => {
|
|
62828
|
+
const help = formatter.formatHelpDoc(doc);
|
|
62829
|
+
if (!doc.subcommands?.length)
|
|
62830
|
+
return help;
|
|
62831
|
+
const welcome = renderWelcome(options);
|
|
62832
|
+
if (!options.home)
|
|
62833
|
+
return `${welcome}
|
|
62834
|
+
${help}`;
|
|
62835
|
+
const width = Math.max(1, Math.min(options.columns ?? 80, 72));
|
|
62836
|
+
const shortcuts = [
|
|
62837
|
+
"chofex login Sign in",
|
|
62838
|
+
"chofex register Apply",
|
|
62839
|
+
"chofex status Check your application",
|
|
62840
|
+
"chofex --help All commands"
|
|
62841
|
+
];
|
|
62842
|
+
return `${welcome}
|
|
62843
|
+
${shortcuts.flatMap((line) => wrap(line, width)).join(`
|
|
62844
|
+
`)}
|
|
62845
|
+
`;
|
|
62846
|
+
}
|
|
62847
|
+
};
|
|
62848
|
+
};
|
|
62849
|
+
|
|
62689
62850
|
// src/index.ts
|
|
62690
62851
|
var packageMetadata = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
62691
62852
|
var cliVersion = packageMetadata.version;
|
|
@@ -62707,7 +62868,11 @@ var quietConsole = Object.assign(Object.create(console), {
|
|
|
62707
62868
|
return;
|
|
62708
62869
|
}
|
|
62709
62870
|
});
|
|
62710
|
-
var commandProgram = command.pipe(exports_Command.run({ version: cliVersion, renderErrors: !jsonMode }), exports_Effect.
|
|
62871
|
+
var commandProgram = command.pipe(exports_Command.run({ version: cliVersion, renderErrors: !jsonMode }), exports_Effect.provide(exports_CliOutput.layer(welcomeFormatter({
|
|
62872
|
+
home: arguments_.length === 0,
|
|
62873
|
+
columns: process.stdout.columns ?? 80,
|
|
62874
|
+
colors: process.stdout.isTTY === true && process.env.NO_COLOR === undefined && process.env.TERM !== "dumb"
|
|
62875
|
+
}))), exports_Effect.catch((error2) => {
|
|
62711
62876
|
if (!jsonMode)
|
|
62712
62877
|
return exports_Effect.fail(error2);
|
|
62713
62878
|
if (error2._tag === "ShowHelp" && error2.errors.length === 0) {
|