Create a date-stamped scratch directory, initialize it as a git repo, and launch oc.
cds no longer aims for exact alias parity with the old:
alias cds='mkdir -p ~/scratch/$(date +%Y-%m-%d) && cd ~/scratch/$(date +%Y-%m-%d) && oc'It intentionally adds repo bootstrap behavior:
- every daily folder becomes its own git repo
- revisiting an older dated folder without
.gitupgrades it into a repo - each initialized daily repo gets seeded
.gitignoreandAGENTS.md - existing seeded files are never overwritten silently
The launch flow is still preserved: create/resolve dir → cd into it → exec oc.
./install.shThis idempotently symlinks ~/.local/bin/cds → this repo's cds.
cds # create/upgrade ~/scratch/YYYY-MM-DD, git init if needed, seed files, cd, exec oc
cds 2026-01-15 # same for an explicit date
cds --no-launch # create/upgrade + seed + cd, but skip oc
cds 2026-01-15 --no-launch # explicit date, skip oc
cds --help # show help
cds -h # short formFlags and the date arg may appear in any order. Date format is strict YYYY-MM-DD.
| Invocation | Creates dir? | Initializes git? | Seeds files? | cds? |
Launches oc? |
|---|---|---|---|---|---|
cds |
yes if missing | yes if needed | yes if missing | yes | yes |
cds 2026-01-15 |
yes if missing | yes if needed | yes if missing | yes | yes |
cds --no-launch |
yes if missing | yes if needed | yes if missing | yes | no |
| revisit old non-repo day | no | yes | yes if missing | yes | yes/no based on flag |
| revisit existing daily repo | no | no-op | no-overwrite | yes | yes/no based on flag |
cds banana |
no | no | no | no | no |
If git is unavailable or git init fails, cds exits non-zero before launch. If oc is missing, the shell's normal command not found message is shown.
On first repo initialization, cds seeds from canonical templates in templates/:
templates/.gitignoretemplates/AGENTS.md
These are copied into the daily repo only when the target files are missing.
If a daily repo already has its own .gitignore or AGENTS.md, cds leaves them untouched.
The parent ~/scratch repo should ignore top-level date-named daily dirs. This avoids noisy parent git status output and prevents accidental staging of embedded repos as gitlinks.
bash tests/cds_test.sh # repo bootstrap contract
bash tests/parity_test.sh # launch-flow preservationcds_test.sh covers:
- fresh repo creation
- explicit date repo init
- revisit upgrade for old non-repo days
- same-day rerun no-op behavior
- seeded
.gitignore+AGENTS.md - no-overwrite behavior for existing files
gitfailure aborts before launch--no-launchand normalocinvocation behavior
parity_test.sh verifies launch-flow preservation: cds --no-launch still creates the dated dir, cds into it, and returns an equivalent exit code on both the happy path and a read-only-parent failure path after the repo bootstrap change.
If shellcheck is installed, cds_test.sh also lints cds and install.sh.
The open-chad project still ships its own bin/cds fork. This repo is the canonical source of ~/.local/bin/cds after ./install.sh is run here.
- real scripts on PATH work from non-interactive shells and tools
- repo bootstrap, template seeding, and input validation are awkward in alias form
- a single canonical repo keeps
cdsbehavior testable and versioned