@tostudy-ai/cli 0.16.11 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +159 -49
- package/dist/cli.js.map +4 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -281,7 +281,7 @@ var require_picocolors = __commonJS({
|
|
|
281
281
|
}
|
|
282
282
|
});
|
|
283
283
|
|
|
284
|
-
// ../../node_modules/@parisgroup-ai/logger/dist/logger.base-
|
|
284
|
+
// ../../node_modules/@parisgroup-ai/logger/dist/logger.base-Bznav79x.mjs
|
|
285
285
|
function formatJson(entry) {
|
|
286
286
|
const { timestamp, level, message, service, environment, context, data, error: error49 } = entry;
|
|
287
287
|
const output3 = {
|
|
@@ -385,8 +385,8 @@ function extractErrorInfo(error49, includeStack, visited = /* @__PURE__ */ new W
|
|
|
385
385
|
return info;
|
|
386
386
|
}
|
|
387
387
|
var import_picocolors, LOG_LEVELS, LEVEL_COLORS, LEVEL_WIDTH, BaseLogger;
|
|
388
|
-
var
|
|
389
|
-
"../../node_modules/@parisgroup-ai/logger/dist/logger.base-
|
|
388
|
+
var init_logger_base_Bznav79x = __esm({
|
|
389
|
+
"../../node_modules/@parisgroup-ai/logger/dist/logger.base-Bznav79x.mjs"() {
|
|
390
390
|
init_sanitize_DSkXy3jL();
|
|
391
391
|
import_picocolors = __toESM(require_picocolors(), 1);
|
|
392
392
|
LOG_LEVELS = {
|
|
@@ -708,7 +708,7 @@ function createLogger(module, options) {
|
|
|
708
708
|
var asyncLocalStorage, ConsoleTransport, FileTransport, HttpTransport, SINGLETON_KEY$1, SEVERITY, OtlpLogsTransport, SINGLETON_KEY, Logger, logger;
|
|
709
709
|
var init_dist = __esm({
|
|
710
710
|
"../../node_modules/@parisgroup-ai/logger/dist/index.mjs"() {
|
|
711
|
-
|
|
711
|
+
init_logger_base_Bznav79x();
|
|
712
712
|
init_sanitize_DSkXy3jL();
|
|
713
713
|
asyncLocalStorage = new AsyncLocalStorage();
|
|
714
714
|
ConsoleTransport = class {
|
|
@@ -1058,8 +1058,9 @@ async function cliApiFetch(url2, token, init) {
|
|
|
1058
1058
|
if (!response.ok) {
|
|
1059
1059
|
const code = typeof body.error === "string" && body.error.length > 0 ? body.error : void 0;
|
|
1060
1060
|
const friendly = typeof body.message === "string" && body.message.length > 0 ? body.message : void 0;
|
|
1061
|
+
const unauthenticated = response.status === 401 ? "Sess\xE3o inv\xE1lida ou expirada. Rode: tostudy login" : void 0;
|
|
1061
1062
|
throw new CliApiError(
|
|
1062
|
-
friendly ?? code ?? `API error ${response.status}`,
|
|
1063
|
+
friendly ?? unauthenticated ?? code ?? `API error ${response.status}`,
|
|
1063
1064
|
response.status,
|
|
1064
1065
|
code
|
|
1065
1066
|
);
|
|
@@ -1925,7 +1926,11 @@ function renderCourseInstruction(input2) {
|
|
|
1925
1926
|
sections.push(renderHowToAdapt(input2.enrollmentProfile));
|
|
1926
1927
|
sections.push(renderPrecedence());
|
|
1927
1928
|
sections.push(renderWhereStudentIs(input2.progress));
|
|
1929
|
+
sections.push(renderMemoryLoad());
|
|
1928
1930
|
sections.push(renderHowToConduct());
|
|
1931
|
+
sections.push(renderStudentAuthorship());
|
|
1932
|
+
sections.push(renderConceptBeforeApplication());
|
|
1933
|
+
sections.push(renderTrainingCaseFraming());
|
|
1929
1934
|
sections.push(renderSilentTools());
|
|
1930
1935
|
sections.push(renderHandlingSituations());
|
|
1931
1936
|
sections.push(renderTechnicalReference());
|
|
@@ -1966,6 +1971,9 @@ Rode \`tostudy context --json\` em sil\xEAncio para descobrir o estado do aluno.
|
|
|
1966
1971
|
3. Se houver summaries, mencione brevemente: "Da \xFAltima vez paramos em {ultimoModulo}. Pronto pra continuar?"
|
|
1967
1972
|
4. Siga "Como Conduzir a Aula" abaixo.`);
|
|
1968
1973
|
sections.push(renderHowToConduct());
|
|
1974
|
+
sections.push(renderStudentAuthorship());
|
|
1975
|
+
sections.push(renderConceptBeforeApplication());
|
|
1976
|
+
sections.push(renderTrainingCaseFraming());
|
|
1969
1977
|
sections.push(renderSilentTools());
|
|
1970
1978
|
sections.push(`## Compacta\xE7\xE3o de Contexto (Autom\xE1tico)
|
|
1971
1979
|
|
|
@@ -1982,7 +1990,7 @@ Quando \`tostudy next --json\` retornar \`MODULE_COMPLETE\`:
|
|
|
1982
1990
|
Isso garante continuidade entre sess\xF5es e evita estouro de contexto em sess\xF5es longas.`);
|
|
1983
1991
|
sections.push(renderHandlingSituations());
|
|
1984
1992
|
sections.push(renderTechnicalReference());
|
|
1985
|
-
sections.push(`<!-- tostudy-template-version:
|
|
1993
|
+
sections.push(`<!-- tostudy-template-version: 5 -->`);
|
|
1986
1994
|
return sections.join("\n\n") + "\n";
|
|
1987
1995
|
}
|
|
1988
1996
|
function renderTitle(input2) {
|
|
@@ -2041,7 +2049,7 @@ function renderWhoIsStudent(brief, profile) {
|
|
|
2041
2049
|
if (brief && brief.text.trim().length > 0) {
|
|
2042
2050
|
parts.push(brief.text);
|
|
2043
2051
|
parts.push(
|
|
2044
|
-
|
|
2052
|
+
'_(Este \xE9 o brief que o aluno escreveu sobre si mesmo. Use como contexto principal \u2014 nomes, empresa, projetos reais, motiva\xE7\xF5es. Tudo que voc\xEA disser deve parecer que voc\xEA leu e entendeu quem ele \xE9. O brief descreve quem ele \xE9 profissionalmente \u2014 N\xC3O o n\xEDvel dele neste curso: "avan\xE7ado" em outra \xE1rea n\xE3o vale como avan\xE7ado aqui.)_'
|
|
2045
2053
|
);
|
|
2046
2054
|
} else {
|
|
2047
2055
|
parts.push(
|
|
@@ -2074,7 +2082,7 @@ function renderHowToAdapt(profile) {
|
|
|
2074
2082
|
if (!profile) {
|
|
2075
2083
|
return `### Como Adaptar
|
|
2076
2084
|
|
|
2077
|
-
Sem informa\xE7\xE3o de n\xEDvel espec\xEDfico deste curso \u2014
|
|
2085
|
+
Sem informa\xE7\xE3o de n\xEDvel espec\xEDfico deste curso \u2014 o brief base N\xC3O vale como n\xEDvel neste assunto. Comece explicativo mas breve; calibre pelo que o aluno demonstrar aqui. Na d\xFAvida, prefira "porqu\xEA antes do como".`;
|
|
2078
2086
|
}
|
|
2079
2087
|
if (profile.learnerLevel === "beginner") {
|
|
2080
2088
|
return `### Como Adaptar
|
|
@@ -2114,6 +2122,9 @@ Voc\xEA tem DUAS fontes que te orientam, e elas resolvem conflitos assim:
|
|
|
2114
2122
|
| ----------------------------- | ----------------------------- | ---------------------------------------------- |
|
|
2115
2123
|
| Sua **persona** (acima) | voz, tom, nome, express\xF5es | usar catchphrase do creator ao cumprimentar |
|
|
2116
2124
|
| **Contexto do aluno** (acima) | profundidade, ritmo, exemplos | "vou come\xE7ar pelo porqu\xEA" (iniciante) |
|
|
2125
|
+
| **Brief base (T1)** | quem ele \xE9 (nomes, projetos) | exemplos com o contexto real dele |
|
|
2126
|
+
|
|
2127
|
+
O brief base NUNCA define o n\xEDvel neste curso \u2014 o n\xEDvel vem do campo "Neste Curso" e do que o aluno demonstra nas respostas aqui.
|
|
2117
2128
|
|
|
2118
2129
|
**Se conflitam, ambos valem ao mesmo tempo.** Voc\xEA mant\xE9m sua voz E adapta a profundidade. Exemplo: persona \`technical\` + aluno \`beginner\` \u2014 voc\xEA explica conceitos t\xE9cnicos de forma precisa MAS sempre come\xE7a pelo "porqu\xEA" antes do "como", e traduz jarg\xE3o na primeira vez que usa.`;
|
|
2119
2130
|
}
|
|
@@ -2152,6 +2163,33 @@ Quando o aluno passou na li\xE7\xE3o:
|
|
|
2152
2163
|
- Pergunte se ele quer seguir ou pausar.
|
|
2153
2164
|
- Ao seguir \u2014 \`tostudy next\` (sil\xEAncio) \u2014 apresente a pr\xF3xima.`;
|
|
2154
2165
|
}
|
|
2166
|
+
function renderMemoryLoad() {
|
|
2167
|
+
return `## Mem\xF3ria do Aluno
|
|
2168
|
+
|
|
2169
|
+
No in\xEDcio de cada sess\xE3o, rode \`tostudy memory --json\` em sil\xEAncio. Use as dificuldades conhecidas e os pontos fortes para calibrar ritmo e exemplos \u2014 reforce onde ele travou, n\xE3o repita o que ele j\xE1 domina. NUNCA mostre esse bloco cru ao aluno.`;
|
|
2170
|
+
}
|
|
2171
|
+
function renderStudentAuthorship() {
|
|
2172
|
+
return `## Autoria do Aluno (OBRIGAT\xD3RIO)
|
|
2173
|
+
|
|
2174
|
+
Em li\xE7\xF5es de **exerc\xEDcio, quiz ou checkpoint**, a resposta \xE9 do ALUNO \u2014 nunca sua.
|
|
2175
|
+
|
|
2176
|
+
1. **Nunca redija a resposta sozinho.** Antes de escrever qualquer arquivo de resposta, pergunte ao aluno as decis\xF5es que o exerc\xEDcio pede (par\xE2metros, valores, escolhas \u2014 "qual dura\xE7\xE3o voc\xEA quer no gancho?", "qual curva voc\xEA escolhe para a aterrissagem?"). Rascunhe A PARTIR das respostas dele, com ele.
|
|
2177
|
+
2. **S\xF3 rode \`tostudy validate\` depois que o aluno revisar e confirmar a resposta como dele.** "Sim", "pr\xF3xima" ou "monte o arquivo" N\xC3O \xE9 resposta \u2014 \xE9 a deixa para voc\xEA perguntar a primeira decis\xE3o.
|
|
2178
|
+
3. **S\xF3 rode \`tostudy next\` quando o aluno pedir para avan\xE7ar com as pr\xF3prias palavras.** Nunca encadeie validate \u2192 next sem uma fala do aluno entre os dois.
|
|
2179
|
+
4. Isso vale em QUALQUER abordagem de ensino, incluindo explora\xE7\xE3o com IA: voc\xEA demonstra ferramentas e executa passos JUNTO com o aluno, mas exerc\xEDcios e checkpoints medem o que ELE decide. Sem as decis\xF5es dele, n\xE3o h\xE1 o que validar.`;
|
|
2180
|
+
}
|
|
2181
|
+
function renderConceptBeforeApplication() {
|
|
2182
|
+
return `## Conceito Antes da Aplica\xE7\xE3o (OBRIGAT\xD3RIO)
|
|
2183
|
+
|
|
2184
|
+
1. **N\xE3o cobre a aplica\xE7\xE3o de um termo que o aluno ainda n\xE3o explicou.** Antes de pedir uma decis\xE3o t\xE9cnica sobre um conceito novo, pe\xE7a que ele o descreva com as pr\xF3prias palavras. Se ele n\xE3o souber, ensine \u2014 analogia + exemplo \u2014 e s\xF3 ent\xE3o volte ao exerc\xEDcio.
|
|
2185
|
+
2. **"N\xE3o entendi" trava a aplica\xE7\xE3o.** Se o aluno pedir mais did\xE1tica ou disser que n\xE3o entendeu, explique por outro \xE2ngulo ou rode \`tostudy theory\` (em sil\xEAncio) e traduza. NUNCA repita a mesma pergunta de aplica\xE7\xE3o sem ensinar algo novo antes.
|
|
2186
|
+
3. **Dificuldade registrada = ritmo did\xE1tico.** Se a mem\xF3ria (\`tostudy memory\`) mostra dificuldades ou o aluno pediu ritmo mais did\xE1tico, priorize cheques de conceito antes de cada exerc\xEDcio \u2014 mesmo que o brief base diga "avan\xE7ado". O n\xEDvel dele NESTE curso \xE9 o que ele demonstra aqui.`;
|
|
2187
|
+
}
|
|
2188
|
+
function renderTrainingCaseFraming() {
|
|
2189
|
+
return `## Enquadramento de Caso de Treino (OBRIGAT\xD3RIO)
|
|
2190
|
+
|
|
2191
|
+
1. **SEMPRE identifique personas ou datasets fict\xEDcios de aulas realworld como cen\xE1rios de treino.** Fa\xE7a isso ANTES de apresentar a persona, os dados ou qualquer resultado derivado deles. **NUNCA apresente a sa\xEDda de um caso de treino como resultado do pr\xF3prio neg\xF3cio do aluno.** Esta regra se aplica a TODOS os tipos de aula \u2014 incluindo realworld, checkpoint, intro, conceito e exerc\xEDcio.`;
|
|
2192
|
+
}
|
|
2155
2193
|
function renderSilentTools() {
|
|
2156
2194
|
return `## Ferramentas Silenciosas
|
|
2157
2195
|
|
|
@@ -2163,6 +2201,8 @@ Estes comandos s\xE3o suas ferramentas. Rode em sil\xEAncio (sem anunciar), use
|
|
|
2163
2201
|
- \`tostudy next --json\` \u2014 avan\xE7a para a pr\xF3xima li\xE7\xE3o.
|
|
2164
2202
|
- \`tostudy hint --json\` \u2014 dica progressiva (3 n\xEDveis).
|
|
2165
2203
|
- \`tostudy validate <arquivo>\` \u2014 valida exerc\xEDcio (exit 0 = passou, 1 = falhou).
|
|
2204
|
+
- \`tostudy theory --json\` \u2014 micro-aula extra na li\xE7\xE3o atual (aceita \`--focus "<tema>"\`). Use quando o aluno disser "n\xE3o entendi" ou pedir mais did\xE1tica.
|
|
2205
|
+
- \`tostudy level --json\` \u2014 v\xEA/ajusta o n\xEDvel de scaffolding dos exerc\xEDcios (os n\xEDveis DISPON\xCDVEIS v\xEAm no \`--json\`; ofere\xE7a s\xF3 esses). Use quando o exerc\xEDcio est\xE1 acima ou abaixo do ponto do aluno.
|
|
2166
2206
|
|
|
2167
2207
|
- \`tostudy insight <tipo> "<descri\xE7\xE3o>" --json\` \u2014 registra na mem\xF3ria do curso um sinal cognitivo do aluno. Tipos: \`difficulty\` (travou ou confundiu um conceito), \`breakthrough\` (teve um clique, dominou algo), \`question\` (d\xFAvida recorrente).
|
|
2168
2208
|
|
|
@@ -2176,6 +2216,7 @@ function renderHandlingSituations() {
|
|
|
2176
2216
|
| Situa\xE7\xE3o | O que fazer |
|
|
2177
2217
|
| ------------------------------------- | ---------------------------------------------------------- |
|
|
2178
2218
|
| \`tostudy validate\` falhou | Mostrar feedback, sugerir \`tostudy hint\`, tentar de novo |
|
|
2219
|
+
| Aluno diz "n\xE3o entendi" / quer did\xE1tica | Explicar por outro \xE2ngulo, \`tostudy theory\` (em sil\xEAncio); n\xE3o repetir a pergunta de aplica\xE7\xE3o |
|
|
2179
2220
|
| "Nenhuma li\xE7\xE3o ativa" | Rodar \`tostudy start\` para carregar m\xF3dulo |
|
|
2180
2221
|
| Comando retorna erro | Verificar \`tostudy doctor\` para diagn\xF3stico |
|
|
2181
2222
|
| Aluno perdido / sem saber o que fazer | Rodar \`tostudy progress\` e resumir estado atual |
|
|
@@ -2194,7 +2235,7 @@ function renderTechnicalReference() {
|
|
|
2194
2235
|
}
|
|
2195
2236
|
function renderFooter(course) {
|
|
2196
2237
|
return `<!-- tostudy-course-id: ${course.courseId} -->
|
|
2197
|
-
<!-- tostudy-template-version:
|
|
2238
|
+
<!-- tostudy-template-version: 4 -->`;
|
|
2198
2239
|
}
|
|
2199
2240
|
var TONE_LABELS, LEVEL_LABELS;
|
|
2200
2241
|
var init_instruction_template_v3 = __esm({
|
|
@@ -2617,11 +2658,18 @@ var init_login = __esm({
|
|
|
2617
2658
|
}
|
|
2618
2659
|
if (opts.manual) {
|
|
2619
2660
|
console.log(`
|
|
2620
|
-
|
|
2621
|
-
console.log(`
|
|
2661
|
+
Login sem browser nesta m\xE1quina:`);
|
|
2662
|
+
console.log(` 1. Em um computador com browser, acesse:`);
|
|
2663
|
+
console.log(` ${apiUrl}/api/cli/auth/authorize`);
|
|
2664
|
+
console.log(
|
|
2665
|
+
` 2. Ap\xF3s autorizar, o browser tenta abrir http://localhost:9876/callback?code=...`
|
|
2666
|
+
);
|
|
2667
|
+
console.log(
|
|
2668
|
+
` e falha (n\xE3o h\xE1 CLI nesse computador). Copie o valor de "code" da barra de endere\xE7o.`
|
|
2669
|
+
);
|
|
2670
|
+
console.log(` 3. Em at\xE9 5 minutos, volte aqui e rode:`);
|
|
2671
|
+
console.log(` tostudy login --code <code>
|
|
2622
2672
|
`);
|
|
2623
|
-
console.log(" Ap\xF3s autorizar, o browser ser\xE1 redirecionado e o login ser\xE1 conclu\xEDdo.");
|
|
2624
|
-
console.log(" Certifique-se de rodar este comando sem --manual para o fluxo autom\xE1tico.\n");
|
|
2625
2673
|
return;
|
|
2626
2674
|
}
|
|
2627
2675
|
console.log("\n Abrindo browser para autentica\xE7\xE3o...\n");
|
|
@@ -3224,30 +3272,43 @@ var init_resolve = __esm({
|
|
|
3224
3272
|
});
|
|
3225
3273
|
|
|
3226
3274
|
// src/auth/guards.ts
|
|
3275
|
+
var guards_exports = {};
|
|
3276
|
+
__export(guards_exports, {
|
|
3277
|
+
requireActiveCourse: () => requireActiveCourse,
|
|
3278
|
+
requireSession: () => requireSession
|
|
3279
|
+
});
|
|
3227
3280
|
async function refreshCliSession(session, configDir) {
|
|
3281
|
+
let response;
|
|
3228
3282
|
try {
|
|
3229
|
-
|
|
3283
|
+
response = await fetch(`${session.apiUrl}/api/cli/auth/refresh`, {
|
|
3230
3284
|
method: "POST",
|
|
3231
3285
|
headers: { "Content-Type": "application/json" },
|
|
3232
3286
|
body: JSON.stringify({ refreshToken: session.refreshToken })
|
|
3233
3287
|
});
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
const data = await response.json();
|
|
3239
|
-
const refreshed = {
|
|
3240
|
-
...session,
|
|
3241
|
-
token: data.token,
|
|
3242
|
-
refreshToken: data.refreshToken,
|
|
3243
|
-
expiresAt: data.expiresAt
|
|
3244
|
-
};
|
|
3245
|
-
await saveSession(refreshed, configDir);
|
|
3246
|
-
return refreshed;
|
|
3247
|
-
} catch {
|
|
3288
|
+
} catch (err) {
|
|
3289
|
+
return { status: "unavailable", reason: err instanceof Error ? err.message : String(err) };
|
|
3290
|
+
}
|
|
3291
|
+
if (response.status === 401 || response.status === 403) {
|
|
3248
3292
|
await clearSessionArtifacts(configDir);
|
|
3249
|
-
return
|
|
3293
|
+
return { status: "rejected" };
|
|
3294
|
+
}
|
|
3295
|
+
if (!response.ok) {
|
|
3296
|
+
return { status: "unavailable", reason: `HTTP ${response.status}` };
|
|
3250
3297
|
}
|
|
3298
|
+
let data;
|
|
3299
|
+
try {
|
|
3300
|
+
data = await response.json();
|
|
3301
|
+
} catch (err) {
|
|
3302
|
+
return { status: "unavailable", reason: err instanceof Error ? err.message : String(err) };
|
|
3303
|
+
}
|
|
3304
|
+
const refreshed = {
|
|
3305
|
+
...session,
|
|
3306
|
+
token: data.token,
|
|
3307
|
+
refreshToken: data.refreshToken,
|
|
3308
|
+
expiresAt: data.expiresAt
|
|
3309
|
+
};
|
|
3310
|
+
await saveSession(refreshed, configDir);
|
|
3311
|
+
return { status: "ok", session: refreshed };
|
|
3251
3312
|
}
|
|
3252
3313
|
async function requireSession(configDir) {
|
|
3253
3314
|
const session = await getSession(configDir);
|
|
@@ -3257,12 +3318,17 @@ async function requireSession(configDir) {
|
|
|
3257
3318
|
}
|
|
3258
3319
|
const expiresAt = new Date(session.expiresAt);
|
|
3259
3320
|
if (expiresAt < /* @__PURE__ */ new Date()) {
|
|
3260
|
-
const
|
|
3261
|
-
if (
|
|
3321
|
+
const outcome = await refreshCliSession(session, configDir);
|
|
3322
|
+
if (outcome.status === "ok") return outcome.session;
|
|
3323
|
+
if (outcome.status === "rejected") {
|
|
3262
3324
|
process.stderr.write("Erro: Sess\xE3o expirada. Rode: tostudy login\n");
|
|
3263
3325
|
process.exit(2);
|
|
3264
3326
|
}
|
|
3265
|
-
|
|
3327
|
+
process.stderr.write(
|
|
3328
|
+
`Erro: N\xE3o foi poss\xEDvel renovar a sess\xE3o (${outcome.reason}). Sua sess\xE3o foi mantida \u2014 verifique a conex\xE3o e tente de novo.
|
|
3329
|
+
`
|
|
3330
|
+
);
|
|
3331
|
+
process.exit(4);
|
|
3266
3332
|
}
|
|
3267
3333
|
return session;
|
|
3268
3334
|
}
|
|
@@ -3413,7 +3479,7 @@ var CLI_VERSION;
|
|
|
3413
3479
|
var init_version = __esm({
|
|
3414
3480
|
"src/version.ts"() {
|
|
3415
3481
|
"use strict";
|
|
3416
|
-
CLI_VERSION = true ? "0.
|
|
3482
|
+
CLI_VERSION = true ? "0.17.0" : "0.7.1";
|
|
3417
3483
|
}
|
|
3418
3484
|
});
|
|
3419
3485
|
|
|
@@ -4372,6 +4438,7 @@ var init_select = __esm({
|
|
|
4372
4438
|
interactive: isInteractiveTerminal(opts.json)
|
|
4373
4439
|
});
|
|
4374
4440
|
let pipelineResult = null;
|
|
4441
|
+
let pipelineError = null;
|
|
4375
4442
|
try {
|
|
4376
4443
|
pipelineResult = await resolveAndGenerate(
|
|
4377
4444
|
{ courseId: detail.courseId, enrollmentId },
|
|
@@ -4382,9 +4449,8 @@ var init_select = __esm({
|
|
|
4382
4449
|
}
|
|
4383
4450
|
);
|
|
4384
4451
|
} catch (err) {
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
});
|
|
4452
|
+
pipelineError = err instanceof Error ? err.message : String(err);
|
|
4453
|
+
logger8.warn("Failed to run instruction pipeline", { error: pipelineError });
|
|
4388
4454
|
}
|
|
4389
4455
|
const slugMatch = pipelineResult?.wroteFiles.find((f) => f.startsWith(".claude/commands/"))?.match(/tostudy-(.+)\.md$/);
|
|
4390
4456
|
const courseSlug2 = slugMatch?.[1] ?? "";
|
|
@@ -4402,7 +4468,8 @@ var init_select = __esm({
|
|
|
4402
4468
|
usedT0: pipelineResult?.usedT0 ?? false,
|
|
4403
4469
|
usedT1: pipelineResult?.usedT1 ?? false,
|
|
4404
4470
|
usedT2: pipelineResult?.usedT2 ?? false,
|
|
4405
|
-
instruction: pipelineResult?.renderedInstruction ?? null
|
|
4471
|
+
instruction: pipelineResult?.renderedInstruction ?? null,
|
|
4472
|
+
pipelineError
|
|
4406
4473
|
},
|
|
4407
4474
|
{ json: true }
|
|
4408
4475
|
);
|
|
@@ -4426,7 +4493,8 @@ var init_select = __esm({
|
|
|
4426
4493
|
` Progresso: ${detail.progress}% | ${detail.moduleCount} m\xF3dulos | ${detail.lessonCount} li\xE7\xF5es`,
|
|
4427
4494
|
wsLine,
|
|
4428
4495
|
"",
|
|
4429
|
-
|
|
4496
|
+
pipelineError ? `\u26A0 Arquivos de contexto N\xC3O foram criados (${pipelineError}).
|
|
4497
|
+
Rode \`tostudy select\` de novo com a conex\xE3o ativa.` : " Arquivos de contexto criados para seu assistente AI."
|
|
4430
4498
|
];
|
|
4431
4499
|
if (pipelineResult && !pipelineResult.usedT0) {
|
|
4432
4500
|
lines.push(" (sem persona do creator \u2014 usando tutor neutro)");
|
|
@@ -19635,6 +19703,13 @@ var init_credit_payment_enums = __esm({
|
|
|
19635
19703
|
}
|
|
19636
19704
|
});
|
|
19637
19705
|
|
|
19706
|
+
// ../../packages/types/src/meeting-integrations.ts
|
|
19707
|
+
var init_meeting_integrations = __esm({
|
|
19708
|
+
"../../packages/types/src/meeting-integrations.ts"() {
|
|
19709
|
+
"use strict";
|
|
19710
|
+
}
|
|
19711
|
+
});
|
|
19712
|
+
|
|
19638
19713
|
// ../../packages/types/src/referral.ts
|
|
19639
19714
|
var init_referral = __esm({
|
|
19640
19715
|
"../../packages/types/src/referral.ts"() {
|
|
@@ -19658,6 +19733,7 @@ var init_src = __esm({
|
|
|
19658
19733
|
init_lesson_review();
|
|
19659
19734
|
init_errors4();
|
|
19660
19735
|
init_credit_payment_enums();
|
|
19736
|
+
init_meeting_integrations();
|
|
19661
19737
|
init_referral();
|
|
19662
19738
|
}
|
|
19663
19739
|
});
|
|
@@ -20427,15 +20503,27 @@ Rode \`tostudy select <n\xFAmero>\` para ativar um curso.`,
|
|
|
20427
20503
|
progressData,
|
|
20428
20504
|
learnerProfile
|
|
20429
20505
|
);
|
|
20430
|
-
await deps.saveRemoteEnrollmentOnboarding({
|
|
20431
|
-
apiUrl: session.apiUrl,
|
|
20432
|
-
token: session.token,
|
|
20433
|
-
enrollmentId: activeCourse.enrollmentId,
|
|
20434
|
-
learnerBrief: artifacts.learnerBrief,
|
|
20435
|
-
learnerProfile,
|
|
20436
|
-
source: "cli"
|
|
20437
|
-
});
|
|
20438
20506
|
await deps.saveCourseLearnerProfile(activeCourse, learnerProfile, artifacts);
|
|
20507
|
+
try {
|
|
20508
|
+
await deps.saveRemoteEnrollmentOnboarding({
|
|
20509
|
+
apiUrl: session.apiUrl,
|
|
20510
|
+
token: session.token,
|
|
20511
|
+
enrollmentId: activeCourse.enrollmentId,
|
|
20512
|
+
learnerBrief: artifacts.learnerBrief,
|
|
20513
|
+
learnerProfile,
|
|
20514
|
+
source: "cli"
|
|
20515
|
+
});
|
|
20516
|
+
} catch (err) {
|
|
20517
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
20518
|
+
deps.logger.warn("Failed to save enrollment onboarding remotely", { error: reason });
|
|
20519
|
+
if (!flags.json) {
|
|
20520
|
+
process.stderr.write(
|
|
20521
|
+
`\u26A0 Suas respostas foram salvas neste computador, mas n\xE3o chegaram ao servidor (${reason}).
|
|
20522
|
+
Rode \`tostudy init\` de novo com a conex\xE3o ativa para sincronizar.
|
|
20523
|
+
`
|
|
20524
|
+
);
|
|
20525
|
+
}
|
|
20526
|
+
}
|
|
20439
20527
|
try {
|
|
20440
20528
|
const rootAgents = await resolveRootAgentsConsent({
|
|
20441
20529
|
cwd: process.cwd(),
|
|
@@ -20493,7 +20581,13 @@ var init_init = __esm({
|
|
|
20493
20581
|
init_pipeline_deps();
|
|
20494
20582
|
logger17 = createLogger("cli:init");
|
|
20495
20583
|
defaultDeps4 = {
|
|
20496
|
-
|
|
20584
|
+
// GH #1419 item 3 — `init` used the raw session, so an expired access
|
|
20585
|
+
// token met the POST as a 401. Refresh through the guard when one exists.
|
|
20586
|
+
getSession: async () => {
|
|
20587
|
+
if (!await getSession()) return null;
|
|
20588
|
+
const { requireSession: requireSession2 } = await Promise.resolve().then(() => (init_guards(), guards_exports));
|
|
20589
|
+
return requireSession2();
|
|
20590
|
+
},
|
|
20497
20591
|
findWorkspaceState,
|
|
20498
20592
|
listCourses,
|
|
20499
20593
|
getProgress,
|
|
@@ -22957,8 +23051,17 @@ __export(cli_exports, {
|
|
|
22957
23051
|
import { Command as Command35 } from "commander";
|
|
22958
23052
|
function createProgram() {
|
|
22959
23053
|
const program2 = new Command35();
|
|
22960
|
-
program2.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")
|
|
22961
|
-
|
|
23054
|
+
program2.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(
|
|
23055
|
+
"before",
|
|
23056
|
+
[
|
|
23057
|
+
"",
|
|
23058
|
+
" Come\xE7ando: login \u2192 courses \u2192 select <n> \u2192 start",
|
|
23059
|
+
" Estudando: next \xB7 lesson \xB7 hint \xB7 validate \xB7 theory \xB7 progress",
|
|
23060
|
+
" Com d\xFAvida: tostudy menu (mostra onde voc\xEA est\xE1 e o que fazer)",
|
|
23061
|
+
""
|
|
23062
|
+
].join("\n")
|
|
23063
|
+
);
|
|
23064
|
+
program2.addCommand(setupCommand, { hidden: true });
|
|
22962
23065
|
program2.addCommand(doctorCommand);
|
|
22963
23066
|
program2.addCommand(initCommand);
|
|
22964
23067
|
program2.addCommand(loginCommand);
|
|
@@ -23134,6 +23237,13 @@ if (!process.env["TOSTUDY_LOCALE"]) {
|
|
|
23134
23237
|
var { createProgram: createProgram2, CLI_VERSION: CLI_VERSION2 } = await Promise.resolve().then(() => (init_cli(), cli_exports));
|
|
23135
23238
|
var { checkForUpdates: checkForUpdates2 } = await Promise.resolve().then(() => (init_update_checker(), update_checker_exports));
|
|
23136
23239
|
var { maybeAutoUpdate: maybeAutoUpdate2 } = await Promise.resolve().then(() => (init_auto_updater(), auto_updater_exports));
|
|
23240
|
+
process.on("unhandledRejection", (reason) => {
|
|
23241
|
+
const msg = reason instanceof Error ? reason.message : String(reason);
|
|
23242
|
+
process.stderr.write(`Erro: ${msg}
|
|
23243
|
+
Se o problema continuar, rode: tostudy doctor
|
|
23244
|
+
`);
|
|
23245
|
+
process.exit(1);
|
|
23246
|
+
});
|
|
23137
23247
|
var program = createProgram2();
|
|
23138
23248
|
program.parse();
|
|
23139
23249
|
checkForUpdates2(CLI_VERSION2);
|