Luxe 0.1.3: your sessions on your phone, joinable sessions, and nested AGENTS.md
- luxe remote puts the sessions on your computer in reach of your own phone or tablet over Tailscale: write, steer, answer prompts, send photos, browse files, diffs and GitHub, with a paired device and your own Tailscale login. - luxe join lets another program on the same machine join a running session over the RPC protocol. - An AGENTS.md in a subfolder reaches the model the first time it works there. - Long sessions stay fast: no stall before each model call, lighter memory, cheaper drawing. - A session is open in one Luxe at a time, web_search shares results across its phrasings, and a grep glob starting with ! excludes. The CHANGELOG has the full list.
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
# <lines[,lines…]> <path> <fn> # reason
|
||||
406 crates/luxe-tui/src/commands/built_in.rs built_in # the command catalog: one `Command` literal per entry, no logic to pull out, so a new command raises this by its own entry
|
||||
369 crates/luxe-tui/src/app/messages.rs reduce_inner # the `Msg` reducer, one arm per message and nearly all of them one call; the fat arms already live in `app::messages::*`
|
||||
353 crates/luxe-tui/src/app/commands.rs dispatch_action # maps each `UiAction` to the one call that handles it; arms are a line or two and a handler that grows moves out
|
||||
253 crates/luxe-tui/src/app/events.rs reduce # the `Event` reducer, one arm per engine event; the long arms delegate to `app::events::*`
|
||||
223 crates/luxe-core/src/engine/run.rs run # the engine action loop, a dispatch over `Action` where each arm is one handler call; the arms that did real work are methods
|
||||
351 crates/luxe-tui/src/app/commands.rs dispatch_action # maps each `UiAction` to the one call that handles it; arms are a line or two and a handler that grows moves out
|
||||
237 crates/luxe-tui/src/app/events.rs reduce # the `Event` reducer, one arm per engine event; the long arms delegate to `app::events::*`
|
||||
218 crates/luxe-core/src/engine/run.rs run # the engine action loop, a dispatch over `Action` where each arm is one handler call; the arms that did real work are methods
|
||||
204 crates/luxe-tui/src/app/commands/slash.rs run_slash # maps each slash command to the handler that runs it; the arms that grew are in `commands::*`
|
||||
128 crates/luxe-core/src/engine/turn.rs run_turn # the turn state machine: its `break`s and early returns share the loop state, and every step that could stand alone (compact, stream, commit, tools, wrap-up) already does
|
||||
125 crates/luxe-cli/src/cli/rpc/translate.rs to_engine_action # the RPC vocabulary mapped onto `Action`, one thin arm per variant
|
||||
125 crates/luxe-tui/src/main_loop/click.rs clicked_target # one arm per mouse target, each a view guard and one message or a call into a named handler
|
||||
108 crates/luxe-tui/src/app/construct.rs with_file_provider # the `App` literal, one field per line; nothing in it is logic to extract
|
||||
113 crates/luxe-cli/src/cli/rpc/translate.rs to_engine_action # the RPC vocabulary mapped onto `Action`, one thin arm per variant
|
||||
107 crates/luxe-tui/src/app/construct.rs with_file_provider # the `App` literal, one field per line; nothing in it is logic to extract
|
||||
97 crates/luxe-cli/src/cli/headless.rs headless_json_event # one arm per `Event` the JSON stream reports, each building its small object
|
||||
93 crates/luxe-core/src/engine/turn/stream.rs read_stream # one match over provider events whose arms share the accumulating reply and `break` the loop; the arms that did more are helpers
|
||||
90 crates/luxe-tui/src/view/guided_review/overlays/help.rs help_groups # the review keys card as a table of rows, one per line
|
||||
|
||||
66
scripts/press-shots.mjs
Normal file
66
scripts/press-shots.mjs
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env node
|
||||
// Render the press kit's screenshots to web/public/press/<name>.png.
|
||||
//
|
||||
// Each one is a still the site already draws (`web/src/pages/press-shots.astro`), photographed at
|
||||
// twice its size so it stays sharp in an article or on a slide. Separate from `site-assets.sh`
|
||||
// for the reason `social-card.sh` is: that one turns Rust into assets and CI checks it, and this
|
||||
// needs Node, a build and a browser.
|
||||
//
|
||||
// Usage: node scripts/press-shots.mjs (from the repository root, after `npm install` in web/)
|
||||
|
||||
import { spawn, spawnSync } from "node:child_process";
|
||||
import { mkdirSync } from "node:fs";
|
||||
import { createRequire } from "node:module";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
|
||||
const web = join(dirname(fileURLToPath(import.meta.url)), "..", "web");
|
||||
const out = join(web, "public", "press");
|
||||
const port = process.env.PORT ?? "4332";
|
||||
const origin = `http://localhost:${port}`;
|
||||
|
||||
const require = createRequire(join(web, "package.json"));
|
||||
const playwright = await import(pathToFileURL(require.resolve("playwright")).href);
|
||||
const { chromium } = playwright.chromium ? playwright : playwright.default;
|
||||
|
||||
function build() {
|
||||
const built = spawnSync("npm", ["run", "build"], { cwd: web, stdio: "inherit" });
|
||||
if (built.status !== 0) throw new Error(`the site build failed with status ${built.status}`);
|
||||
}
|
||||
|
||||
async function waitForPreview() {
|
||||
for (let attempt = 0; attempt < 30; attempt++) {
|
||||
await new Promise((done) => setTimeout(done, 1000));
|
||||
const reply = await fetch(`${origin}/press-shots/`).catch(() => null);
|
||||
if (reply?.ok) return;
|
||||
}
|
||||
throw new Error(`the preview never came up on ${origin}`);
|
||||
}
|
||||
|
||||
// A tall window, so a still is sized by its own width cap rather than by the screen's height
|
||||
async function photograph() {
|
||||
const browser = await chromium.launch();
|
||||
const page = await browser.newPage({
|
||||
viewport: { width: 1980, height: 2400 },
|
||||
deviceScaleFactor: 2,
|
||||
reducedMotion: "reduce",
|
||||
});
|
||||
await page.goto(`${origin}/press-shots/`, { waitUntil: "networkidle" });
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
mkdirSync(out, { recursive: true });
|
||||
for (const shot of await page.$$("[data-shot]")) {
|
||||
const name = await shot.getAttribute("data-shot");
|
||||
await (await shot.$(".still__plate")).screenshot({ path: join(out, `${name}.png`) });
|
||||
console.log(`wrote web/public/press/${name}.png`);
|
||||
}
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
build();
|
||||
const preview = spawn("npx", ["astro", "preview", "--port", port], { cwd: web, stdio: "ignore" });
|
||||
try {
|
||||
await waitForPreview();
|
||||
await photograph();
|
||||
} finally {
|
||||
preview.kill();
|
||||
}
|
||||
83
scripts/remote-fonts.sh
Executable file
83
scripts/remote-fonts.sh
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the phone app's webfonts into crates/luxe-remote/app/fonts/.
|
||||
#
|
||||
# The same two faces as the website (see scripts/site-fonts.sh for the licensing, which holds here
|
||||
# too): JetBrains Mono Nerd Font Mono, and Adwaita Mono for the marks it lacks. The subset differs.
|
||||
# The site draws a known set of characters; the app draws whatever a model writes. So it keeps the
|
||||
# ranges text is written in (Latin, Greek, Cyrillic, punctuation, arrows, maths, box drawing) plus
|
||||
# every glyph Luxe draws: the TUI's glyph table at every tier (the glyph_codepoints example), and,
|
||||
# when the website has been built, its coverage.txt, which catches what captures show outside the
|
||||
# table. Anything else falls through the CSS stack to the phone's own font, one glyph at a time.
|
||||
#
|
||||
# The fonts are embedded in the luxe binary, so the size matters twice: once in the download, and
|
||||
# once on every phone's first load.
|
||||
#
|
||||
# Requires: fonttools + brotli, and both faces installed (or JETBRAINS_DIR / ADWAITA_DIR). The OFL
|
||||
# texts beside the fonts are committed and don't change, so they aren't copied again.
|
||||
#
|
||||
# Usage: scripts/remote-fonts.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
out_dir="${repo_root}/crates/luxe-remote/app/fonts"
|
||||
site_fonts="${repo_root}/web/public/fonts"
|
||||
jetbrains_dir="${JETBRAINS_DIR:-${HOME}/.local/share/fonts/JetBrainsMonoNFM}"
|
||||
adwaita_dir="${ADWAITA_DIR:-/usr/share/fonts/TTF}"
|
||||
|
||||
for needed in "${jetbrains_dir}/JetBrainsMonoNerdFontMono-Regular.ttf" \
|
||||
"${adwaita_dir}/AdwaitaMonoNerdFontMono-Regular.ttf"; do
|
||||
[[ -f "${needed}" ]] || {
|
||||
echo "missing ${needed} (the header of scripts/remote-fonts.sh says where each comes from)" >&2
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
command -v pyftsubset >/dev/null || {
|
||||
echo "pyftsubset not found — pip install fonttools brotli" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
text='U+0020-007E,U+00A0-024F,U+0370-03FF,U+0400-04FF,U+2000-206F,U+20A0-20CF,U+2100-214F'
|
||||
symbols='U+2190-21FF,U+2200-22FF,U+2300-23FF,U+2500-259F,U+25A0-25FF,U+2700-27BF'
|
||||
luxe_glyphs() {
|
||||
cargo run -q -p luxe-tui --example glyph_codepoints --manifest-path "${repo_root}/Cargo.toml"
|
||||
if [[ -f "${site_fonts}/coverage.txt" ]]; then
|
||||
sed 's/#.*//' "${site_fonts}/coverage.txt" | tr -d '[:blank:]' | grep .
|
||||
fi
|
||||
}
|
||||
luxe="$(luxe_glyphs | sort -u | paste -sd, -)"
|
||||
unicodes="${text},${symbols},${luxe}"
|
||||
|
||||
subset() {
|
||||
pyftsubset "$1" --output-file="$2" --flavor=woff2 --unicodes="$3" \
|
||||
--layout-features= --no-hinting --desubroutinize \
|
||||
--name-IDs='0,1,2,3,4,5,6,13,14' --notdef-outline 2>/dev/null
|
||||
printf ' %-34s %7s\n' "$(basename "$2")" "$(stat -c%s "$2")"
|
||||
}
|
||||
|
||||
pyftsubset_python="$(head -1 "$(command -v pyftsubset)" | sed 's/^#!//')"
|
||||
cmap() {
|
||||
${pyftsubset_python} -c 'import sys
|
||||
from fontTools.ttLib import TTFont
|
||||
print("\n".join(f"U+{c:04X}" for c in sorted(TTFont(sys.argv[1]).getBestCmap())))' "$1"
|
||||
}
|
||||
|
||||
mkdir -p "${out_dir}"
|
||||
rm -f "${out_dir}"/*.woff2
|
||||
for style in Regular Bold Italic; do
|
||||
subset "${jetbrains_dir}/JetBrainsMonoNerdFontMono-${style}.ttf" \
|
||||
"${out_dir}/jetbrains-mono-${style,,}.woff2" "${unicodes}"
|
||||
done
|
||||
|
||||
# Only Luxe's own marks come from Adwaita: filling every gap in the text ranges would add its
|
||||
# drawing of characters JetBrains Mono chose to leave out, for little a phone can't draw itself
|
||||
gaps="$(comm -23 <(printf '%s' "${luxe}" | tr ',' '\n' | sort -u) \
|
||||
<(cmap "${out_dir}/jetbrains-mono-regular.woff2" | sort -u) | paste -sd, -)"
|
||||
if [[ -n "${gaps}" ]]; then
|
||||
for style in Regular Bold; do
|
||||
subset "${adwaita_dir}/AdwaitaMonoNerdFontMono-${style}.ttf" \
|
||||
"${out_dir}/adwaita-mono-${style,,}.woff2" "${gaps}"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "wrote $(du -sh "${out_dir}" | cut -f1) to ${out_dir#"${repo_root}/"}"
|
||||
56
scripts/remote-vendor.sh
Executable file
56
scripts/remote-vendor.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
# Vendor the phone app's view library: Preact, its hooks, htm, and Preact Signals.
|
||||
#
|
||||
# The app has no build step, so these ship as the packages publish them, byte for byte, and the
|
||||
# browser resolves their bare imports (`from "preact"`) through the page's import map. Each file's
|
||||
# SHA-256 goes into `manifest.json`, and a test in `luxe-remote` holds the embedded files to it, so
|
||||
# an edit to a vendored file fails the build instead of shipping as "Preact 11.0.1".
|
||||
#
|
||||
# To update: change a version below, run this, then check the app still boots. The same versions go
|
||||
# in crates/luxe-remote/app-tests/package.json, whose type declarations check the app; a test there
|
||||
# holds the two together.
|
||||
#
|
||||
# Requires: npm (only to fetch; nothing is installed). Usage: scripts/remote-vendor.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
out_dir="${repo_root}/crates/luxe-remote/app/vendor"
|
||||
work_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "${work_dir}"' EXIT
|
||||
|
||||
# package@version, the file inside the package, and the name it is served under
|
||||
files=(
|
||||
"preact@11.0.1 dist/preact.mjs preact.mjs"
|
||||
"preact@11.0.1 hooks/dist/hooks.mjs hooks.mjs"
|
||||
"htm@3.1.1 dist/htm.mjs htm.mjs"
|
||||
"@preact/signals-core@1.14.4 dist/signals-core.mjs signals-core.mjs"
|
||||
"@preact/signals@2.11.3 dist/signals.mjs signals.mjs"
|
||||
)
|
||||
|
||||
fetch() {
|
||||
local spec="$1" dir="${work_dir}/$1"
|
||||
if [[ ! -d "${dir}" ]]; then
|
||||
mkdir -p "${dir}"
|
||||
(cd "${dir}" && npm pack --silent "${spec}" >/dev/null && tar xzf ./*.tgz)
|
||||
fi
|
||||
echo "${dir}/package"
|
||||
}
|
||||
|
||||
rm -rf "${out_dir}"
|
||||
mkdir -p "${out_dir}/licenses"
|
||||
manifest="["
|
||||
for line in "${files[@]}"; do
|
||||
read -r spec inner served <<<"${line}"
|
||||
package_dir="$(fetch "${spec}")"
|
||||
cp "${package_dir}/${inner}" "${out_dir}/${served}"
|
||||
name="${spec%@*}"
|
||||
slug="${name#@}"
|
||||
cp "${package_dir}/LICENSE" "${out_dir}/licenses/${slug//\//-}.txt"
|
||||
license="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["license"])' "${package_dir}/package.json")"
|
||||
sha="$(sha256sum "${out_dir}/${served}" | cut -d' ' -f1)"
|
||||
manifest+="
|
||||
{\"file\": \"${served}\", \"package\": \"${name}\", \"version\": \"${spec##*@}\", \"from\": \"${inner}\", \"license\": \"${license}\", \"sha256\": \"${sha}\"},"
|
||||
done
|
||||
printf '%s\n]\n' "${manifest%,}" >"${out_dir}/manifest.json"
|
||||
echo "vendored ${#files[@]} files into ${out_dir#"${repo_root}/"}"
|
||||
@@ -113,6 +113,8 @@ GUIDE_SHOTS=(
|
||||
"chat-plan-ready:100:26:loop-plan-ready"
|
||||
)
|
||||
guide_dir="${repo_root}/docs/guide/images"
|
||||
# The phone app's wordmark, from the same art. The app has no build step, so it ships the file
|
||||
app_dir="${repo_root}/crates/luxe-remote/app/generated"
|
||||
|
||||
# Luxe's own theme, the one the site is set in. The colors are baked into each file rather than left
|
||||
# as custom properties, so a capture stays correct wherever it is embedded — a README, someone's
|
||||
@@ -145,8 +147,9 @@ shiki() { cargo run --quiet --release -p luxe-tui --example shiki_theme -- "$@";
|
||||
wordmark_gif() { cargo run --quiet --release -p luxe-tui --example wordmark_gif -- "$@"; }
|
||||
|
||||
generate() {
|
||||
local target="$1" guide_target="$2"
|
||||
mkdir -p "${target}" "${guide_target}"
|
||||
local target="$1" guide_target="$2" app_target="$3"
|
||||
mkdir -p "${target}" "${guide_target}" "${app_target}"
|
||||
wordmark app >"${app_target}/wordmark.svg"
|
||||
|
||||
wordmark wordmark >"${target}/wordmark.svg"
|
||||
wordmark mark >"${target}/mark.svg"
|
||||
@@ -199,8 +202,9 @@ cargo build --quiet --release -p luxe-tui --features fixture \
|
||||
if [[ "${check}" == true ]]; then
|
||||
scratch="$(mktemp -d)"
|
||||
trap 'rm -rf "${scratch}"' EXIT
|
||||
generate "${scratch}/site" "${scratch}/guide"
|
||||
if diff -ru "${out_dir}" "${scratch}/site" && diff -ru "${guide_dir}" "${scratch}/guide"; then
|
||||
generate "${scratch}/site" "${scratch}/guide" "${scratch}/app"
|
||||
if diff -ru "${out_dir}" "${scratch}/site" && diff -ru "${guide_dir}" "${scratch}/guide" &&
|
||||
diff -ru "${app_dir}" "${scratch}/app"; then
|
||||
echo "site assets are up to date"
|
||||
else
|
||||
echo >&2
|
||||
@@ -210,7 +214,7 @@ if [[ "${check}" == true ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
generate "${out_dir}" "${guide_dir}"
|
||||
generate "${out_dir}" "${guide_dir}" "${app_dir}"
|
||||
|
||||
printf '%s\n' "wrote $(find "${out_dir}" -type f | wc -l) files to ${out_dir}"
|
||||
du -sh "${out_dir}" | cut -f1 | xargs -I{} echo "total {} on disk, and they gzip to about a tenth of that"
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Files allowed over a size limit, and the most they may grow to. See scripts/size-check.py.
|
||||
# <lines> <kind> <path> # reason
|
||||
621 prod crates/luxe-core/src/event/events.rs # the published Event vocabulary, kept whole: thin variants and no logic, and splitting it into nested enums would retag the wire
|
||||
614 prod crates/luxe-core/src/event/events.rs # the published Event vocabulary, kept whole: thin variants and no logic, and splitting it into nested enums would retag the wire
|
||||
|
||||
@@ -5,7 +5,8 @@ Compares the workspace version against a base ref, normally the pull request's t
|
||||
|
||||
- a change to what reaches crates.io (anything under `crates/`, `Cargo.toml`, `Cargo.lock`) on top
|
||||
of a released version has to raise it, and by exactly one semver step, so a typo cannot skip a
|
||||
release. A version is released once a `v<version>` tag marks it. Until then it already names the
|
||||
release. A version is released once a `v<version>` tag marks it, locally or, in a development
|
||||
checkout, on its `public` remote (the public repository). Until then it already names the
|
||||
release this change will ship in, so no bump is owed; it may still move, but only to another
|
||||
single step past the last release, as when a breaking change turns a pending patch into a minor;
|
||||
- the version never goes down, shipped change or not;
|
||||
@@ -31,6 +32,8 @@ SEMVER = re.compile(
|
||||
r"(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$"
|
||||
)
|
||||
SHIPPED_FILES = {"Cargo.toml", "Cargo.lock"}
|
||||
# A development checkout names the public repository this, and its tags are the releases
|
||||
RELEASE_REMOTE = "public"
|
||||
DEPENDENCY_TABLES = ("dependencies", "dev-dependencies", "build-dependencies")
|
||||
|
||||
|
||||
@@ -130,9 +133,39 @@ def problems(base_ref: str) -> list[str]:
|
||||
|
||||
|
||||
def released() -> list[str]:
|
||||
"""Every version a `v<version>` tag marks."""
|
||||
tags = git("tag", "--list", "v*").split()
|
||||
return [tag[1:] for tag in tags if SEMVER.match(tag[1:])]
|
||||
"""Every version a `v<version>` tag marks, here or on the release remote."""
|
||||
tags = set(git("tag", "--list", "v*").split()) | set(release_remote_tags())
|
||||
return sorted(tag[1:] for tag in tags if SEMVER.match(tag[1:]))
|
||||
|
||||
|
||||
def release_remote_tags() -> list[str]:
|
||||
"""The release remote's `v*` tags, read without fetching; none when it isn't set up.
|
||||
|
||||
A development checkout never sees the public repository's tags on its own, so a release made
|
||||
there would look unreleased here, and work would pile up under a version that already shipped.
|
||||
Offline, the local tags are all there is, and the check says so rather than failing.
|
||||
"""
|
||||
if RELEASE_REMOTE not in git("remote").split():
|
||||
return []
|
||||
listing = subprocess.run(
|
||||
["git", "ls-remote", "--tags", "--refs", RELEASE_REMOTE, "v*"],
|
||||
cwd=ROOT,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
if listing.returncode != 0:
|
||||
reason = listing.stderr.strip()
|
||||
warning = f"warning: could not read `{RELEASE_REMOTE}`'s tags, so only local ones count"
|
||||
print(f"version-check: {warning}: {reason}", file=sys.stderr)
|
||||
return []
|
||||
return tags_in_listing(listing.stdout)
|
||||
|
||||
|
||||
def tags_in_listing(listing: str) -> list[str]:
|
||||
"""The tag names in `git ls-remote --tags --refs` output."""
|
||||
prefix = "refs/tags/"
|
||||
refs = (line.split("\t", 1)[-1] for line in listing.splitlines())
|
||||
return [ref[len(prefix) :] for ref in refs if ref.startswith(prefix)]
|
||||
|
||||
|
||||
def shipped_problem(base: str, head: str, released: list[str]) -> str | None:
|
||||
|
||||
@@ -113,6 +113,15 @@ class Changelog(unittest.TestCase):
|
||||
self.assertFalse(vc.changelog_has("### [0.2.0]\n", "0.2.0"))
|
||||
|
||||
|
||||
class TagListing(unittest.TestCase):
|
||||
def test_reads_tag_names_from_ls_remote(self):
|
||||
listing = "3f5a\trefs/tags/v0.1.2\n6a20\trefs/tags/v0.1.1\n"
|
||||
self.assertEqual(vc.tags_in_listing(listing), ["v0.1.2", "v0.1.1"])
|
||||
|
||||
def test_ignores_what_is_not_a_tag(self):
|
||||
self.assertEqual(vc.tags_in_listing("9e30\trefs/heads/main\n\n"), [])
|
||||
|
||||
|
||||
class AgainstARepository(unittest.TestCase):
|
||||
"""The git wiring: a real repository, a base branch, and a change on top of it."""
|
||||
|
||||
@@ -168,6 +177,24 @@ class AgainstARepository(unittest.TestCase):
|
||||
self.commit("change")
|
||||
self.assertEqual(vc.problems("main"), [])
|
||||
|
||||
def test_a_release_tagged_only_on_the_public_remote_counts(self):
|
||||
# The break this catches: reading local tags only, so a development checkout keeps
|
||||
# adding to a version the public repository already released
|
||||
public = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(public.cleanup)
|
||||
self.run_git("clone", "-q", "--bare", str(self.root), public.name)
|
||||
subprocess.run(["git", "tag", "v0.1.0", "main"], cwd=public.name, check=True)
|
||||
self.run_git("remote", "add", "public", public.name)
|
||||
self.write("crates/a/src/lib.rs", "pub fn new() {}\n")
|
||||
self.commit("change")
|
||||
self.assertIn("leaves the version at 0.1.0", " ".join(vc.problems("main")))
|
||||
|
||||
def test_an_unreachable_public_remote_falls_back_to_local_tags(self):
|
||||
self.run_git("remote", "add", "public", str(self.root / "missing"))
|
||||
self.write("crates/a/src/lib.rs", "pub fn new() {}\n")
|
||||
self.commit("change")
|
||||
self.assertEqual(vc.problems("main"), [])
|
||||
|
||||
|
||||
class ShippedProblem(unittest.TestCase):
|
||||
"""The bump a shipped change owes, given which versions have been released."""
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check shipped prose against `docs/brand/voice.md`.
|
||||
|
||||
Taste that cannot be asserted drifts. This asserts the one part of the voice that a machine can
|
||||
actually judge: the words the rule bans outright. Everything else in that document — evidence with
|
||||
claims, naming the trade-off, sentence variance — is a human's call, and pretending otherwise would
|
||||
produce a checker nobody trusts.
|
||||
This checks the part of the voice a machine can judge: banned words and British spellings. The rest
|
||||
of that document (plain words, labels over sentences, where wordplay belongs) is a person's call.
|
||||
|
||||
Two severities, because they are different promises:
|
||||
|
||||
@@ -13,7 +11,7 @@ Two severities, because they are different promises:
|
||||
Reported, never fatal.
|
||||
|
||||
Code is not prose: fenced blocks and inline spans are skipped, so a banned word inside a command is
|
||||
a command. `docs/brand/voice.md` is skipped entirely — it quotes every one of these on purpose.
|
||||
a command.
|
||||
|
||||
python3 scripts/voice-check.py # everything shipped
|
||||
python3 scripts/voice-check.py --review # include the judgement calls
|
||||
@@ -120,8 +118,7 @@ BRITISH = {
|
||||
"spelt": "spelled",
|
||||
}
|
||||
|
||||
# Text we did not write, plus this file — which contains every banned spelling by definition, the
|
||||
# same reason `docs/brand/voice.md` is skipped above. Lockfiles are resolver output and can name a
|
||||
# Text we did not write, plus this file, which contains every banned spelling by definition. Lockfiles are resolver output and can name a
|
||||
# real package `@img/color`; upstream license grants keep whatever spelling they shipped with. The
|
||||
# GitHub fixtures are GitHub's own answers, saved verbatim, with strangers' titles in them.
|
||||
SPELLING_SKIP = (
|
||||
@@ -149,7 +146,6 @@ SPELLING_SKIP_EXT = (
|
||||
# Prose that ships. The planning docs and the journal are development-only and write for a different
|
||||
# reader; holding them to the product's voice would be a category error.
|
||||
INCLUDE = ["README.md", "docs/guide/*.md", "web/src/**/*.astro", "web/src/**/*.svelte"]
|
||||
SKIP = {"docs/brand/voice.md"}
|
||||
|
||||
|
||||
def prose(text: str) -> str:
|
||||
@@ -236,14 +232,7 @@ def main() -> int:
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
paths = sorted(
|
||||
{
|
||||
p
|
||||
for pattern in INCLUDE
|
||||
for p in ROOT.glob(pattern)
|
||||
if str(p.relative_to(ROOT)) not in SKIP
|
||||
}
|
||||
)
|
||||
paths = sorted({p for pattern in INCLUDE for p in ROOT.glob(pattern)})
|
||||
|
||||
banned = [f for p in paths for f in findings(p, BANNED, CASE_SENSITIVE)]
|
||||
print(f"voice check \u2014 {len(paths)} files")
|
||||
|
||||
Reference in New Issue
Block a user