seed: curriculum content

This commit is contained in:
2026-05-07 14:32:44 +00:00
parent 9258534803
commit ec76f4f56b
100 changed files with 2846 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
---
type: challenge
title: "The Saver"
xp: 75
duration: 25
difficulty: 2
---
# The Saver
> **[INCOMING — Mission Control, Earth]**
>
> Cadet, snapshots. Git's whole purpose is to capture *commits* —
> snapshots of your work — that you can return to later.
>
> The flow per commit:
>
> 1. Create or modify a file
> 2. `git add <file>` — stage it
> 3. `git commit -m "<message>"` — lock it in
>
> When your script runs, a clean Git repo with identity already set
> sits in the working directory. Make three commits, in this exact
> order:
>
> 1. Create `a.txt` with `alpha`. Commit message: `add alpha`
> 2. Create `b.txt` with `beta`. Commit message: `add beta`
> 3. Create `c.txt` with `gamma`. Commit message: `add gamma`
>
> [END TRANSMISSION]
## Your Task
In `starter/starter.sh`, run six commands per the flow above (one
echo + add + commit per file).
## Objectives
- `a.txt`, `b.txt`, `c.txt` exist with `alpha`, `beta`, `gamma`
- `git log` shows exactly 3 commits
- Commit messages: `add alpha`, `add beta`, `add gamma` in order

View File

@@ -0,0 +1,14 @@
#!/bin/bash
# The Saver — make three commits.
#
# When this script runs, a fresh Git repo with identity already set
# is in your working directory. Make three commits, in this exact
# order:
#
# 1. Create a.txt containing "alpha". Commit message: "add alpha"
# 2. Create b.txt containing "beta". Commit message: "add beta"
# 3. Create c.txt containing "gamma". Commit message: "add gamma"
#
# Tools: echo, git add, git commit -m
# Your code here.

View File

@@ -0,0 +1,20 @@
#!/bin/bash
git init -q -b main
git config user.name "Setup"
git config user.email "setup@learnroom.local"
bash solution.sh > /dev/null 2>&1
N=0
report() { N=$((N+1)); if [ "$1" = "0" ]; then echo "ok $N - $2"; else echo "not ok $N - $2"; fi; }
{ [ -f a.txt ] && grep -q alpha a.txt 2>/dev/null; }; report $? "a.txt exists with 'alpha'"
{ [ -f b.txt ] && grep -q beta b.txt 2>/dev/null; }; report $? "b.txt exists with 'beta'"
{ [ -f c.txt ] && grep -q gamma c.txt 2>/dev/null; }; report $? "c.txt exists with 'gamma'"
COUNT=$(git log --oneline 2>/dev/null | wc -l | tr -d ' ')
[ "$COUNT" = "3" ]; report $? "exactly 3 commits in git log"
MSGS=$(git log --reverse --format='%s' 2>/dev/null)
EXPECTED=$'add alpha\nadd beta\nadd gamma'
[ "$MSGS" = "$EXPECTED" ]; report $? "commit messages: 'add alpha', 'add beta', 'add gamma' in order"