@tostudy-ai/cli 0.17.1 → 0.17.3
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 +42 -30
- 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
|
}
|
|
@@ -1668,7 +1670,7 @@ function formatLesson(data) {
|
|
|
1668
1670
|
if (lesson.exerciseContent) {
|
|
1669
1671
|
lines.push("", "\u2500\u2500\u2500 Exerc\xEDcio \u2500\u2500\u2500", lesson.exerciseContent);
|
|
1670
1672
|
}
|
|
1671
|
-
if (/^checkpoint/i.test(lesson.title.trim())) {
|
|
1673
|
+
if (lesson.type === "checkpoint" || /^checkpoint/i.test(lesson.title.trim())) {
|
|
1672
1674
|
lines.push(
|
|
1673
1675
|
"",
|
|
1674
1676
|
"\u{1F4A1} Escreva suas respostas num arquivo (ex: checkpoint.md) e valide:",
|
|
@@ -1758,11 +1760,20 @@ function formatModuleStart(data) {
|
|
|
1758
1760
|
if (firstLesson.acceptanceCriteria) {
|
|
1759
1761
|
lines.push("", "Crit\xE9rios de aceita\xE7\xE3o:", firstLesson.acceptanceCriteria);
|
|
1760
1762
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1763
|
+
if (firstLesson.type === "checkpoint" || /^checkpoint/i.test(firstLesson.title.trim())) {
|
|
1764
|
+
lines.push(
|
|
1765
|
+
"",
|
|
1766
|
+
"\u{1F4A1} Escreva suas respostas num arquivo (ex: checkpoint.md) e valide:",
|
|
1767
|
+
" tostudy validate checkpoint.md",
|
|
1768
|
+
"\u2192 tostudy hint para obter uma dica"
|
|
1769
|
+
);
|
|
1770
|
+
} else {
|
|
1771
|
+
lines.push(
|
|
1772
|
+
"",
|
|
1773
|
+
"\u2192 tostudy validate <resposta> para validar sua solu\xE7\xE3o",
|
|
1774
|
+
"\u2192 tostudy hint para obter uma dica"
|
|
1775
|
+
);
|
|
1776
|
+
}
|
|
1766
1777
|
return lines.join("\n");
|
|
1767
1778
|
}
|
|
1768
1779
|
function formatMoreTheory(data) {
|
|
@@ -2982,19 +2993,17 @@ async function writeWorkspaceMarker(workspacePath, input2, options = {}) {
|
|
|
2982
2993
|
const existing = await readWorkspaceMarker(workspacePath);
|
|
2983
2994
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2984
2995
|
let carried = {};
|
|
2985
|
-
if (existing
|
|
2996
|
+
if (existing) {
|
|
2986
2997
|
try {
|
|
2987
2998
|
const raw = JSON.parse(readFileSync2(filePath, "utf-8"));
|
|
2988
|
-
for (const key of [
|
|
2989
|
-
"currentLessonId",
|
|
2990
|
-
"currentModuleId",
|
|
2991
|
-
"courseTags",
|
|
2992
|
-
"courseLevel",
|
|
2993
|
-
"lastInitCourseId",
|
|
2994
|
-
"templateVersion"
|
|
2995
|
-
]) {
|
|
2999
|
+
for (const key of ["lastInitCourseId", "templateVersion"]) {
|
|
2996
3000
|
if (raw[key] !== void 0) carried[key] = raw[key];
|
|
2997
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
|
+
}
|
|
2998
3007
|
} catch {
|
|
2999
3008
|
carried = {};
|
|
3000
3009
|
}
|
|
@@ -3522,7 +3531,7 @@ var CLI_VERSION;
|
|
|
3522
3531
|
var init_version = __esm({
|
|
3523
3532
|
"src/version.ts"() {
|
|
3524
3533
|
"use strict";
|
|
3525
|
-
CLI_VERSION = true ? "0.17.
|
|
3534
|
+
CLI_VERSION = true ? "0.17.3" : "0.7.1";
|
|
3526
3535
|
}
|
|
3527
3536
|
});
|
|
3528
3537
|
|
|
@@ -4922,12 +4931,15 @@ function adjustTimeEstimate(type, baseMinutes) {
|
|
|
4922
4931
|
if (type === "exercise") return Math.max(baseMinutes, 30);
|
|
4923
4932
|
return baseMinutes;
|
|
4924
4933
|
}
|
|
4925
|
-
function isCheckpoint(title) {
|
|
4926
|
-
return /^checkpoint/i.test(title.trim());
|
|
4934
|
+
function isCheckpoint(type, title) {
|
|
4935
|
+
return type === "checkpoint" || /^checkpoint/i.test(title.trim());
|
|
4936
|
+
}
|
|
4937
|
+
function isPracticalType(type) {
|
|
4938
|
+
return type === "exercise" || type === "checkpoint" || type === "realworld" || type === "project";
|
|
4927
4939
|
}
|
|
4928
4940
|
function formatLessonContent(data, workspacePath, courseTitle) {
|
|
4929
4941
|
const time3 = adjustTimeEstimate(data.type, data.estimatedTimeMinutes);
|
|
4930
|
-
const isPractical = data.type
|
|
4942
|
+
const isPractical = isPracticalType(data.type) || isCheckpoint(data.type, data.title);
|
|
4931
4943
|
const lines = [`\u2501\u2501\u2501 Li\xE7\xE3o: ${data.title} \u2501\u2501\u2501`];
|
|
4932
4944
|
if (isPractical && workspacePath) {
|
|
4933
4945
|
const base = path13.basename(workspacePath) === ".tostudy" ? path13.dirname(workspacePath) : workspacePath;
|
|
@@ -4948,7 +4960,7 @@ function formatLessonContent(data, workspacePath, courseTitle) {
|
|
|
4948
4960
|
if (data.hints && data.hints.length > 0) {
|
|
4949
4961
|
lines.push("", `Dicas dispon\xEDveis: ${data.hints.length}`);
|
|
4950
4962
|
}
|
|
4951
|
-
if (isCheckpoint(data.title)) {
|
|
4963
|
+
if (isCheckpoint(data.type, data.title)) {
|
|
4952
4964
|
lines.push(
|
|
4953
4965
|
"",
|
|
4954
4966
|
"\u{1F4A1} Escreva suas respostas num arquivo (ex: checkpoint.md) e valide:",
|
|
@@ -5024,7 +5036,7 @@ var init_lesson = __esm({
|
|
|
5024
5036
|
{ json: false }
|
|
5025
5037
|
);
|
|
5026
5038
|
}
|
|
5027
|
-
if (content.type
|
|
5039
|
+
if (isPracticalType(content.type) && !ws.found) {
|
|
5028
5040
|
process.stderr.write(
|
|
5029
5041
|
"\n\u{1F4A1} Dica: rode `tostudy select` desta pasta para us\xE1-la como workspace, ou `tostudy workspace setup` para criar em ~/study/.\n"
|
|
5030
5042
|
);
|