@tostudy-ai/cli 0.18.2 → 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
@@ -1021,6 +1021,14 @@ var init_errors_pt_br = __esm({
1021
1021
  courseArchived: "Este curso foi arquivado e est\xE1 dispon\xEDvel somente para leitura.\nUse `tostudy lesson` para revisar o conte\xFAdo j\xE1 estudado.\n",
1022
1022
  noActiveCourse: "Nenhum curso ativo nesta pasta.\nVeja seus cursos com `tostudy courses` e ative um com `tostudy select <n>`.\n",
1023
1023
  studyWorkspaceHint: "Dica: rode `tostudy select` desta pasta para us\xE1-la como workspace, ou `tostudy workspace setup` para criar em ~/study/. Depois rode `tostudy export` para gravar o exerc\xEDcio e os crit\xE9rios de valida\xE7\xE3o.\n",
1024
+ setupCommandDescription: "Atalho antigo. A pasta de estudo \xE9 workspace setup; o MCP \xE9 setup mcp",
1025
+ setupRetiredNotice: "\n \u26A0\uFE0F `tostudy setup` n\xE3o cria a pasta de estudo.",
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:",
1024
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",
1025
1033
  creator: {
1026
1034
  loginBrowserOnly: "`--creator` s\xF3 funciona no login pelo browser. Rode `tostudy login --creator` sem --code, --magic-link ou --manual.",
@@ -1115,6 +1123,14 @@ var init_errors_en_us = __esm({
1115
1123
  courseArchived: "This course has been archived and is available for reading only.\nUse `tostudy lesson` to review the content you've already studied.\n",
1116
1124
  noActiveCourse: "No active course in this folder.\nList your courses with `tostudy courses` and activate one with `tostudy select <n>`.\n",
1117
1125
  studyWorkspaceHint: "Tip: run `tostudy select` in this folder to use it as the workspace, or `tostudy workspace setup` to create one in ~/study/. Then run `tostudy export` to save the exercise and the validation criteria on this computer.\n",
1126
+ setupCommandDescription: "Old shortcut. The study folder is workspace setup; MCP is setup mcp",
1127
+ setupRetiredNotice: "\n \u26A0\uFE0F `tostudy setup` does not create the study folder.",
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:",
1118
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",
1119
1135
  creator: {
1120
1136
  loginBrowserOnly: "`--creator` only works with the browser login. Run `tostudy login --creator` without --code, --magic-link or --manual.",
@@ -3134,7 +3150,7 @@ var init_guards = __esm({
3134
3150
  });
3135
3151
 
3136
3152
  // src/cli.ts
3137
- import { Command as Command37 } from "commander";
3153
+ import { Command as Command38 } from "commander";
3138
3154
 
3139
3155
  // src/commands/login.ts
3140
3156
  init_dist();
@@ -3669,6 +3685,7 @@ var logoutCommand = new Command2("logout").description("Remove token local").act
3669
3685
 
3670
3686
  // src/commands/setup.ts
3671
3687
  init_guards();
3688
+ init_errors();
3672
3689
  import { Command as Command3 } from "commander";
3673
3690
 
3674
3691
  // src/installer/mcp-setup.ts
@@ -3714,10 +3731,9 @@ var defaultDeps = {
3714
3731
  }
3715
3732
  };
3716
3733
  async function runSetup(_opts, deps = defaultDeps) {
3717
- deps.log("\n \u26A0\uFE0F `tostudy setup` foi incorporado ao `tostudy login`.");
3718
- deps.log(
3719
- " Rode `tostudy login`, depois `tostudy courses` e `tostudy select <n>` para estudar no terminal.\n"
3720
- );
3734
+ const errors = getErrors();
3735
+ deps.log(errors.setupRetiredNotice);
3736
+ deps.log(errors.setupRetiredNext);
3721
3737
  }
3722
3738
  async function runSetupMcpSubcommand() {
3723
3739
  console.log("\n ToStudy MCP Setup\n \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n");
@@ -3730,7 +3746,7 @@ async function runSetupMcpSubcommand() {
3730
3746
  console.log(" \u2192 Reinicie o IDE para ativar o servidor MCP");
3731
3747
  console.log(" \u2192 tostudy doctor (verificar conex\xE3o)\n");
3732
3748
  }
3733
- var setupCommand = new Command3("setup").description("Configura ambiente para estudar").option("--quick", "Setup r\xE1pido (sem wizard)").option("--ide <ide>", "Configura IDE espec\xEDfica").option("--mcp", "Configura o MCP nas IDEs detectadas usando a sess\xE3o atual do CLI").action(async (opts) => {
3749
+ var setupCommand = new Command3("setup").description(getErrors().setupCommandDescription).option("--quick", "Setup r\xE1pido (sem wizard)").option("--ide <ide>", "Configura IDE espec\xEDfica").option("--mcp", "Configura o MCP nas IDEs detectadas usando a sess\xE3o atual do CLI").action(async (opts) => {
3734
3750
  await runSetup(opts);
3735
3751
  });
3736
3752
  setupCommand.command("mcp").description("Configura MCP server no seu IDE automaticamente").action(async () => {
@@ -3780,7 +3796,7 @@ init_workspace_state();
3780
3796
  init_formatter();
3781
3797
 
3782
3798
  // src/version.ts
3783
- var CLI_VERSION = true ? "0.18.2" : "0.7.1";
3799
+ var CLI_VERSION = true ? "0.18.4" : "0.7.1";
3784
3800
 
3785
3801
  // src/update-checker.ts
3786
3802
  init_config_dir();
@@ -4276,9 +4292,53 @@ var coursesCommand = new Command5("courses").description("List your enrolled cou
4276
4292
  }
4277
4293
  });
4278
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
+
4279
4339
  // src/commands/select.ts
4280
4340
  init_dist();
4281
- import { Command as Command6 } from "commander";
4341
+ import { Command as Command7 } from "commander";
4282
4342
  import os7 from "node:os";
4283
4343
  init_guards();
4284
4344
  init_workspace_marker();
@@ -4722,7 +4782,7 @@ function isInteractiveTerminal(json2) {
4722
4782
 
4723
4783
  // src/commands/select.ts
4724
4784
  var logger8 = createLogger("cli:select");
4725
- 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(
4726
4786
  "--root-agents",
4727
4787
  "Add the ToStudy block to an existing AGENTS.md in this folder without asking"
4728
4788
  ).action(async (course, opts) => {
@@ -4850,13 +4910,13 @@ var selectCommand = new Command6("select").description("Activate a course by ID
4850
4910
 
4851
4911
  // src/commands/progress.ts
4852
4912
  init_dist();
4853
- import { Command as Command7 } from "commander";
4913
+ import { Command as Command8 } from "commander";
4854
4914
  init_guards();
4855
4915
  init_course_state();
4856
4916
  init_formatter();
4857
4917
  init_errors();
4858
4918
  var logger9 = createLogger("cli:progress");
4859
- 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) => {
4860
4920
  try {
4861
4921
  const session = await requireSession();
4862
4922
  const activeCourse = await requireActiveCourse();
@@ -4882,7 +4942,7 @@ var progressCommand = new Command7("progress").description("Show your progress i
4882
4942
 
4883
4943
  // src/commands/start.ts
4884
4944
  init_dist();
4885
- import { Command as Command8 } from "commander";
4945
+ import { Command as Command9 } from "commander";
4886
4946
 
4887
4947
  // ../../../../../Users/cleitonparis/www/pg/apps/cursos/packages/tostudy-core/src/lessons/next-lesson.ts
4888
4948
  async function nextLesson(input2, deps) {
@@ -4991,20 +5051,20 @@ async function runStart(opts, deps = defaultDeps3) {
4991
5051
  deps.error(msg);
4992
5052
  }
4993
5053
  }
4994
- 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) => {
4995
5055
  await runStart(opts);
4996
5056
  });
4997
5057
 
4998
5058
  // src/commands/start-next.ts
4999
5059
  init_dist();
5000
- import { Command as Command9 } from "commander";
5060
+ import { Command as Command10 } from "commander";
5001
5061
  init_guards();
5002
5062
  init_course_state();
5003
5063
  init_workspace_state();
5004
5064
  init_formatter();
5005
5065
  init_errors();
5006
5066
  var logger11 = createLogger("cli:start-next");
5007
- 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) => {
5008
5068
  try {
5009
5069
  const session = await requireSession();
5010
5070
  const activeCourse = await requireActiveCourse();
@@ -5047,14 +5107,14 @@ var startNextCommand = new Command9("start-next").description("Transition to the
5047
5107
 
5048
5108
  // src/commands/next.ts
5049
5109
  init_dist();
5050
- import { Command as Command10 } from "commander";
5110
+ import { Command as Command11 } from "commander";
5051
5111
  init_guards();
5052
5112
  init_course_state();
5053
5113
  init_workspace_state();
5054
5114
  init_formatter();
5055
5115
  init_errors();
5056
5116
  var logger12 = createLogger("cli:next");
5057
- 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) => {
5058
5118
  try {
5059
5119
  const session = await requireSession();
5060
5120
  const activeCourse = await requireActiveCourse();
@@ -5132,7 +5192,7 @@ var nextCommand = new Command10("next").description("Advance to the next lesson
5132
5192
 
5133
5193
  // src/commands/lesson.ts
5134
5194
  init_dist();
5135
- import { Command as Command11 } from "commander";
5195
+ import { Command as Command12 } from "commander";
5136
5196
  init_guards();
5137
5197
  init_course_state();
5138
5198
  init_formatter();
@@ -5190,7 +5250,7 @@ function formatLessonContent(data, workspacePath, courseTitle) {
5190
5250
  }
5191
5251
  return lines.join("\n");
5192
5252
  }
5193
- 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(
5194
5254
  "--read <lessonId>",
5195
5255
  "Read a specific lesson by id (works on archived / read-only courses)"
5196
5256
  ).action(async (opts) => {
@@ -5261,7 +5321,7 @@ var lessonCommand = new Command11("lesson").description("Show the content of the
5261
5321
 
5262
5322
  // src/commands/knowledge.ts
5263
5323
  init_dist();
5264
- import { Command as Command12 } from "commander";
5324
+ import { Command as Command13 } from "commander";
5265
5325
  init_guards();
5266
5326
  init_formatter();
5267
5327
  var logger14 = createLogger("cli:knowledge");
@@ -5281,7 +5341,7 @@ function formatKnowledge(data) {
5281
5341
  });
5282
5342
  return lines.join("\n").trimEnd();
5283
5343
  }
5284
- 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) => {
5285
5345
  try {
5286
5346
  const activeCourse = await requireActiveCourse();
5287
5347
  if (!activeCourse.courseId) {
@@ -5312,13 +5372,13 @@ var knowledgeCommand = new Command12("knowledge").description("Show the active c
5312
5372
 
5313
5373
  // src/commands/hint.ts
5314
5374
  init_dist();
5315
- import { Command as Command13 } from "commander";
5375
+ import { Command as Command14 } from "commander";
5316
5376
  init_guards();
5317
5377
  init_course_state();
5318
5378
  init_formatter();
5319
5379
  init_errors();
5320
5380
  var logger15 = createLogger("cli:hint");
5321
- 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) => {
5322
5382
  try {
5323
5383
  const session = await requireSession();
5324
5384
  const activeCourse = await requireActiveCourse();
@@ -5369,7 +5429,7 @@ var hintCommand = new Command13("hint").description("Get a progressive hint for
5369
5429
  init_dist();
5370
5430
  import fs11 from "node:fs";
5371
5431
  import path14 from "node:path";
5372
- import { Command as Command14 } from "commander";
5432
+ import { Command as Command15 } from "commander";
5373
5433
 
5374
5434
  // ../../../../../Users/cleitonparis/www/pg/apps/cursos/packages/tostudy-core/src/exercises/validate-solution.ts
5375
5435
  async function validateSolution(input2, deps) {
@@ -19555,7 +19615,7 @@ async function clearRetryPin() {
19555
19615
  await updateWorkspaceState(ws.workspacePath, { retryLessonId: void 0 });
19556
19616
  }
19557
19617
  }
19558
- 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) => {
19559
19619
  try {
19560
19620
  const session = await requireSession();
19561
19621
  const activeCourse = await requireActiveCourse();
@@ -19693,13 +19753,13 @@ var validateCommand = new Command14("validate").description("Validate your solut
19693
19753
 
19694
19754
  // src/commands/retry.ts
19695
19755
  init_dist();
19696
- import { Command as Command15 } from "commander";
19756
+ import { Command as Command16 } from "commander";
19697
19757
  init_guards();
19698
19758
  init_workspace_state();
19699
19759
  init_formatter();
19700
19760
  var logger17 = createLogger("cli:retry");
19701
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;
19702
- 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) => {
19703
19763
  try {
19704
19764
  if (opts.clear) {
19705
19765
  const ws2 = await findWorkspaceState();
@@ -19760,8 +19820,8 @@ var retryCommand = new Command15("retry").description("Revalidate a lesson you a
19760
19820
  init_session_store();
19761
19821
  init_workspace_state();
19762
19822
  init_formatter();
19763
- import { Command as Command16 } from "commander";
19764
- 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 () => {
19765
19825
  const session = await getSession();
19766
19826
  const wsResult = session ? await findWorkspaceState() : null;
19767
19827
  const activeCourse = wsResult?.state ?? null;
@@ -19818,7 +19878,7 @@ var menuCommand = new Command16("menu").description("Show available commands and
19818
19878
 
19819
19879
  // src/commands/init.ts
19820
19880
  init_dist();
19821
- import { Command as Command17 } from "commander";
19881
+ import { Command as Command18 } from "commander";
19822
19882
  init_session_store();
19823
19883
  init_course_state();
19824
19884
  init_workspace_state();
@@ -20134,7 +20194,7 @@ Rode \`tostudy select <n\xFAmero>\` para ativar um curso.`,
20134
20194
  deps.output(artifacts.learnerBrief, { json: false });
20135
20195
  }
20136
20196
  }
20137
- 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(
20138
20198
  "--root-agents",
20139
20199
  "Add the ToStudy block to an existing AGENTS.md in this folder without asking"
20140
20200
  ).option("--json", "Output structured JSON").action(async (opts) => {
@@ -20143,7 +20203,7 @@ var initCommand = new Command17("init").description("Generate tutor instructions
20143
20203
 
20144
20204
  // src/commands/workspace.ts
20145
20205
  init_dist();
20146
- import { Command as Command18 } from "commander";
20206
+ import { Command as Command19 } from "commander";
20147
20207
 
20148
20208
  // ../../../../../Users/cleitonparis/www/pg/apps/cursos/packages/tostudy-core/src/workspace/setup-workspace.ts
20149
20209
  import fs12 from "node:fs/promises";
@@ -20434,7 +20494,7 @@ import path17 from "node:path";
20434
20494
  import os8 from "node:os";
20435
20495
  import fs14 from "node:fs/promises";
20436
20496
  var logger19 = createLogger("cli:workspace");
20437
- var workspaceCommand = new Command18("workspace").description(
20497
+ var workspaceCommand = new Command19("workspace").description(
20438
20498
  getErrors().workspaceCommandDescription
20439
20499
  );
20440
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) => {
@@ -20602,7 +20662,7 @@ workspaceCommand.command("status").description("Mostrar status do workspace do c
20602
20662
 
20603
20663
  // src/commands/export.ts
20604
20664
  init_dist();
20605
- import { Command as Command19 } from "commander";
20665
+ import { Command as Command20 } from "commander";
20606
20666
  init_guards();
20607
20667
  init_course_state();
20608
20668
  init_resolve();
@@ -20611,7 +20671,7 @@ import path18 from "node:path";
20611
20671
  import os9 from "node:os";
20612
20672
  import fs15 from "node:fs/promises";
20613
20673
  var logger20 = createLogger("cli:export");
20614
- 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) => {
20615
20675
  try {
20616
20676
  const session = await requireSession();
20617
20677
  const activeCourse = await requireActiveCourse();
@@ -20716,12 +20776,12 @@ init_guards();
20716
20776
  init_course_state();
20717
20777
  init_resolve();
20718
20778
  init_errors();
20719
- import { Command as Command20 } from "commander";
20779
+ import { Command as Command21 } from "commander";
20720
20780
  import { execFile as execFile3 } from "node:child_process";
20721
20781
  import path19 from "node:path";
20722
20782
  import os10 from "node:os";
20723
20783
  var logger21 = createLogger("cli:open");
20724
- 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) => {
20725
20785
  try {
20726
20786
  const activeCourse = await requireActiveCourse();
20727
20787
  const onboardingState = await getCourseOnboardingState(activeCourse.courseId);
@@ -20756,7 +20816,7 @@ var openCommand = new Command20("open").description("Abrir workspace do curso na
20756
20816
 
20757
20817
  // src/commands/vault.ts
20758
20818
  init_dist();
20759
- import { Command as Command21 } from "commander";
20819
+ import { Command as Command22 } from "commander";
20760
20820
 
20761
20821
  // ../../../../../Users/cleitonparis/www/pg/apps/cursos/packages/tostudy-core/src/vault/generate-vault-files.ts
20762
20822
  init_slug();
@@ -20802,7 +20862,7 @@ import path21 from "node:path";
20802
20862
  import os11 from "node:os";
20803
20863
  import fs17 from "node:fs/promises";
20804
20864
  var logger22 = createLogger("cli:vault");
20805
- var vaultCommand = new Command21("vault").description("Gerenciar vault Obsidian do curso");
20865
+ var vaultCommand = new Command22("vault").description("Gerenciar vault Obsidian do curso");
20806
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) => {
20807
20867
  try {
20808
20868
  const session = await requireSession();
@@ -20975,7 +21035,7 @@ init_formatter();
20975
21035
  init_errors();
20976
21036
  import os13 from "node:os";
20977
21037
  import path25 from "node:path";
20978
- import { Command as Command23 } from "commander";
21038
+ import { Command as Command24 } from "commander";
20979
21039
 
20980
21040
  // ../../../../../Users/cleitonparis/www/pg/apps/cursos/packages/validators/src/authored-course.ts
20981
21041
  import { createHash } from "node:crypto";
@@ -21917,7 +21977,7 @@ function installCreatorSkill(input2) {
21917
21977
  // src/commands/brief-open.ts
21918
21978
  init_guards();
21919
21979
  init_formatter();
21920
- import { Command as Command22 } from "commander";
21980
+ import { Command as Command23 } from "commander";
21921
21981
  import { execFile as execFile4 } from "node:child_process";
21922
21982
  import { platform } from "node:process";
21923
21983
  var BRIEF_URL = "https://tostudy.ai/student/settings/learner-brief";
@@ -21942,7 +22002,7 @@ function openUrl(url2, options = {}) {
21942
22002
  }
21943
22003
  });
21944
22004
  }
21945
- 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 () => {
21946
22006
  await requireSession();
21947
22007
  output(`Abrindo ${BRIEF_URL} no navegador...`, { json: false });
21948
22008
  openUrl(BRIEF_URL);
@@ -21950,7 +22010,7 @@ var briefOpenCommand = new Command22("brief-open").description("Open the learner
21950
22010
 
21951
22011
  // src/commands/creator.ts
21952
22012
  var logger23 = createLogger("cli:creator");
21953
- var creatorCommand = new Command23("creator").description(
22013
+ var creatorCommand = new Command24("creator").description(
21954
22014
  "Author a course with your own AI agent: init, validate, push, pull, audit, status, open"
21955
22015
  );
21956
22016
  function fail(err, opts, context) {
@@ -22247,8 +22307,8 @@ creatorCommand.command("open").description("Open the course in the creator porta
22247
22307
  init_guards();
22248
22308
  init_course_state();
22249
22309
  init_user_profile();
22250
- import { Command as Command24 } from "commander";
22251
- 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) => {
22252
22312
  const activeCourse = await requireActiveCourse();
22253
22313
  const onboarding = await getCourseOnboardingState(activeCourse.courseId);
22254
22314
  const profile = onboarding?.learnerProfile ?? await getUserProfile();
@@ -22310,10 +22370,10 @@ var profileCommand = new Command24("profile").description("Show your learner pro
22310
22370
  init_dist();
22311
22371
  init_guards();
22312
22372
  init_formatter();
22313
- import { Command as Command25 } from "commander";
22373
+ import { Command as Command26 } from "commander";
22314
22374
  init_workspace_state();
22315
22375
  var logger24 = createLogger("cli:sync");
22316
- 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(
22317
22377
  "--all-runtimes",
22318
22378
  "Write instruction files for every supported runtime, even undetected ones"
22319
22379
  ).option(
@@ -22385,10 +22445,10 @@ var syncCommand = new Command25("sync").description("Regenerate instruction file
22385
22445
  // src/commands/brief.ts
22386
22446
  init_dist();
22387
22447
  init_guards();
22388
- import { Command as Command26 } from "commander";
22448
+ import { Command as Command27 } from "commander";
22389
22449
  init_formatter();
22390
22450
  var logger25 = createLogger("cli:brief");
22391
- 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) => {
22392
22452
  try {
22393
22453
  const session = await requireSession();
22394
22454
  const cached2 = await readBriefCache();
@@ -22429,10 +22489,10 @@ var briefCommand = new Command26("brief").description("Show your base learner br
22429
22489
  // src/commands/brief-create.ts
22430
22490
  init_dist();
22431
22491
  init_guards();
22432
- import { Command as Command27 } from "commander";
22492
+ import { Command as Command28 } from "commander";
22433
22493
  init_formatter();
22434
22494
  var logger26 = createLogger("cli:brief-create");
22435
- 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 () => {
22436
22496
  try {
22437
22497
  const session = await requireSession();
22438
22498
  const answers = await collectBootstrapAnswers({ userName: session.userName });
@@ -22466,7 +22526,7 @@ init_dist();
22466
22526
  init_guards();
22467
22527
  init_workspace_state();
22468
22528
  import fs22 from "node:fs";
22469
- import { Command as Command28 } from "commander";
22529
+ import { Command as Command29 } from "commander";
22470
22530
 
22471
22531
  // src/sessions/storage.ts
22472
22532
  init_dist();
@@ -22515,7 +22575,7 @@ async function loadSessionContext(workspacePath) {
22515
22575
  // src/commands/compact.ts
22516
22576
  init_formatter();
22517
22577
  var logger28 = createLogger("cli:compact");
22518
- 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) => {
22519
22579
  try {
22520
22580
  const activeCourse = await requireActiveCourse();
22521
22581
  const ws = await findWorkspaceState();
@@ -22553,12 +22613,12 @@ var compactCommand = new Command28("compact").description("Save a module study s
22553
22613
  // src/commands/context.ts
22554
22614
  init_dist();
22555
22615
  init_workspace_state();
22556
- import { Command as Command29 } from "commander";
22616
+ import { Command as Command30 } from "commander";
22557
22617
  init_course_state();
22558
22618
  init_formatter();
22559
22619
  init_errors();
22560
22620
  var logger29 = createLogger("cli:context");
22561
- 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) => {
22562
22622
  try {
22563
22623
  const ws = await findWorkspaceState();
22564
22624
  if (!ws) {
@@ -22610,13 +22670,13 @@ var contextCommand = new Command29("context").description("Load session context
22610
22670
 
22611
22671
  // src/commands/memory.ts
22612
22672
  init_dist();
22613
- import { Command as Command30 } from "commander";
22673
+ import { Command as Command31 } from "commander";
22614
22674
  init_workspace_state();
22615
22675
  init_guards();
22616
22676
  init_formatter();
22617
22677
  init_errors();
22618
22678
  var logger30 = createLogger("cli:memory");
22619
- 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) => {
22620
22680
  try {
22621
22681
  const ws = await findWorkspaceState();
22622
22682
  if (!ws) {
@@ -22647,14 +22707,14 @@ var memoryCommand = new Command30("memory").description("Load accumulated studen
22647
22707
 
22648
22708
  // src/commands/insight.ts
22649
22709
  init_dist();
22650
- import { Command as Command31 } from "commander";
22710
+ import { Command as Command32 } from "commander";
22651
22711
  init_workspace_state();
22652
22712
  init_guards();
22653
22713
  init_formatter();
22654
22714
  init_errors();
22655
22715
  var logger31 = createLogger("cli:insight");
22656
22716
  var VALID_TYPES = ["difficulty", "breakthrough", "question"];
22657
- var insightCommand = new Command31("insight").description(
22717
+ var insightCommand = new Command32("insight").description(
22658
22718
  "Persist a student cognitive insight (difficulty | breakthrough | question) into course memory"
22659
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) => {
22660
22720
  try {
@@ -22702,7 +22762,7 @@ var insightCommand = new Command31("insight").description(
22702
22762
 
22703
22763
  // src/commands/level.ts
22704
22764
  init_dist();
22705
- import { Command as Command32 } from "commander";
22765
+ import { Command as Command33 } from "commander";
22706
22766
  init_guards();
22707
22767
  init_formatter();
22708
22768
  var logger32 = createLogger("cli:level");
@@ -22717,7 +22777,7 @@ var LEVEL_LABELS2 = {
22717
22777
  function isExerciseLevel2(value) {
22718
22778
  return ALL_LEVELS.includes(value);
22719
22779
  }
22720
- 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) => {
22721
22781
  try {
22722
22782
  const session = await requireSession();
22723
22783
  const activeCourse = await requireActiveCourse();
@@ -22782,10 +22842,10 @@ init_dist();
22782
22842
  init_guards();
22783
22843
  init_formatter();
22784
22844
  init_errors();
22785
- import { Command as Command33 } from "commander";
22845
+ import { Command as Command34 } from "commander";
22786
22846
  var logger33 = createLogger("cli:theory");
22787
22847
  var EXERCISE_LEVELS2 = ["L0", "L1", "L2", "L3", "L4"];
22788
- 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) => {
22789
22849
  try {
22790
22850
  const session = await requireSession();
22791
22851
  const active = await requireActiveCourse();
@@ -22880,7 +22940,7 @@ var theoryCommand = new Command33("theory").description("Request more theory on
22880
22940
  // src/commands/export-grades.ts
22881
22941
  init_dist();
22882
22942
  init_guards();
22883
- import { Command as Command34 } from "commander";
22943
+ import { Command as Command35 } from "commander";
22884
22944
 
22885
22945
  // src/formatters/grades.ts
22886
22946
  function formatGradesJson(attempts) {
@@ -23248,7 +23308,7 @@ async function runExportGrades(opts, deps = defaultDeps5) {
23248
23308
  if (!rendered.endsWith("\n")) rendered += "\n";
23249
23309
  deps.stdoutWrite(rendered);
23250
23310
  }
23251
- 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(
23252
23312
  "--course <slug>",
23253
23313
  "Slug do curso (gerado a partir do t\xEDtulo). Sem a flag, exporta o curso ativo."
23254
23314
  ).option("--format <json|csv|md>", "Formato de sa\xEDda (default: json)", "json").addHelpText(
@@ -23272,7 +23332,7 @@ C\xF3digos de sa\xEDda:
23272
23332
 
23273
23333
  // src/commands/grades.ts
23274
23334
  init_dist();
23275
- import { Command as Command35 } from "commander";
23335
+ import { Command as Command36 } from "commander";
23276
23336
  init_guards();
23277
23337
  var logger35 = createLogger("cli:grades");
23278
23338
  var defaultDeps6 = {
@@ -23428,7 +23488,7 @@ async function runGrades(opts, deps = defaultDeps6) {
23428
23488
  );
23429
23489
  deps.stdoutWrite(formatGradesAllEnrollmentsTable(summaries) + "\n");
23430
23490
  }
23431
- 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(
23432
23492
  "--course <slug>",
23433
23493
  "Slug do curso (gerado a partir do t\xEDtulo). Sem a flag, lista todos os cursos."
23434
23494
  ).addHelpText(
@@ -23452,7 +23512,7 @@ C\xF3digos de sa\xEDda:
23452
23512
  // src/commands/review.ts
23453
23513
  init_dist();
23454
23514
  init_guards();
23455
- import { Command as Command36 } from "commander";
23515
+ import { Command as Command37 } from "commander";
23456
23516
  import { createInterface } from "node:readline/promises";
23457
23517
  import { stdin as defaultStdin, stdout as defaultStdout } from "node:process";
23458
23518
  var logger36 = createLogger("cli:review");
@@ -23602,7 +23662,7 @@ async function runReview(slug, opts, deps = defaultDeps7) {
23602
23662
  }) + "\n"
23603
23663
  );
23604
23664
  }
23605
- 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(
23606
23666
  "after",
23607
23667
  `
23608
23668
  Exemplos:
@@ -23625,12 +23685,12 @@ C\xF3digos de sa\xEDda:
23625
23685
 
23626
23686
  // src/cli.ts
23627
23687
  function createProgram() {
23628
- const program = new Command37();
23688
+ const program = new Command38();
23629
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(
23630
23690
  "before",
23631
23691
  [
23632
23692
  "",
23633
- " Come\xE7ando: login \u2192 courses \u2192 select <n> \u2192 start",
23693
+ " Come\xE7ando: login \u2192 enroll <id> \u2192 courses \u2192 select <n> \u2192 start",
23634
23694
  " Estudando: next \xB7 lesson \xB7 hint \xB7 validate \xB7 theory \xB7 progress",
23635
23695
  " Com d\xFAvida: tostudy menu (mostra onde voc\xEA est\xE1 e o que fazer)",
23636
23696
  ""
@@ -23642,6 +23702,7 @@ function createProgram() {
23642
23702
  program.addCommand(loginCommand);
23643
23703
  program.addCommand(logoutCommand);
23644
23704
  program.addCommand(coursesCommand);
23705
+ program.addCommand(enrollCommand);
23645
23706
  program.addCommand(selectCommand);
23646
23707
  program.addCommand(progressCommand);
23647
23708
  program.addCommand(startCommand);