@icarusmx/creta 1.5.7 → 1.5.8
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/bin/creta.js +150 -14
- package/package.json +1 -1
package/bin/creta.js
CHANGED
|
@@ -607,20 +607,27 @@ async function unstuckProject(level) {
|
|
|
607
607
|
}
|
|
608
608
|
|
|
609
609
|
function showHelp() {
|
|
610
|
-
console.log("\
|
|
611
|
-
console.log("
|
|
612
|
-
console.log("
|
|
613
|
-
|
|
614
|
-
console.log("
|
|
615
|
-
console.log(" creta
|
|
616
|
-
console.log(" creta
|
|
617
|
-
console.log(" creta
|
|
618
|
-
console.log(" creta
|
|
619
|
-
|
|
620
|
-
console.log("
|
|
621
|
-
console.log("
|
|
622
|
-
console.log("
|
|
623
|
-
console.log("
|
|
610
|
+
console.log("\nCreta es una herramienta de CLI desarrollada por icarus.mx.")
|
|
611
|
+
console.log("El propósito de esta herramienta es acompañar a aprendices y")
|
|
612
|
+
console.log("constructores del taller en su camino de aprendizaje.\n")
|
|
613
|
+
|
|
614
|
+
console.log("📖 Documentación de comandos:")
|
|
615
|
+
console.log(" creta ls - Documentación en español del comando ls")
|
|
616
|
+
console.log(" creta cd - Documentación en español del comando cd")
|
|
617
|
+
console.log(" creta git status - Documentación en español de git status")
|
|
618
|
+
console.log(" creta [comando] - Documentación de cualquier comando soportado\n")
|
|
619
|
+
|
|
620
|
+
console.log("🎓 Aprendizaje:")
|
|
621
|
+
console.log(" creta - Menú principal interactivo")
|
|
622
|
+
console.log(" creta sintaxis - Aprende comandos de terminal y Git")
|
|
623
|
+
console.log(" creta enunciados - Explora los 7 enunciados fundamentales de OOP")
|
|
624
|
+
console.log(" creta papers - Recrea papers clásicos de Computer Science\n")
|
|
625
|
+
|
|
626
|
+
console.log("🛠️ Proyectos:")
|
|
627
|
+
console.log(" creta portafolio - Crea tu portafolio personal")
|
|
628
|
+
console.log(" creta code - Sesión interactiva de programación con IA\n")
|
|
629
|
+
|
|
630
|
+
console.log("💡 Usa 'creta' sin argumentos para ver el menú principal.")
|
|
624
631
|
}
|
|
625
632
|
|
|
626
633
|
async function startMainMenu() {
|
|
@@ -727,6 +734,46 @@ Salgamos de este laberinto 🏛️
|
|
|
727
734
|
return
|
|
728
735
|
}
|
|
729
736
|
|
|
737
|
+
// Handle vim-style navigation
|
|
738
|
+
if (key === 'k' || key === 'K') { // Vim: up
|
|
739
|
+
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : options.length - 1
|
|
740
|
+
renderOptions()
|
|
741
|
+
return
|
|
742
|
+
} else if (key === 'j' || key === 'J') { // Vim: down
|
|
743
|
+
selectedIndex = selectedIndex < options.length - 1 ? selectedIndex + 1 : 0
|
|
744
|
+
renderOptions()
|
|
745
|
+
return
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// Handle number key selection
|
|
749
|
+
const num = parseInt(key)
|
|
750
|
+
if (num >= 1 && num <= options.length) {
|
|
751
|
+
selectedIndex = num - 1
|
|
752
|
+
process.stdin.setRawMode(false)
|
|
753
|
+
process.stdin.removeListener('data', onKeyPress)
|
|
754
|
+
|
|
755
|
+
const selectedOption = options[selectedIndex]
|
|
756
|
+
|
|
757
|
+
// Clear screen
|
|
758
|
+
process.stdout.write('\x1b[2J')
|
|
759
|
+
process.stdout.write('\x1b[H')
|
|
760
|
+
|
|
761
|
+
if (selectedOption.id === 1) {
|
|
762
|
+
startSintaxisSelector().then(resolve)
|
|
763
|
+
} else if (selectedOption.id === 2) {
|
|
764
|
+
startEnunciadosSelector().then(resolve)
|
|
765
|
+
} else if (selectedOption.id === 3) {
|
|
766
|
+
startProyectosSelector().then(resolve)
|
|
767
|
+
} else if (selectedOption.id === 4) {
|
|
768
|
+
const executor = new PapersExecutor()
|
|
769
|
+
executor.execute().then(resolve)
|
|
770
|
+
} else if (selectedOption.id === 5) {
|
|
771
|
+
const executor = new ExercisesExecutor()
|
|
772
|
+
executor.execute().then(resolve)
|
|
773
|
+
}
|
|
774
|
+
return
|
|
775
|
+
}
|
|
776
|
+
|
|
730
777
|
// Handle arrow keys (escape sequences)
|
|
731
778
|
if (key === '\u001b[A') { // Up arrow
|
|
732
779
|
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : options.length - 1
|
|
@@ -1047,6 +1094,27 @@ async function startEnunciadosSelectorInteractive() {
|
|
|
1047
1094
|
return
|
|
1048
1095
|
}
|
|
1049
1096
|
|
|
1097
|
+
// Handle vim-style navigation
|
|
1098
|
+
if (key === 'k' || key === 'K') { // Vim: up
|
|
1099
|
+
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : ENUNCIADOS.length - 1
|
|
1100
|
+
renderOptions()
|
|
1101
|
+
return
|
|
1102
|
+
} else if (key === 'j' || key === 'J') { // Vim: down
|
|
1103
|
+
selectedIndex = selectedIndex < ENUNCIADOS.length - 1 ? selectedIndex + 1 : 0
|
|
1104
|
+
renderOptions()
|
|
1105
|
+
return
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
// Handle number key selection (1-7)
|
|
1109
|
+
const num = parseInt(key)
|
|
1110
|
+
if (num >= 1 && num <= ENUNCIADOS.length) {
|
|
1111
|
+
selectedIndex = num - 1
|
|
1112
|
+
// Simulate Enter key press to execute the selected option
|
|
1113
|
+
const enterEvent = '\r'
|
|
1114
|
+
onKeyPress(enterEvent)
|
|
1115
|
+
return
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1050
1118
|
// Handle arrow keys (escape sequences)
|
|
1051
1119
|
if (key === '\u001b[A') { // Up arrow
|
|
1052
1120
|
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : ENUNCIADOS.length - 1
|
|
@@ -1379,6 +1447,40 @@ async function startProyectosSelectorInteractive() {
|
|
|
1379
1447
|
return
|
|
1380
1448
|
}
|
|
1381
1449
|
|
|
1450
|
+
// Handle vim-style navigation
|
|
1451
|
+
if (key === 'k' || key === 'K') { // Vim: up
|
|
1452
|
+
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : projects.length - 1
|
|
1453
|
+
renderOptions()
|
|
1454
|
+
return
|
|
1455
|
+
} else if (key === 'j' || key === 'J') { // Vim: down
|
|
1456
|
+
selectedIndex = selectedIndex < projects.length - 1 ? selectedIndex + 1 : 0
|
|
1457
|
+
renderOptions()
|
|
1458
|
+
return
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
// Handle number key selection
|
|
1462
|
+
const num = parseInt(key)
|
|
1463
|
+
if (num >= 1 && num <= projects.length) {
|
|
1464
|
+
selectedIndex = num - 1
|
|
1465
|
+
process.stdin.setRawMode(false)
|
|
1466
|
+
process.stdin.removeListener('data', onKeyPress)
|
|
1467
|
+
|
|
1468
|
+
const selectedProject = projects[selectedIndex]
|
|
1469
|
+
|
|
1470
|
+
// Clear screen
|
|
1471
|
+
process.stdout.write('\x1b[2J')
|
|
1472
|
+
process.stdout.write('\x1b[H')
|
|
1473
|
+
|
|
1474
|
+
if (selectedProject.type === 'pr') {
|
|
1475
|
+
startPullRequestTutorial().then(resolve)
|
|
1476
|
+
} else if (selectedProject.type === 'portfolio') {
|
|
1477
|
+
startPortfolioSelector().then(resolve)
|
|
1478
|
+
} else if (selectedProject.type === 'vim') {
|
|
1479
|
+
startVimSetupTutorial().then(resolve)
|
|
1480
|
+
}
|
|
1481
|
+
return
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1382
1484
|
// Handle arrow keys (escape sequences)
|
|
1383
1485
|
if (key === '\u001b[A') { // Up arrow
|
|
1384
1486
|
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : projects.length - 1
|
|
@@ -1565,6 +1667,40 @@ async function startPortfolioSelectorInteractive() {
|
|
|
1565
1667
|
return
|
|
1566
1668
|
}
|
|
1567
1669
|
|
|
1670
|
+
// Handle vim-style navigation
|
|
1671
|
+
if (key === 'k' || key === 'K') { // Vim: up
|
|
1672
|
+
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : projects.length - 1
|
|
1673
|
+
renderOptions()
|
|
1674
|
+
return
|
|
1675
|
+
} else if (key === 'j' || key === 'J') { // Vim: down
|
|
1676
|
+
selectedIndex = selectedIndex < projects.length - 1 ? selectedIndex + 1 : 0
|
|
1677
|
+
renderOptions()
|
|
1678
|
+
return
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
// Handle number key selection
|
|
1682
|
+
const num = parseInt(key)
|
|
1683
|
+
if (num >= 1 && num <= projects.length) {
|
|
1684
|
+
selectedIndex = num - 1
|
|
1685
|
+
process.stdin.setRawMode(false)
|
|
1686
|
+
process.stdin.removeListener('data', onKeyPress)
|
|
1687
|
+
|
|
1688
|
+
const selectedProject = projects[selectedIndex]
|
|
1689
|
+
const level = selectedProject.level
|
|
1690
|
+
|
|
1691
|
+
// Clear screen
|
|
1692
|
+
process.stdout.write('\x1b[2J')
|
|
1693
|
+
process.stdout.write('\x1b[H')
|
|
1694
|
+
|
|
1695
|
+
// Check if we're in an existing Creta project
|
|
1696
|
+
if (level > 0 && isInCretaProject()) {
|
|
1697
|
+
unstuckProject(level).then(resolve)
|
|
1698
|
+
} else {
|
|
1699
|
+
createPortfolioProject(level).then(resolve)
|
|
1700
|
+
}
|
|
1701
|
+
return
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1568
1704
|
// Handle arrow keys (escape sequences)
|
|
1569
1705
|
if (key === '\u001b[A') { // Up arrow
|
|
1570
1706
|
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : projects.length - 1
|