From f721edba07cadd9781a1b5aa6b93e2925f9f064e Mon Sep 17 00:00:00 2001 From: Zach Harris Date: Mon, 16 Nov 2026 10:38:26 -0500 Subject: [PATCH 1/2] docs(readme): generate the status block from package.json and web/SURFACES.tsv README said v0.1.0 (draft) while package.json and npm were at 0.1.3, and the live voice page was not linked. scripts/readme-sync.sh renders the block (idempotent), test.sh runs it with --check, and npm's version lifecycle re-runs it so each tag commit carries current docs. Co-Authored-By: Claude Opus 5.5 --- README.md | 8 ++++++- RELEASING.md | 6 +++++ package.json | 3 ++- scripts/readme-sync.sh | 53 ++++++++++++++++++++++++++++++++++++++++++ test.sh | 4 ++++ web/SURFACES.tsv | 2 ++ 6 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 scripts/readme-sync.sh create mode 100644 web/SURFACES.tsv diff --git a/README.md b/README.md index f14c3ab..c4d0cfc 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,16 @@ > natively in **bash 3.2 ↔ zsh ↔ POSIX sh** (and ksh) with byte-identical > behavior. Think i18n, but for shells: **service localization** for scripts. -**License:** MIT · **Status:** v0.1.0 (draft) · **Locales verified:** bash 3.2.57, + +**License:** MIT · **Status:** v0.1.3 · **Locales verified:** bash 3.2.57, bash 5.3, zsh 5.9, dash (POSIX), /bin/sh, ksh93 — all against one shared [conformance suite](conformance/). +**Try it live:** + +- [Rosetta Voice](https://rosetta-shell.arcs.care/voice): say or type a shell construct and hear the portable fix, with what was heard shown word for word + + **In one line:** the constructs that silently break a script when it moves environments — associative arrays, `${v,,}`, arrays, `echo -e`, process substitution — get one portable shim each, and a conformance runner proves the diff --git a/RELEASING.md b/RELEASING.md index 64a657d..2c2029d 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -24,6 +24,12 @@ npm version patch # or minor / major — bumps package.json AND makes the g git push --follow-tags ``` +`npm version` also runs `scripts/readme-sync.sh` (the `version` script in +package.json), so the README status block and its live-surface list land in +the same tag commit. `test.sh` fails if that block is stale, so a release +cannot ship docs that disagree with package.json. To add a live surface, add a +row to `web/SURFACES.tsv`, never edit the block by hand. + That's it. The `release` workflow fires on the `v*` tag and: 1. verifies the tag matches `package.json`, 2. `npm publish --provenance --access public`, diff --git a/package.json b/package.json index e5b29ed..ccabe43 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "LICENSE" ], "scripts": { - "test": "sh test.sh" + "test": "sh test.sh", + "version": "sh scripts/readme-sync.sh && git add README.md" }, "keywords": [ "shell", diff --git a/scripts/readme-sync.sh b/scripts/readme-sync.sh new file mode 100644 index 0000000..749bbef --- /dev/null +++ b/scripts/readme-sync.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env sh +# readme-sync.sh: render README.md's status block from package.json + web/SURFACES.tsv. +# Idempotent: running it twice changes nothing. The README block is a cast; this is the mold. +# sh scripts/readme-sync.sh rewrite the block in place +# sh scripts/readme-sync.sh --check exit 1 if the block is stale (test.sh runs this) +# npm's "version" lifecycle runs it, so `npm version ` folds the new version into the tag commit. +set -eu +_self=$0 +case "$_self" in */*) _dir=${_self%/*} ;; *) _dir=. ;; esac +ROOT=$(cd "$_dir/.." && pwd) +README="$ROOT/README.md" +BEGIN='' +END='' + +[ -f "$ROOT/web/SURFACES.tsv" ] || { echo "readme-sync: web/SURFACES.tsv missing" >&2; exit 2; } +ver=$(sed -n 's/^[[:space:]]*"version":[[:space:]]*"\([^"]*\)".*/\1/p' "$ROOT/package.json" | head -n 1) +[ -n "$ver" ] || { echo "readme-sync: no version in package.json" >&2; exit 2; } + +block=$(mktemp); out=$(mktemp) +trap 'rm -f "$block" "$out"' EXIT +{ + echo "$BEGIN" + echo "**License:** MIT · **Status:** v$ver · **Locales verified:** bash 3.2.57," + echo "bash 5.3, zsh 5.9, dash (POSIX), /bin/sh, ksh93 — all against one shared" + echo "[conformance suite](conformance/)." + _tab=$(printf '\t') + grep -v '^#' "$ROOT/web/SURFACES.tsv" | grep -v '^[[:space:]]*$' | { + _first=1 + while IFS="$_tab" read -r url label what; do + if [ "$_first" = 1 ]; then echo; echo "**Try it live:**"; echo; _first=0; fi + echo "- [$label]($url): $what" + done + } + echo "$END" +} > "$block" + +grep -qF "$BEGIN" "$README" || { echo "readme-sync: begin marker missing in README.md" >&2; exit 2; } +grep -qF "$END" "$README" || { echo "readme-sync: end marker missing in README.md" >&2; exit 2; } + +awk -v b="$BEGIN" -v e="$END" -v f="$block" ' + $0 == b { while ((getline l < f) > 0) print l; skip = 1; next } + $0 == e { skip = 0; next } + !skip { print } +' "$README" > "$out" + +if [ "${1:-}" = "--check" ]; then + if cmp -s "$README" "$out"; then echo " [PASS] README status block matches package.json v$ver + web/SURFACES.tsv"; exit 0; fi + echo "FAIL: README.md status block is stale; run: sh scripts/readme-sync.sh" >&2 + diff "$README" "$out" >&2 || true + exit 1 +fi +cmp -s "$README" "$out" || cat "$out" > "$README" +echo "readme-sync: README.md at v$ver" diff --git a/test.sh b/test.sh index 59d7dfc..fa1841f 100755 --- a/test.sh +++ b/test.sh @@ -45,5 +45,9 @@ else echo " [SKIP] no web/ in this copy" fi +echo +echo "# README status block matches package.json and web/SURFACES.tsv" +sh "$ROOT/scripts/readme-sync.sh" --check + echo echo "ALL SMOKE CHECKS PASSED" diff --git a/web/SURFACES.tsv b/web/SURFACES.tsv new file mode 100644 index 0000000..8ec00c2 --- /dev/null +++ b/web/SURFACES.tsv @@ -0,0 +1,2 @@ +# urllabelwhat it does. One row per live surface; scripts/readme-sync.sh renders these into README.md. +https://rosetta-shell.arcs.care/voice Rosetta Voice say or type a shell construct and hear the portable fix, with what was heard shown word for word From ed66f4734a6c2e38004719ccb5ecdbf62b0e8da1 Mon Sep 17 00:00:00 2001 From: Zach Harris Date: Mon, 16 Nov 2026 10:41:33 -0500 Subject: [PATCH 2/2] ci: run the README status check on every push and before npm publish Co-Authored-By: Claude Opus 5.5 --- .github/workflows/portability.yml | 3 +++ .github/workflows/release.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/portability.yml b/.github/workflows/portability.yml index f49421f..fef9d7d 100644 --- a/.github/workflows/portability.yml +++ b/.github/workflows/portability.yml @@ -44,3 +44,6 @@ jobs: - name: Self-conformance (the library is itself lossless here) run: bin/rosetta selftest + + - name: README status block is current (scripts/readme-sync.sh --check) + run: sh scripts/readme-sync.sh --check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 47e2efc..5860bdc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,6 +37,8 @@ jobs: if [ "$PKG" != "$TAG" ]; then echo "::error::tag $GITHUB_REF_NAME does not match package.json version $PKG"; exit 1 fi + - name: README status block matches this version (no stale docs ship) + run: sh scripts/readme-sync.sh --check - name: Publish to npm (with provenance) run: npm publish --provenance --access public env: