ECC/scripts
Thejesh Reddy 5deee34c93
fix(hooks): remove stray '?' that made every 'yarn <anything>' fire tmux reminder (#2517)
* fix(hooks): remove stray '?' that made every 'yarn <anything>' trigger tmux reminder

The tmux-reminder matcher uses one alternation per package manager. Each
branch requires a subcommand (install|test) — except yarn, whose subcommand
group carried a trailing `?`:

    yarn (install|test)?

That made the subcommand optional, so the branch degraded to "yarn " plus
anything: `yarn add foo`, `yarn build`, `yarn dev`, even `yarn --version`
all matched and spammed the "Consider running in tmux" hint into the
additional-context channel.

Drop the `?` so yarn matches parity with npm/pnpm/bun. Verified locally
against 14 cases (yarn install/test still fire; yarn add/build/dev/… no
longer do; npm/pnpm/bun/pytest behavior unchanged).

Fixes #2514

* test(hooks): add pre-bash-tmux-reminder regression tests

Add coverage for the tmux-reminder matcher following the auto-tmux-dev.test.js
structure — the regex-first hook now has direct regression tests for the yarn
branch fix in this PR (and for the sibling package managers, other matched
tools, TMUX bypass, and malformed input).

16 assertions total:
  - fires for: yarn install, yarn test, npm install, pnpm test, bun install,
               pytest tests/, cargo build
  - does NOT fire for: yarn add react, yarn build, yarn dev, yarn --version,
                       bare `yarn`, npm run dev
  - respects TMUX env var
  - tolerates invalid JSON and missing command field

Verified the tests actually catch the bug: reintroducing the buggy
`yarn (install|test)?` fails 4 of the 5 yarn non-match cases (the fifth,
bare `yarn`, stays passing because even the buggy branch requires a trailing
space after yarn).

Addresses CodeRabbit review on #2517.

* test(hooks): fail loudly on spawn errors, use destructuring, split runTests

Address three CodeRabbit review notes on tests/hooks/pre-bash-tmux-reminder.test.js:

- Fail loudly on spawnSync errors: raise instead of coercing
  `result.status || 0`, which would mask spawn errors, timeouts, or signal
  termination as a successful exit 0 (masks legitimate test failures).
- Use destructuring (`const { TMUX, ...env } = process.env`) instead of
  copy-then-`delete` so the base env is built immutably.
- Split `runTests` (was 66 lines) into small per-group helpers
  (runYarnTests, runSiblingPackageManagerTests, runOtherToolTests,
  runTmuxBypassTests, runEdgeCaseTests). `runTests` is now 18 lines and
  purely orchestrates.

16 assertions still pass; no coverage changes.

The 4th CodeRabbit note (avoid console.log in test files) is intentionally
not adopted here — every sibling hook test in this repo
(auto-tmux-dev.test.js, bash-hook-dispatcher.test.js, block-no-verify.test.js,
etc.) writes to console.log because the project's own test runner
(tests/run-all.js) is console-log based and there is no Jest/Mocha
dependency. Diverging from the established convention in a bugfix PR is
out of scope.

* test(hooks): trim tmux reminder regression coverage

---------

Co-authored-by: Haley Chen <2022hachen@gmail.com>
2026-07-20 16:21:03 -04:00
..
ci fix(install): reference all curated skills in modules + reverse-coverage guard (#2431) (#2440) 2026-07-08 17:14:52 -04:00
codemaps feat: add scripts/codemaps/generate.ts codemap generator Fixes #247 - The generate.ts script referenced in agents/doc-updater.md was missing from the repository. This adds the actual implementation. The script: - Recursively walks the src directory (skipping node_modules, dist, etc.) - Classifies files into 5 areas: frontend, backend, database, integrations, workers - Generates docs/CODEMAPS/INDEX.md + one .md per area - Uses the codemap format defined in doc-updater.md - Supports optional srcDir argument: npx tsx scripts/codemaps/generate.ts [srcDir] 2026-02-22 16:19:16 +05:30
codex fix: add plugin cache health check (#2249) 2026-06-15 14:01:25 -04:00
codex-git-hooks fix: skip pre-push checks on branch deletion 2026-03-29 23:09:26 +09:00
discord fix(security): discord bot SSRF/log-injection/DoS hardening + bump markdown-it/js-yaml 2026-06-18 19:50:15 -04:00
hooks fix(hooks): remove stray '?' that made every 'yarn <anything>' fire tmux reminder (#2517) 2026-07-20 16:21:03 -04:00
lib fix: make the installer runtime pass strict supply-chain vetting (#2503) 2026-07-17 17:13:49 -04:00
auto-update.js style: apply repo formatter to the security-fix files (no behavior change) 2026-06-18 20:03:24 -04:00
build-opencode.js fix: restore ci baseline for opencode packaging 2026-04-05 14:47:26 -07:00
catalog.js feat: add install catalog and project config autodetection 2026-03-27 05:56:39 -04:00
claw.js fix(security): gateguard classifier bypasses (GHSA-4v57) + Windows CI + claw ReDoS 2026-06-18 20:02:30 -04:00
consult.js fix: tune machine learning workflow routing 2026-05-11 18:11:05 -04:00
control-pane.js feat: add dynamic workflow team orchestration surface 2026-06-04 21:45:13 +08:00
dashboard-web.js refactor(hooks): consolidate PostToolUse hooks into sync/async dispatchers (#2494) 2026-07-19 15:47:10 -04:00
discussion-audit.js chore: gate canonical ECC release identity (#1991) 2026-05-19 06:42:17 -04:00
doctor.js fix(scripts): add os.homedir() fallback for Windows compatibility 2026-03-28 11:28:12 +08:00
ecc.js feat: add dry-run mode for hook execution (#2116) (#2188) 2026-06-15 14:01:21 -04:00
gan-harness.sh fix: harden install planning and sync tracked catalogs 2026-03-31 22:57:48 -07:00
gemini-adapt-agents.js feat: add gemini agent adapter 2026-04-08 15:38:49 -07:00
github-coordination.js refactor: apply code-review findings to github-native coordination 2026-06-11 14:05:42 -04:00
harness-adapter-compliance.js docs: add data-backed harness adapter scorecard (#1785) 2026-05-12 02:59:52 -04:00
harness-audit.js fix: guard two script edge cases (tolerant package.json parse, set -u empty array) (#2088) 2026-06-07 13:01:21 +08:00
install-apply.js feat(install): add Kimi Code CLI install target (kimi-project adapter) (#2441) 2026-07-03 22:24:13 -07:00
install-plan.js fix: restore short Claude plugin slug and skill installs (#1712) 2026-05-11 02:10:36 -04:00
list-installed.js fix(scripts): add os.homedir() fallback for Windows compatibility 2026-03-28 11:28:12 +08:00
loop-status.js fix: handle dotted reserved snapshot names 2026-04-30 12:25:14 -04:00
mcp-inventory.js feat: MCP inventory (ecc.mcp.v1) — unified cross-harness MCP config view (#2146) 2026-06-06 03:55:17 +08:00
observability-readiness.js security: add supply-chain IOC scanner (#1904) 2026-05-14 21:15:35 -04:00
operator-readiness-dashboard.js docs: sync live native payments gate evidence 2026-05-19 23:25:38 -04:00
orchestrate-codex-worker.sh fix: resolve all CI test failures (19 fixes across 6 files) (#519) 2026-03-16 01:59:53 -07:00
orchestrate-worktrees.js fix: preserve orchestration launcher compatibility 2026-03-12 15:40:25 -07:00
orchestration-status.js feat: orchestration harness, selective install, observer improvements 2026-03-14 12:55:25 -07:00
plan-canvas.js feat: Plan Canvas, a browser review canvas for plans (#2467) 2026-07-08 17:12:48 -04:00
platform-audit.js docs: sync selected-target announcement gate (#2020) 2026-05-19 22:09:45 -04:00
preview-pack-smoke.js docs: sync selected-target announcement gate (#2020) 2026-05-19 22:09:45 -04:00
proximity-tick.js feat(layer4): live messages-table wiring for proximity triggers 2026-06-20 20:49:17 -04:00
release-approval-gate.js fix(release): derive approval gate paths from version (#2383) 2026-06-29 15:50:55 -07:00
release-video-suite.js fix(release): derive video suite paths from version (#2384) 2026-06-29 15:50:57 -07:00
release.sh fix: context-size /compact trigger, Codex marketplace plugin path, live README badges (#2237) 2026-06-11 16:21:53 -04:00
repair.js fix(scripts): add os.homedir() fallback for Windows compatibility 2026-03-28 11:28:12 +08:00
session-inspect.js feat: self-improving skills loop — observe, inspect, amend, evaluate 2026-03-14 23:21:18 -07:00
sessions-cli.js fix(scripts): add os.homedir() fallback for Windows compatibility 2026-03-28 11:28:12 +08:00
setup-package-manager.js fix: reject flags passed as package manager names in setup-package-manager CLI 2026-02-13 03:37:46 -08:00
skill-create-output.js fix: narrow unicode cleanup scope 2026-03-29 21:21:18 -04:00
skills-health.js feat(design): skill health dashboard mockup (#518) 2026-03-16 14:01:41 -07:00
status.js feat: add github-native coordination (epic-* commands + scripts + tests) 2026-06-11 12:58:11 -04:00
sync-ecc-to-codex.sh feat: sync the codex baseline and agent roles 2026-04-01 16:08:03 -07:00
uninstall.js fix(scripts): add os.homedir() fallback for Windows compatibility 2026-03-28 11:28:12 +08:00
work-items.js feat(control-pane): interactive JIT board — claim/move cards from the webapp 2026-06-18 18:16:46 -04:00
worktree-lifecycle.js feat: worktree-lifecycle service (deterministic conflict prediction + safe GC) (#2164) 2026-06-07 13:00:08 +08:00