@tostudy-ai/cli 0.17.2 → 0.17.4
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/cli.js +33 -22
- package/dist/cli.js.map +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -41,7 +41,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
41
41
|
mod
|
|
42
42
|
));
|
|
43
43
|
|
|
44
|
-
// ../../node_modules/@parisgroup-ai/logger/dist/sanitize-
|
|
44
|
+
// ../../node_modules/@parisgroup-ai/logger/dist/sanitize-Cu_Xsxno.mjs
|
|
45
45
|
function isSensitiveKey(key) {
|
|
46
46
|
if (matchesSensitiveField(key)) return true;
|
|
47
47
|
return matchesPluralOfSensitiveField(key);
|
|
@@ -149,8 +149,8 @@ function sanitizeEntryData(obj, additionalSensitiveKeys, includeStack, redactMas
|
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
var SENSITIVE_FIELDS;
|
|
152
|
-
var
|
|
153
|
-
"../../node_modules/@parisgroup-ai/logger/dist/sanitize-
|
|
152
|
+
var init_sanitize_Cu_Xsxno = __esm({
|
|
153
|
+
"../../node_modules/@parisgroup-ai/logger/dist/sanitize-Cu_Xsxno.mjs"() {
|
|
154
154
|
SENSITIVE_FIELDS = [
|
|
155
155
|
"password",
|
|
156
156
|
"senha",
|
|
@@ -281,7 +281,7 @@ var require_picocolors = __commonJS({
|
|
|
281
281
|
}
|
|
282
282
|
});
|
|
283
283
|
|
|
284
|
-
// ../../node_modules/@parisgroup-ai/logger/dist/logger.base-
|
|
284
|
+
// ../../node_modules/@parisgroup-ai/logger/dist/logger.base-DkCKo9Cu.mjs
|
|
285
285
|
function formatJson(entry) {
|
|
286
286
|
const { timestamp, level, message, service, environment, context, data, error: error49 } = entry;
|
|
287
287
|
const output3 = {
|
|
@@ -385,9 +385,9 @@ function extractErrorInfo(error49, includeStack, visited = /* @__PURE__ */ new W
|
|
|
385
385
|
return info;
|
|
386
386
|
}
|
|
387
387
|
var import_picocolors, LOG_LEVELS, LEVEL_COLORS, LEVEL_WIDTH, BaseLogger;
|
|
388
|
-
var
|
|
389
|
-
"../../node_modules/@parisgroup-ai/logger/dist/logger.base-
|
|
390
|
-
|
|
388
|
+
var init_logger_base_DkCKo9Cu = __esm({
|
|
389
|
+
"../../node_modules/@parisgroup-ai/logger/dist/logger.base-DkCKo9Cu.mjs"() {
|
|
390
|
+
init_sanitize_Cu_Xsxno();
|
|
391
391
|
import_picocolors = __toESM(require_picocolors(), 1);
|
|
392
392
|
LOG_LEVELS = {
|
|
393
393
|
trace: 0,
|
|
@@ -708,8 +708,8 @@ function createLogger(module, options) {
|
|
|
708
708
|
var asyncLocalStorage, ConsoleTransport, FileTransport, HttpTransport, SINGLETON_KEY$1, SEVERITY, OtlpLogsTransport, SINGLETON_KEY, Logger, logger;
|
|
709
709
|
var init_dist = __esm({
|
|
710
710
|
"../../node_modules/@parisgroup-ai/logger/dist/index.mjs"() {
|
|
711
|
-
|
|
712
|
-
|
|
711
|
+
init_logger_base_DkCKo9Cu();
|
|
712
|
+
init_sanitize_Cu_Xsxno();
|
|
713
713
|
asyncLocalStorage = new AsyncLocalStorage();
|
|
714
714
|
ConsoleTransport = class {
|
|
715
715
|
log(entry, formatted) {
|
|
@@ -770,6 +770,7 @@ var init_dist = __esm({
|
|
|
770
770
|
this.flush().catch(() => {
|
|
771
771
|
});
|
|
772
772
|
}, this.flushInterval);
|
|
773
|
+
this.timer.unref();
|
|
773
774
|
process.once("beforeExit", () => this.dispose());
|
|
774
775
|
process.once("SIGTERM", () => this.dispose());
|
|
775
776
|
}
|
|
@@ -864,6 +865,7 @@ var init_dist = __esm({
|
|
|
864
865
|
this.flush().catch(() => {
|
|
865
866
|
});
|
|
866
867
|
}, this.flushInterval);
|
|
868
|
+
this.timer.unref();
|
|
867
869
|
process.once("beforeExit", () => this.dispose());
|
|
868
870
|
process.once("SIGTERM", () => this.dispose());
|
|
869
871
|
}
|
|
@@ -1151,10 +1153,10 @@ function createHttpProvider(apiUrl, token) {
|
|
|
1151
1153
|
}
|
|
1152
1154
|
},
|
|
1153
1155
|
exercises: {
|
|
1154
|
-
validate: async (lessonId, solution, _userId, enrollmentId) => {
|
|
1156
|
+
validate: async (lessonId, solution, _userId, enrollmentId, metadata) => {
|
|
1155
1157
|
return cliApiFetch(`${base}/exercises/validate`, token, {
|
|
1156
1158
|
method: "POST",
|
|
1157
|
-
body: JSON.stringify({ lessonId, solution, enrollmentId })
|
|
1159
|
+
body: JSON.stringify({ lessonId, solution, enrollmentId, metadata })
|
|
1158
1160
|
});
|
|
1159
1161
|
},
|
|
1160
1162
|
getEnrollmentLevels: async (enrollmentId) => {
|
|
@@ -2991,19 +2993,17 @@ async function writeWorkspaceMarker(workspacePath, input2, options = {}) {
|
|
|
2991
2993
|
const existing = await readWorkspaceMarker(workspacePath);
|
|
2992
2994
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2993
2995
|
let carried = {};
|
|
2994
|
-
if (existing
|
|
2996
|
+
if (existing) {
|
|
2995
2997
|
try {
|
|
2996
2998
|
const raw = JSON.parse(readFileSync2(filePath, "utf-8"));
|
|
2997
|
-
for (const key of [
|
|
2998
|
-
"currentLessonId",
|
|
2999
|
-
"currentModuleId",
|
|
3000
|
-
"courseTags",
|
|
3001
|
-
"courseLevel",
|
|
3002
|
-
"lastInitCourseId",
|
|
3003
|
-
"templateVersion"
|
|
3004
|
-
]) {
|
|
2999
|
+
for (const key of ["lastInitCourseId", "templateVersion"]) {
|
|
3005
3000
|
if (raw[key] !== void 0) carried[key] = raw[key];
|
|
3006
3001
|
}
|
|
3002
|
+
if (existing.courseId === input2.courseId) {
|
|
3003
|
+
for (const key of ["currentLessonId", "currentModuleId", "courseTags", "courseLevel"]) {
|
|
3004
|
+
if (raw[key] !== void 0) carried[key] = raw[key];
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
3007
|
} catch {
|
|
3008
3008
|
carried = {};
|
|
3009
3009
|
}
|
|
@@ -3531,7 +3531,7 @@ var CLI_VERSION;
|
|
|
3531
3531
|
var init_version = __esm({
|
|
3532
3532
|
"src/version.ts"() {
|
|
3533
3533
|
"use strict";
|
|
3534
|
-
CLI_VERSION = true ? "0.17.
|
|
3534
|
+
CLI_VERSION = true ? "0.17.3" : "0.7.1";
|
|
3535
3535
|
}
|
|
3536
3536
|
});
|
|
3537
3537
|
|
|
@@ -5186,6 +5186,15 @@ var init_hint = __esm({
|
|
|
5186
5186
|
// ../../packages/tostudy-core/src/exercises/validate-solution.ts
|
|
5187
5187
|
async function validateSolution(input2, deps) {
|
|
5188
5188
|
deps.logger.info("tostudy-core: validateSolution", { lessonId: input2.lessonId });
|
|
5189
|
+
if (input2.metadata !== void 0) {
|
|
5190
|
+
return deps.data.exercises.validate(
|
|
5191
|
+
input2.lessonId,
|
|
5192
|
+
input2.solution,
|
|
5193
|
+
input2.userId,
|
|
5194
|
+
input2.enrollmentId,
|
|
5195
|
+
input2.metadata
|
|
5196
|
+
);
|
|
5197
|
+
}
|
|
5189
5198
|
return deps.data.exercises.validate(
|
|
5190
5199
|
input2.lessonId,
|
|
5191
5200
|
input2.solution,
|
|
@@ -20146,6 +20155,7 @@ var init_validate = __esm({
|
|
|
20146
20155
|
init_formatter();
|
|
20147
20156
|
init_init_template();
|
|
20148
20157
|
init_errors();
|
|
20158
|
+
init_version();
|
|
20149
20159
|
logger16 = createLogger("cli:validate");
|
|
20150
20160
|
validateCommand = new Command14("validate").description("Validate your solution for the current exercise").argument("[file]", "Path to the solution file to read").option("--stdin", "Read solution from stdin instead of a file").option("--json", "Output structured JSON").action(async (file2, opts) => {
|
|
20151
20161
|
try {
|
|
@@ -20229,7 +20239,8 @@ var init_validate = __esm({
|
|
|
20229
20239
|
lessonId,
|
|
20230
20240
|
solution,
|
|
20231
20241
|
userId: session.userId,
|
|
20232
|
-
enrollmentId: activeCourse.enrollmentId
|
|
20242
|
+
enrollmentId: activeCourse.enrollmentId,
|
|
20243
|
+
metadata: { clientVersion: CLI_VERSION }
|
|
20233
20244
|
},
|
|
20234
20245
|
deps
|
|
20235
20246
|
);
|