Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(app): stop lint:ui-tokens reporting success on a scan it could not run\n\n`lint:ui-tokens` and `lint:commands-tokens` were `! rg <pattern> <paths...>`,\nrelying on ripgrep's 0 = matched / 1 = no match to make the negation the gate.\n\nripgrep has a third exit code: 2, for an error — most commonly a path that does\nnot exist. `! 2` is also 0, so once any scanned directory was deleted the check\nbegan reporting success regardless of what the remaining files contained. It\nstill printed the violations it found; nothing read them.\n\nThat is not hypothetical. 93fb9e25 ("refactor: remove TinyPlace from core and\napp", #5847) deleted `src/components/orchestration/` while it was still on\n`lint:ui-tokens`'s path list, so the guard has been silently off since\n2026-08-30 — the run prints `rg: src/components/orchestration/: No such file or\ndirectory (os error 2)` and then passes.\n\nFix, in two parts:\n - drop the stale path from the list;\n - move the scan into scripts/lint-token-scan.sh, which validates every path\n up front (naming the offending one) and handles ripgrep's exit code\n explicitly. Anything that is not a clean 0/1 is a failure. A guard that\n cannot look must never report that it looked and found nothing.\n\n`lint:commands-tokens` had the identical shape with a path that happens to\nstill exist; it moves to the same scanner rather than being left latent.\n\nVerified by running the script, not by reading it:\n - clean tree, all paths present -> exit 0\n - stale path restored to the list -> exit 1, names the path\n - real violation planted in src/components/dashboard/ -> exit 1, names the file\n - old inline form, same violation + missing path -> exit 0 (the bug)\n

M3gA-Mindd885d60bd1cc
diff --git a/app/package.json b/app/package.json
index 7b68403646..90de3480ab 100644
--- a/app/package.json
+++ b/app/package.json
@@ -65,8 +65,8 @@
"format:check": "prettier --check . && pnpm rust:format:check",
"lint": "eslint . --ext .ts,.tsx --cache",
"lint:fix": "eslint . --ext .ts,.tsx --fix --cache",
- "lint:commands-tokens": "bash -c 'command -v rg >/dev/null 2>&1 || { echo \"lint:commands-tokens requires ripgrep. Install: brew install ripgrep (macOS) / apt install ripgrep (Debian/Ubuntu) / see https://github.com/BurntSushi/ripgrep#installation\" >&2; exit 1; }; ! rg -nU \"(bg|text|border|ring|shadow)-(neutral|primary|sage|amber|canvas|stone|slate)\" src/components/commands/'",
- "lint:ui-tokens": "bash -c 'command -v rg >/dev/null 2>&1 || { echo \"lint:ui-tokens requires ripgrep. Install: brew install ripgrep (macOS) / apt install ripgrep (Debian/Ubuntu)\" >&2; exit 1; }; ! rg -nP \"^(?!\\s*(//|\\*|/\\*)).*\\b(bg|text|border|ring|divide)-(neutral|stone|slate|canvas|white|black)\\b\" src/components/ui/ src/components/layout/ src/components/settings/ src/features/conversations/ src/components/intelligence/ src/components/feedback/ src/components/flows/ src/components/chat/ src/components/rewards/ src/components/skills/ src/components/channels/ src/pages/ src/components/dashboard/ src/components/orchestration/ src/components/composio/ src/components/notifications/ src/components/accounts/ src/components/approvals/ src/features/human/ && ! rg -nP \"^(?!\\s*(//|\\*|/\\*)).*(color-mix\\(|oklch\\(|@layer )\" src/components/ui/ src/styles/fonts.css && node scripts/lint-undefined-scales.mjs'",
+ "lint:commands-tokens": "bash scripts/lint-token-scan.sh lint:commands-tokens -nU \"(bg|text|border|ring|shadow)-(neutral|primary|sage|amber|canvas|stone|slate)\" src/components/commands/",
+ "lint:ui-tokens": "bash scripts/lint-token-scan.sh lint:ui-tokens -nP \"^(?!\\s*(//|\\*|/\\*)).*\\b(bg|text|border|ring|divide)-(neutral|stone|slate|canvas|white|black)\\b\" src/components/ui/ src/components/layout/ src/components/settings/ src/features/conversations/ src/components/intelligence/ src/components/feedback/ src/components/flows/ src/components/chat/ src/components/rewards/ src/components/skills/ src/components/channels/ src/pages/ src/components/dashboard/ src/components/composio/ src/components/notifications/ src/components/accounts/ src/components/approvals/ src/features/human/ && bash scripts/lint-token-scan.sh lint:ui-tokens -nP \"^(?!\\s*(//|\\*|/\\*)).*(color-mix\\(|oklch\\(|@layer )\" src/components/ui/ src/styles/fonts.css && node scripts/lint-undefined-scales.mjs",
"knip": "knip --config knip.json",
"knip:production": "knip --config knip.json --production"
},
diff --git a/app/scripts/lint-token-scan.sh b/app/scripts/lint-token-scan.sh
new file mode 100755
index 0000000000..bb000c421e
--- /dev/null
+++ b/app/scripts/lint-token-scan.sh
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+#
+# Fail when a forbidden hardcoded-colour token appears in a scanned path.
+#
+# WHY THIS IS A SCRIPT AND NOT `! rg ...` IN package.json
+# -------------------------------------------------------
+# These checks used to be written inline as `! rg <pattern> <paths...>`, relying
+# on ripgrep's exit code: 0 = matched, 1 = no match. The negation turned "no
+# match" into success.
+#
+# ripgrep has a THIRD exit code: 2, for an error — most commonly a path that
+# does not exist. `! 2` is also 0, so the moment any scanned directory was
+# deleted the whole check began reporting success no matter what the remaining
+# files contained. It still printed the violations it found; nothing read them.
+#
+# That is exactly what happened: `src/components/orchestration/` was removed in
+# a54c4e7d ("refactor: remove TinyPlace from core and app", #5847) while it was
+# still on `lint:ui-tokens`'s path list, and the guard silently stopped guarding.
+#
+# So: exit codes are handled explicitly here, and anything that is not a clean
+# 0/1 from ripgrep is a FAILURE. A guard that cannot look must never report that
+# it looked and found nothing.
+#
+# Usage: lint-token-scan.sh <label> <rg-flags> <pattern> <path>...
+set -uo pipefail
+
+if [ "$#" -lt 4 ]; then
+ echo "usage: $0 <label> <rg-flags> <pattern> <path>..." >&2
+ exit 2
+fi
+
+label="$1"
+flags="$2"
+pattern="$3"
+shift 3
+
+if ! command -v rg >/dev/null 2>&1; then
+ echo "$label requires ripgrep. Install: brew install ripgrep (macOS) / apt install ripgrep (Debian/Ubuntu) / see https://github.com/BurntSushi/ripgrep#installation" >&2
+ exit 1
+fi
+
+# Check the paths up front rather than letting ripgrep's error be the signal.
+# This names the offending path, which is the thing a maintainer needs: a stale
+# entry here means a directory moved or was deleted and the list was not updated.
+missing=0
+for path in "$@"; do
+ if [ ! -e "$path" ]; then
+ echo "$label: scanned path does not exist: $path" >&2
+ missing=1
+ fi
+done
+if [ "$missing" -ne 0 ]; then
+ echo "$label: refusing to report success on an incomplete scan. Update the path list in package.json." >&2
+ exit 1
+fi
+
+# shellcheck disable=SC2086 # $flags is a deliberate word-split of rg flags.
+rg $flags "$pattern" "$@"
+status=$?
+
+case "$status" in
+ 0)
+ echo "$label: forbidden token(s) found above." >&2
+ exit 1
+ ;;
+ 1)
+ # No match — the only success path.
+ exit 0
+ ;;
+ *)
+ echo "$label: ripgrep exited $status (not a match/no-match result); treating as a failure rather than a pass." >&2
+ exit 1
+ ;;
+esac