@przeprogramowani/10x-cli 1.2.0 → 1.3.1
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.mjs +47 -5
- package/package.json +1 -1
- package/skills/10x-cli-guide/SKILL.md +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2271,7 +2271,7 @@ var cac = (name = "") => new CAC(name);
|
|
|
2271
2271
|
// package.json
|
|
2272
2272
|
var package_default = {
|
|
2273
2273
|
name: "@przeprogramowani/10x-cli",
|
|
2274
|
-
version: "1.
|
|
2274
|
+
version: "1.3.1",
|
|
2275
2275
|
description: "Open-source CLI for 10xDevs course content",
|
|
2276
2276
|
repository: {
|
|
2277
2277
|
type: "git",
|
|
@@ -3034,6 +3034,37 @@ function resolveApiBase() {
|
|
|
3034
3034
|
throw new Error(`API_BASE_URL must be ${DEFAULT_API_BASE} or http://localhost[:port] (got ${JSON.stringify(override)})`);
|
|
3035
3035
|
}
|
|
3036
3036
|
var DEFAULT_TIMEOUT_MS = 30000;
|
|
3037
|
+
var UNKNOWN_API_ERROR_MESSAGE = "An unknown error occurred. Please contact 10xDevs mentors and share the command that caused this. Sorry for the issue!";
|
|
3038
|
+
var ERROR_CODE_MESSAGES = {
|
|
3039
|
+
course_not_found: "Course not found.",
|
|
3040
|
+
lesson_not_found: "Lesson not found.",
|
|
3041
|
+
module_not_found: "Module not found.",
|
|
3042
|
+
artifact_not_found: "Artifact not found.",
|
|
3043
|
+
bundle_not_found: "Bundle not found.",
|
|
3044
|
+
module_locked: "This module is not available yet.",
|
|
3045
|
+
signing_failed: "Could not sign the download URL. Try again in a moment.",
|
|
3046
|
+
invalid_json: "The server received a malformed request.",
|
|
3047
|
+
unauthorized: "You are not signed in. Run `10x auth` first.",
|
|
3048
|
+
no_membership: "No active course membership was found for this email.",
|
|
3049
|
+
invalid_refresh_token: "Your session has expired. Run `10x auth` again.",
|
|
3050
|
+
membership_revoked: "Your course membership has been revoked.",
|
|
3051
|
+
rate_limited: "Too many requests. Please slow down and try again shortly.",
|
|
3052
|
+
email_send_failed: "Could not send the login email. Try again in a moment.",
|
|
3053
|
+
admin_access_required: "This action requires admin access.",
|
|
3054
|
+
circle_api_error: "The membership service is temporarily unavailable.",
|
|
3055
|
+
internal_error: "The server hit an unexpected error."
|
|
3056
|
+
};
|
|
3057
|
+
function messageForApiError(payload) {
|
|
3058
|
+
if (!payload)
|
|
3059
|
+
return;
|
|
3060
|
+
if (typeof payload.message === "string" && payload.message.length > 0) {
|
|
3061
|
+
return payload.message;
|
|
3062
|
+
}
|
|
3063
|
+
if (typeof payload.error === "string" && payload.error.length > 0) {
|
|
3064
|
+
return ERROR_CODE_MESSAGES[payload.error];
|
|
3065
|
+
}
|
|
3066
|
+
return;
|
|
3067
|
+
}
|
|
3037
3068
|
async function request(method, path, body, options = {}) {
|
|
3038
3069
|
const base = resolveApiBase();
|
|
3039
3070
|
const url = path.startsWith("http") ? path : `${base}${path}`;
|
|
@@ -3077,11 +3108,22 @@ async function request(method, path, body, options = {}) {
|
|
|
3077
3108
|
}
|
|
3078
3109
|
if (!response.ok) {
|
|
3079
3110
|
const payload = parsed && typeof parsed === "object" ? parsed : undefined;
|
|
3111
|
+
const mapped = messageForApiError(payload);
|
|
3112
|
+
let errorMessage;
|
|
3113
|
+
if (mapped) {
|
|
3114
|
+
errorMessage = mapped;
|
|
3115
|
+
} else if (payload) {
|
|
3116
|
+
errorMessage = UNKNOWN_API_ERROR_MESSAGE;
|
|
3117
|
+
} else if (response.statusText.length > 0) {
|
|
3118
|
+
errorMessage = response.statusText;
|
|
3119
|
+
} else {
|
|
3120
|
+
errorMessage = UNKNOWN_API_ERROR_MESSAGE;
|
|
3121
|
+
}
|
|
3080
3122
|
return {
|
|
3081
3123
|
ok: false,
|
|
3082
3124
|
status: response.status,
|
|
3083
|
-
code: payload?.code
|
|
3084
|
-
error:
|
|
3125
|
+
code: typeof payload?.code === "string" ? payload.code : `http_${response.status}`,
|
|
3126
|
+
error: errorMessage,
|
|
3085
3127
|
payload
|
|
3086
3128
|
};
|
|
3087
3129
|
}
|
|
@@ -3990,7 +4032,7 @@ function checkToolDirectory() {
|
|
|
3990
4032
|
}
|
|
3991
4033
|
|
|
3992
4034
|
// src/lib/lesson-ref.ts
|
|
3993
|
-
var MIN_MODULE =
|
|
4035
|
+
var MIN_MODULE = 0;
|
|
3994
4036
|
var MAX_MODULE = 5;
|
|
3995
4037
|
var LESSON_REF_RE = /^m(\d+)l(\d+)$/;
|
|
3996
4038
|
var MODULE_REF_RE = /^(?:m)?(\d+)$/;
|
|
@@ -5213,7 +5255,7 @@ function renderCatalog(ctx, catalog) {
|
|
|
5213
5255
|
output(ctx, `No modules available in '${catalog.course}'.`, undefined);
|
|
5214
5256
|
return;
|
|
5215
5257
|
}
|
|
5216
|
-
const exampleModule = catalog.modules.find((m3) => m3.effectiveState === "unlocked")?.module ?? catalog.modules[0]?.module ??
|
|
5258
|
+
const exampleModule = catalog.modules.find((m3) => m3.effectiveState === "unlocked")?.module ?? catalog.modules[0]?.module ?? 0;
|
|
5217
5259
|
const lines = [];
|
|
5218
5260
|
lines.push(`Course: ${catalog.course}`);
|
|
5219
5261
|
lines.push("");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: 10x-cli-guide
|
|
3
|
-
description: Invoke this skill when the user asks how to USE the 10x-cli day-to-day — fetching lessons, listing modules, switching AI tools, troubleshooting errors, understanding where artifacts land, or working on a specific OS (Windows, Linux, macOS). Covers commands (get, list, doctor, auth --status/--logout), tool profiles, artifact locations, common errors, and platform-specific tips. Excludes: first-time installation and onboarding (use 10x-cli-setup instead), developing or contributing to 10x-cli source code, and general programming help.
|
|
3
|
+
description: "Invoke this skill when the user asks how to USE the 10x-cli day-to-day — fetching lessons, listing modules, switching AI tools, troubleshooting errors, understanding where artifacts land, or working on a specific OS (Windows, Linux, macOS). Covers commands (get, list, doctor, auth --status/--logout), tool profiles, artifact locations, common errors, and platform-specific tips. Excludes: first-time installation and onboarding (use 10x-cli-setup instead), developing or contributing to 10x-cli source code, and general programming help."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# 10x-cli Daily Usage Guide
|