@tostudy-ai/cli 0.18.8 → 0.18.10

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/main.js CHANGED
@@ -1691,6 +1691,7 @@ function formatLesson(data) {
1691
1691
  "",
1692
1692
  `\u{1F4D6} ${lesson.title}`,
1693
1693
  ` M\xF3dulo: ${lesson.moduleTitle} | Tipo: ${lesson.type}`,
1694
+ ...data.channelWarning ? [`\u26A0 ${data.channelWarning}`] : [],
1694
1695
  "",
1695
1696
  exercise ? filterExerciseContent(lesson.content, exercise.index) : lesson.content,
1696
1697
  "",
@@ -1774,7 +1775,8 @@ function formatModuleStart(data) {
1774
1775
  const lines = [
1775
1776
  `\u2501\u2501\u2501 M\xF3dulo ${wayfinding.moduleOrder}/${wayfinding.totalModules} \u2501\u2501\u2501`,
1776
1777
  "",
1777
- `\u{1F5C2} ${mod.title}`
1778
+ `\u{1F5C2} ${mod.title}`,
1779
+ ...data.channelWarning ? [`\u26A0 ${data.channelWarning}`] : []
1778
1780
  ];
1779
1781
  if (mod.description) {
1780
1782
  lines.push("", mod.description);
@@ -2001,7 +2003,9 @@ Rode \`tostudy context --json\` em sil\xEAncio para descobrir o estado do aluno.
2001
2003
 
2002
2004
  ### Se erro "no_workspace" (aluno ainda n\xE3o configurou):
2003
2005
 
2004
- 1. Pergunte ao aluno: "Em qual pasta voc\xEA quer estudar? A pasta atual \xE9 \`{cwd}\`. Usar esta mesma?"
2006
+ 1. Rode \`pwd\` em sil\xEAncio para descobrir a pasta atual e pergunte ao aluno: "Em qual pasta
2007
+ voc\xEA quer estudar? A pasta atual \xE9 \`<o caminho que o pwd devolveu>\`. Usar esta mesma?"
2008
+ Cite sempre o caminho de verdade \u2014 nunca deixe um espa\xE7o reservado aparecer para o aluno.
2005
2009
  2. Se o aluno confirmar, rode \`tostudy courses --json\` em sil\xEAncio.
2006
2010
  3. Mostre a lista de cursos de forma amig\xE1vel.
2007
2011
  4. Se o aluno tiver apenas 1 curso, ative direto. Se tiver mais, pergunte qual quer estudar.
@@ -2019,7 +2023,8 @@ Rode \`tostudy context --json\` em sil\xEAncio para descobrir o estado do aluno.
2019
2023
 
2020
2024
  1. Leia os \`moduleSummaries\` do resultado para saber o que o aluno j\xE1 estudou.
2021
2025
  2. Rode \`tostudy memory --json\` em sil\xEAncio para carregar o perfil do aluno (dificuldades conhecidas, pontos fortes) e os resumos das li\xE7\xF5es recentes. Use esse contexto para adaptar a aula \u2014 n\xE3o repita o que o aluno j\xE1 domina, e reforce os pontos onde ele teve dificuldade. NUNCA mostre esse bloco cru ao aluno.
2022
- 3. Se houver summaries, mencione brevemente: "Da \xFAltima vez paramos em {ultimoModulo}. Pronto pra continuar?"
2026
+ 3. Se houver summaries, diga brevemente onde voc\xEAs pararam, citando o t\xEDtulo do \xFAltimo
2027
+ m\xF3dulo pelo nome que veio no contexto, e pergunte se o aluno quer continuar.
2023
2028
  4. Siga "Como Conduzir a Aula" abaixo.`);
2024
2029
  sections.push(renderHowToConduct());
2025
2030
  sections.push(renderStudentAuthorship());
@@ -2293,7 +2298,7 @@ var init_instruction_template_v3 = __esm({
2293
2298
  "src/output/instruction-template-v3.ts"() {
2294
2299
  "use strict";
2295
2300
  COURSE_TEMPLATE_VERSION = 4;
2296
- UNIVERSAL_TEMPLATE_VERSION = 5;
2301
+ UNIVERSAL_TEMPLATE_VERSION = 6;
2297
2302
  TONE_LABELS = {
2298
2303
  formal: "formal",
2299
2304
  casual: "casual",
@@ -3213,11 +3218,13 @@ var CliApiError = class extends Error {
3213
3218
  code;
3214
3219
  };
3215
3220
  async function cliApiFetch(url2, token, init) {
3221
+ const nodeVersion = globalThis.process?.versions?.node;
3216
3222
  const response = await fetch(url2, {
3217
3223
  ...init,
3218
3224
  headers: {
3219
3225
  "Content-Type": "application/json",
3220
3226
  Authorization: `Bearer ${token}`,
3227
+ ...nodeVersion ? { "X-Tostudy-Node-Version": nodeVersion } : {},
3221
3228
  ...init?.headers
3222
3229
  }
3223
3230
  });
@@ -3833,7 +3840,7 @@ init_workspace_state();
3833
3840
  init_formatter();
3834
3841
 
3835
3842
  // src/version.ts
3836
- var CLI_VERSION = true ? "0.18.7" : "0.7.1";
3843
+ var CLI_VERSION = true ? "0.18.10" : "0.7.1";
3837
3844
 
3838
3845
  // src/update-checker.ts
3839
3846
  init_config_dir();
@@ -4597,6 +4604,7 @@ function formatBlock(ranked, lineFor) {
4597
4604
  const lines = [];
4598
4605
  for (const [index, row] of ranked.entries()) {
4599
4606
  lines.push(`${index + 1}. ${row.course.title}`);
4607
+ if (row.course.channelWarning) lines.push(`\u26A0 ${row.course.channelWarning}`);
4600
4608
  lines.push(`${copy.suggestReason} ${reasonText(row.reason, copy)}`);
4601
4609
  lines.push(lineFor(row));
4602
4610
  }
@@ -4652,11 +4660,13 @@ function formatEnrollResult(result) {
4652
4660
  return `${copy.enrollPaid}
4653
4661
  ${result.enrollUrl}`;
4654
4662
  }
4663
+ const warning = result.channelWarning ? `
4664
+ \u26A0 ${result.channelWarning}` : "";
4655
4665
  if (!result.cliChannel) {
4656
4666
  return `${copy.enrollDoneWebOnly}
4657
- ${result.courseUrl}`;
4667
+ ${result.courseUrl}${warning}`;
4658
4668
  }
4659
- return copy.enrollDone;
4669
+ return `${copy.enrollDone}${warning}`;
4660
4670
  }
4661
4671
  async function runEnroll(courseId, deps = {
4662
4672
  requireSession,
@@ -21147,9 +21157,11 @@ init_dist();
21147
21157
  import { Command as Command23 } from "commander";
21148
21158
 
21149
21159
  // ../../packages/tostudy-core/src/vault/generate-vault-files.ts
21160
+ init_dist();
21150
21161
  init_slug();
21151
21162
 
21152
21163
  // ../../packages/tostudy-core/src/vault/write-vault.ts
21164
+ init_dist();
21153
21165
  import fs17 from "node:fs/promises";
21154
21166
  import path21 from "node:path";
21155
21167
 
@@ -21159,10 +21171,20 @@ var VAULT_MARKER_VERSION = 1;
21159
21171
 
21160
21172
  // ../../packages/tostudy-core/src/vault/write-vault.ts
21161
21173
  async function writeVaultFiles(files, outputPath, courseId, courseSlug2) {
21174
+ const root = path21.resolve(outputPath);
21175
+ const skippedPaths = [];
21176
+ let filesWritten = 0;
21162
21177
  for (const file2 of files) {
21163
- const fullPath = path21.join(outputPath, file2.relativePath);
21178
+ const fullPath = path21.resolve(root, file2.relativePath);
21179
+ const rel = path21.relative(root, fullPath);
21180
+ if (!rel || rel.startsWith("..") || path21.isAbsolute(rel)) {
21181
+ logger.warn("vault.write_outside_root_skipped", { relativePath: file2.relativePath });
21182
+ skippedPaths.push(file2.relativePath);
21183
+ continue;
21184
+ }
21164
21185
  await fs17.mkdir(path21.dirname(fullPath), { recursive: true });
21165
21186
  await fs17.writeFile(fullPath, file2.content, "utf-8");
21187
+ filesWritten++;
21166
21188
  }
21167
21189
  const vaultPath = path21.join(outputPath, courseSlug2);
21168
21190
  const marker = {
@@ -21177,7 +21199,7 @@ async function writeVaultFiles(files, outputPath, courseId, courseSlug2) {
21177
21199
  JSON.stringify(marker, null, 2),
21178
21200
  "utf-8"
21179
21201
  );
21180
- return { vaultPath, filesWritten: files.length };
21202
+ return { vaultPath, filesWritten, skippedPaths };
21181
21203
  }
21182
21204
 
21183
21205
  // src/commands/vault.ts