refactor(cli)!: split the contributor tool out of the ludic CLI

`ludic help` ended with a section titled "contributing to the toolchain itself",
listing bootstrap, reseed, docs-gen and release tasks. None of that is available
to someone who installed the language — those tasks need the repository — so the
shipped tool was advertising work its user cannot do, in a namespace they have to
read past to find `new` and `run`.

The tasks move to a second program, dev.ludic -> bin/ludic-dev, built from a
checkout and excluded from every release artifact. `ludic` keeps the project and
package commands and nothing else; `ludic dev …` now explains where the tasks
went instead of failing as an unknown command.

What this shook out: the two programs share prelude/build/project/pkg, so the
helpers each had accreted in whichever file first needed them — cc(),
ensure_ludicc, the string functions, title_case, cmd_version — moved to where
both can see them. The argument-shift indirection added for the `dev` namespace
is gone with the namespace, so commands read argv directly again.

`ludic-dev test` asserts the split rather than trusting it: the staged install
must build a project, and `ludic dev build` there must fail while naming
ludic-dev. install.sh keeps building older tags, whose bootstrap goes through
main.ludic.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-05 23:15:12 +03:00
parent f369fbd227
commit e175619543
46 changed files with 630 additions and 558 deletions

View file

@ -199,15 +199,22 @@ install_from_source() {
git clone --quiet --depth 1 --branch "v${VERSION}" "${REPO_URL}.git" "$_src" 2>/dev/null \
|| git clone --quiet --depth 1 "${REPO_URL}.git" "$_src" \
|| die "could not clone ${REPO_URL}"
# A release older than the CLI cannot produce one, and the build would fail
# deep inside clang with nothing pointing at the cause.
[ -f "${_src}/tools/ludic-cli/main.ludic" ] || die "release v${VERSION} predates the ludic CLI; install a newer one with --version X.Y.Z"
# Which entry point builds the toolchain depends on the age of the tag: the
# contributor tool was split out of the CLI after 0.5.2, so an older release
# still bootstraps through main.ludic. A release older than either predates the
# CLI entirely, and saying so beats failing deep inside clang.
if [ -f "${_src}/tools/ludic-cli/dev.ludic" ]; then
_boot='bin/ludicc tools/ludic-cli/dev.ludic -o bin/ludic-dev && bin/ludic-dev build'
elif [ -f "${_src}/tools/ludic-cli/main.ludic" ]; then
_boot='bin/ludicc tools/ludic-cli/main.ludic -o bin/ludic && bin/ludic dev build'
else
die "release v${VERSION} predates the ludic CLI; install a newer one with --version X.Y.Z"
fi
CC=clang; have clang || CC=cc
( cd "$_src" \
&& mkdir -p bin \
&& "$CC" selfhost/ludicc.seed.ll -o bin/ludicc 2>/dev/null \
&& bin/ludicc tools/ludic-cli/main.ludic -o bin/ludic \
&& bin/ludic dev build >/dev/null ) || die "the source build failed"
&& eval "$_boot" >/dev/null ) || die "the source build failed"
_stage="${TMP}/stage"
mkdir -p "${_stage}/bin"