bun run check # TypeScript + ESLint + OxLint + Knip
bun run test # Vitest (correctness tests)
bun run test:coverage # Vitest + coverage thresholds
bun run test:perf # Performance gates (latency budgets)
bun run check:rust # cargo check + cargo test + cargo clippy
bun run check:all # All of the above — mirrors CI exactly
bunx tauri build # Full release build
bun run check:all is the single command that mirrors CI. If it passes locally, CI will pass. Do NOT merge if any check fails.
CLI wrapper uses open -a "$TARGET" --args "$FILE_ARG" — must use --args, not positional. CLI supports subcommands: mpad update (self-update from latest GitHub release), mpad version, mpad help.
Architecture
File I/O: Custom Rust read_file/write_file commands — do NOT use Tauri FS plugin (scope issues with absolute paths)
CLI args: InitialFileState managed state in Rust, fetched by frontend via get_initial_file command (avoids event race condition)
File watcher: Content-based comparison against current editor state — do NOT use timestamp-based detection (causes false positives)
I’m checking the repo state first so I can commit the current tracked changes safely, choose a commit message from the diff, and then push the current branch to its remote.
Assistant
The worktree includes source edits plus workspace metadata changes. I’m checking the diff shape now so I can avoid committing an obviously local-only file if that would be a mistake.
Assistant
The actual code diff is small and coherent. I’m excluding the local agent workspace files from the commit unless verification shows they were intentionally meant to be versioned, then I’ll run the repo checks before committing.
Assistant
The symlink at .claude/skills/expect is tracked, but the new .claude and .codex skill directories look like local environment drift rather than app code. I’m keeping those out of the commit and waiting on the full CI-equivalent check now.
Assistant
Frontend checks and tests passed. The Rust portion hit a sandboxed network dependency fetch against static.crates.io, so I’m letting that fail cleanly and then I’ll rerun it with elevation as required.
Assistant
The Rust checks are rerunning with network access now. Once that clears, I’ll commit only the app/doc changes and push main to origin.
Assistant
The Rust verification is still in flight. I’m keeping the commit blocked on that result rather than pushing unchecked changes to main.
Assistant
Verification passed end to end. I’m staging only the application and docs files now, leaving the local .claude/.codex environment files out of the commit.
Assistant
Git writes are blocked by the sandbox here because they need .git/index.lock. I’m rerunning the stage-and-commit step with elevation, then I’ll push once the commit is created.
Assistant
The commit is running through the repo’s pre-commit hook now, which is the right gate here. I’m waiting for that to finish before pushing.
Assistant
The commit is created at 1d4c333. The repo still has local-only .claude and .codex changes outside that commit; I’m leaving those untouched and pushing the new main commit to origin now.
Assistant
Pushed main to origin with commit 1d4c333 (Improve editor keyboard handling and syntax colors).
Verification passed before the push: frontend checks/tests, perf tests, and Rust check/test/clippy. I left local agent-environment changes out of the commit, so these are still uncommitted in your worktree: deleted .claude/skills/expect, untracked .claude/settings.local.json, and untracked .codex/skills/.
User
push everything
Assistant
You want the remaining local changes included as well. I’m checking what’s left in the worktree, then I’ll commit all of it and push main again.
Assistant
The remaining delta is the agent/config material under .claude and .codex, plus the tracked .claude/skills/expect symlink being replaced. I’m staging the full worktree now and creating one follow-up commit for all of it.
Assistant
The repo hook is running again on this second commit. I’m waiting for it to clear, then I’ll push main with the new commit.
Frontmatter: Strict regex /^---\n([\s\S]*?)\n---(?:\n|$)/ — do NOT use gray-matter (breaks on lone ---)
Editor storage: Cast through unknown — (ed.storage as unknown as Record<...>) required for tsc -b
BubbleMenu: Import from @tiptap/react/menus, NOT @tiptap/react
Code splitting: @tiptap/pm cannot be in vite manualChunks (no main export)
Sidebar: list_markdown_files Rust command walks filesystem recursively (includes dotdirs like .claude/), filtered to .md/.markdown/.mdown only. Skips node_modules, target, .git, dist, build, __pycache__, .venv, .env, .pytest_cache. Git status overlaid from git_repo_tree.
Command palette: Unified Cmd+K palette combining file search and commands. Logic in src/lib/fuzzyMatch.ts (exported for testing). Empty query shows all commands; typing filters both files and commands. Commands rank above files (+2000 score boost).
These constraints are mechanically enforced — see eslint.config.jsno-restricted-imports and tests/ perf gates. Run bun run check:all to verify.
How to Learn the Codebase (for agents)
Do NOT rely on static documentation — it goes stale. Instead, discover conventions from the code itself:
Lint rules are law: eslint.config.js has no-restricted-imports that ban dangerous patterns (FS plugin direct read/write, gray-matter, wrong BubbleMenu import). Violating these fails CI. Read the rule messages for rationale.
Tests are specs: tests/ contains the source-of-truth behavioral contracts. Read test files before modifying any module — they document expected behavior better than prose.
Perf gates are enforced: tests/fuzzyMatch.test.ts has median-latency gates. tests/perf.test.ts enforces bundle/import budgets. New perf-sensitive code must have perf gates.
Pre-commit runs everything: .hooks/pre-commit is the canonical check sequence. Auto-installed via bun install (prepare script).
CI is the gatekeeper: .github/workflows/ci.yml — if it's not checked in CI, it's not enforced. Read this file to understand what gates exist.
Rust tests tell the git story: src-tauri/src/git.rs#[cfg(test)] module — 18 tests covering all git operations with temp repos.
Cmd+K command palette (files + commands), Cmd+S save, Cmd+O open, Cmd+F find, Cmd+/ source toggle, [ sidebar (left panel), ] diff (right panel), Cmd+L git log, Cmd+Shift+Up/Down heading cycle (H1-H6 + paragraph), / on empty line for slash commands. [ and ] are modifier-free shortcuts — they only fire when focus is NOT in an editable area (editor, input, textarea). Cmd+B is reserved for bold (TipTap built-in) — do NOT reassign it.
Gotchas
React 19: refs cannot be read/written during render — use useEffect for updates, callbacks for reads
React 19: set-state-in-effect lint rule — avoid calling setState synchronously in effects; use callbacks or fetch in .then() chains instead
React 19: react-refresh/only-export-components — don't export non-component functions from component files; extract shared logic to src/lib/
git2 feature name is vendored-libgit2 (not vendored)
Pre-commit hook at .hooks/pre-commit mirrors CI (tsc, eslint, oxlint, knip, vitest, cargo check/test/clippy) — auto-installed via bun install
Diff panel must refresh when switching files — handle in loadFile, not via a separate effect (avoids setState-in-effect lint)
Sidebar auto-expands .claude/, .cursor/, .agents/ directories by default
Panel color consistency: All panel backgrounds (sidebar, diff, git log, status bar) MUST use the same background color. In dark mode, --bg-secondary and --sidebar-bg must be identical. Do NOT introduce new panel background values that break this consistency.
Status bar: Must span the full window width (placed outside .app-content, not inside .app-main). No gap between sidebar and main content at the status bar level.
Task items: Checked task items auto-remove from the document after 800ms delay via TaskItemAutoRemove extension. This is the intended UX — do NOT disable it.
Window title: Set to "mpad" only (not the filename). Filename is shown in the status bar for in-app display.
Performance Rules
All perf-sensitive code must have mechanical enforcement. See tests/perf.test.ts for active gates: