Skip to content

Add integration keybindings, focus, and fetch countdowns - #17

Merged
shayan-ys merged 4 commits into
mainfrom
feat/integration-keys
Oct 9, 2026
Merged

shayan-ys merged 4 commits into
mainfrom
feat/integration-keys

Conversation

@shayan-ys

@shayan-ys shayan-ys commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

📝 Summary

This PR lets integrations bind keys and lets users remap or turn off the built-in keys. A key press re-runs the integration with DEVDASH_ACTION, and each keyed integration gets a private DEVDASH_STATE_FILE for the run. Tab moves focus between keyed integrations. Section headings count down to their next fetch, and each section lists its own keys.

Related Issue: Closes #7


🛠️ Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • ⚡ Performance / Refactor (code optimization without behavior changes)
  • 📚 Documentation update

🔍 Changes Made

  • [keys] table for built-ins (refresh, quit, focus; an empty string turns one off) and a per-integration keys = { j = "newer" } table, validated strictly. Collisions with built-ins are rejected, including for disabled integrations.
  • Case-sensitive key decoding, with arrows, Enter, and Tab, and buffering of partial escape sequences.
  • Action delivery: FIFO queue (cap 8) per integration, serialized runs, immediate redraw. A failed action run keeps the last good rows under the error.
  • Watch mode creates a 0700 temp directory with one 0600 state file per keyed integration and deletes it on exit.
  • Focus: ▸ marks the focused heading; Tab cycles in screen order.
  • Key hints: an integration's bindings sit under its section, r refresh under the last PR section, and q quit (plus tab focus when two or more integrations are focusable) at the bottom. No clock or every Ns.
  • Section headings show fetched Xs ago · next fetch Ns or fetching…; REVIEW REQUESTED shares the PR fetch status.
  • PR and usage refreshes run in the background, so keys stay responsive; r during a refresh schedules one follow-up.
  • Docs: README key and focus section, config.example.toml, GLOSSARY.md, CHANGELOG; the stale prompt-tutor Watcher-keys sentence is removed.

Built-in keys are now case-sensitive: R and Q no longer refresh or quit.


🧪 How to Test

  1. git checkout feat/integration-keys && uv sync
  2. uv run pytest -q && uv run ruff check .
  3. Add an integration with keys = { j = "newer", k = "older" } and run devdash. Its bindings appear under its section, a key press redraws that section at once, and q quit is the last row.
  4. The prompt-tutor example needs prompt-tutor's feat/devdash-keys (shayan-ys/prompt-tutor), which merges first.

✅ Review and verification

  • Review path: material, agent code review; omitted optional reviews: none. CodeRabbit was requested but never reported (it has not reviewed any PR in this repo).
  • Review fixes: r during a running refresh now starts the follow-up as soon as that refresh ends (PTY smoke with a 3 s gh: second call at +3.04 s, no further keys); escape sequences with intermediate bytes (ESC ( B, ESC # 8) are dropped whole; USAGE counts down to the global refresh, which is when it is actually fetched; fresh usage replaces the cached report again (carry_over argument order); REVIEW REQUESTED shows the PR fetch status.
  • Verification: uv run pytest -q: 107 passed; uv run ruff check .: clean; CI green on all six matrix jobs. PTY smoke with the real prompt-tutor --once and a stub gh: per-section hints render (r refresh under REVIEW REQUESTED, bindings under PROMPT TUTOR, q quit last), k moves the selection, keys respond in about 0.03 s during a slow gh refresh, and q exits within 0.05 s.
  • Declined findings: none.
  • Remaining non-blocking findings: global State fields are published one by one while Rich renders from another thread; no failure observed, left as hardening.

prompt-tutor --once no longer prints the key row (shayan-ys/prompt-tutor#17).
Integrations declare keys = { key = "action" }; a press re-runs the command
with DEVDASH_ACTION and a per-process DEVDASH_STATE_FILE. Tab cycles focus
between keyed integrations. [keys] remaps or disables r/q/tab, now
case-sensitive. The footer lists key hints only; section headings count down
to their next fetch. Global refreshes run in the background so input stays
responsive.

Refs #7, map #8.
Each section lists its own keys: an integration's bindings under its
output, refresh under the last PR section, and quit plus focus at the
bottom. REVIEW REQUESTED shows the same fetch status as MY PRS. Fresh
usage reports replace the cached one again (carry_over argument order).
@shayan-ys

Copy link
Copy Markdown
Owner Author

@coderabbitai review

…scapes

- r during a running refresh polls the refresh thread, so the follow-up
  starts when it finishes instead of at the next interval.
- ESC sequences with intermediate bytes (ESC ( B, ESC # 8) are dropped
  whole instead of leaking their final byte as a key.
- USAGE counts down to the global refresh, which is when it is fetched.
@shayan-ys

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@shayan-ys
shayan-ys marked this pull request as ready for review October 9, 2026 16:48
@shayan-ys
shayan-ys merged commit f753d02 into main Oct 9, 2026
6 checks passed
@shayan-ys
shayan-ys deleted the feat/integration-keys branch October 9, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integration keybindings: let integrations add and change keys

1 participant