spawnpoint 0.2.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6ae1f2aae6f8340c03f309364e62b1b78113eff6aab8fcd6ba61ba416cf028b7
4
+ data.tar.gz: caa9708a4ff55754b5643f107a0bf09fb64b2e736da36986bc23c0babc46da89
5
+ SHA512:
6
+ metadata.gz: bc35e776bfca6667e159e4d8b7a5d6f78378b26a0d4d8ffcd0ad0cae32cef918ae168ec247a39301606767d8df496ca3923c5cc9b5fac9ca28b5aebcbb7974e5
7
+ data.tar.gz: aaf1371dea70274993ab2b3b10efdd2c777b05c6ae005cb703b2681e8d0f0d894a0048b34a167e8d2a40ccef9d4df004514fc374c52a5bb7de2c02f464d23228
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ .claude
2
+ .agent-learning
3
+ *.gem
4
+ /pkg/
5
+ /Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem "minitest", "~> 5.0"
8
+ gem "rake", "~> 13.0"
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bebekim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # spwn
2
+
3
+ A child-friendly text interface for Git, aimed at 12-year-olds learning to program games.
4
+
5
+ `spwn` is a thin wrapper around Git that renames the commands into game-like language and
6
+ presents them through a simple command-line interface. It is not a replacement for Git; it is
7
+ a mask that makes the vocabulary friendlier while still calling Git under the hood.
8
+
9
+ ## Before you start
10
+
11
+ `spwn` needs two things already installed: **Ruby** and **Git**. It does not install either of
12
+ them for you.
13
+
14
+ Check whether you have them by running:
15
+
16
+ ```bash
17
+ ruby --version
18
+ git --version
19
+ ```
20
+
21
+ If both commands print a version number, you are ready to go. If one of them says "command not
22
+ found", install the missing piece first.
23
+
24
+ - **Ruby** — from `https://www.ruby-lang.org/`. On Windows, the RubyInstaller2 downloads are at
25
+ `https://github.com/oneclick/rubyinstaller2/releases`; pick the latest release and use the
26
+ installer that matches your machine (the plain installer is enough if you do not need to compile
27
+ C extensions).
28
+ - **Git** — from `https://git-scm.com/`. On macOS, Git may already be available; if not,
29
+ `xcode-select --install` is one common way to get it. On Windows, the Git installer from
30
+ `git-scm.com` puts Git on your PATH.
31
+
32
+ Once Ruby and Git are installed, `spwn` itself is one `gem install` away.
33
+
34
+ ## Philosophy
35
+
36
+ - Friendlier words, not a new VCS. Git still does the real work.
37
+ - Thin confirmations. Dangerous operations still go through Git's normal behavior; we do not
38
+ add extra popups unless a command genuinely needs a "are you sure?" step.
39
+ - Easy to extend. The mapping between `spwn` commands and Git invocations lives inside
40
+ `lib/spawnpoint/cli.rb` so students and instructors can add or change commands in one place.
41
+ - Standard Git still works. Students can always fall back to `git` directly when they are ready.
42
+
43
+ ## Quick start
44
+
45
+ Install the gem and run `spwn`:
46
+
47
+ ```bash
48
+ gem install spawnpoint
49
+ spwn --help
50
+ ```
51
+
52
+ To run the latest code from this repository instead:
53
+
54
+ ```bash
55
+ ruby -Ilib exe/spwn --help
56
+ ```
57
+
58
+ ## Installing for a student
59
+
60
+ `spwn` is published as the `spawnpoint` gem, so installation is the same on macOS
61
+ and Windows once Ruby is installed:
62
+
63
+ ```bash
64
+ gem install spawnpoint
65
+ ```
66
+
67
+ This puts the `spwn` command on the PATH. Updating later is `gem update spawnpoint`.
68
+
69
+ If a machine cannot reach rubygems.org, build the gem from this repository and
70
+ install the file directly:
71
+
72
+ ```bash
73
+ gem build spawnpoint.gemspec
74
+ gem install --local ./spawnpoint-0.2.0.gem
75
+ ```
76
+
77
+ ## Command mapping
78
+
79
+ `spwn` is a thin rename layer over Git. The table below shows the main mappings. When a student
80
+ is ready, they can use the Git command directly instead.
81
+
82
+ | `spwn` command | Git command(s) | What it does |
83
+ | --- | --- | --- |
84
+ | `spwn init` | `git init` | Start a new project folder that Git can track. |
85
+ | `spwn add <file>` | `git add <file>` | Tell Git which files to include in the next snapshot. |
86
+ | `spwn add .` | `git add .` | Stage all changed files in the current folder. |
87
+ | `spwn add -A` | `git add -A` | Stage all changed files, including deletions. |
88
+ | `spwn commit -m 'note'` | `git commit -m 'note'` | Save the files you have already picked. |
89
+ | `spwn save -m 'note'` | `git add .` then `git commit -m 'note'` | Stage changed files and commit them together. |
90
+ | `spwn look` | `git status` | See what is going on in your project right now. |
91
+ | `spwn compare` | `git diff` | See what changed since the last snapshot. |
92
+ | `spwn history` | `git log` | Replay the story of your project, one snapshot at a time. |
93
+ | `spwn hop <branch>` | `git switch <branch>` | Jump to another universe (branch). |
94
+ | `spwn hop -- <branch> <file>` | `git restore --source <branch> -- <file>` | Bring a file back from another snapshot. |
95
+ | `spwn upload` | `git push` | Send your snapshots to the shared project space. |
96
+ | `spwn download` | `git pull` | Fetch new snapshots from the shared project space and combine them with yours. |
97
+ | `spwn sync <lesson> --into <game>` | — | Copy lesson files into a game folder, replacing matching files when confirmed. |
98
+ | `spwn rollback --into <game>` | — | Undo the most recent lesson sync: restore replaced files and remove newly copied files. |
99
+
100
+ A few notes about the mapping:
101
+
102
+ - `spwn save` is the only command that runs more than one Git command. It stages the current
103
+ folder and then commits, so students can think of it as "save everything with a note".
104
+ - `spwn hop --` is the file-restore form. The branch must be named explicitly, for example
105
+ `spwn hop -- feature my_level.rb`. If you give only a file name and that file already exists on
106
+ the current branch, `spwn` restores it from there; otherwise it asks you to name the source
107
+ branch.
108
+ - `spwn` does not hide Git's errors on purpose. If something goes wrong, the error still comes
109
+ from Git, so students eventually see the real message behind the friendly name.
110
+
111
+ ## Commands
112
+
113
+ Run `spwn --help` for the current list. The first version focuses on the commands
114
+ students need while following a single-player course:
115
+
116
+ - `spwn save` — stage changed files and commit them together.
117
+ - `spwn add` — stage files. Supports individual paths, `.`, and `-A`.
118
+ - `spwn commit` — commit already staged changes.
119
+ - `spwn look` — inspect the current state.
120
+ - `spwn compare` — show what changed.
121
+ - `spwn history` — show recent commits.
122
+ - `spwn hop` — switch branches or restore files.
123
+ - `spwn upload` — push to a remote.
124
+ - `spwn download` — fetch and integrate from a remote.
125
+ - `spwn init` — start a new project.
126
+ - `spwn sync <lesson> --into <game>` — copy lesson files into a game folder. Use `--force` to
127
+ replace matching files without asking.
128
+ - `spwn rollback --into <game>` — undo the most recent sync. Files that existed before the sync
129
+ are restored, files created by the sync are removed, and unrelated game files are left alone.
130
+
131
+ Branch-related commands are framed as "multiverse" because branches feel like parallel universes
132
+ to a 12-year-old. `spwn hop` is the entry point for both switching branches and restoring files;
133
+ the script explains the difference in its help text.
134
+
135
+ ## Extending the mapping
136
+
137
+ Open `lib/spawnpoint/cli.rb` and look for the command mapping table near the top of the file. Each entry
138
+ describes:
139
+
140
+ - the `spwn` subcommand name,
141
+ - the help text shown to students,
142
+ - the Git command or commands to run,
143
+ - any flags or argument handling.
144
+
145
+ To add a new command, add a row to that table and, if needed, a small amount of argument handling
146
+ code nearby. To change how an existing command works, edit its row. You do not need to touch the
147
+ main dispatch logic unless you are changing how arguments flow through the script.
148
+
149
+ ## Relationship to the course
150
+
151
+ This tool is intentionally small. It is designed to be used alongside the course materials, not
152
+ to become a project of its own. If a lesson needs a new Git workflow, add the corresponding
153
+ `spwn` command rather than building a separate tool.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rake/testtask"
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << "test" << "lib"
7
+ t.test_files = FileList["test/**/test_*.rb"]
8
+ end
9
+
10
+ task default: :test
@@ -0,0 +1,90 @@
1
+ # Package spwn as the `spawnpoint` Ruby gem
2
+
3
+ **Status:** approved 2026-08-14
4
+ **Target release:** v0.2.0 (v0.1.0 is already tagged and released on GitHub)
5
+
6
+ ## Goal
7
+
8
+ Students install the tool with `gem install spawnpoint` and run `spwn`. The gem
9
+ name `spwn` is taken on rubygems.org (unrelated 2012 gem); `spawnpoint` is free.
10
+ The executable stays `spwn` regardless of gem name.
11
+
12
+ ## Decisions
13
+
14
+ - Publish to rubygems.org as `spawnpoint` (executable: `spwn`).
15
+ - Standard gem layout (hand-written gemspec, no `bundle gem` scaffold).
16
+ - The three review findings from the v0.1.0 review are fixed in this pass.
17
+
18
+ ## Architecture
19
+
20
+ ```
21
+ spawnpoint.gemspec # hand-written; executables ["spwn"], bindir "exe"
22
+ Gemfile # gemspec + dev dependencies only
23
+ Rakefile # default task: test
24
+ LICENSE # MIT
25
+ exe/spwn # require "spawnpoint/cli"; exit Spawnpoint::CLI.run(ARGV)
26
+ lib/spawnpoint.rb # entry point; requires version + cli
27
+ lib/spawnpoint/version.rb # Spawnpoint::VERSION = "0.2.0"
28
+ lib/spawnpoint/cli.rb # command table, dispatch, help (moved from bin/spwn)
29
+ lib/spawnpoint/synchronizer.rb # moved from bin/__sync__.rb, class renamed
30
+ test/ # minitest suite
31
+ ```
32
+
33
+ - Module namespace is `Spawnpoint` (matches gem name convention).
34
+ - `bin/spwn` and `bin/__sync__.rb` are deleted; their code moves into `lib/`.
35
+ - No runtime dependencies — Ruby stdlib only (`fileutils`, `pathname`, `set`).
36
+
37
+ ## Bug fixes folded in
38
+
39
+ 1. **Exit-code propagation** — today `bin/spwn:322-323` calls the handler and
40
+ always returns 0. New contract: handlers return an Integer exit code or a
41
+ boolean (from `system`); the dispatcher normalizes to an Integer and
42
+ `Spawnpoint::CLI.run` returns it. `spwn sync` misuse and git command failures
43
+ exit non-zero.
44
+ 2. **Marker merge** — `.spwn_synced_paths` is written as the union of previously
45
+ known paths and this sync's paths (`known | new_known`), so files accepted in
46
+ earlier lessons are not re-prompted later.
47
+ 3. **Rename and cleanup** — `Syncronizer` → `Synchronizer`; the dead
48
+ auto-replace branch and the no-op `next if child == ...` guards are removed.
49
+
50
+ ## Packaging details
51
+
52
+ - Gemspec: name `spawnpoint`, version from `Spawnpoint::VERSION`, files from
53
+ `git ls-files`, homepage `https://github.com/bebekim/spawnpoint`,
54
+ license `MIT`, `required_ruby_version >= 3.0` (uses `argv[1..]`).
55
+ - `Gemfile` contains `gemspec` plus dev dependencies (minitest, rake).
56
+ - MIT `LICENSE` file added (gemspec requires a license for a clean push).
57
+
58
+ ## Testing
59
+
60
+ Minitest (stdlib, no new runtime deps) in `test/`:
61
+
62
+ - CLI: unknown command exits 1; sync with missing args exits non-zero; `--help`
63
+ exits 0.
64
+ - Synchronizer: fresh copy into a game folder; overwrite-with-confirmation;
65
+ `--force`; rollback restores replaced files and removes created ones; marker
66
+ union across two lessons (accepted file from lesson 1 is not re-prompted in
67
+ lesson 3).
68
+
69
+ ## README changes
70
+
71
+ - Install section: `gem install spawnpoint`, then `spwn --help`.
72
+ - Quick start for repo development: `ruby -Ilib exe/spwn --help`.
73
+ - Remove the PATH-shim section (obsolete — the gem puts `spwn` on PATH).
74
+ - Command mapping table and sync/rollback docs unchanged.
75
+
76
+ ## Release flow (after implementation lands)
77
+
78
+ 1. Commit, tag `v0.2.0`, push.
79
+ 2. `gem build spawnpoint.gemspec` → `spawnpoint-0.2.0.gem`.
80
+ 3. GitHub release `v0.2.0` (attach the `.gem` optional).
81
+ 4. `gem push spawnpoint-0.2.0.gem` — requires the maintainer's rubygems.org
82
+ credentials; run by the maintainer or with an API key provided at that time.
83
+
84
+ ## Out of scope
85
+
86
+ - Homebrew formula, Scoop/WinGet manifests (README future-ideas list).
87
+ - The untracked pipeline/agent scaffolding (`spec.md`, `plan.json`,
88
+ `pipeline-config.json`, `runs/`, `artifacts/`, `.agent-learning/`, `.claude/`)
89
+ — left out of the gem via `git ls-files`; a separate decision whether they
90
+ belong in the repo at all.