chofex-cli 0.1.197 → 0.1.202
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 +33 -3
- package/dist/index.js +86 -77
- package/package.json +2 -22
package/README.md
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Hack the Andes CLI
|
|
2
2
|
|
|
3
3
|
Command-line client for Hack the Andes.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm install --global
|
|
8
|
+
npm install --global hacktheandes-cli@latest
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
También puedes instalar `chofex-cli`. Ambos paquetes instalan los comandos
|
|
12
|
+
`andes` y `chofex`, con los mismos subcomandos, configuración y sesión guardada.
|
|
13
|
+
Instala uno de los dos paquetes.
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
andes register
|
|
17
|
+
chofex register
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Para instalarlo dentro de un proyecto, usa `npm install hacktheandes-cli` y
|
|
21
|
+
ejecuta `npx andes register` o `npx chofex register`.
|
|
22
|
+
|
|
23
|
+
Los ejemplos con `chofex` también funcionan con `andes`:
|
|
12
24
|
|
|
13
25
|
```sh
|
|
14
26
|
chofex
|
|
@@ -37,6 +49,9 @@ chofex badge regenerate
|
|
|
37
49
|
`chofex update` and `chofex upgrade` are interchangeable; both update the CLI
|
|
38
50
|
to the latest published version.
|
|
39
51
|
|
|
52
|
+
Las actualizaciones conservan el paquete instalado: `hacktheandes-cli` o
|
|
53
|
+
`chofex-cli`, independientemente del comando que uses.
|
|
54
|
+
|
|
40
55
|
Las copias instaladas también consultan npm cada vez que se inicia `chofex` e
|
|
41
56
|
instalan una versión publicada más reciente antes de ejecutar el comando. Si
|
|
42
57
|
npm o la red no están disponibles temporalmente, se continúa con la versión
|
|
@@ -145,3 +160,18 @@ override the API URL when running against a local or preview Chofex instance.
|
|
|
145
160
|
|
|
146
161
|
Registration links use `https://hacktheandes.com` by default. Local or preview
|
|
147
162
|
environments can override that origin with `CHOFEX_PUBLIC_SITE_URL`.
|
|
163
|
+
|
|
164
|
+
## Verificar los paquetes npm
|
|
165
|
+
|
|
166
|
+
Desde la raíz del repositorio:
|
|
167
|
+
|
|
168
|
+
```sh
|
|
169
|
+
bun --filter chofex-cli build
|
|
170
|
+
bun --filter chofex-cli prepare-packages
|
|
171
|
+
bun --filter chofex-cli verify-packages
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
La verificación empaqueta e instala ambos paquetes en directorios temporales.
|
|
175
|
+
Comprueba los dos comandos, la ayuda de registro, la salida JSON y el paquete
|
|
176
|
+
que solicita cada actualización. El workflow de publicación ejecuta estos
|
|
177
|
+
mismos pasos antes de publicar ambos paquetes con la misma versión.
|
package/dist/index.js
CHANGED
|
@@ -2319,9 +2319,9 @@ var require_envpath = __commonJS((exports, module) => {
|
|
|
2319
2319
|
splitPath: () => splitPath
|
|
2320
2320
|
});
|
|
2321
2321
|
module.exports = __toCommonJS(envpath_exports);
|
|
2322
|
-
var
|
|
2322
|
+
var import_node_path2 = __toESM2(__require("node:path"));
|
|
2323
2323
|
function prependPathEntries(pathValue, directories) {
|
|
2324
|
-
const pathParts = pathValue.split(
|
|
2324
|
+
const pathParts = pathValue.split(import_node_path2.default.delimiter).filter(Boolean);
|
|
2325
2325
|
const prepended = [];
|
|
2326
2326
|
for (const directory3 of directories) {
|
|
2327
2327
|
if (!pathParts.includes(directory3) && !prepended.includes(directory3)) {
|
|
@@ -2331,10 +2331,10 @@ var require_envpath = __commonJS((exports, module) => {
|
|
|
2331
2331
|
if (prepended.length === 0) {
|
|
2332
2332
|
return pathValue;
|
|
2333
2333
|
}
|
|
2334
|
-
return pathValue === "" || pathValue ===
|
|
2334
|
+
return pathValue === "" || pathValue === import_node_path2.default.delimiter ? `${prepended.join(import_node_path2.default.delimiter)}${pathValue}` : [...prepended, pathValue].join(import_node_path2.default.delimiter);
|
|
2335
2335
|
}
|
|
2336
2336
|
function splitPath(pathValue) {
|
|
2337
|
-
return pathValue.split(
|
|
2337
|
+
return pathValue.split(import_node_path2.default.delimiter).filter(Boolean);
|
|
2338
2338
|
}
|
|
2339
2339
|
function getEnvPath(env = process.env) {
|
|
2340
2340
|
if (process.platform !== "win32") {
|
|
@@ -2436,7 +2436,7 @@ var require_fsutils = __commonJS((exports, module) => {
|
|
|
2436
2436
|
});
|
|
2437
2437
|
module.exports = __toCommonJS(fsutils_exports);
|
|
2438
2438
|
var import_promises4 = __require("node:fs/promises");
|
|
2439
|
-
var
|
|
2439
|
+
var import_node_path2 = __toESM2(__require("node:path"));
|
|
2440
2440
|
var import_errutils = require_errutils();
|
|
2441
2441
|
async function getCanonicalPath(filePath) {
|
|
2442
2442
|
try {
|
|
@@ -2447,14 +2447,14 @@ var require_fsutils = __commonJS((exports, module) => {
|
|
|
2447
2447
|
}
|
|
2448
2448
|
function getDirectoriesBetween(parent, child) {
|
|
2449
2449
|
const directories = [];
|
|
2450
|
-
let current =
|
|
2451
|
-
const resolvedParent =
|
|
2450
|
+
let current = import_node_path2.default.resolve(child);
|
|
2451
|
+
const resolvedParent = import_node_path2.default.resolve(parent);
|
|
2452
2452
|
while (true) {
|
|
2453
2453
|
directories.push(current);
|
|
2454
2454
|
if (current === resolvedParent) {
|
|
2455
2455
|
return directories.reverse();
|
|
2456
2456
|
}
|
|
2457
|
-
const next =
|
|
2457
|
+
const next = import_node_path2.default.dirname(current);
|
|
2458
2458
|
if (next === current) {
|
|
2459
2459
|
return [];
|
|
2460
2460
|
}
|
|
@@ -2472,18 +2472,18 @@ var require_fsutils = __commonJS((exports, module) => {
|
|
|
2472
2472
|
}
|
|
2473
2473
|
}
|
|
2474
2474
|
function isNodeScript(filePath) {
|
|
2475
|
-
return [".js", ".cjs", ".mjs"].includes(
|
|
2475
|
+
return [".js", ".cjs", ".mjs"].includes(import_node_path2.default.extname(filePath));
|
|
2476
2476
|
}
|
|
2477
2477
|
function isSubpath(parent, child) {
|
|
2478
|
-
const relativePath =
|
|
2479
|
-
return relativePath === "" || relativePath !== "" && !relativePath.startsWith("..") && !
|
|
2478
|
+
const relativePath = import_node_path2.default.relative(parent, child);
|
|
2479
|
+
return relativePath === "" || relativePath !== "" && !relativePath.startsWith("..") && !import_node_path2.default.isAbsolute(relativePath);
|
|
2480
2480
|
}
|
|
2481
2481
|
function getCommandBase(command) {
|
|
2482
|
-
const extension =
|
|
2482
|
+
const extension = import_node_path2.default.extname(command).toLowerCase();
|
|
2483
2483
|
if (process.platform === "win32" && [".cmd", ".exe"].includes(extension)) {
|
|
2484
|
-
return
|
|
2484
|
+
return import_node_path2.default.basename(command, extension);
|
|
2485
2485
|
}
|
|
2486
|
-
return
|
|
2486
|
+
return import_node_path2.default.basename(command);
|
|
2487
2487
|
}
|
|
2488
2488
|
});
|
|
2489
2489
|
|
|
@@ -2520,11 +2520,11 @@ var require_safety = __commonJS((exports, module) => {
|
|
|
2520
2520
|
});
|
|
2521
2521
|
module.exports = __toCommonJS(safety_exports);
|
|
2522
2522
|
var import_promises4 = __require("node:fs/promises");
|
|
2523
|
-
var
|
|
2523
|
+
var import_node_path2 = __toESM2(__require("node:path"));
|
|
2524
2524
|
var import_errutils = require_errutils();
|
|
2525
2525
|
var import_fsutils = require_fsutils();
|
|
2526
2526
|
async function getSkippedNodeModulesReason(nodeModulesDirectory, parentDirectories) {
|
|
2527
|
-
const parentDirectory =
|
|
2527
|
+
const parentDirectory = import_node_path2.default.dirname(nodeModulesDirectory);
|
|
2528
2528
|
parentDirectories ??= [parentDirectory];
|
|
2529
2529
|
for (const directory3 of parentDirectories) {
|
|
2530
2530
|
let unsafeParentReason;
|
|
@@ -2551,7 +2551,7 @@ var require_safety = __commonJS((exports, module) => {
|
|
|
2551
2551
|
if (unsafeNodeModulesReason) {
|
|
2552
2552
|
return unsafeNodeModulesReason;
|
|
2553
2553
|
}
|
|
2554
|
-
return await getSkippedLocalBinDirectoryReason(
|
|
2554
|
+
return await getSkippedLocalBinDirectoryReason(import_node_path2.default.join(nodeModulesDirectory, ".bin"));
|
|
2555
2555
|
}
|
|
2556
2556
|
async function getSkippedLocalBinDirectoryReason(localBinDirectory) {
|
|
2557
2557
|
const result3 = await (0, import_fsutils.statIfExists)(localBinDirectory);
|
|
@@ -2588,7 +2588,7 @@ var require_safety = __commonJS((exports, module) => {
|
|
|
2588
2588
|
return null;
|
|
2589
2589
|
}
|
|
2590
2590
|
async function getUnsafePackageFileReason(packageDirectory, filePath) {
|
|
2591
|
-
const directoriesToCheck = (0, import_fsutils.getDirectoriesBetween)(packageDirectory,
|
|
2591
|
+
const directoriesToCheck = (0, import_fsutils.getDirectoriesBetween)(packageDirectory, import_node_path2.default.dirname(filePath));
|
|
2592
2592
|
if (directoriesToCheck.length === 0) {
|
|
2593
2593
|
return `${filePath} resolves outside package`;
|
|
2594
2594
|
}
|
|
@@ -2667,14 +2667,14 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2667
2667
|
});
|
|
2668
2668
|
module.exports = __toCommonJS(lookup_exports);
|
|
2669
2669
|
var import_promises4 = __require("node:fs/promises");
|
|
2670
|
-
var
|
|
2670
|
+
var import_node_path2 = __toESM2(__require("node:path"));
|
|
2671
2671
|
var import_envpath = require_envpath();
|
|
2672
2672
|
var import_errutils = require_errutils();
|
|
2673
2673
|
var import_fsutils = require_fsutils();
|
|
2674
2674
|
var import_safety = require_safety();
|
|
2675
2675
|
var cliInvocationCache = /* @__PURE__ */ new Map;
|
|
2676
2676
|
async function findVercelCli2(options = {}) {
|
|
2677
|
-
const cwd =
|
|
2677
|
+
const cwd = import_node_path2.default.resolve(options.cwd ?? process.cwd());
|
|
2678
2678
|
const pathValue = options.path ?? (0, import_envpath.getEnvPath)(process.env);
|
|
2679
2679
|
const resolution = await resolveCachedCliInvocation(cwd, pathValue);
|
|
2680
2680
|
return resolution.found ? toVercelCliInvocation(resolution) : null;
|
|
@@ -2751,8 +2751,8 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2751
2751
|
return null;
|
|
2752
2752
|
}
|
|
2753
2753
|
function getPathCommandCandidate(directory3, command, cwd) {
|
|
2754
|
-
const candidateDirectory =
|
|
2755
|
-
return
|
|
2754
|
+
const candidateDirectory = import_node_path2.default.isAbsolute(directory3) ? directory3 : import_node_path2.default.resolve(cwd, directory3);
|
|
2755
|
+
return import_node_path2.default.join(candidateDirectory, command);
|
|
2756
2756
|
}
|
|
2757
2757
|
async function canAccessCommandCandidate(candidate, localBinSearch, diagnostics) {
|
|
2758
2758
|
try {
|
|
@@ -2804,12 +2804,12 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2804
2804
|
return commandBases.flatMap((command) => extensions.map((extension) => `${command}${extension}`));
|
|
2805
2805
|
}
|
|
2806
2806
|
async function getLocalBinSearch(cwd) {
|
|
2807
|
-
const searchRoot = await (0, import_fsutils.getCanonicalPath)(
|
|
2807
|
+
const searchRoot = await (0, import_fsutils.getCanonicalPath)(import_node_path2.default.resolve(cwd));
|
|
2808
2808
|
const ancestorSearch = await getAncestorDirectorySearch(searchRoot);
|
|
2809
2809
|
const skippedNodeModules = [];
|
|
2810
2810
|
const directories = [];
|
|
2811
2811
|
for (const directory3 of ancestorSearch.directories) {
|
|
2812
|
-
const nodeModulesDirectory =
|
|
2812
|
+
const nodeModulesDirectory = import_node_path2.default.join(directory3, "node_modules");
|
|
2813
2813
|
const parentDirectories = ancestorSearch.stopReason === "project-root-marker" ? (0, import_fsutils.getDirectoriesBetween)(ancestorSearch.stoppedAt, directory3) : (0, import_fsutils.getDirectoriesBetween)(directory3, searchRoot);
|
|
2814
2814
|
const skippedReason = await (0, import_safety.getSkippedNodeModulesReason)(nodeModulesDirectory, parentDirectories);
|
|
2815
2815
|
if (skippedReason) {
|
|
@@ -2819,7 +2819,7 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2819
2819
|
});
|
|
2820
2820
|
continue;
|
|
2821
2821
|
}
|
|
2822
|
-
directories.push(
|
|
2822
|
+
directories.push(import_node_path2.default.join(nodeModulesDirectory, ".bin"));
|
|
2823
2823
|
}
|
|
2824
2824
|
return {
|
|
2825
2825
|
directories,
|
|
@@ -2834,7 +2834,7 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2834
2834
|
}
|
|
2835
2835
|
async function getAncestorDirectorySearch(cwd) {
|
|
2836
2836
|
const directories = [];
|
|
2837
|
-
let current =
|
|
2837
|
+
let current = import_node_path2.default.resolve(cwd);
|
|
2838
2838
|
while (true) {
|
|
2839
2839
|
directories.push(current);
|
|
2840
2840
|
const marker = await getProjectRootMarker(current);
|
|
@@ -2846,7 +2846,7 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2846
2846
|
markerPath: marker.path
|
|
2847
2847
|
};
|
|
2848
2848
|
}
|
|
2849
|
-
const parent =
|
|
2849
|
+
const parent = import_node_path2.default.dirname(current);
|
|
2850
2850
|
if (parent === current) {
|
|
2851
2851
|
return {
|
|
2852
2852
|
directories,
|
|
@@ -2858,7 +2858,7 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2858
2858
|
}
|
|
2859
2859
|
}
|
|
2860
2860
|
async function getProjectRootMarker(directory3) {
|
|
2861
|
-
const gitPath =
|
|
2861
|
+
const gitPath = import_node_path2.default.join(directory3, ".git");
|
|
2862
2862
|
try {
|
|
2863
2863
|
await (0, import_promises4.stat)(gitPath);
|
|
2864
2864
|
return { path: gitPath };
|
|
@@ -2866,23 +2866,23 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2866
2866
|
return null;
|
|
2867
2867
|
}
|
|
2868
2868
|
async function getLocalBinDirectory(filePath, localBinDirectories) {
|
|
2869
|
-
const resolvedFilePath =
|
|
2869
|
+
const resolvedFilePath = import_node_path2.default.resolve(filePath);
|
|
2870
2870
|
let canonicalFilePath = resolvedFilePath;
|
|
2871
2871
|
try {
|
|
2872
|
-
canonicalFilePath =
|
|
2872
|
+
canonicalFilePath = import_node_path2.default.join(await (0, import_promises4.realpath)(import_node_path2.default.dirname(resolvedFilePath)), import_node_path2.default.basename(resolvedFilePath));
|
|
2873
2873
|
} catch {}
|
|
2874
2874
|
for (let localBinDirectory of localBinDirectories) {
|
|
2875
2875
|
try {
|
|
2876
2876
|
localBinDirectory = await (0, import_promises4.realpath)(localBinDirectory);
|
|
2877
2877
|
} catch {}
|
|
2878
|
-
if (canonicalFilePath.startsWith(`${localBinDirectory}${
|
|
2878
|
+
if (canonicalFilePath.startsWith(`${localBinDirectory}${import_node_path2.default.sep}`)) {
|
|
2879
2879
|
return localBinDirectory;
|
|
2880
2880
|
}
|
|
2881
2881
|
}
|
|
2882
2882
|
return null;
|
|
2883
2883
|
}
|
|
2884
2884
|
async function getNodeModulesBinDirectory(filePath) {
|
|
2885
|
-
const candidateDirectory =
|
|
2885
|
+
const candidateDirectory = import_node_path2.default.resolve(import_node_path2.default.dirname(filePath));
|
|
2886
2886
|
const directories = [candidateDirectory];
|
|
2887
2887
|
try {
|
|
2888
2888
|
const canonicalDirectory = await (0, import_promises4.realpath)(candidateDirectory);
|
|
@@ -2891,7 +2891,7 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2891
2891
|
}
|
|
2892
2892
|
} catch {}
|
|
2893
2893
|
for (const directory3 of directories) {
|
|
2894
|
-
if (
|
|
2894
|
+
if (import_node_path2.default.basename(directory3) === ".bin" && import_node_path2.default.basename(import_node_path2.default.dirname(directory3)) === "node_modules") {
|
|
2895
2895
|
return directory3;
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
@@ -2906,7 +2906,7 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2906
2906
|
if (!nodeModulesBinDirectory) {
|
|
2907
2907
|
return null;
|
|
2908
2908
|
}
|
|
2909
|
-
const nodeModulesDirectory =
|
|
2909
|
+
const nodeModulesDirectory = import_node_path2.default.dirname(nodeModulesBinDirectory);
|
|
2910
2910
|
const skippedReason = await (0, import_safety.getSkippedNodeModulesReason)(nodeModulesDirectory);
|
|
2911
2911
|
if (skippedReason) {
|
|
2912
2912
|
return { reason: `local node_modules is ${skippedReason}` };
|
|
@@ -2915,8 +2915,8 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2915
2915
|
}
|
|
2916
2916
|
async function getLocalVercelPackageBin(command, localBinDirectory) {
|
|
2917
2917
|
const commandBase = (0, import_fsutils.getCommandBase)(command);
|
|
2918
|
-
const nodeModulesDirectory =
|
|
2919
|
-
if (commandBase !== "vercel" ||
|
|
2918
|
+
const nodeModulesDirectory = import_node_path2.default.dirname(localBinDirectory);
|
|
2919
|
+
if (commandBase !== "vercel" || import_node_path2.default.basename(nodeModulesDirectory) !== "node_modules") {
|
|
2920
2920
|
return { reason: "not a local vercel bin" };
|
|
2921
2921
|
}
|
|
2922
2922
|
try {
|
|
@@ -2937,7 +2937,7 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2937
2937
|
}
|
|
2938
2938
|
}
|
|
2939
2939
|
async function getLocalVercelPackage(nodeModulesDirectory) {
|
|
2940
|
-
const packageDirectory =
|
|
2940
|
+
const packageDirectory = import_node_path2.default.join(nodeModulesDirectory, "vercel");
|
|
2941
2941
|
const realNodeModulesDirectory = await (0, import_promises4.realpath)(nodeModulesDirectory);
|
|
2942
2942
|
const realPackageDirectory = await (0, import_promises4.realpath)(packageDirectory);
|
|
2943
2943
|
if (!(0, import_fsutils.isSubpath)(realNodeModulesDirectory, realPackageDirectory)) {
|
|
@@ -2958,7 +2958,7 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2958
2958
|
};
|
|
2959
2959
|
}
|
|
2960
2960
|
async function readLocalVercelPackageJson(realPackageDirectory) {
|
|
2961
|
-
const packageJsonPath =
|
|
2961
|
+
const packageJsonPath = import_node_path2.default.join(realPackageDirectory, "package.json");
|
|
2962
2962
|
const realPackageJsonPath = await (0, import_promises4.realpath)(packageJsonPath);
|
|
2963
2963
|
if (!(0, import_fsutils.isSubpath)(realPackageDirectory, realPackageJsonPath)) {
|
|
2964
2964
|
return { reason: "local vercel package.json resolves outside package" };
|
|
@@ -2983,7 +2983,7 @@ var require_lookup = __commonJS((exports, module) => {
|
|
|
2983
2983
|
if (!binTarget) {
|
|
2984
2984
|
return { reason: "local vercel package does not declare bin.vercel" };
|
|
2985
2985
|
}
|
|
2986
|
-
const declaredBinPath =
|
|
2986
|
+
const declaredBinPath = import_node_path2.default.resolve(realPackageDirectory, binTarget);
|
|
2987
2987
|
const realDeclaredBinPath = await (0, import_promises4.realpath)(declaredBinPath);
|
|
2988
2988
|
if (!(0, import_fsutils.isSubpath)(realPackageDirectory, realDeclaredBinPath)) {
|
|
2989
2989
|
return { reason: "local vercel package bin resolves outside package" };
|
|
@@ -3050,13 +3050,13 @@ var require_exec = __commonJS((exports, module) => {
|
|
|
3050
3050
|
execVercelCli: () => execVercelCli2
|
|
3051
3051
|
});
|
|
3052
3052
|
module.exports = __toCommonJS(exec_exports);
|
|
3053
|
-
var
|
|
3053
|
+
var import_node_path2 = __toESM2(__require("node:path"));
|
|
3054
3054
|
var import_execa = __toESM2(require_execa());
|
|
3055
3055
|
var import_envpath = require_envpath();
|
|
3056
3056
|
var import_errors9 = require_errors();
|
|
3057
3057
|
var import_lookup = require_lookup();
|
|
3058
3058
|
async function execVercelCli2(args2, options = {}) {
|
|
3059
|
-
const cwd =
|
|
3059
|
+
const cwd = import_node_path2.default.resolve(options.cwd ?? process.cwd());
|
|
3060
3060
|
await (0, import_errors9.assertValidCwd)(cwd);
|
|
3061
3061
|
const env = mergeExecEnv(options.env);
|
|
3062
3062
|
const pathValue = (0, import_envpath.getEnvPath)(env);
|
|
@@ -3111,7 +3111,7 @@ var require_exec = __commonJS((exports, module) => {
|
|
|
3111
3111
|
}
|
|
3112
3112
|
async function prependLocalBinsToEnvPath(cwd, env = process.env) {
|
|
3113
3113
|
const localPath = await prependLocalBinsToPath(cwd, (0, import_envpath.getEnvPath)(env));
|
|
3114
|
-
return (0, import_envpath.setEnvPath)(env, (0, import_envpath.prependPathEntries)(localPath, [
|
|
3114
|
+
return (0, import_envpath.setEnvPath)(env, (0, import_envpath.prependPathEntries)(localPath, [import_node_path2.default.dirname(process.execPath)]));
|
|
3115
3115
|
}
|
|
3116
3116
|
async function prependLocalBinsToPath(cwd, pathValue = "") {
|
|
3117
3117
|
return (0, import_envpath.prependPathEntries)(pathValue, (await (0, import_lookup.getLocalBinSearch)(cwd)).directories);
|
|
@@ -5120,12 +5120,12 @@ var require_dist2 = __commonJS((exports, module) => {
|
|
|
5120
5120
|
var authConfigSchema2 = authConfigSchema.passthrough();
|
|
5121
5121
|
var import_node_fs2 = __toESM2(__require("fs"));
|
|
5122
5122
|
var import_node_path2 = __toESM2(__require("path"));
|
|
5123
|
-
var
|
|
5124
|
-
var
|
|
5123
|
+
var import_node_fs3 = __toESM2(__require("fs"));
|
|
5124
|
+
var import_node_path3 = __toESM2(__require("path"));
|
|
5125
5125
|
var import_node_os = __require("os");
|
|
5126
5126
|
function isReadableDirectory(targetPath) {
|
|
5127
5127
|
try {
|
|
5128
|
-
return
|
|
5128
|
+
return import_node_fs3.default.lstatSync(targetPath).isDirectory();
|
|
5129
5129
|
} catch {
|
|
5130
5130
|
return false;
|
|
5131
5131
|
}
|
|
@@ -5144,13 +5144,13 @@ var require_dist2 = __commonJS((exports, module) => {
|
|
|
5144
5144
|
}
|
|
5145
5145
|
function getGlobalPathConfig() {
|
|
5146
5146
|
let vercelDirectories = getDataDirectories("com.vercel.cli");
|
|
5147
|
-
return [...vercelDirectories,
|
|
5147
|
+
return [...vercelDirectories, import_node_path3.default.join((0, import_node_os.homedir)(), ".now"), ...getDataDirectories("now")].find((configPath) => isReadableDirectory(configPath)) || vercelDirectories[0];
|
|
5148
5148
|
}
|
|
5149
5149
|
function getConfigFilePath(configDir) {
|
|
5150
|
-
return
|
|
5150
|
+
return import_node_path3.default.join(configDir, "config.json");
|
|
5151
5151
|
}
|
|
5152
5152
|
function getAuthConfigFilePath(configDir) {
|
|
5153
|
-
return
|
|
5153
|
+
return import_node_path3.default.join(configDir, "auth.json");
|
|
5154
5154
|
}
|
|
5155
5155
|
var DOCS_URL = "https://vercel.com/docs/projects/project-configuration/global-configuration";
|
|
5156
5156
|
var defaultGlobalConfig = { "// Note": "This is your Vercel config file. For more information see the global configuration documentation.", "// Docs": `${DOCS_URL}#config.json` };
|
|
@@ -5398,11 +5398,11 @@ var require_oauth = __commonJS((exports, module) => {
|
|
|
5398
5398
|
if (!response.ok) {
|
|
5399
5399
|
throw new Error("Failed to discover OAuth endpoints");
|
|
5400
5400
|
}
|
|
5401
|
-
const
|
|
5402
|
-
if (!
|
|
5401
|
+
const metadata2 = await response.json();
|
|
5402
|
+
if (!metadata2 || typeof metadata2.token_endpoint !== "string") {
|
|
5403
5403
|
throw new Error("Invalid OAuth discovery response");
|
|
5404
5404
|
}
|
|
5405
|
-
const endpoint2 =
|
|
5405
|
+
const endpoint2 = metadata2.token_endpoint;
|
|
5406
5406
|
_tokenEndpoint = endpoint2;
|
|
5407
5407
|
return endpoint2;
|
|
5408
5408
|
}
|
|
@@ -14113,8 +14113,8 @@ var require_util2 = __commonJS((exports, module) => {
|
|
|
14113
14113
|
return true;
|
|
14114
14114
|
}
|
|
14115
14115
|
const strongest = getStrongestMetadata(parsedMetadata);
|
|
14116
|
-
const
|
|
14117
|
-
for (const item of
|
|
14116
|
+
const metadata2 = filterMetadataListByAlgorithm(parsedMetadata, strongest);
|
|
14117
|
+
for (const item of metadata2) {
|
|
14118
14118
|
const algorithm = item.algo;
|
|
14119
14119
|
const expectedValue = item.hash;
|
|
14120
14120
|
let actualValue = crypto2.createHash(algorithm).update(bytes).digest("base64");
|
|
@@ -14132,10 +14132,10 @@ var require_util2 = __commonJS((exports, module) => {
|
|
|
14132
14132
|
return false;
|
|
14133
14133
|
}
|
|
14134
14134
|
var parseHashWithOptions = /(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i;
|
|
14135
|
-
function parseMetadata(
|
|
14135
|
+
function parseMetadata(metadata2) {
|
|
14136
14136
|
const result3 = [];
|
|
14137
14137
|
let empty9 = true;
|
|
14138
|
-
for (const token of
|
|
14138
|
+
for (const token of metadata2.split(" ")) {
|
|
14139
14139
|
empty9 = false;
|
|
14140
14140
|
const parsedToken = parseHashWithOptions.exec(token);
|
|
14141
14141
|
if (parsedToken === null || parsedToken.groups === undefined || parsedToken.groups.algo === undefined) {
|
|
@@ -14157,13 +14157,13 @@ var require_util2 = __commonJS((exports, module) => {
|
|
|
14157
14157
|
return algorithm;
|
|
14158
14158
|
}
|
|
14159
14159
|
for (let i = 1;i < metadataList.length; ++i) {
|
|
14160
|
-
const
|
|
14161
|
-
if (
|
|
14160
|
+
const metadata2 = metadataList[i];
|
|
14161
|
+
if (metadata2.algo[3] === "5") {
|
|
14162
14162
|
algorithm = "sha512";
|
|
14163
14163
|
break;
|
|
14164
14164
|
} else if (algorithm[3] === "3") {
|
|
14165
14165
|
continue;
|
|
14166
|
-
} else if (
|
|
14166
|
+
} else if (metadata2.algo[3] === "3") {
|
|
14167
14167
|
algorithm = "sha384";
|
|
14168
14168
|
}
|
|
14169
14169
|
}
|
|
@@ -27644,7 +27644,6 @@ var require_throttleit = __commonJS((exports, module) => {
|
|
|
27644
27644
|
});
|
|
27645
27645
|
|
|
27646
27646
|
// src/index.ts
|
|
27647
|
-
import { readFileSync } from "node:fs";
|
|
27648
27647
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
27649
27648
|
// ../../node_modules/@effect/platform-node/dist/NodeRuntime.js
|
|
27650
27649
|
var exports_NodeRuntime = {};
|
|
@@ -60831,13 +60830,31 @@ var createChallengeScaffold = exports_Effect.fn("createChallengeScaffold")(funct
|
|
|
60831
60830
|
return { challenge: challengeSlug, path: solutionPath, status };
|
|
60832
60831
|
});
|
|
60833
60832
|
|
|
60833
|
+
// src/metadata.ts
|
|
60834
|
+
import { readFileSync } from "node:fs";
|
|
60835
|
+
import { basename } from "node:path";
|
|
60836
|
+
var readMetadata = () => {
|
|
60837
|
+
if (typeof CHOFEX_VERSION !== "undefined") {
|
|
60838
|
+
return { name: "chofex-cli", version: CHOFEX_VERSION };
|
|
60839
|
+
}
|
|
60840
|
+
return exports_Schema.decodeUnknownSync(exports_Schema.Struct({
|
|
60841
|
+
name: exports_Schema.Literals(["chofex-cli", "hacktheandes-cli"]),
|
|
60842
|
+
version: exports_Schema.String
|
|
60843
|
+
}))(JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")));
|
|
60844
|
+
};
|
|
60845
|
+
var metadata = readMetadata();
|
|
60846
|
+
var cliVersion = metadata.version;
|
|
60847
|
+
var cliPackageName = metadata.name;
|
|
60848
|
+
var invokedAsAndes = /^andes(?:\.cmd|\.exe)?$/.test(basename(process.argv[1] ?? ""));
|
|
60849
|
+
var cliCommandName = invokedAsAndes ? "andes" : "chofex";
|
|
60850
|
+
|
|
60834
60851
|
// src/cli-root.ts
|
|
60835
60852
|
var rootValueFlagNames = {
|
|
60836
60853
|
apiUrl: "api-url",
|
|
60837
60854
|
output: "output",
|
|
60838
60855
|
token: "token"
|
|
60839
60856
|
};
|
|
60840
|
-
var root = exports_Command.make(
|
|
60857
|
+
var root = exports_Command.make(cliCommandName).pipe(exports_Command.withSharedFlags({
|
|
60841
60858
|
apiUrl: exports_Flag.string(rootValueFlagNames.apiUrl).pipe(exports_Flag.withDefault(config.apiUrl), exports_Flag.withDescription("Chofex API base URL")),
|
|
60842
60859
|
output: exports_Flag.choice(rootValueFlagNames.output, ["human", "json"]).pipe(exports_Flag.withDefault("human"), exports_Flag.withDescription("Output format")),
|
|
60843
60860
|
token: exports_Flag.string(rootValueFlagNames.token).pipe(exports_Flag.optional, exports_Flag.withDescription("Clerk OAuth token (prefer CHOFEX_TOKEN to avoid shell history)"))
|
|
@@ -63451,17 +63468,17 @@ var normalizePicturePath = (input) => {
|
|
|
63451
63468
|
var readPicture = (inputPath) => exports_Effect.tryPromise({
|
|
63452
63469
|
try: async () => {
|
|
63453
63470
|
const path4 = normalizePicturePath(inputPath);
|
|
63454
|
-
const
|
|
63455
|
-
if (!
|
|
63471
|
+
const metadata2 = await stat3(path4);
|
|
63472
|
+
if (!metadata2.isFile())
|
|
63456
63473
|
throw new Error("Path is not a regular file");
|
|
63457
|
-
if (
|
|
63474
|
+
if (metadata2.size < 1 || metadata2.size > maximumPictureBytes) {
|
|
63458
63475
|
throw new Error("Picture must be between 1 byte and 5 MB");
|
|
63459
63476
|
}
|
|
63460
63477
|
const contents = await readFile5(path4);
|
|
63461
63478
|
const contentType = detectPictureContentType(contents);
|
|
63462
63479
|
if (!contentType)
|
|
63463
63480
|
throw new Error("Picture must be JPEG, PNG, or WebP");
|
|
63464
|
-
return { contents, contentType, size:
|
|
63481
|
+
return { contents, contentType, size: metadata2.size };
|
|
63465
63482
|
},
|
|
63466
63483
|
catch: (error2) => cliError("INVALID_PICTURE_FILE", `Could not use ${normalizePicturePath(inputPath)}: ${String(error2)}`)
|
|
63467
63484
|
});
|
|
@@ -63500,7 +63517,6 @@ import { spawn as spawn3 } from "node:child_process";
|
|
|
63500
63517
|
import { mkdtemp as mkdtemp2, rm as rm2 } from "node:fs/promises";
|
|
63501
63518
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
63502
63519
|
import { dirname as dirname2, isAbsolute, join as join3, relative, sep } from "node:path";
|
|
63503
|
-
var cliPackageName = "chofex-cli";
|
|
63504
63520
|
var upgradeVersion = "latest";
|
|
63505
63521
|
var skillName = "chofex-hackathon";
|
|
63506
63522
|
var skillRepository = "https://github.com/crafter-station/hack-the-andes";
|
|
@@ -63685,12 +63701,12 @@ var fetchLatestVersion = async () => {
|
|
|
63685
63701
|
if (!response.ok) {
|
|
63686
63702
|
throw new Error(`npm registry returned HTTP ${response.status}`);
|
|
63687
63703
|
}
|
|
63688
|
-
const
|
|
63689
|
-
if (typeof
|
|
63704
|
+
const metadata2 = await response.json();
|
|
63705
|
+
if (typeof metadata2 !== "object" || metadata2 === null || !("version" in metadata2) || typeof metadata2.version !== "string") {
|
|
63690
63706
|
throw new Error("npm registry returned an invalid package version");
|
|
63691
63707
|
}
|
|
63692
|
-
parseVersion(
|
|
63693
|
-
return
|
|
63708
|
+
parseVersion(metadata2.version);
|
|
63709
|
+
return metadata2.version;
|
|
63694
63710
|
};
|
|
63695
63711
|
var autoUpdateCli = async (currentVersion, options = {}) => {
|
|
63696
63712
|
const latestVersion = await (options.fetchLatestVersion ?? fetchLatestVersion)();
|
|
@@ -64012,7 +64028,7 @@ var makeUpgradeCommand = (name) => exports_Command.make(name, {}, exports_Effect
|
|
|
64012
64028
|
catch: (error2) => cliError("UPGRADE_FAILED", `No se pudieron actualizar ${cliPackageName} y ${skillName}`, false, String(error2))
|
|
64013
64029
|
});
|
|
64014
64030
|
yield* execute(options.output, operation, () => `Se actualizó ${cliPackageName} a la versión ${upgradeVersion} y se refrescó ${skillName}.`);
|
|
64015
|
-
})).pipe(exports_Command.withDescription(
|
|
64031
|
+
})).pipe(exports_Command.withDescription(`Actualiza ${cliPackageName} y su skill de agente a la última versión`));
|
|
64016
64032
|
var updateCommand = makeUpgradeCommand("update");
|
|
64017
64033
|
var upgradeCommand = makeUpgradeCommand("upgrade");
|
|
64018
64034
|
var inputValidation = (stage, path4) => {
|
|
@@ -64247,13 +64263,6 @@ ${shortcuts.flatMap((line) => wrap(line, width)).join(`
|
|
|
64247
64263
|
};
|
|
64248
64264
|
|
|
64249
64265
|
// src/index.ts
|
|
64250
|
-
var readCliVersion = () => {
|
|
64251
|
-
if (typeof CHOFEX_VERSION !== "undefined")
|
|
64252
|
-
return CHOFEX_VERSION;
|
|
64253
|
-
const packageMetadata = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
64254
|
-
return packageMetadata.version;
|
|
64255
|
-
};
|
|
64256
|
-
var cliVersion = readCliVersion();
|
|
64257
64266
|
var arguments_ = process.argv.slice(2);
|
|
64258
64267
|
var jsonOutputRequested = (arguments_2) => {
|
|
64259
64268
|
if (arguments_2.includes("--output=json"))
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chofex-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.202",
|
|
4
4
|
"description": "Command-line client for Hack the Andes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
+
"andes": "./dist/index.js",
|
|
7
8
|
"chofex": "./dist/index.js"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|
|
@@ -30,26 +31,5 @@
|
|
|
30
31
|
"publishConfig": {
|
|
31
32
|
"access": "public",
|
|
32
33
|
"registry": "https://registry.npmjs.org/"
|
|
33
|
-
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"build": "rm -rf dist && bun build src/index.ts --target=node --outfile=dist/index.js",
|
|
36
|
-
"dev": "bun src/index.ts",
|
|
37
|
-
"lint": "biome lint --error-on-warnings .",
|
|
38
|
-
"format": "biome format --write .",
|
|
39
|
-
"check-types": "tsc --noEmit",
|
|
40
|
-
"test": "bun test",
|
|
41
|
-
"prepack": "bun run build"
|
|
42
|
-
},
|
|
43
|
-
"devDependencies": {
|
|
44
|
-
"@biomejs/biome": "2.5.12",
|
|
45
|
-
"@effect/platform-node": "4.0.0-rc.112",
|
|
46
|
-
"@chofex/challenges-contract": "*",
|
|
47
|
-
"@chofex/registration-contract": "*",
|
|
48
|
-
"@chofex/typescript-config": "*",
|
|
49
|
-
"@types/bun": "^1.3.14",
|
|
50
|
-
"@types/node": "26.4.1",
|
|
51
|
-
"@vercel/blob": "^2.8.0",
|
|
52
|
-
"effect": "4.0.0-rc.112",
|
|
53
|
-
"typescript": "7.0.2"
|
|
54
34
|
}
|
|
55
35
|
}
|