@tostudy-ai/cli 0.18.9 → 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);
@@ -3216,11 +3218,13 @@ var CliApiError = class extends Error {
3216
3218
  code;
3217
3219
  };
3218
3220
  async function cliApiFetch(url2, token, init) {
3221
+ const nodeVersion = globalThis.process?.versions?.node;
3219
3222
  const response = await fetch(url2, {
3220
3223
  ...init,
3221
3224
  headers: {
3222
3225
  "Content-Type": "application/json",
3223
3226
  Authorization: `Bearer ${token}`,
3227
+ ...nodeVersion ? { "X-Tostudy-Node-Version": nodeVersion } : {},
3224
3228
  ...init?.headers
3225
3229
  }
3226
3230
  });
@@ -3836,7 +3840,7 @@ init_workspace_state();
3836
3840
  init_formatter();
3837
3841
 
3838
3842
  // src/version.ts
3839
- var CLI_VERSION = true ? "0.18.9" : "0.7.1";
3843
+ var CLI_VERSION = true ? "0.18.10" : "0.7.1";
3840
3844
 
3841
3845
  // src/update-checker.ts
3842
3846
  init_config_dir();
@@ -4600,6 +4604,7 @@ function formatBlock(ranked, lineFor) {
4600
4604
  const lines = [];
4601
4605
  for (const [index, row] of ranked.entries()) {
4602
4606
  lines.push(`${index + 1}. ${row.course.title}`);
4607
+ if (row.course.channelWarning) lines.push(`\u26A0 ${row.course.channelWarning}`);
4603
4608
  lines.push(`${copy.suggestReason} ${reasonText(row.reason, copy)}`);
4604
4609
  lines.push(lineFor(row));
4605
4610
  }
@@ -4655,11 +4660,13 @@ function formatEnrollResult(result) {
4655
4660
  return `${copy.enrollPaid}
4656
4661
  ${result.enrollUrl}`;
4657
4662
  }
4663
+ const warning = result.channelWarning ? `
4664
+ \u26A0 ${result.channelWarning}` : "";
4658
4665
  if (!result.cliChannel) {
4659
4666
  return `${copy.enrollDoneWebOnly}
4660
- ${result.courseUrl}`;
4667
+ ${result.courseUrl}${warning}`;
4661
4668
  }
4662
- return copy.enrollDone;
4669
+ return `${copy.enrollDone}${warning}`;
4663
4670
  }
4664
4671
  async function runEnroll(courseId, deps = {
4665
4672
  requireSession,
@@ -21150,9 +21157,11 @@ init_dist();
21150
21157
  import { Command as Command23 } from "commander";
21151
21158
 
21152
21159
  // ../../packages/tostudy-core/src/vault/generate-vault-files.ts
21160
+ init_dist();
21153
21161
  init_slug();
21154
21162
 
21155
21163
  // ../../packages/tostudy-core/src/vault/write-vault.ts
21164
+ init_dist();
21156
21165
  import fs17 from "node:fs/promises";
21157
21166
  import path21 from "node:path";
21158
21167
 
@@ -21162,10 +21171,20 @@ var VAULT_MARKER_VERSION = 1;
21162
21171
 
21163
21172
  // ../../packages/tostudy-core/src/vault/write-vault.ts
21164
21173
  async function writeVaultFiles(files, outputPath, courseId, courseSlug2) {
21174
+ const root = path21.resolve(outputPath);
21175
+ const skippedPaths = [];
21176
+ let filesWritten = 0;
21165
21177
  for (const file2 of files) {
21166
- 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
+ }
21167
21185
  await fs17.mkdir(path21.dirname(fullPath), { recursive: true });
21168
21186
  await fs17.writeFile(fullPath, file2.content, "utf-8");
21187
+ filesWritten++;
21169
21188
  }
21170
21189
  const vaultPath = path21.join(outputPath, courseSlug2);
21171
21190
  const marker = {
@@ -21180,7 +21199,7 @@ async function writeVaultFiles(files, outputPath, courseId, courseSlug2) {
21180
21199
  JSON.stringify(marker, null, 2),
21181
21200
  "utf-8"
21182
21201
  );
21183
- return { vaultPath, filesWritten: files.length };
21202
+ return { vaultPath, filesWritten, skippedPaths };
21184
21203
  }
21185
21204
 
21186
21205
  // src/commands/vault.ts