@icarusmx/creta 1.5.3 → 1.5.6
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 +14 -4
- package/lib/builders/MenuBuilder.js +23 -4
- package/lib/executors/ExercisesExecutor.js +271 -0
- package/lib/exercises/array-object-manipulation.md +1281 -0
- package/lib/exercises/git-stash-workflow.md +426 -0
- package/lib/exercises/railway-deployment.md +1185 -0
- package/lib/papers/bitcoin/bitcoin.md +92 -0
- package/lib/papers/mapreduce/mapreduce.md +476 -0
- package/lib/papers/spark/spark.md +49 -0
- package/package.json +5 -1
- package/ascii-logo.txt +0 -8
- package/codex-refactor.txt +0 -13
- package/docs/diagrams/README.md +0 -131
- package/docs/diagrams/architecture-overview.mmd +0 -71
- package/docs/diagrams/architecture.svg +0 -1
- package/docs/diagrams/ecosystem-integration.mmd +0 -49
- package/docs/diagrams/evolution-phases.mmd +0 -49
- package/docs/diagrams/output.svg +0 -1
- package/docs/diagrams/phase2-command-help-flow.mmd +0 -51
- package/docs/diagrams/user-journey.mmd +0 -78
- package/ejemplo.sh +0 -3
- package/refactor.txt +0 -581
- package/templates/sveltekit-portfolio/package.json +0 -20
- package/templates/sveltekit-portfolio/src/app.css +0 -51
- package/templates/sveltekit-portfolio/src/app.html +0 -12
- package/templates/sveltekit-portfolio/src/routes/+layout.svelte +0 -108
- package/templates/sveltekit-portfolio/src/routes/+page.svelte +0 -79
- package/templates/sveltekit-portfolio/static/favicon.png +0 -0
- package/templates/sveltekit-portfolio/svelte.config.js +0 -10
- package/templates/sveltekit-portfolio/vite.config.js +0 -10
- package/test/enunciados.test.js +0 -72
- package/test/sintaxis-menu.test.js +0 -45
- package/wea-fome-qlia.sh +0 -92
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
# Git Stash Workflow - Wrong Branch Recovery
|
|
2
|
+
|
|
3
|
+
<!-- vim: set foldmethod=marker foldlevel=0: -->
|
|
4
|
+
|
|
5
|
+
## 📖 LazyVim Reading Guide {{{
|
|
6
|
+
|
|
7
|
+
**Start with:** `zM` (close all folds) → Navigate with `za` (toggle fold under cursor)
|
|
8
|
+
|
|
9
|
+
This document uses fold markers `{{{` and `}}}` for organized reading.
|
|
10
|
+
|
|
11
|
+
}}}
|
|
12
|
+
|
|
13
|
+
## 🚨 Problem: Made Changes on Main Instead of Dev {{{
|
|
14
|
+
|
|
15
|
+
You're coding away, making changes, and suddenly realize: **"Oh no, I'm on `main` not `dev`!"**
|
|
16
|
+
|
|
17
|
+
This is a common mistake. Here's the **clean recovery workflow** using `git stash`.
|
|
18
|
+
|
|
19
|
+
}}}
|
|
20
|
+
|
|
21
|
+
## ✅ Solution: Stash → Switch → Pop {{{
|
|
22
|
+
|
|
23
|
+
### Step 1: Stash Your Changes {{{
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Stash ALL changes (tracked + untracked files)
|
|
27
|
+
git stash push -u -m "WIP: changes meant for dev branch"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Flags explained:**
|
|
31
|
+
- `-u` or `--include-untracked`: Stash untracked files too (new files you created)
|
|
32
|
+
- `-m "message"`: Give your stash a descriptive name so you remember what it is
|
|
33
|
+
|
|
34
|
+
**What happens:**
|
|
35
|
+
- Your working directory becomes clean
|
|
36
|
+
- All changes are safely stored in the stash
|
|
37
|
+
- You're still on `main` branch
|
|
38
|
+
|
|
39
|
+
}}}
|
|
40
|
+
|
|
41
|
+
### Step 2: Switch to Correct Branch {{{
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Switch to dev branch
|
|
45
|
+
git checkout dev
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Now you're on the correct branch** with a clean working directory.
|
|
49
|
+
|
|
50
|
+
}}}
|
|
51
|
+
|
|
52
|
+
### Step 3: Apply Stashed Changes {{{
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Apply and remove the stash
|
|
56
|
+
git stash pop
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**What happens:**
|
|
60
|
+
- Your stashed changes are applied to `dev` branch
|
|
61
|
+
- The stash is removed from the stash list
|
|
62
|
+
- You can now continue working
|
|
63
|
+
|
|
64
|
+
**Alternative:** Use `git stash apply` if you want to keep the stash (doesn't remove it)
|
|
65
|
+
|
|
66
|
+
}}}
|
|
67
|
+
|
|
68
|
+
}}}
|
|
69
|
+
|
|
70
|
+
## 🔍 Checking Your Stash {{{
|
|
71
|
+
|
|
72
|
+
### List All Stashes {{{
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git stash list
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Output example:**
|
|
79
|
+
```
|
|
80
|
+
stash@{0}: On main: WIP: changes meant for dev branch
|
|
81
|
+
stash@{1}: On main: experimental feature attempt
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
}}}
|
|
85
|
+
|
|
86
|
+
### View Stash Contents {{{
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Show what's in the most recent stash
|
|
90
|
+
git stash show
|
|
91
|
+
|
|
92
|
+
# Show full diff
|
|
93
|
+
git stash show -p
|
|
94
|
+
|
|
95
|
+
# Show specific stash
|
|
96
|
+
git stash show stash@{1}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
}}}
|
|
100
|
+
|
|
101
|
+
### Apply Specific Stash {{{
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Apply a specific stash (keeps it in the list)
|
|
105
|
+
git stash apply stash@{1}
|
|
106
|
+
|
|
107
|
+
# Pop a specific stash (removes it from the list)
|
|
108
|
+
git stash pop stash@{1}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
}}}
|
|
112
|
+
|
|
113
|
+
### Delete Stash {{{
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Drop specific stash
|
|
117
|
+
git stash drop stash@{0}
|
|
118
|
+
|
|
119
|
+
# Clear all stashes (careful!)
|
|
120
|
+
git stash clear
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
}}}
|
|
124
|
+
|
|
125
|
+
}}}
|
|
126
|
+
|
|
127
|
+
## 🎯 Real-World Scenarios {{{
|
|
128
|
+
|
|
129
|
+
### Scenario 1: Uncommitted Changes on Wrong Branch {{{
|
|
130
|
+
|
|
131
|
+
**Problem:**
|
|
132
|
+
```bash
|
|
133
|
+
$ git status
|
|
134
|
+
On branch main
|
|
135
|
+
Changes not staged for commit:
|
|
136
|
+
modified: bin/creta.js
|
|
137
|
+
modified: package.json
|
|
138
|
+
|
|
139
|
+
Untracked files:
|
|
140
|
+
lib/exercises/
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Solution:**
|
|
144
|
+
```bash
|
|
145
|
+
# 1. Stash everything
|
|
146
|
+
git stash push -u -m "WIP: lesson 7 improvements"
|
|
147
|
+
|
|
148
|
+
# 2. Switch to dev
|
|
149
|
+
git checkout dev
|
|
150
|
+
|
|
151
|
+
# 3. Apply changes
|
|
152
|
+
git stash pop
|
|
153
|
+
|
|
154
|
+
# 4. Continue working
|
|
155
|
+
git status # Now on dev with your changes
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
}}}
|
|
159
|
+
|
|
160
|
+
### Scenario 2: Already Made Commits on Main {{{
|
|
161
|
+
|
|
162
|
+
**Problem:** You committed changes to `main` that should be on `dev`.
|
|
163
|
+
|
|
164
|
+
**Solution: Cherry-pick approach**
|
|
165
|
+
```bash
|
|
166
|
+
# 1. Note the commit hash
|
|
167
|
+
git log --oneline -1
|
|
168
|
+
# ddbd498 add refactor.txt file
|
|
169
|
+
|
|
170
|
+
# 2. Switch to dev
|
|
171
|
+
git checkout dev
|
|
172
|
+
|
|
173
|
+
# 3. Cherry-pick the commit
|
|
174
|
+
git cherry-pick ddbd498
|
|
175
|
+
|
|
176
|
+
# 4. Go back to main and reset
|
|
177
|
+
git checkout main
|
|
178
|
+
git reset --hard HEAD~1 # Remove the last commit from main
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Caution:** Only do this if you **haven't pushed** to remote yet!
|
|
182
|
+
|
|
183
|
+
}}}
|
|
184
|
+
|
|
185
|
+
### Scenario 3: Mixed - Some Committed, Some Uncommitted {{{
|
|
186
|
+
|
|
187
|
+
**Solution: Combine both approaches**
|
|
188
|
+
```bash
|
|
189
|
+
# 1. Stash uncommitted changes
|
|
190
|
+
git stash push -u -m "WIP: uncommitted work"
|
|
191
|
+
|
|
192
|
+
# 2. Note committed hash
|
|
193
|
+
git log --oneline -1
|
|
194
|
+
|
|
195
|
+
# 3. Switch to dev
|
|
196
|
+
git checkout dev
|
|
197
|
+
|
|
198
|
+
# 4. Cherry-pick the commit
|
|
199
|
+
git cherry-pick <hash>
|
|
200
|
+
|
|
201
|
+
# 5. Pop the stash
|
|
202
|
+
git stash pop
|
|
203
|
+
|
|
204
|
+
# 6. Clean up main
|
|
205
|
+
git checkout main
|
|
206
|
+
git reset --hard HEAD~1
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
}}}
|
|
210
|
+
|
|
211
|
+
}}}
|
|
212
|
+
|
|
213
|
+
## 🛡️ Best Practices {{{
|
|
214
|
+
|
|
215
|
+
### Prevention {{{
|
|
216
|
+
|
|
217
|
+
1. **Check branch before coding:**
|
|
218
|
+
```bash
|
|
219
|
+
git branch # Shows current branch with *
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
2. **Use git prompt in shell** (shows current branch in prompt)
|
|
223
|
+
- Oh-My-Zsh, Starship, etc.
|
|
224
|
+
|
|
225
|
+
3. **Create feature branches immediately:**
|
|
226
|
+
```bash
|
|
227
|
+
git checkout -b feature/lesson-7-fix
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
}}}
|
|
231
|
+
|
|
232
|
+
### Working with Stash {{{
|
|
233
|
+
|
|
234
|
+
1. **Always use descriptive messages** with `-m`
|
|
235
|
+
- ❌ `git stash`
|
|
236
|
+
- ✅ `git stash push -u -m "WIP: implementing user auth"`
|
|
237
|
+
|
|
238
|
+
2. **Stash frequently** when switching contexts
|
|
239
|
+
```bash
|
|
240
|
+
git stash push -m "WIP: pausing to fix urgent bug"
|
|
241
|
+
git checkout hotfix-branch
|
|
242
|
+
# ... fix bug ...
|
|
243
|
+
git checkout -
|
|
244
|
+
git stash pop
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
3. **Don't let stashes pile up** - apply or drop them regularly
|
|
248
|
+
|
|
249
|
+
}}}
|
|
250
|
+
|
|
251
|
+
### Safety {{{
|
|
252
|
+
|
|
253
|
+
1. **Never `git stash clear`** unless you're 100% sure
|
|
254
|
+
2. **Before `git reset --hard`** - make sure you haven't pushed
|
|
255
|
+
3. **Check stash contents** before popping: `git stash show -p`
|
|
256
|
+
|
|
257
|
+
}}}
|
|
258
|
+
|
|
259
|
+
}}}
|
|
260
|
+
|
|
261
|
+
## 🧪 Practice Exercise {{{
|
|
262
|
+
|
|
263
|
+
Try this safe simulation:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# 1. Create a test scenario
|
|
267
|
+
echo "test" > test-file.txt
|
|
268
|
+
git status # See untracked file
|
|
269
|
+
|
|
270
|
+
# 2. Stash it
|
|
271
|
+
git stash push -u -m "test stash practice"
|
|
272
|
+
|
|
273
|
+
# 3. Verify it's gone
|
|
274
|
+
ls test-file.txt # Should error (file doesn't exist)
|
|
275
|
+
|
|
276
|
+
# 4. Check stash
|
|
277
|
+
git stash list
|
|
278
|
+
git stash show -p
|
|
279
|
+
|
|
280
|
+
# 5. Restore it
|
|
281
|
+
git stash pop
|
|
282
|
+
|
|
283
|
+
# 6. Clean up
|
|
284
|
+
rm test-file.txt
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
}}}
|
|
288
|
+
|
|
289
|
+
## 📚 Quick Reference {{{
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
# Stash with untracked files
|
|
293
|
+
git stash push -u -m "descriptive message"
|
|
294
|
+
|
|
295
|
+
# List stashes
|
|
296
|
+
git stash list
|
|
297
|
+
|
|
298
|
+
# Show stash contents
|
|
299
|
+
git stash show -p
|
|
300
|
+
|
|
301
|
+
# Apply and keep stash
|
|
302
|
+
git stash apply
|
|
303
|
+
|
|
304
|
+
# Apply and remove stash
|
|
305
|
+
git stash pop
|
|
306
|
+
|
|
307
|
+
# Apply specific stash
|
|
308
|
+
git stash pop stash@{1}
|
|
309
|
+
|
|
310
|
+
# Delete specific stash
|
|
311
|
+
git stash drop stash@{0}
|
|
312
|
+
|
|
313
|
+
# Delete all stashes (CAREFUL!)
|
|
314
|
+
git stash clear
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
}}}
|
|
318
|
+
|
|
319
|
+
## 🔬 Diagnostic Commands - Understanding Your Situation {{{
|
|
320
|
+
|
|
321
|
+
Before fixing anything, you need to understand what you're dealing with. These commands help you see the full picture.
|
|
322
|
+
|
|
323
|
+
### Visualize Branch Divergence {{{
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
git log --oneline --all --graph --decorate -10
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**What each flag does:**
|
|
330
|
+
- `--oneline`: Show each commit as one line (compact view)
|
|
331
|
+
- `--all`: Show ALL branches (not just current branch)
|
|
332
|
+
- `--graph`: Draw a text-based graph showing branch structure
|
|
333
|
+
- `--decorate`: Show branch names and tags next to commits
|
|
334
|
+
- `-10`: Limit to last 10 commits
|
|
335
|
+
|
|
336
|
+
**Output example:**
|
|
337
|
+
```
|
|
338
|
+
* 4093951 (dev) add new strategic route for creta cli
|
|
339
|
+
* 1348508 add os fundamentals
|
|
340
|
+
* fb1fca8 try to make one big lesson
|
|
341
|
+
| * ddbd498 (HEAD -> main) add refactor.txt file
|
|
342
|
+
| * 31a47a2 first commands
|
|
343
|
+
|/
|
|
344
|
+
* b01a857 initial commit
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**What this tells you:**
|
|
348
|
+
- `dev` and `main` have diverged from commit `b01a857`
|
|
349
|
+
- `dev` has 3 new commits
|
|
350
|
+
- `main` has 2 new commits
|
|
351
|
+
- They're on different paths! 🚨
|
|
352
|
+
|
|
353
|
+
}}}
|
|
354
|
+
|
|
355
|
+
### Compare Branches {{{
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
# Show commits on main that aren't on dev
|
|
359
|
+
git log dev..main --oneline
|
|
360
|
+
|
|
361
|
+
# Show commits on dev that aren't on main
|
|
362
|
+
git log main..dev --oneline
|
|
363
|
+
|
|
364
|
+
# Show all differences between branches
|
|
365
|
+
git log --left-right --oneline main...dev
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
**Interpret results:**
|
|
369
|
+
- Empty output = branches are in sync
|
|
370
|
+
- Commits listed = those commits are unique to one branch
|
|
371
|
+
|
|
372
|
+
}}}
|
|
373
|
+
|
|
374
|
+
### Check Current Status {{{
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
# What branch am I on?
|
|
378
|
+
git branch
|
|
379
|
+
|
|
380
|
+
# What's changed?
|
|
381
|
+
git status
|
|
382
|
+
|
|
383
|
+
# What commits are recent?
|
|
384
|
+
git log --oneline -5
|
|
385
|
+
|
|
386
|
+
# Did I already push this?
|
|
387
|
+
git log @{u}..HEAD # Shows unpushed commits
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
}}}
|
|
391
|
+
|
|
392
|
+
### Understanding Main vs Dev State {{{
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
# Is main ahead of dev?
|
|
396
|
+
git rev-list --left-right --count main...dev
|
|
397
|
+
|
|
398
|
+
# Output: "2 3" means:
|
|
399
|
+
# - main has 2 commits dev doesn't have
|
|
400
|
+
# - dev has 3 commits main doesn't have
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Decision tree:**
|
|
404
|
+
- `0 X`: Main is behind → merge dev into main
|
|
405
|
+
- `X 0`: Main is ahead → merge main into dev
|
|
406
|
+
- `X Y`: Branches diverged → need to decide merge strategy
|
|
407
|
+
|
|
408
|
+
}}}
|
|
409
|
+
|
|
410
|
+
}}}
|
|
411
|
+
|
|
412
|
+
## 🎓 Related Git Workflows {{{
|
|
413
|
+
|
|
414
|
+
- **Branch switching:** `git checkout <branch>`
|
|
415
|
+
- **Create branch:** `git checkout -b <new-branch>`
|
|
416
|
+
- **Cherry-pick:** `git cherry-pick <commit-hash>`
|
|
417
|
+
- **Reset commits:** `git reset --hard HEAD~1`
|
|
418
|
+
- **View history:** `git log --oneline --graph`
|
|
419
|
+
- **Visualize all branches:** `git log --oneline --all --graph --decorate`
|
|
420
|
+
- **Compare branches:** `git log branch1..branch2`
|
|
421
|
+
|
|
422
|
+
}}}
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
**Remember:** Stash is your safety net. When in doubt, stash it out! 🎯
|