The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(hooks): capture both token-lint exits in pre-push
obchain0de85c850c16
diff --git a/.husky/pre-push b/.husky/pre-pushindex 04639bb6db..7ce5cdebc9 100755--- a/.husky/pre-push+++ b/.husky/pre-push@@ -191,15 +191,19 @@ elseecho "(PRE_PUSH_FORCE_CLIPPY=1 runs it anyway.)"fi-# Enforce scoped cmd-* tokens in components/commands/+# Enforce scoped cmd-* tokens in components/commands/.+# Capture each exit separately: reading `$?` after the second one discarded the+# first, so a lint:commands-tokens failure passed silently whenever+# lint:ui-tokens succeeded.set +erun_check pnpm --dir app run lint:commands-tokens-run_check pnpm --dir app run lint:ui-tokensCMD_TOKENS_EXIT=$?+run_check pnpm --dir app run lint:ui-tokens+UI_TOKENS_EXIT=$?set -e# Exit with error if any command still fails after fixes-if [ $FORMAT_EXIT -ne 0 ] || [ $LINT_EXIT -ne 0 ] || [ $COMPILE_EXIT -ne 0 ] || [ $RUST_CLIPPY_EXIT -ne 0 ] || [ $CMD_TOKENS_EXIT -ne 0 ]; then+if [ $FORMAT_EXIT -ne 0 ] || [ $LINT_EXIT -ne 0 ] || [ $COMPILE_EXIT -ne 0 ] || [ $RUST_CLIPPY_EXIT -ne 0 ] || [ $CMD_TOKENS_EXIT -ne 0 ] || [ $UI_TOKENS_EXIT -ne 0 ]; thenechoecho "============================================================"echo "Pre-push checks failed."@@ -209,7 +213,7 @@ if [ $FORMAT_EXIT -ne 0 ] || [ $LINT_EXIT -ne 0 ] || [ $COMPILE_EXIT -ne 0 ] ||echo " git add -A && git commit -m 'chore: apply auto-fixes'"echo " git push"fi- if [ $COMPILE_EXIT -ne 0 ] || [ $RUST_CLIPPY_EXIT -ne 0 ] || [ $CMD_TOKENS_EXIT -ne 0 ]; then+ if [ $COMPILE_EXIT -ne 0 ] || [ $RUST_CLIPPY_EXIT -ne 0 ] || [ $CMD_TOKENS_EXIT -ne 0 ] || [ $UI_TOKENS_EXIT -ne 0 ]; thenecho "Fix the remaining errors above (TypeScript / Rust / cmd-tokens)"echo "before re-pushing — these have no auto-fix path."fidiff --git a/scripts/__tests__/pre-push-hook.test.mjs b/scripts/__tests__/pre-push-hook.test.mjsindex 4f55fc17a8..f23aa2d9c1 100644--- a/scripts/__tests__/pre-push-hook.test.mjs+++ b/scripts/__tests__/pre-push-hook.test.mjs@@ -215,3 +215,32 @@ test('one Rust ref among several decides for the whole push', () => {]);assert.equal(ranClippy(run), true);});++// ── the token gates (#6533 defect 2) ───────────────────────────────────────++test('a lint:commands-tokens failure fails the hook', () => {+ // Regression for the defect: `$?` was read after `lint:ui-tokens`, so the+ // commands-tokens exit was discarded and this push passed.+ const { ws, line } = pushOf('docs/guide.md', 'docs only\n');+ const run = runHook(ws, [line], { fail: 'lint:commands-tokens' });+ assert.equal(run.status, 1, 'a failing lint:commands-tokens must fail the hook');+ assert.match(run.stdout, /cmd-tokens/);+});++test('a lint:ui-tokens failure still fails the hook', () => {+ const { ws, line } = pushOf('docs/guide.md', 'docs only\n');+ assert.equal(runHook(ws, [line], { fail: 'lint:ui-tokens' }).status, 1);+});++test('both token lints run even when the first one fails', () => {+ // Each has to report on its own; stopping at the first would hide the other.+ const { ws, line } = pushOf('docs/guide.md', 'docs only\n');+ const run = runHook(ws, [line], { fail: 'lint:commands-tokens' });+ assert.ok(run.calls.includes('--dir app run lint:commands-tokens'));+ assert.ok(run.calls.includes('--dir app run lint:ui-tokens'));+});++test('a clean push exits 0', () => {+ const { ws, line } = pushOf('docs/guide.md', 'docs only\n');+ assert.equal(runHook(ws, [line]).status, 0);+});