@icarusmx/creta 1.4.9 → 1.4.10

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.
@@ -9,11 +9,89 @@ export const PIPING_REDIRECCION = {
9
9
  },
10
10
 
11
11
  steps: [
12
+ {
13
+ type: 'text',
14
+ content: 'Primero, entendamos los 3 canales de comunicación que tiene cada programa.'
15
+ },
16
+ {
17
+ type: 'pause'
18
+ },
19
+ {
20
+ type: 'text',
21
+ content: 'Cada comando que ejecutas tiene 3 "streams" (flujos) estándar:'
22
+ },
23
+ {
24
+ type: 'text',
25
+ content: '• stdin (standard input) - Canal 0: Por donde entra información'
26
+ },
27
+ {
28
+ type: 'text',
29
+ content: '• stdout (standard output) - Canal 1: Por donde sale información normal'
30
+ },
31
+ {
32
+ type: 'text',
33
+ content: '• stderr (standard error) - Canal 2: Por donde salen mensajes de error'
34
+ },
35
+ {
36
+ type: 'pause'
37
+ },
38
+ {
39
+ type: 'text',
40
+ content: 'Por defecto:'
41
+ },
42
+ {
43
+ type: 'text',
44
+ content: '• stdin lee del teclado'
45
+ },
46
+ {
47
+ type: 'text',
48
+ content: '• stdout y stderr escriben a la pantalla'
49
+ },
50
+ {
51
+ type: 'pause'
52
+ },
53
+ {
54
+ type: 'text',
55
+ content: 'Pero con piping y redirección puedes cambiar estos destinos.'
56
+ },
57
+ {
58
+ type: 'pause'
59
+ },
60
+ {
61
+ type: 'code',
62
+ title: 'Los 3 streams en acción',
63
+ code: `# ls produce salida normal (stdout)
64
+ ls archivo.txt
65
+ # → archivo.txt (aparece en pantalla)
66
+
67
+ # ls con archivo inexistente produce error (stderr)
68
+ ls archivo-que-no-existe
69
+ # → ls: archivo-que-no-existe: No such file or directory (aparece en pantalla)
70
+
71
+ # read espera entrada (stdin)
72
+ read NOMBRE
73
+ # → [cursor esperando que escribas]`,
74
+ after: [
75
+ '',
76
+ 'Aunque ambos aparecen en pantalla, stdout y stderr son canales separados.',
77
+ 'Esto te permite tratarlos diferente con redirección.'
78
+ ]
79
+ },
80
+ {
81
+ type: 'pause'
82
+ },
83
+ {
84
+ type: 'text',
85
+ content: 'Ahora veamos cómo manipular estos streams.'
86
+ },
87
+ {
88
+ type: 'pause'
89
+ },
12
90
  {
13
91
  type: 'command-intro',
14
92
  command: '|',
15
93
  description: 'El pipe (tubería)',
16
- explanation: 'El símbolo | toma la salida de un comando y la envía como entrada a otro.',
94
+ explanation: 'El símbolo | conecta el stdout de un comando al stdin de otro.',
17
95
  example: 'ls | grep ".js"\ncat archivo.txt | wc -l',
18
96
  instruction: 'Úsalo para encadenar comandos. La salida del izquierdo entra al derecho.'
19
97
  },
@@ -68,19 +146,56 @@ export const PIPING_REDIRECCION = {
68
146
  {
69
147
  type: 'command-intro',
70
148
  command: '2>',
71
- description: 'Redirección de errores',
72
- explanation: '2> redirige los mensajes de error (stderr) a un archivo.',
149
+ description: 'Redirección de errores (stderr)',
150
+ explanation: 'El 2 se refiere al file descriptor de stderr. 2> redirige solo los errores a un archivo.',
73
151
  example: 'npm install 2> errores.log\nls archivo-que-no-existe 2> /dev/null',
74
152
  instruction: '/dev/null es como un "agujero negro" - descarta todo lo que le envíes.'
75
153
  },
154
+ {
155
+ type: 'text',
156
+ content: 'También puedes redirigir stdout explícitamente con 1> (aunque > solo es equivalente).'
157
+ },
158
+ {
159
+ type: 'pause'
160
+ },
76
161
  {
77
162
  type: 'command-intro',
78
163
  command: '&>',
79
- description: 'Redirección de salida Y errores',
80
- explanation: '&> redirige tanto la salida normal como los errores al mismo destino.',
164
+ description: 'Redirección de stdout Y stderr',
165
+ explanation: '&> redirige ambos canales (1 y 2) al mismo destino. Es como hacer 1> archivo 2>&1',
81
166
  example: 'npm install &> install-log.txt\ngit pull &> pull.log',
82
167
  instruction: 'Útil cuando quieres capturar todo lo que un comando produce.'
83
168
  },
169
+ {
170
+ type: 'pause'
171
+ },
172
+ {
173
+ type: 'code',
174
+ title: 'Standard streams en acción',
175
+ code: `# Separar stdout y stderr en diferentes archivos
176
+ ls archivo.txt archivo-inexistente 1> salidas.txt 2> errores.txt
177
+ # → archivo.txt va a salidas.txt
178
+ # → el error va a errores.txt
179
+
180
+ # Guardar salida, descartar errores
181
+ npm install 1> install.log 2> /dev/null
182
+
183
+ # Redirigir stderr a stdout, luego todo a un archivo
184
+ ls archivo-inexistente 2>&1 | grep "No such"
185
+ # → El error se convierte en stdout y puede ser procesado por grep
186
+
187
+ # Capturar todo en un solo archivo (equivalentes)
188
+ comando &> todo.log
189
+ comando > todo.log 2>&1`,
190
+ after: [
191
+ '',
192
+ 'Entender los file descriptors (0, 1, 2) te da control total del flujo de datos.',
193
+ 'Puedes separar, combinar, o descartar cualquier stream según necesites.'
194
+ ]
195
+ },
196
+ {
197
+ type: 'pause'
198
+ },
84
199
  {
85
200
  type: 'code',
86
201
  title: 'Ejemplo real: Procesando una versión',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icarusmx/creta",
3
- "version": "1.4.9",
3
+ "version": "1.4.10",
4
4
  "description": "Salgamos de este laberinto.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,16 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Read(//private/tmp/**)",
5
- "Bash(node:*)",
6
- "WebFetch(domain:github.com)",
7
- "Bash(npm install)",
8
- "Bash(npm run dev:*)",
9
- "Bash(rm:*)",
10
- "Bash(npm publish:*)",
11
- "Bash(npm view:*)"
12
- ],
13
- "deny": [],
14
- "ask": []
15
- }
16
- }
package/deploy-patch.sh DELETED
@@ -1,30 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Get current version from package.json
4
- CURRENT_VERSION=$(node -p "require('./package.json').version")
5
-
6
- # Split version into parts
7
- IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
8
- MAJOR="${VERSION_PARTS[0]}"
9
- MINOR="${VERSION_PARTS[1]}"
10
- PATCH="${VERSION_PARTS[2]}"
11
-
12
- # Increment patch
13
- NEW_PATCH=$((PATCH + 1))
14
- NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
15
-
16
- echo "📦 Bumping version: $CURRENT_VERSION → $NEW_VERSION"
17
-
18
- # Update package.json
19
- sed -i '' "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$NEW_VERSION\"/" package.json
20
-
21
- echo "🚀 Publishing to npm..."
22
- npm publish
23
-
24
- if [ $? -eq 0 ]; then
25
- echo "✅ Successfully published @icarusmx/creta@$NEW_VERSION"
26
- else
27
- echo "❌ Publish failed, reverting version..."
28
- sed -i '' "s/\"version\": \"$NEW_VERSION\"/\"version\": \"$CURRENT_VERSION\"/" package.json
29
- exit 1
30
- fi