refactor: enhance documentation and address code quality issues#3
Merged
simonCatBot merged 4 commits intomasterfrom Mar 27, 2026
Merged
refactor: enhance documentation and address code quality issues#3simonCatBot merged 4 commits intomasterfrom
simonCatBot merged 4 commits intomasterfrom
Conversation
added 4 commits
March 26, 2026 22:24
Documentation: - CONTRIBUTING.md: rewrite with clear prerequisites (Node ≥20.9.0), full troubleshooting section for native deps, SQLite errors, Node version mismatches, and the OPENCLAW_SKIP_NATIVE_RUNTIME_VERIFY flag. Expand scripts table and clarify UX audit cleanup step. - .github/ISSUE_TEMPLATE/issue.md: add Gateway version field to environment section for better reproducibility. - next.config.ts: add TODO comment explaining why ignoreBuildErrors is temporarily true and noting that npm run typecheck still catches errors in CI. Code quality: - package.json: pin @multiavatar/multiavatar GitHub dependency to specific commit SHA (a938f6f) to prevent drift if the repo is reorganized. - src/lib/controlplane/projection-store.ts: replace inline createRequire/createRequire pattern with a dedicated, documented ESM/CJS shim at _better-sqlite3-require.ts. Makes the module-system boundary explicit and easy to find. - src/lib/rate-limit.ts: new file — simple in-process sliding-window rate limiter for intent routes. Per-IP, 60 req/s default, 30 req/s for chat.send. Includes test coverage. - src/lib/controlplane/intent-route.ts: wire in rate limiter; add X-RateLimit-Limit / X-RateLimit-Remaining response headers to all intent responses. - src/app/api/intents/chat-send/route.ts: add rate limit check (30 req/s, higher than default to accommodate real-time typing). - tests/unit/rateLimit.test.ts: new — covers allow/block/per-key isolation/window-expiry/defaults.
- Add Key Concepts section (Gateway, Agent, Session, Intent, Outbox) - Expand Features with detailed descriptions for each tab area, including specific controls and behaviors - Add a Gateway URL reference table as the canonical home for every scenario (local, Tailscale, SSH tunnel, cloud TLS) - Add Tailscale binding instructions with gateway.bind config tip - Add Permissions at a Glance table covering command mode, sandbox mode, workspace access, and tools profile - Add critical warning about workspaceAccess=ro also disabling write/edit/apply_patch tools inside sandbox (a non-obvious gotcha) - Expand Troubleshooting with sections for 401 auth split (gateway token vs ROCclaw access token), agent not responding, and sandbox not working - Point to the full permissions doc for the sandbox debug checklist - Remove stale Quick Start section, fold its content into the reorganized structure
README: - Cut from 13KB to 6KB. Remove redundant content. - Remove Scripts table (belongs in CONTRIBUTING.md). - Remove Permissions at a Glance table (full model in permissions doc). - Remove ASCII UI art (goes stale, not useful for technical orientation). - Lead with how to connect and how it works, then features, then troubleshooting. Flat and direct. - Remove dead 'color-system.md' link (file does not exist). - Add Document Map table to orient readers by task. docs/ui-guide.md: - Full rewrite. Remove all implementation/state descriptions. - Organize by UI surface: connection screen, agents tab, chat panel, settings sidebar (four tabs), system metrics, tokens. - Remove stale 'coming soon' items (heartbeats, skills, browser). - Remove references to old onboarding flows. - Remove 'core rule' about localhost (no longer confusing in practice). - Every control in the chat header and settings tabs is now in a table. docs/pi-chat-streaming.md: - Cut from 1.4KB to 1.6KB. Rename from 'PI Chat Streaming' to 'Chat Streaming' — 'PI' is internal terminology. - Keep the transport model, reconnect/replay, history, and degraded behavior sections. Remove no longer accurate internal routing hints. docs/permissions-sandboxing.md: - Cut from 18KB to 5.8KB. - Lead with mental model (UI vs enforcement point) before diving in. - Remove the full code entry point inventory (code archaeology). - Remove the Glossary (duplicated in old README, now removed). - Keep: sandbox modes, workspace access (with ro warning), tool policy layering, exec approvals, session exec settings, debug checklist. - Remove: mermaids, upstream file paths, implementation references. - New 'Debugging: when something feels wrong' section covers the three common failure modes with clear triage steps. ARCHITECTURE.md: - Remove 'OpenClaw Studio' throughout, replace with 'rocCLAW'. - Remove 'Removed legacy surfaces' section and guardrails about /api/gateway routes (archaeology, not useful in a current doc). - Reformat as a reference document: table of modules, table of routes, clear error semantics, compact guardrails that explain _why_ each constraint exists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Documentation overhaul + five targeted code quality improvements identified during a project audit.
Changes
Documentation
OPENCLAW_SKIP_NATIVE_RUNTIME_VERIFYescape hatch. Expanded the scripts table with descriptions and clarified when to runcleanup:ux-artifacts.// TODOcomment explaining whyignoreBuildErrors: trueis temporarily needed and confirming thatnpm run typecheck(CI) still catches type errors.Code quality
@multiavatar/multiavatarGitHub dependency to commit SHAa938f6fto prevent breakage if the upstream repo reorganizes or deletes the default branch.createRequire/better-sqlite3CJS→ESM bridge into a single, clearly-documented shim. Makes the module-system boundary explicit and easy to refactor later.chat.send. IncludesX-RateLimit-*response headers and full test coverage.X-RateLimit-LimitandX-RateLimit-Remainingheaders.rateLimitRemainingcorrectness.Testing
npm run lintnpm run typechecknpm run testnpm run e2e(requiresnpx playwright install)AI-assisted
Yes — audit performed by Miaman (OpenClaw agent). Full audit notes available on request.