@icarusmx/creta 1.5.12 → 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.
package/bin/creta.js CHANGED
@@ -139,6 +139,34 @@ if (command.startsWith('portafolio')) {
139
139
  // Show AWS billing detective guide
140
140
  const viewer = new AWSGuideViewer()
141
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
+ }
142
170
  } else if (command === 'reset') {
143
171
  // Reset user state with confirmation
144
172
  const rl = createInterface({ input: process.stdin, output: process.stdout })
@@ -652,6 +680,7 @@ function showHelp() {
652
680
 
653
681
  console.log("📖 Documentación de comandos:")
654
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")
655
684
  console.log(" creta cd - Documentación en español del comando cd")
656
685
  console.log(" creta curl - Documentación en español del comando curl")
657
686
  console.log(" creta git status - Documentación en español de git status")
@@ -1875,7 +1904,7 @@ async function startVimSetupTutorial() {
1875
1904
  // Helper function to detect command help requests
1876
1905
  function isCommandHelpRequest(args) {
1877
1906
  // List of supported commands for help
1878
- const basicCommands = ['ls', 'cd', 'mkdir', 'touch', 'wc', 'curl']
1907
+ const basicCommands = ['ls', 'cd', 'mkdir', 'touch', 'wc', 'curl', 'grep']
1879
1908
  const gitCommands = ['git status', 'git add', 'git commit', 'git push', 'git log']
1880
1909
 
1881
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
  }
@@ -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
+ }