@tostudy-ai/cli 0.18.3 → 0.18.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/main.js CHANGED
@@ -1024,6 +1024,11 @@ var init_errors_pt_br = __esm({
1024
1024
  setupCommandDescription: "Atalho antigo. A pasta de estudo \xE9 workspace setup; o MCP \xE9 setup mcp",
1025
1025
  setupRetiredNotice: "\n \u26A0\uFE0F `tostudy setup` n\xE3o cria a pasta de estudo.",
1026
1026
  setupRetiredNext: " Pasta de estudo: `tostudy workspace setup`. MCP: `tostudy setup mcp`. Para entrar: `tostudy login`, depois `tostudy courses` e `tostudy select <n>`.\n",
1027
+ enrollCommandDescription: "Matricula em um curso gratuito. Curso pago abre no navegador.",
1028
+ enrollInvalidId: "Informe o ID do curso (UUID). Exemplo: tostudy enroll 11111111-1111-4111-8111-111111111111",
1029
+ enrollDone: "Matriculado. Rode `tostudy courses` e depois `tostudy select <n>`.",
1030
+ enrollDoneWebOnly: "Matriculado. Este curso n\xE3o abre no terminal. Continue no navegador:",
1031
+ enrollPaid: "Este curso \xE9 pago. A matr\xEDcula fica no navegador e nada \xE9 debitado por aqui:",
1027
1032
  enrollmentNotEntitled: "\u{1F6AB} Sua matr\xEDcula neste curso n\xE3o est\xE1 mais ativa (reembolso, cancelamento ou preview expirado).\nPara voltar a estudar, adquira o curso novamente em https://tostudy.ai.\n",
1028
1033
  creator: {
1029
1034
  loginBrowserOnly: "`--creator` s\xF3 funciona no login pelo browser. Rode `tostudy login --creator` sem --code, --magic-link ou --manual.",
@@ -1121,6 +1126,11 @@ var init_errors_en_us = __esm({
1121
1126
  setupCommandDescription: "Old shortcut. The study folder is workspace setup; MCP is setup mcp",
1122
1127
  setupRetiredNotice: "\n \u26A0\uFE0F `tostudy setup` does not create the study folder.",
1123
1128
  setupRetiredNext: " Study folder: `tostudy workspace setup`. MCP: `tostudy setup mcp`. To sign in: `tostudy login`, then `tostudy courses` and `tostudy select <n>`.\n",
1129
+ enrollCommandDescription: "Enroll in a free course. A priced course opens in the browser.",
1130
+ enrollInvalidId: "Pass the course ID (UUID). Example: tostudy enroll 11111111-1111-4111-8111-111111111111",
1131
+ enrollDone: "Enrolled. Run `tostudy courses`, then `tostudy select <n>`.",
1132
+ enrollDoneWebOnly: "Enrolled. This course does not open in the terminal. Continue in the browser:",
1133
+ enrollPaid: "This course is paid. Enrollment stays in the browser and nothing is charged here:",
1124
1134
  enrollmentNotEntitled: "\u{1F6AB} Your enrollment in this course is no longer active (refund, cancellation, or expired preview).\nTo study again, purchase the course at https://tostudy.ai.\n",
1125
1135
  creator: {
1126
1136
  loginBrowserOnly: "`--creator` only works with the browser login. Run `tostudy login --creator` without --code, --magic-link or --manual.",
@@ -3140,7 +3150,7 @@ var init_guards = __esm({
3140
3150
  });
3141
3151
 
3142
3152
  // src/cli.ts
3143
- import { Command as Command37 } from "commander";
3153
+ import { Command as Command38 } from "commander";
3144
3154
 
3145
3155
  // src/commands/login.ts
3146
3156
  init_dist();
@@ -3786,7 +3796,7 @@ init_workspace_state();
3786
3796
  init_formatter();
3787
3797
 
3788
3798
  // src/version.ts
3789
- var CLI_VERSION = true ? "0.18.3" : "0.7.1";
3799
+ var CLI_VERSION = true ? "0.18.4" : "0.7.1";
3790
3800
 
3791
3801
  // src/update-checker.ts
3792
3802
  init_config_dir();
@@ -4282,9 +4292,53 @@ var coursesCommand = new Command5("courses").description("List your enrolled cou
4282
4292
  }
4283
4293
  });
4284
4294
 
4295
+ // src/commands/enroll.ts
4296
+ import { Command as Command6 } from "commander";
4297
+ init_guards();
4298
+ init_errors();
4299
+ init_formatter();
4300
+ var COURSE_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
4301
+ function formatEnrollResult(result) {
4302
+ const copy = getErrors();
4303
+ if (!result.enrolled) {
4304
+ return `${copy.enrollPaid}
4305
+ ${result.enrollUrl}`;
4306
+ }
4307
+ if (!result.cliChannel) {
4308
+ return `${copy.enrollDoneWebOnly}
4309
+ ${result.courseUrl}`;
4310
+ }
4311
+ return copy.enrollDone;
4312
+ }
4313
+ async function runEnroll(courseId, deps = {
4314
+ requireSession,
4315
+ request: ({ apiUrl, token, courseId: id }) => cliApiFetch(`${apiUrl}/api/cli/enrollments`, token, {
4316
+ method: "POST",
4317
+ body: JSON.stringify({ courseId: id })
4318
+ })
4319
+ }) {
4320
+ if (!COURSE_ID.test(courseId)) {
4321
+ throw new Error(getErrors().enrollInvalidId);
4322
+ }
4323
+ const session = await deps.requireSession();
4324
+ const result = await deps.request({
4325
+ apiUrl: session.apiUrl,
4326
+ token: session.token,
4327
+ courseId
4328
+ });
4329
+ return formatEnrollResult(result);
4330
+ }
4331
+ var enrollCommand = new Command6("enroll").description(getErrors().enrollCommandDescription).argument("<courseId>", "Published course ID (UUID)").action(async (courseId) => {
4332
+ try {
4333
+ output(await runEnroll(courseId), { json: false });
4334
+ } catch (err) {
4335
+ error(err instanceof Error ? err.message : String(err));
4336
+ }
4337
+ });
4338
+
4285
4339
  // src/commands/select.ts
4286
4340
  init_dist();
4287
- import { Command as Command6 } from "commander";
4341
+ import { Command as Command7 } from "commander";
4288
4342
  import os7 from "node:os";
4289
4343
  init_guards();
4290
4344
  init_workspace_marker();
@@ -4728,7 +4782,7 @@ function isInteractiveTerminal(json2) {
4728
4782
 
4729
4783
  // src/commands/select.ts
4730
4784
  var logger8 = createLogger("cli:select");
4731
- var selectCommand = new Command6("select").description("Activate a course by ID or list index number").argument("<course>", "Course ID (UUID) or index number from `tostudy courses`").option("--json", "Output structured JSON").option(
4785
+ var selectCommand = new Command7("select").description("Activate a course by ID or list index number").argument("<course>", "Course ID (UUID) or index number from `tostudy courses`").option("--json", "Output structured JSON").option(
4732
4786
  "--root-agents",
4733
4787
  "Add the ToStudy block to an existing AGENTS.md in this folder without asking"
4734
4788
  ).action(async (course, opts) => {
@@ -4856,13 +4910,13 @@ var selectCommand = new Command6("select").description("Activate a course by ID
4856
4910
 
4857
4911
  // src/commands/progress.ts
4858
4912
  init_dist();
4859
- import { Command as Command7 } from "commander";
4913
+ import { Command as Command8 } from "commander";
4860
4914
  init_guards();
4861
4915
  init_course_state();
4862
4916
  init_formatter();
4863
4917
  init_errors();
4864
4918
  var logger9 = createLogger("cli:progress");
4865
- var progressCommand = new Command7("progress").description("Show your progress in the active course").option("--json", "Output structured JSON").action(async (opts) => {
4919
+ var progressCommand = new Command8("progress").description("Show your progress in the active course").option("--json", "Output structured JSON").action(async (opts) => {
4866
4920
  try {
4867
4921
  const session = await requireSession();
4868
4922
  const activeCourse = await requireActiveCourse();
@@ -4888,7 +4942,7 @@ var progressCommand = new Command7("progress").description("Show your progress i
4888
4942
 
4889
4943
  // src/commands/start.ts
4890
4944
  init_dist();
4891
- import { Command as Command8 } from "commander";
4945
+ import { Command as Command9 } from "commander";
4892
4946
 
4893
4947
  // ../../../../../Users/cleitonparis/www/pg/apps/cursos/packages/tostudy-core/src/lessons/next-lesson.ts
4894
4948
  async function nextLesson(input2, deps) {
@@ -4997,20 +5051,20 @@ async function runStart(opts, deps = defaultDeps3) {
4997
5051
  deps.error(msg);
4998
5052
  }
4999
5053
  }
5000
- var startCommand = new Command8("start").description("Start (or resume) the current module of the active course").option("--json", "Output structured JSON").action(async (opts) => {
5054
+ var startCommand = new Command9("start").description("Start (or resume) the current module of the active course").option("--json", "Output structured JSON").action(async (opts) => {
5001
5055
  await runStart(opts);
5002
5056
  });
5003
5057
 
5004
5058
  // src/commands/start-next.ts
5005
5059
  init_dist();
5006
- import { Command as Command9 } from "commander";
5060
+ import { Command as Command10 } from "commander";
5007
5061
  init_guards();
5008
5062
  init_course_state();
5009
5063
  init_workspace_state();
5010
5064
  init_formatter();
5011
5065
  init_errors();
5012
5066
  var logger11 = createLogger("cli:start-next");
5013
- var startNextCommand = new Command9("start-next").description("Transition to the next module after completing the current one").option("--json", "Output structured JSON").action(async (opts) => {
5067
+ var startNextCommand = new Command10("start-next").description("Transition to the next module after completing the current one").option("--json", "Output structured JSON").action(async (opts) => {
5014
5068
  try {
5015
5069
  const session = await requireSession();
5016
5070
  const activeCourse = await requireActiveCourse();
@@ -5053,14 +5107,14 @@ var startNextCommand = new Command9("start-next").description("Transition to the
5053
5107
 
5054
5108
  // src/commands/next.ts
5055
5109
  init_dist();
5056
- import { Command as Command10 } from "commander";
5110
+ import { Command as Command11 } from "commander";
5057
5111
  init_guards();
5058
5112
  init_course_state();
5059
5113
  init_workspace_state();
5060
5114
  init_formatter();
5061
5115
  init_errors();
5062
5116
  var logger12 = createLogger("cli:next");
5063
- var nextCommand = new Command10("next").description("Advance to the next lesson in the active course").option("--json", "Output structured JSON").action(async (opts) => {
5117
+ var nextCommand = new Command11("next").description("Advance to the next lesson in the active course").option("--json", "Output structured JSON").action(async (opts) => {
5064
5118
  try {
5065
5119
  const session = await requireSession();
5066
5120
  const activeCourse = await requireActiveCourse();
@@ -5138,7 +5192,7 @@ var nextCommand = new Command10("next").description("Advance to the next lesson
5138
5192
 
5139
5193
  // src/commands/lesson.ts
5140
5194
  init_dist();
5141
- import { Command as Command11 } from "commander";
5195
+ import { Command as Command12 } from "commander";
5142
5196
  init_guards();
5143
5197
  init_course_state();
5144
5198
  init_formatter();
@@ -5196,7 +5250,7 @@ function formatLessonContent(data, workspacePath, courseTitle) {
5196
5250
  }
5197
5251
  return lines.join("\n");
5198
5252
  }
5199
- var lessonCommand = new Command11("lesson").description("Show the content of the current lesson").option("--json", "Output structured JSON").option(
5253
+ var lessonCommand = new Command12("lesson").description("Show the content of the current lesson").option("--json", "Output structured JSON").option(
5200
5254
  "--read <lessonId>",
5201
5255
  "Read a specific lesson by id (works on archived / read-only courses)"
5202
5256
  ).action(async (opts) => {
@@ -5267,7 +5321,7 @@ var lessonCommand = new Command11("lesson").description("Show the content of the
5267
5321
 
5268
5322
  // src/commands/knowledge.ts
5269
5323
  init_dist();
5270
- import { Command as Command12 } from "commander";
5324
+ import { Command as Command13 } from "commander";
5271
5325
  init_guards();
5272
5326
  init_formatter();
5273
5327
  var logger14 = createLogger("cli:knowledge");
@@ -5287,7 +5341,7 @@ function formatKnowledge(data) {
5287
5341
  });
5288
5342
  return lines.join("\n").trimEnd();
5289
5343
  }
5290
- var knowledgeCommand = new Command12("knowledge").description("Show the active course's knowledge base (base de conhecimento)").option("--json", "Output structured JSON").action(async (opts) => {
5344
+ var knowledgeCommand = new Command13("knowledge").description("Show the active course's knowledge base (base de conhecimento)").option("--json", "Output structured JSON").action(async (opts) => {
5291
5345
  try {
5292
5346
  const activeCourse = await requireActiveCourse();
5293
5347
  if (!activeCourse.courseId) {
@@ -5318,13 +5372,13 @@ var knowledgeCommand = new Command12("knowledge").description("Show the active c
5318
5372
 
5319
5373
  // src/commands/hint.ts
5320
5374
  init_dist();
5321
- import { Command as Command13 } from "commander";
5375
+ import { Command as Command14 } from "commander";
5322
5376
  init_guards();
5323
5377
  init_course_state();
5324
5378
  init_formatter();
5325
5379
  init_errors();
5326
5380
  var logger15 = createLogger("cli:hint");
5327
- var hintCommand = new Command13("hint").description("Get a progressive hint for the current exercise").option("--json", "Output structured JSON").action(async (opts) => {
5381
+ var hintCommand = new Command14("hint").description("Get a progressive hint for the current exercise").option("--json", "Output structured JSON").action(async (opts) => {
5328
5382
  try {
5329
5383
  const session = await requireSession();
5330
5384
  const activeCourse = await requireActiveCourse();
@@ -5375,7 +5429,7 @@ var hintCommand = new Command13("hint").description("Get a progressive hint for
5375
5429
  init_dist();
5376
5430
  import fs11 from "node:fs";
5377
5431
  import path14 from "node:path";
5378
- import { Command as Command14 } from "commander";
5432
+ import { Command as Command15 } from "commander";
5379
5433
 
5380
5434
  // ../../../../../Users/cleitonparis/www/pg/apps/cursos/packages/tostudy-core/src/exercises/validate-solution.ts
5381
5435
  async function validateSolution(input2, deps) {
@@ -19561,7 +19615,7 @@ async function clearRetryPin() {
19561
19615
  await updateWorkspaceState(ws.workspacePath, { retryLessonId: void 0 });
19562
19616
  }
19563
19617
  }
19564
- var 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) => {
19618
+ var validateCommand = new Command15("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) => {
19565
19619
  try {
19566
19620
  const session = await requireSession();
19567
19621
  const activeCourse = await requireActiveCourse();
@@ -19699,13 +19753,13 @@ var validateCommand = new Command14("validate").description("Validate your solut
19699
19753
 
19700
19754
  // src/commands/retry.ts
19701
19755
  init_dist();
19702
- import { Command as Command15 } from "commander";
19756
+ import { Command as Command16 } from "commander";
19703
19757
  init_guards();
19704
19758
  init_workspace_state();
19705
19759
  init_formatter();
19706
19760
  var logger17 = createLogger("cli:retry");
19707
19761
  var LESSON_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
19708
- var retryCommand = new Command15("retry").description("Revalidate a lesson you already completed (your grade keeps the best attempt)").argument("[lessonId]", "Id of the completed lesson (see: tostudy grades --course <slug> --json)").option("--clear", "Cancel the pending retry; validate goes back to the current lesson").option("--json", "Output structured JSON").action(async (lessonId, opts) => {
19762
+ var retryCommand = new Command16("retry").description("Revalidate a lesson you already completed (your grade keeps the best attempt)").argument("[lessonId]", "Id of the completed lesson (see: tostudy grades --course <slug> --json)").option("--clear", "Cancel the pending retry; validate goes back to the current lesson").option("--json", "Output structured JSON").action(async (lessonId, opts) => {
19709
19763
  try {
19710
19764
  if (opts.clear) {
19711
19765
  const ws2 = await findWorkspaceState();
@@ -19766,8 +19820,8 @@ var retryCommand = new Command15("retry").description("Revalidate a lesson you a
19766
19820
  init_session_store();
19767
19821
  init_workspace_state();
19768
19822
  init_formatter();
19769
- import { Command as Command16 } from "commander";
19770
- var menuCommand = new Command16("menu").description("Show available commands and current study context").action(async () => {
19823
+ import { Command as Command17 } from "commander";
19824
+ var menuCommand = new Command17("menu").description("Show available commands and current study context").action(async () => {
19771
19825
  const session = await getSession();
19772
19826
  const wsResult = session ? await findWorkspaceState() : null;
19773
19827
  const activeCourse = wsResult?.state ?? null;
@@ -19824,7 +19878,7 @@ var menuCommand = new Command16("menu").description("Show available commands and
19824
19878
 
19825
19879
  // src/commands/init.ts
19826
19880
  init_dist();
19827
- import { Command as Command17 } from "commander";
19881
+ import { Command as Command18 } from "commander";
19828
19882
  init_session_store();
19829
19883
  init_course_state();
19830
19884
  init_workspace_state();
@@ -20140,7 +20194,7 @@ Rode \`tostudy select <n\xFAmero>\` para ativar um curso.`,
20140
20194
  deps.output(artifacts.learnerBrief, { json: false });
20141
20195
  }
20142
20196
  }
20143
- var initCommand = new Command17("init").description("Generate tutor instructions and learner brief for the active course").option("--segment <segment>", "Learner segment/niche").option("--company <company>", "Company or business type").option("--products <products>", "Main products or services").option("--region <region>", "Operating region").option("--team <team>", "Team involved").option("--goal <goal>", "Primary learning goal").option("--level <level>", "Learner level: beginner, intermediate, advanced").option("--adapt-context", "Adapt examples to learner's real context").option(
20197
+ var initCommand = new Command18("init").description("Generate tutor instructions and learner brief for the active course").option("--segment <segment>", "Learner segment/niche").option("--company <company>", "Company or business type").option("--products <products>", "Main products or services").option("--region <region>", "Operating region").option("--team <team>", "Team involved").option("--goal <goal>", "Primary learning goal").option("--level <level>", "Learner level: beginner, intermediate, advanced").option("--adapt-context", "Adapt examples to learner's real context").option(
20144
20198
  "--root-agents",
20145
20199
  "Add the ToStudy block to an existing AGENTS.md in this folder without asking"
20146
20200
  ).option("--json", "Output structured JSON").action(async (opts) => {
@@ -20149,7 +20203,7 @@ var initCommand = new Command17("init").description("Generate tutor instructions
20149
20203
 
20150
20204
  // src/commands/workspace.ts
20151
20205
  init_dist();
20152
- import { Command as Command18 } from "commander";
20206
+ import { Command as Command19 } from "commander";
20153
20207
 
20154
20208
  // ../../../../../Users/cleitonparis/www/pg/apps/cursos/packages/tostudy-core/src/workspace/setup-workspace.ts
20155
20209
  import fs12 from "node:fs/promises";
@@ -20440,7 +20494,7 @@ import path17 from "node:path";
20440
20494
  import os8 from "node:os";
20441
20495
  import fs14 from "node:fs/promises";
20442
20496
  var logger19 = createLogger("cli:workspace");
20443
- var workspaceCommand = new Command18("workspace").description(
20497
+ var workspaceCommand = new Command19("workspace").description(
20444
20498
  getErrors().workspaceCommandDescription
20445
20499
  );
20446
20500
  workspaceCommand.command("setup").description(getErrors().workspaceSetupDescription).option("--path <dir>", "Diret\xF3rio base do workspace (omita para usar a pasta atual)").option("--json", "Output structured JSON").action(async (opts) => {
@@ -20608,7 +20662,7 @@ workspaceCommand.command("status").description("Mostrar status do workspace do c
20608
20662
 
20609
20663
  // src/commands/export.ts
20610
20664
  init_dist();
20611
- import { Command as Command19 } from "commander";
20665
+ import { Command as Command20 } from "commander";
20612
20666
  init_guards();
20613
20667
  init_course_state();
20614
20668
  init_resolve();
@@ -20617,7 +20671,7 @@ import path18 from "node:path";
20617
20671
  import os9 from "node:os";
20618
20672
  import fs15 from "node:fs/promises";
20619
20673
  var logger20 = createLogger("cli:export");
20620
- var exportCommand = new Command19("export").description("Extrair exerc\xEDcio atual para o workspace local").option("--tier <tier>", "Tier do exerc\xEDcio: guided, semiGuided, challenging", "guided").option("--path <dir>", "Diret\xF3rio base do workspace", path18.join(os9.homedir(), "study")).option("--json", "Output structured JSON").action(async (opts) => {
20674
+ var exportCommand = new Command20("export").description("Extrair exerc\xEDcio atual para o workspace local").option("--tier <tier>", "Tier do exerc\xEDcio: guided, semiGuided, challenging", "guided").option("--path <dir>", "Diret\xF3rio base do workspace", path18.join(os9.homedir(), "study")).option("--json", "Output structured JSON").action(async (opts) => {
20621
20675
  try {
20622
20676
  const session = await requireSession();
20623
20677
  const activeCourse = await requireActiveCourse();
@@ -20722,12 +20776,12 @@ init_guards();
20722
20776
  init_course_state();
20723
20777
  init_resolve();
20724
20778
  init_errors();
20725
- import { Command as Command20 } from "commander";
20779
+ import { Command as Command21 } from "commander";
20726
20780
  import { execFile as execFile3 } from "node:child_process";
20727
20781
  import path19 from "node:path";
20728
20782
  import os10 from "node:os";
20729
20783
  var logger21 = createLogger("cli:open");
20730
- var openCommand = new Command20("open").description("Abrir workspace do curso na IDE").option("--path <dir>", "Diret\xF3rio base do workspace", path19.join(os10.homedir(), "study")).action(async (opts) => {
20784
+ var openCommand = new Command21("open").description("Abrir workspace do curso na IDE").option("--path <dir>", "Diret\xF3rio base do workspace", path19.join(os10.homedir(), "study")).action(async (opts) => {
20731
20785
  try {
20732
20786
  const activeCourse = await requireActiveCourse();
20733
20787
  const onboardingState = await getCourseOnboardingState(activeCourse.courseId);
@@ -20762,7 +20816,7 @@ var openCommand = new Command20("open").description("Abrir workspace do curso na
20762
20816
 
20763
20817
  // src/commands/vault.ts
20764
20818
  init_dist();
20765
- import { Command as Command21 } from "commander";
20819
+ import { Command as Command22 } from "commander";
20766
20820
 
20767
20821
  // ../../../../../Users/cleitonparis/www/pg/apps/cursos/packages/tostudy-core/src/vault/generate-vault-files.ts
20768
20822
  init_slug();
@@ -20808,7 +20862,7 @@ import path21 from "node:path";
20808
20862
  import os11 from "node:os";
20809
20863
  import fs17 from "node:fs/promises";
20810
20864
  var logger22 = createLogger("cli:vault");
20811
- var vaultCommand = new Command21("vault").description("Gerenciar vault Obsidian do curso");
20865
+ var vaultCommand = new Command22("vault").description("Gerenciar vault Obsidian do curso");
20812
20866
  vaultCommand.command("init").description("Gerar vault Obsidian para o curso ativo").option("--path <dir>", "Diret\xF3rio base do workspace", path21.join(os11.homedir(), "study")).option("--json", "Output structured JSON").action(async (opts) => {
20813
20867
  try {
20814
20868
  const session = await requireSession();
@@ -20981,7 +21035,7 @@ init_formatter();
20981
21035
  init_errors();
20982
21036
  import os13 from "node:os";
20983
21037
  import path25 from "node:path";
20984
- import { Command as Command23 } from "commander";
21038
+ import { Command as Command24 } from "commander";
20985
21039
 
20986
21040
  // ../../../../../Users/cleitonparis/www/pg/apps/cursos/packages/validators/src/authored-course.ts
20987
21041
  import { createHash } from "node:crypto";
@@ -21923,7 +21977,7 @@ function installCreatorSkill(input2) {
21923
21977
  // src/commands/brief-open.ts
21924
21978
  init_guards();
21925
21979
  init_formatter();
21926
- import { Command as Command22 } from "commander";
21980
+ import { Command as Command23 } from "commander";
21927
21981
  import { execFile as execFile4 } from "node:child_process";
21928
21982
  import { platform } from "node:process";
21929
21983
  var BRIEF_URL = "https://tostudy.ai/student/settings/learner-brief";
@@ -21948,7 +22002,7 @@ function openUrl(url2, options = {}) {
21948
22002
  }
21949
22003
  });
21950
22004
  }
21951
- var briefOpenCommand = new Command22("brief-open").description("Open the learner brief editor in your web browser").action(async () => {
22005
+ var briefOpenCommand = new Command23("brief-open").description("Open the learner brief editor in your web browser").action(async () => {
21952
22006
  await requireSession();
21953
22007
  output(`Abrindo ${BRIEF_URL} no navegador...`, { json: false });
21954
22008
  openUrl(BRIEF_URL);
@@ -21956,7 +22010,7 @@ var briefOpenCommand = new Command22("brief-open").description("Open the learner
21956
22010
 
21957
22011
  // src/commands/creator.ts
21958
22012
  var logger23 = createLogger("cli:creator");
21959
- var creatorCommand = new Command23("creator").description(
22013
+ var creatorCommand = new Command24("creator").description(
21960
22014
  "Author a course with your own AI agent: init, validate, push, pull, audit, status, open"
21961
22015
  );
21962
22016
  function fail(err, opts, context) {
@@ -22253,8 +22307,8 @@ creatorCommand.command("open").description("Open the course in the creator porta
22253
22307
  init_guards();
22254
22308
  init_course_state();
22255
22309
  init_user_profile();
22256
- import { Command as Command24 } from "commander";
22257
- var profileCommand = new Command24("profile").description("Show your learner profile for the active course").option("--json", "Output structured JSON").action(async (opts) => {
22310
+ import { Command as Command25 } from "commander";
22311
+ var profileCommand = new Command25("profile").description("Show your learner profile for the active course").option("--json", "Output structured JSON").action(async (opts) => {
22258
22312
  const activeCourse = await requireActiveCourse();
22259
22313
  const onboarding = await getCourseOnboardingState(activeCourse.courseId);
22260
22314
  const profile = onboarding?.learnerProfile ?? await getUserProfile();
@@ -22316,10 +22370,10 @@ var profileCommand = new Command24("profile").description("Show your learner pro
22316
22370
  init_dist();
22317
22371
  init_guards();
22318
22372
  init_formatter();
22319
- import { Command as Command25 } from "commander";
22373
+ import { Command as Command26 } from "commander";
22320
22374
  init_workspace_state();
22321
22375
  var logger24 = createLogger("cli:sync");
22322
- var syncCommand = new Command25("sync").description("Regenerate instruction files with updated progress").option("--json", "Output structured JSON").option(
22376
+ var syncCommand = new Command26("sync").description("Regenerate instruction files with updated progress").option("--json", "Output structured JSON").option(
22323
22377
  "--all-runtimes",
22324
22378
  "Write instruction files for every supported runtime, even undetected ones"
22325
22379
  ).option(
@@ -22391,10 +22445,10 @@ var syncCommand = new Command25("sync").description("Regenerate instruction file
22391
22445
  // src/commands/brief.ts
22392
22446
  init_dist();
22393
22447
  init_guards();
22394
- import { Command as Command26 } from "commander";
22448
+ import { Command as Command27 } from "commander";
22395
22449
  init_formatter();
22396
22450
  var logger25 = createLogger("cli:brief");
22397
- var briefCommand = new Command26("brief").description("Show your base learner brief (T1) status and content").option("--json", "Output structured JSON").action(async (opts) => {
22451
+ var briefCommand = new Command27("brief").description("Show your base learner brief (T1) status and content").option("--json", "Output structured JSON").action(async (opts) => {
22398
22452
  try {
22399
22453
  const session = await requireSession();
22400
22454
  const cached2 = await readBriefCache();
@@ -22435,10 +22489,10 @@ var briefCommand = new Command26("brief").description("Show your base learner br
22435
22489
  // src/commands/brief-create.ts
22436
22490
  init_dist();
22437
22491
  init_guards();
22438
- import { Command as Command27 } from "commander";
22492
+ import { Command as Command28 } from "commander";
22439
22493
  init_formatter();
22440
22494
  var logger26 = createLogger("cli:brief-create");
22441
- var briefCreateCommand = new Command27("brief-create").description("Create your base learner brief via interactive prompts (T1 bootstrap)").action(async () => {
22495
+ var briefCreateCommand = new Command28("brief-create").description("Create your base learner brief via interactive prompts (T1 bootstrap)").action(async () => {
22442
22496
  try {
22443
22497
  const session = await requireSession();
22444
22498
  const answers = await collectBootstrapAnswers({ userName: session.userName });
@@ -22472,7 +22526,7 @@ init_dist();
22472
22526
  init_guards();
22473
22527
  init_workspace_state();
22474
22528
  import fs22 from "node:fs";
22475
- import { Command as Command28 } from "commander";
22529
+ import { Command as Command29 } from "commander";
22476
22530
 
22477
22531
  // src/sessions/storage.ts
22478
22532
  init_dist();
@@ -22521,7 +22575,7 @@ async function loadSessionContext(workspacePath) {
22521
22575
  // src/commands/compact.ts
22522
22576
  init_formatter();
22523
22577
  var logger28 = createLogger("cli:compact");
22524
- var compactCommand = new Command28("compact").description("Save a module study summary (LLM-generated, from stdin)").option("--module-id <id>", "Module ID").option("--module-title <title>", "Module title").option("--json", "Output structured JSON").action(async (opts) => {
22578
+ var compactCommand = new Command29("compact").description("Save a module study summary (LLM-generated, from stdin)").option("--module-id <id>", "Module ID").option("--module-title <title>", "Module title").option("--json", "Output structured JSON").action(async (opts) => {
22525
22579
  try {
22526
22580
  const activeCourse = await requireActiveCourse();
22527
22581
  const ws = await findWorkspaceState();
@@ -22559,12 +22613,12 @@ var compactCommand = new Command28("compact").description("Save a module study s
22559
22613
  // src/commands/context.ts
22560
22614
  init_dist();
22561
22615
  init_workspace_state();
22562
- import { Command as Command29 } from "commander";
22616
+ import { Command as Command30 } from "commander";
22563
22617
  init_course_state();
22564
22618
  init_formatter();
22565
22619
  init_errors();
22566
22620
  var logger29 = createLogger("cli:context");
22567
- var contextCommand = new Command29("context").description("Load session context (workspace state + module summaries) for LLM consumption").option("--json", "Output structured JSON").action(async (opts) => {
22621
+ var contextCommand = new Command30("context").description("Load session context (workspace state + module summaries) for LLM consumption").option("--json", "Output structured JSON").action(async (opts) => {
22568
22622
  try {
22569
22623
  const ws = await findWorkspaceState();
22570
22624
  if (!ws) {
@@ -22616,13 +22670,13 @@ var contextCommand = new Command29("context").description("Load session context
22616
22670
 
22617
22671
  // src/commands/memory.ts
22618
22672
  init_dist();
22619
- import { Command as Command30 } from "commander";
22673
+ import { Command as Command31 } from "commander";
22620
22674
  init_workspace_state();
22621
22675
  init_guards();
22622
22676
  init_formatter();
22623
22677
  init_errors();
22624
22678
  var logger30 = createLogger("cli:memory");
22625
- var memoryCommand = new Command30("memory").description("Load accumulated student memory (learning profile + recent lessons) for the tutor").option("--json", "Output structured JSON").action(async (opts) => {
22679
+ var memoryCommand = new Command31("memory").description("Load accumulated student memory (learning profile + recent lessons) for the tutor").option("--json", "Output structured JSON").action(async (opts) => {
22626
22680
  try {
22627
22681
  const ws = await findWorkspaceState();
22628
22682
  if (!ws) {
@@ -22653,14 +22707,14 @@ var memoryCommand = new Command30("memory").description("Load accumulated studen
22653
22707
 
22654
22708
  // src/commands/insight.ts
22655
22709
  init_dist();
22656
- import { Command as Command31 } from "commander";
22710
+ import { Command as Command32 } from "commander";
22657
22711
  init_workspace_state();
22658
22712
  init_guards();
22659
22713
  init_formatter();
22660
22714
  init_errors();
22661
22715
  var logger31 = createLogger("cli:insight");
22662
22716
  var VALID_TYPES = ["difficulty", "breakthrough", "question"];
22663
- var insightCommand = new Command31("insight").description(
22717
+ var insightCommand = new Command32("insight").description(
22664
22718
  "Persist a student cognitive insight (difficulty | breakthrough | question) into course memory"
22665
22719
  ).argument("<type>", "difficulty | breakthrough | question").argument("<content>", 'Short description, e.g. "confunde async/await com promises"').option("--module-id <id>", "Module the insight relates to").option("--json", "Output structured JSON").action(async (type, content, opts) => {
22666
22720
  try {
@@ -22708,7 +22762,7 @@ var insightCommand = new Command31("insight").description(
22708
22762
 
22709
22763
  // src/commands/level.ts
22710
22764
  init_dist();
22711
- import { Command as Command32 } from "commander";
22765
+ import { Command as Command33 } from "commander";
22712
22766
  init_guards();
22713
22767
  init_formatter();
22714
22768
  var logger32 = createLogger("cli:level");
@@ -22723,7 +22777,7 @@ var LEVEL_LABELS2 = {
22723
22777
  function isExerciseLevel2(value) {
22724
22778
  return ALL_LEVELS.includes(value);
22725
22779
  }
22726
- var levelCommand = new Command32("level").description("Show or set the exercise scaffolding level for the active course").argument("[level]", "Target level: L0, L1, L2, L3, or L4").option("--json", "Output structured JSON").action(async (rawLevel, opts) => {
22780
+ var levelCommand = new Command33("level").description("Show or set the exercise scaffolding level for the active course").argument("[level]", "Target level: L0, L1, L2, L3, or L4").option("--json", "Output structured JSON").action(async (rawLevel, opts) => {
22727
22781
  try {
22728
22782
  const session = await requireSession();
22729
22783
  const activeCourse = await requireActiveCourse();
@@ -22788,10 +22842,10 @@ init_dist();
22788
22842
  init_guards();
22789
22843
  init_formatter();
22790
22844
  init_errors();
22791
- import { Command as Command33 } from "commander";
22845
+ import { Command as Command34 } from "commander";
22792
22846
  var logger33 = createLogger("cli:theory");
22793
22847
  var EXERCISE_LEVELS2 = ["L0", "L1", "L2", "L3", "L4"];
22794
- var theoryCommand = new Command33("theory").description("Request more theory on the current lesson (escape hatch)").option("--focus <text>", "Optional focus area in PT-BR (max 500 chars)").option("--level <L0|L1|L2|L3|L4>", "Override current exercise level (otherwise auto-detect)").option("--lesson <uuid>", "Override lesson ID (defaults to current workspace lesson)").option("--json", "Output structured JSON").action(async (opts) => {
22848
+ var theoryCommand = new Command34("theory").description("Request more theory on the current lesson (escape hatch)").option("--focus <text>", "Optional focus area in PT-BR (max 500 chars)").option("--level <L0|L1|L2|L3|L4>", "Override current exercise level (otherwise auto-detect)").option("--lesson <uuid>", "Override lesson ID (defaults to current workspace lesson)").option("--json", "Output structured JSON").action(async (opts) => {
22795
22849
  try {
22796
22850
  const session = await requireSession();
22797
22851
  const active = await requireActiveCourse();
@@ -22886,7 +22940,7 @@ var theoryCommand = new Command33("theory").description("Request more theory on
22886
22940
  // src/commands/export-grades.ts
22887
22941
  init_dist();
22888
22942
  init_guards();
22889
- import { Command as Command34 } from "commander";
22943
+ import { Command as Command35 } from "commander";
22890
22944
 
22891
22945
  // src/formatters/grades.ts
22892
22946
  function formatGradesJson(attempts) {
@@ -23254,7 +23308,7 @@ async function runExportGrades(opts, deps = defaultDeps5) {
23254
23308
  if (!rendered.endsWith("\n")) rendered += "\n";
23255
23309
  deps.stdoutWrite(rendered);
23256
23310
  }
23257
- var exportGradesCommand = new Command34("export-grades").description("Exporta o hist\xF3rico de valida\xE7\xF5es (notas) do curso ativo").option(
23311
+ var exportGradesCommand = new Command35("export-grades").description("Exporta o hist\xF3rico de valida\xE7\xF5es (notas) do curso ativo").option(
23258
23312
  "--course <slug>",
23259
23313
  "Slug do curso (gerado a partir do t\xEDtulo). Sem a flag, exporta o curso ativo."
23260
23314
  ).option("--format <json|csv|md>", "Formato de sa\xEDda (default: json)", "json").addHelpText(
@@ -23278,7 +23332,7 @@ C\xF3digos de sa\xEDda:
23278
23332
 
23279
23333
  // src/commands/grades.ts
23280
23334
  init_dist();
23281
- import { Command as Command35 } from "commander";
23335
+ import { Command as Command36 } from "commander";
23282
23336
  init_guards();
23283
23337
  var logger35 = createLogger("cli:grades");
23284
23338
  var defaultDeps6 = {
@@ -23434,7 +23488,7 @@ async function runGrades(opts, deps = defaultDeps6) {
23434
23488
  );
23435
23489
  deps.stdoutWrite(formatGradesAllEnrollmentsTable(summaries) + "\n");
23436
23490
  }
23437
- var gradesCommand = new Command35("grades").description("Mostra um resumo das notas (todas as matr\xEDculas ou um curso espec\xEDfico)").option(
23491
+ var gradesCommand = new Command36("grades").description("Mostra um resumo das notas (todas as matr\xEDculas ou um curso espec\xEDfico)").option(
23438
23492
  "--course <slug>",
23439
23493
  "Slug do curso (gerado a partir do t\xEDtulo). Sem a flag, lista todos os cursos."
23440
23494
  ).addHelpText(
@@ -23458,7 +23512,7 @@ C\xF3digos de sa\xEDda:
23458
23512
  // src/commands/review.ts
23459
23513
  init_dist();
23460
23514
  init_guards();
23461
- import { Command as Command36 } from "commander";
23515
+ import { Command as Command37 } from "commander";
23462
23516
  import { createInterface } from "node:readline/promises";
23463
23517
  import { stdin as defaultStdin, stdout as defaultStdout } from "node:process";
23464
23518
  var logger36 = createLogger("cli:review");
@@ -23608,7 +23662,7 @@ async function runReview(slug, opts, deps = defaultDeps7) {
23608
23662
  }) + "\n"
23609
23663
  );
23610
23664
  }
23611
- var reviewCommand = new Command36("review").description("Revisa a \xFAltima tentativa de valida\xE7\xE3o de uma li\xE7\xE3o").argument("<slug>", "Slug do curso (gerado a partir do t\xEDtulo)").option("--json", "Sa\xEDda em JSON (sem prompt interativo)").addHelpText(
23665
+ var reviewCommand = new Command37("review").description("Revisa a \xFAltima tentativa de valida\xE7\xE3o de uma li\xE7\xE3o").argument("<slug>", "Slug do curso (gerado a partir do t\xEDtulo)").option("--json", "Sa\xEDda em JSON (sem prompt interativo)").addHelpText(
23612
23666
  "after",
23613
23667
  `
23614
23668
  Exemplos:
@@ -23631,12 +23685,12 @@ C\xF3digos de sa\xEDda:
23631
23685
 
23632
23686
  // src/cli.ts
23633
23687
  function createProgram() {
23634
- const program = new Command37();
23688
+ const program = new Command38();
23635
23689
  program.name("tostudy").description("ToStudy CLI \u2014 study courses from the terminal").version(CLI_VERSION).option("--verbose", "Enable debug output").option("--course <id>", "Override active course ID").option("--locale <code>", "Output locale (pt-BR | en-US); defaults to LANG env then pt-BR").addHelpText(
23636
23690
  "before",
23637
23691
  [
23638
23692
  "",
23639
- " Come\xE7ando: login \u2192 courses \u2192 select <n> \u2192 start",
23693
+ " Come\xE7ando: login \u2192 enroll <id> \u2192 courses \u2192 select <n> \u2192 start",
23640
23694
  " Estudando: next \xB7 lesson \xB7 hint \xB7 validate \xB7 theory \xB7 progress",
23641
23695
  " Com d\xFAvida: tostudy menu (mostra onde voc\xEA est\xE1 e o que fazer)",
23642
23696
  ""
@@ -23648,6 +23702,7 @@ function createProgram() {
23648
23702
  program.addCommand(loginCommand);
23649
23703
  program.addCommand(logoutCommand);
23650
23704
  program.addCommand(coursesCommand);
23705
+ program.addCommand(enrollCommand);
23651
23706
  program.addCommand(selectCommand);
23652
23707
  program.addCommand(progressCommand);
23653
23708
  program.addCommand(startCommand);