@devquest/cli 1.0.9 → 1.1.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.
@@ -44,16 +44,24 @@ async function testStage1(cwd) {
44
44
  }
45
45
  const output = result.stdout;
46
46
  console.log(chalk_1.default.gray(`Saída do usuário:\n${output}`));
47
- // Validação mock para o estágio 1: o usuário deve imprimir algo relacionado a tokens
48
- // Na plataforma real, esperaríamos JSON estruturado, aqui buscamos palavras-chave
49
- const lowerOutput = output.toLowerCase();
50
- const hasTokens = lowerOutput.includes('token') || lowerOutput.includes('const') || lowerOutput.includes('x');
51
- if (hasTokens) {
52
- console.log(chalk_1.default.green(`✅ Scanner identificou os tokens básicos com sucesso.`));
53
- return true;
47
+ // Validação rigorosa: O Estágio 1 espera que o usuário imprima uma lista de tokens em JSON
48
+ try {
49
+ const tokens = JSON.parse(output.trim());
50
+ const hasConst = tokens.some((t) => t.type === 'KEYWORD' && t.value === 'const');
51
+ const hasIdentifier = tokens.some((t) => t.type === 'IDENTIFIER' && t.value === 'x');
52
+ const hasLiteral = tokens.some((t) => t.type === 'LITERAL' && t.value === '10');
53
+ if (hasConst && hasIdentifier && hasLiteral) {
54
+ console.log(chalk_1.default.green(`✅ Scanner identificou os tokens (const, x, 10) corretamente no formato JSON.`));
55
+ return true;
56
+ }
57
+ else {
58
+ console.log(chalk_1.default.red(`❌ Scanner produziu JSON, mas os tokens esperados (const, x, 10) não foram encontrados ou estão no formato errado.`));
59
+ return false;
60
+ }
54
61
  }
55
- else {
56
- console.log(chalk_1.default.red(`❌ Scanner não produziu a saída esperada (tokens ou logs de depuração).`));
62
+ catch (e) {
63
+ console.log(chalk_1.default.red(`❌ Erro de Formato: O Estágio 1 exige que o Scanner imprima a lista de tokens em formato JSON válido.`));
64
+ console.log(chalk_1.default.yellow(`Exemplo esperado: [{"type": "KEYWORD", "value": "const"}, ...]`));
57
65
  return false;
58
66
  }
59
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devquest/cli",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "DevQuest CLI - Construa seu próprio Redis, Docker, Git e mais",
5
5
  "main": "dist/index.js",
6
6
  "bin": {