@icarusmx/creta 0.5.3 → 0.6.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.
Files changed (3) hide show
  1. package/bin/creta.js +126 -8
  2. package/package.json +1 -1
  3. package/CLAUDE.md +0 -118
package/bin/creta.js CHANGED
@@ -7,6 +7,45 @@ import path from 'path'
7
7
  import { fileURLToPath } from 'url'
8
8
  import { CretaCodeSession } from '../lib/session.js'
9
9
 
10
+ const ENUNCIADOS = [
11
+ {
12
+ id: 1,
13
+ texto: "La parte difícil del diseño orientado a objetos es descomponer un sistema como un conjunto de objetos que interactúan entre sí.",
14
+ nivel: "Fundacional",
15
+ enfoque: "Descomposición de sistemas"
16
+ },
17
+ {
18
+ id: 2,
19
+ texto: "Los objetos interactúan entre sí a través de solicitudes.",
20
+ nivel: "Interacción",
21
+ enfoque: "Comunicación entre objetos"
22
+ },
23
+ {
24
+ id: 3,
25
+ texto: "Las solicitudes son la única forma de conseguir que un objeto lleve a cabo una operación.",
26
+ nivel: "Operaciones",
27
+ enfoque: "Mecanismo de ejecución"
28
+ },
29
+ {
30
+ id: 4,
31
+ texto: "Cada operación declarada por un objeto debe incluir: a) nombre de la operación; b) insumos necesarios para realizar la operación; c) el valor que regresa tras ejecutar la operación. Estos tres elementos constituyen la firma de operación.",
32
+ nivel: "Firmas",
33
+ enfoque: "Contratos de operación"
34
+ },
35
+ {
36
+ id: 5,
37
+ texto: "La interfaz de un objeto es el conjunto de todas sus firmas de operación.",
38
+ nivel: "Interfaces",
39
+ enfoque: "Definición de contratos"
40
+ },
41
+ {
42
+ id: 6,
43
+ texto: "El énfasis al diseñar los objetos debe estar en la definición de sus solicitudes e interfaces.",
44
+ nivel: "Diseño",
45
+ enfoque: "Metodología de desarrollo"
46
+ }
47
+ ]
48
+
10
49
  const args = process.argv.slice(2)
11
50
  const command = args[0]
12
51
 
@@ -14,14 +53,8 @@ console.log("¡Bienvenida de vuelta! 🏛️")
14
53
  console.log("Retomemos desde donde nos quedamos: hagamos tu portafolio.\n")
15
54
 
16
55
  if (!command) {
17
- console.log("Comandos disponibles:")
18
- console.log(" creta portafolio - Crea tu portafolio personal (reto completo)")
19
- console.log(" creta portafolio-1 - Desbloquea nivel 1 (navbar) 🔓")
20
- console.log(" creta portafolio-2 - Desbloquea nivel 2 (navbar + hero) 🔓")
21
- console.log(" creta portafolio-3 - Desbloquea nivel 3 (solución completa) 🔓")
22
- console.log(" creta code - Inicia sesión interactiva de programación 🤖")
23
- console.log("\n💡 Tip: Si estás dentro de un proyecto existente, los comandos")
24
- console.log(" portafolio-1/2/3 actualizarán tus archivos directamente")
56
+ // Default behavior: show enunciados selector
57
+ await startEnunciadosSelector()
25
58
  process.exit(0)
26
59
  }
27
60
 
@@ -34,12 +67,19 @@ if (command.startsWith('portafolio')) {
34
67
  } else {
35
68
  await createPortfolioProject(level)
36
69
  }
70
+ } else if (command === 'enunciados') {
71
+ // Start enunciados selector
72
+ await startEnunciadosSelector()
37
73
  } else if (command === 'code') {
38
74
  // Start interactive coding session
39
75
  const session = new CretaCodeSession()
40
76
  await session.start()
77
+ } else if (command === 'help' || command === 'ayuda') {
78
+ // Show available commands
79
+ showHelp()
41
80
  } else {
42
81
  console.log(`Comando no reconocido: ${command}`)
82
+ console.log("Escribe 'creta help' para ver comandos disponibles")
43
83
  process.exit(1)
44
84
  }
45
85
 
@@ -521,3 +561,81 @@ async function unstuckProject(level) {
521
561
  process.exit(1)
522
562
  }
523
563
  }
564
+
565
+ function showHelp() {
566
+ console.log("\n📚 Comandos disponibles:")
567
+ console.log(" creta - Explora los 6 enunciados fundamentales (comando principal) 🧠")
568
+ console.log(" creta enunciados - Explora los 6 enunciados fundamentales 🧠")
569
+ console.log(" creta portafolio - Crea tu portafolio personal (reto completo)")
570
+ console.log(" creta portafolio-1 - Desbloquea nivel 1 (navbar) 🔓")
571
+ console.log(" creta portafolio-2 - Desbloquea nivel 2 (navbar + hero) 🔓")
572
+ console.log(" creta portafolio-3 - Desbloquea nivel 3 (solución completa) 🔓")
573
+ console.log(" creta code - Inicia sesión interactiva de programación 🤖")
574
+ console.log(" creta help - Muestra esta ayuda")
575
+ console.log("\n💡 Tip: Si estás dentro de un proyecto existente, los comandos")
576
+ console.log(" portafolio-1/2/3 actualizarán tus archivos directamente")
577
+ console.log("\n🎯 La filosofía Creta: partir de enunciados que generan 'ruido' para")
578
+ console.log(" construir comprensión real, no solo sintaxis.")
579
+ }
580
+
581
+ async function startEnunciadosSelector() {
582
+ const rl = createInterface({
583
+ input: process.stdin,
584
+ output: process.stdout
585
+ })
586
+
587
+ const askQuestion = (question) => {
588
+ return new Promise((resolve) => {
589
+ rl.question(question, resolve)
590
+ })
591
+ }
592
+
593
+ try {
594
+ console.log("\n🧠 Los 6 Enunciados Fundamentales de Programación Orientada a Objetos")
595
+ console.log("=" .repeat(70))
596
+ console.log("¿Cuál de estos enunciados te genera más 'ruido' (curiosidad/confusión)?")
597
+ console.log("")
598
+
599
+ ENUNCIADOS.forEach((enunciado, index) => {
600
+ console.log(`${index + 1}. [${enunciado.nivel}] ${enunciado.enfoque}`)
601
+ console.log(` "${enunciado.texto}"`)
602
+ console.log("")
603
+ })
604
+
605
+ const respuesta = await askQuestion("Elige un número (1-6) o 'q' para salir: ")
606
+
607
+ if (respuesta.toLowerCase() === 'q') {
608
+ console.log("¡Hasta la vista! 👋")
609
+ rl.close()
610
+ return
611
+ }
612
+
613
+ const numeroSeleccionado = parseInt(respuesta)
614
+
615
+ if (numeroSeleccionado >= 1 && numeroSeleccionado <= 6) {
616
+ const enunciadoSeleccionado = ENUNCIADOS[numeroSeleccionado - 1]
617
+
618
+ console.log(`\n🎯 Has seleccionado el enunciado ${numeroSeleccionado}:`)
619
+ console.log(`"${enunciadoSeleccionado.texto}"`)
620
+ console.log(`\n💡 Enfoque: ${enunciadoSeleccionado.enfoque}`)
621
+ console.log(`📚 Nivel: ${enunciadoSeleccionado.nivel}`)
622
+
623
+ console.log("\n🚀 Próximamente:")
624
+ console.log("- Sesiones de estudio dirigidas basadas en este enunciado")
625
+ console.log("- Ejercicios prácticos que ilustren el concepto")
626
+ console.log("- Proyectos específicos para internalizar la idea")
627
+
628
+ console.log("\n💭 Por ahora, reflexiona: ¿qué parte específica de este enunciado")
629
+ console.log(" te genera más curiosidad o confusión?")
630
+
631
+ } else {
632
+ console.log("❌ Opción no válida. Elige un número entre 1 y 6.")
633
+ }
634
+
635
+ rl.close()
636
+ } catch (error) {
637
+ console.error('Error:', error.message)
638
+ rl.close()
639
+ process.exit(1)
640
+ }
641
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icarusmx/creta",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "Salgamos de este laberinto.",
5
5
  "type": "module",
6
6
  "bin": {
package/CLAUDE.md DELETED
@@ -1,118 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## Project Overview
6
-
7
- This is "@icarusmx/creta" - a CLI tool for the Icarus software school that helps reconnect with former students by providing them with guided challenges to build personal portfolios. The tool generates SvelteKit 5 + Tailwind CSS 4 boilerplates with instructional comments in Spanish.
8
-
9
- ## Purpose and Mission
10
-
11
- Creta is a Spanish-speaking software school focused on learn-by-building approach. This CLI tool serves as a reconnection mechanism with former students, encouraging them to complete their education by building personal websites. The tool provides progressive difficulty levels where students can skip ahead or get solutions for different components.
12
-
13
- ## Architecture
14
-
15
- - **Entry point**: `bin/creta.js` - Interactive Node.js CLI that collects student names and generates projects
16
- - **Package**: Published as `@icarusmx/creta` on npm with public access (current version: 0.2.2)
17
- - **Language**: JavaScript ES modules (no TypeScript)
18
- - **Templates**: SvelteKit 5 + Tailwind CSS 4 portfolio boilerplate in `/templates/sveltekit-portfolio/`
19
-
20
- ## Available Commands
21
-
22
- - `creta portafolio` - Full challenge with instructional comments (level 0)
23
- - `creta portafolio-1` - Navbar completed (level 1)
24
- - `creta portafolio-2` - Navbar + hero completed (level 2)
25
- - `creta portafolio-3` - Complete solution (level 3)
26
-
27
- ## Technology Stack
28
-
29
- ### Frontend Template
30
- - **SvelteKit 5**: Using new syntax with `{@render children?.()}` instead of `<slot />`
31
- - **Tailwind CSS 4**: Using `@tailwindcss/vite` plugin (no config files needed)
32
- - **Vite**: Build tool and dev server
33
-
34
- ### Template Structure
35
- ```
36
- templates/sveltekit-portfolio/
37
- ├── package.json # SvelteKit 5 + Tailwind 4 dependencies
38
- ├── vite.config.js # Vite config with Tailwind plugin
39
- ├── svelte.config.js # SvelteKit configuration
40
- ├── src/
41
- │ ├── app.html # HTML template
42
- │ ├── app.css # Tailwind directives
43
- │ └── routes/
44
- │ ├── +layout.svelte # Layout with navbar/footer challenges
45
- │ └── +page.svelte # Hero section challenge
46
- └── static/
47
- └── favicon.png
48
- ```
49
-
50
- ## Key Features
51
-
52
- ### Interactive Project Generation
53
- - Prompts for student name using readline interface
54
- - Generates project directory named `{name}-portafolio`
55
- - Replaces `{{STUDENT_NAME}}` and `{{PROJECT_NAME}}` placeholders
56
- - Copies template files with level-specific modifications
57
-
58
- ### Progressive Difficulty System
59
- The `applyLevelModifications()` function provides solutions based on level:
60
- - **Level 1+**: Complete navbar with navigation links
61
- - **Level 2+**: Complete hero section with student's name
62
- - **Level 3+**: Complete footer with copyright and Creta attribution
63
-
64
- ### Spanish Instructional Design
65
- - All comments and instructions in Spanish
66
- - Detailed Tailwind CSS patterns and tips
67
- - Encouraging messages for returning students
68
- - HTML structure examples in code blocks (using `[placeholders]` to avoid parsing issues)
69
-
70
- ## Development Commands
71
-
72
- ```bash
73
- # Test CLI locally
74
- node bin/creta.js
75
-
76
- # Test specific commands
77
- node bin/creta.js portafolio
78
- node bin/creta.js portafolio-1
79
-
80
- # Publish to npm (increment version first)
81
- npm publish
82
- ```
83
-
84
- ## Current State (v0.2.2)
85
-
86
- The CLI is fully functional with:
87
- - ✅ Interactive name collection
88
- - ✅ SvelteKit 5 + Tailwind 4 template generation
89
- - ✅ Progressive difficulty levels (0-3)
90
- - ✅ Spanish instructional comments
91
- - ✅ Proper Svelte 5 syntax (`{@render children?.()}`)
92
- - ✅ HTML parsing issue fixes
93
- - ✅ Encouraging welcome message for returning students
94
-
95
- ## Recent Fixes and Updates
96
-
97
- ### Version History
98
- - **0.2.2**: Fixed Svelte 5 syntax and updated welcome message
99
- - **0.2.1**: Fixed HTML comment parsing errors in Svelte templates
100
- - **0.2.0**: Updated to Tailwind 4, changed command to "portafolio", new greeting
101
- - **0.1.1**: Fixed template path resolution for global installs
102
- - **0.1.0**: Initial working version with template generation
103
- - **0.0.2**: Basic CLI structure
104
-
105
- ### Known Issues Resolved
106
- - ✅ HTML comments in code examples causing Svelte parsing errors (fixed by using `[placeholders]`)
107
- - ✅ Svelte 5 syntax compatibility (`<slot />` → `{@render children?.()}`)
108
- - ✅ Tailwind 4 migration (removed config files, updated to Vite plugin)
109
- - ✅ Template path resolution for global npm installs
110
-
111
- ## Message and Tone
112
-
113
- The CLI uses encouraging Spanish messages:
114
- - Welcome: "¡Bienvenido de vuelta! 🏛️"
115
- - Mission: "Retomemos desde donde nos quedamos: hagamos tu portafolio."
116
- - Hero message: "Gracias por seguir aquí. Abre el proyecto usando `code .` y sigue las instrucciones. Si tienes dudas, apóyate en el equipo"
117
-
118
- This reflects Creta's supportive approach to bringing students back to complete their learning journey.