@icarusmx/creta 1.5.11 → 1.5.13

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 (26) hide show
  1. package/bin/creta.js +37 -1
  2. package/lib/data/command-help/aws-ec2.js +34 -0
  3. package/lib/data/command-help/grep.js +72 -0
  4. package/lib/data/command-help/index.js +9 -1
  5. package/lib/executors/CommandHelpExecutor.js +6 -1
  6. package/lib/executors/ExercisesExecutor.js +8 -0
  7. package/lib/exercises/.claude/settings.local.json +12 -0
  8. package/lib/exercises/01-developing-muscle-for-nvim.md +528 -0
  9. package/lib/exercises/{iterm2-pane-navigation.md → 02-iterm2-pane-navigation.md} +1 -1
  10. package/lib/exercises/05-svelte-first-steps.md +1340 -0
  11. package/lib/exercises/{curl-and-pipes.md → 06-curl-and-pipes.md} +187 -72
  12. package/lib/exercises/07-claude-api-first-steps.md +855 -0
  13. package/lib/exercises/08-playwright-svelte-guide.md +1384 -0
  14. package/lib/exercises/09-docker-first-steps.md +1475 -0
  15. package/lib/exercises/{railway-deployment.md → 10-railway-deployment.md} +1 -0
  16. package/lib/exercises/{aws-billing-detective.md → 11-aws-billing-detective.md} +215 -35
  17. package/lib/exercises/12-install-skills.md +755 -0
  18. package/lib/exercises/README.md +180 -0
  19. package/lib/exercises/utils/booklet-2up.js +133 -0
  20. package/lib/exercises/utils/booklet-manual-duplex.js +159 -0
  21. package/lib/exercises/utils/booklet-simple.js +136 -0
  22. package/lib/exercises/utils/create-booklet.js +116 -0
  23. package/lib/scripts/aws-ec2-all.sh +58 -0
  24. package/package.json +3 -2
  25. /package/lib/exercises/{git-stash-workflow.md → 03-git-stash-workflow.md} +0 -0
  26. /package/lib/exercises/{array-object-manipulation.md → 04-array-object-manipulation.md} +0 -0
package/bin/creta.js CHANGED
@@ -71,6 +71,13 @@ const ENUNCIADOS = [
71
71
  const args = process.argv.slice(2)
72
72
  const command = args[0]
73
73
 
74
+ // Initialize user state on every run (creates ~/.creta/user.json on first run)
75
+ // Skip for utility commands that don't need state tracking
76
+ const utilityCommands = new Set(['reset', 'privacy', 'privacidad', 'help', 'ayuda'])
77
+ if (!utilityCommands.has(command)) {
78
+ UserState.updateLastSeen()
79
+ }
80
+
74
81
  // Check if this is a command help request (Phase 2: Desarrollador mode)
75
82
  if (command && isCommandHelpRequest(args)) {
76
83
  const executor = new CommandHelpExecutor(args)
@@ -132,6 +139,34 @@ if (command.startsWith('portafolio')) {
132
139
  // Show AWS billing detective guide
133
140
  const viewer = new AWSGuideViewer()
134
141
  await viewer.start()
142
+ } else if (command === 'aws-ec2') {
143
+ const subcommand = args[1]
144
+
145
+ if (subcommand === 'all') {
146
+ // Execute the AWS EC2 audit script
147
+ showLogo()
148
+ console.log('🔍 Ejecutando auditoría de EC2 y volúmenes EBS en todas las regiones...\n')
149
+
150
+ const __filename = fileURLToPath(import.meta.url)
151
+ const __dirname = path.dirname(__filename)
152
+ const scriptPath = path.join(__dirname, '../lib/scripts/aws-ec2-all.sh')
153
+
154
+ try {
155
+ execSync(`bash "${scriptPath}"`, { stdio: 'inherit' })
156
+ } catch (error) {
157
+ console.error('\n❌ Error ejecutando el script:', error.message)
158
+ console.log('\n💡 Asegúrate de tener AWS CLI configurado: aws configure')
159
+ }
160
+ } else if (subcommand === 'help' || !subcommand) {
161
+ // Show help via CommandHelpExecutor
162
+ const executor = new CommandHelpExecutor(['aws-ec2'])
163
+ await executor.execute()
164
+ } else {
165
+ console.log(`❌ Subcomando no reconocido: ${subcommand}`)
166
+ console.log('\nComandos disponibles:')
167
+ console.log(' creta aws-ec2 all - Audita todas las regiones')
168
+ console.log(' creta aws-ec2 help - Muestra ayuda')
169
+ }
135
170
  } else if (command === 'reset') {
136
171
  // Reset user state with confirmation
137
172
  const rl = createInterface({ input: process.stdin, output: process.stdout })
@@ -645,6 +680,7 @@ function showHelp() {
645
680
 
646
681
  console.log("📖 Documentación de comandos:")
647
682
  console.log(" creta ls - Documentación en español del comando ls")
683
+ console.log(" creta grep - Documentación en español del comando grep")
648
684
  console.log(" creta cd - Documentación en español del comando cd")
649
685
  console.log(" creta curl - Documentación en español del comando curl")
650
686
  console.log(" creta git status - Documentación en español de git status")
@@ -1868,7 +1904,7 @@ async function startVimSetupTutorial() {
1868
1904
  // Helper function to detect command help requests
1869
1905
  function isCommandHelpRequest(args) {
1870
1906
  // List of supported commands for help
1871
- const basicCommands = ['ls', 'cd', 'mkdir', 'touch', 'wc', 'curl']
1907
+ const basicCommands = ['ls', 'cd', 'mkdir', 'touch', 'wc', 'curl', 'grep']
1872
1908
  const gitCommands = ['git status', 'git add', 'git commit', 'git push', 'git log']
1873
1909
 
1874
1910
  const commandString = args.join(' ')
@@ -0,0 +1,34 @@
1
+ export const awsEc2 = {
2
+ command: 'aws-ec2',
3
+ description: 'Herramienta para auditar instancias EC2 y volúmenes EBS en AWS - encuentra recursos olvidados que te están costando dinero',
4
+ usage: 'creta aws-ec2 [comando]',
5
+ commonOptions: [
6
+ {
7
+ flag: 'all',
8
+ description: 'Escanea TODAS las regiones de AWS buscando instancias EC2 y volúmenes EBS'
9
+ },
10
+ {
11
+ flag: 'help',
12
+ description: 'Muestra esta ayuda'
13
+ }
14
+ ],
15
+ examples: [
16
+ {
17
+ command: 'creta aws-ec2 all',
18
+ description: 'Audita todas las regiones - encuentra instancias y volúmenes que no conocías'
19
+ },
20
+ {
21
+ command: 'creta aws-ec2 help',
22
+ description: 'Muestra esta documentación'
23
+ }
24
+ ],
25
+ relatedLesson: 'AWS Billing Detective',
26
+ tips: [
27
+ 'Este comando puede tardar 1-2 minutos - está escaneando ~20 regiones',
28
+ 'Volúmenes AVAILABLE (no attached) = DINERO DESPERDICIADO cada mes',
29
+ 'Si encuentras instancias corriendo que no conocías, ¡apágalas!',
30
+ 'Pro tip: ejecuta esto mensualmente para evitar cargos sorpresa en tu bill de AWS',
31
+ 'Requiere que tengas AWS CLI configurado: aws configure',
32
+ 'El script destaca los volúmenes "AVAILABLE" porque esos son los que te cuestan sin usarlos'
33
+ ]
34
+ }
@@ -0,0 +1,72 @@
1
+ export const grep = {
2
+ command: 'grep',
3
+ description: 'Busca patrones de texto en archivos o entrada de texto',
4
+ usage: 'grep [opciones] "patrón" [archivo(s)]',
5
+ commonOptions: [
6
+ {
7
+ flag: '-i',
8
+ description: 'Ignora mayúsculas/minúsculas (case insensitive)'
9
+ },
10
+ {
11
+ flag: '-r',
12
+ description: 'Búsqueda recursiva en carpetas'
13
+ },
14
+ {
15
+ flag: '-n',
16
+ description: 'Muestra números de línea'
17
+ },
18
+ {
19
+ flag: '-v',
20
+ description: 'Invierte búsqueda (muestra líneas que NO coinciden)'
21
+ },
22
+ {
23
+ flag: '-c',
24
+ description: 'Cuenta líneas que coinciden'
25
+ },
26
+ {
27
+ flag: '-l',
28
+ description: 'Solo muestra nombres de archivos con coincidencias'
29
+ },
30
+ {
31
+ flag: '-A',
32
+ description: 'Muestra N líneas DESPUÉS de la coincidencia'
33
+ },
34
+ {
35
+ flag: '-B',
36
+ description: 'Muestra N líneas ANTES de la coincidencia'
37
+ }
38
+ ],
39
+ examples: [
40
+ {
41
+ command: 'grep "error" app.log',
42
+ description: 'Busca la palabra "error" en el archivo app.log'
43
+ },
44
+ {
45
+ command: 'grep -i "warning" *.log',
46
+ description: 'Busca "warning" ignorando mayúsculas en todos los .log'
47
+ },
48
+ {
49
+ command: 'grep -r "TODO" src/',
50
+ description: 'Busca "TODO" recursivamente en la carpeta src/'
51
+ },
52
+ {
53
+ command: 'grep -n "function" script.js',
54
+ description: 'Busca "function" y muestra números de línea'
55
+ },
56
+ {
57
+ command: 'grep -c "import" *.js',
58
+ description: 'Cuenta cuántas líneas tienen "import" en cada .js'
59
+ },
60
+ {
61
+ command: 'grep -v "test" file.txt',
62
+ description: 'Muestra todas las líneas que NO contienen "test"'
63
+ }
64
+ ],
65
+ relatedLesson: 'Pipes y redirecciones',
66
+ tips: [
67
+ 'Pro tip: combina con pipes → `cat file.log | grep "error" | wc -l`',
68
+ 'Usa comillas dobles para buscar frases: `grep "syntax error" file.js`',
69
+ 'grep -r es tu amigo: busca en todo un proyecto rápidamente',
70
+ 'Combina -A y -B para contexto: `grep -A 3 -B 2 "error"` muestra líneas alrededor'
71
+ ]
72
+ }
@@ -5,6 +5,7 @@ export { mkdir } from './mkdir.js'
5
5
  export { touch } from './touch.js'
6
6
  export { wc } from './wc.js'
7
7
  export { curl } from './curl.js'
8
+ export { grep } from './grep.js'
8
9
 
9
10
  // Git commands
10
11
  export { gitStatus } from './git-status.js'
@@ -13,6 +14,9 @@ export { gitCommit } from './git-commit.js'
13
14
  export { gitPush } from './git-push.js'
14
15
  export { gitLog } from './git-log.js'
15
16
 
17
+ // AWS commands
18
+ export { awsEc2 } from './aws-ec2.js'
19
+
16
20
  // Command mapping for lookup
17
21
  export const commandMap = {
18
22
  // Basic
@@ -22,11 +26,15 @@ export const commandMap = {
22
26
  'touch': 'touch',
23
27
  'wc': 'wc',
24
28
  'curl': 'curl',
29
+ 'grep': 'grep',
25
30
 
26
31
  // Git
27
32
  'git status': 'gitStatus',
28
33
  'git add': 'gitAdd',
29
34
  'git commit': 'gitCommit',
30
35
  'git push': 'gitPush',
31
- 'git log': 'gitLog'
36
+ 'git log': 'gitLog',
37
+
38
+ // AWS
39
+ 'aws-ec2': 'awsEc2'
32
40
  }
@@ -79,15 +79,20 @@ export class CommandHelpExecutor {
79
79
  console.log('')
80
80
 
81
81
  console.log(chalk.bold(' Básicos:'))
82
- console.log(chalk.cyan(' ls, cd, mkdir, touch, wc'))
82
+ console.log(chalk.cyan(' ls, cd, mkdir, touch, wc, curl'))
83
83
  console.log('')
84
84
 
85
85
  console.log(chalk.bold(' Git:'))
86
86
  console.log(chalk.cyan(' git status, git add, git commit, git push, git log'))
87
87
  console.log('')
88
88
 
89
+ console.log(chalk.bold(' AWS:'))
90
+ console.log(chalk.cyan(' aws-ec2'))
91
+ console.log('')
92
+
89
93
  console.log(chalk.dim('💡 Ejemplo: creta ls'))
90
94
  console.log(chalk.dim('💡 Ejemplo: creta git status'))
95
+ console.log(chalk.dim('💡 Ejemplo: creta aws-ec2'))
91
96
  console.log('')
92
97
  }
93
98
  }
@@ -41,6 +41,14 @@ export class ExercisesExecutor {
41
41
  file: "aws-billing-detective.md",
42
42
  lines: 588,
43
43
  topics: ["AWS", "CLI", "Cost Management", "DevOps"]
44
+ },
45
+ {
46
+ id: 5,
47
+ title: "curl + Pipes - Processing APIs in Real Time",
48
+ description: "Quick API insights without Postman or browser",
49
+ file: "curl-and-pipes.md",
50
+ lines: 844,
51
+ topics: ["curl", "APIs", "Piping", "REST", "JSON"]
44
52
  }
45
53
  ]
46
54
  }
@@ -0,0 +1,12 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Read(//Users/guillermo/icarus/creta/cli/bin/**)",
5
+ "Read(//Users/guillermo/icarus/creta/cli/**)",
6
+ "Bash(chmod:*)",
7
+ "Bash(/Users/guillermo/icarus/creta/cli/lib/exercises/test-curl-examples.sh)"
8
+ ],
9
+ "deny": [],
10
+ "ask": []
11
+ }
12
+ }