mirror of
https://github.com/logseq/logseq.git
synced 2026-05-18 01:42:19 +00:00
2.9 KiB
2.9 KiB
Repository Guidelines
Project Structure & Module Organization
src/is the main codebase.src/main/contains core application logic.src/main/mobile/is the mobile app code.src/main/frontend/components/houses UI components.src/main/frontend/inference_worker/andsrc/main/frontend/worker/hold webworker code, including RTC insrc/main/frontend/worker/rtc/.
src/electron/is Electron-specific code.src/test/contains unit tests.deps/contains internal dependencies/modules.clj-e2e/contains app end-to-end tests (Playwright + Clojure test runner).cli-e2e/contains shell-first end-to-end tests for compiledlogseq-clianddb-worker-node.
Build, Test, and Development Commands
bb dev:lint-and-testruns linters and unit tests.bb dev:test -v <namespace/testcase-name>runs a single unit test (example:bb dev:test -v logseq.some-test/foo).- App E2E tests live in
clj-e2e/; run from that directory withbb test(orbb -f clj-e2e/bb.edn testfrom repo root). - CLI E2E tests live in
cli-e2e/; run withbb -f cli-e2e/bb.edn test --skip-build(orbb -f cli-e2e/bb.edn buildfirst when needed). - If a request says only “e2e”, clarify whether it targets
clj-e2e/orcli-e2e/before planning changes.
Coding Style & Naming Conventions
- ClojureScript keywords are defined via
logseq.common.defkeywords/defkeyword; use existing keywords and add new ones in the shared definitions. - Follow existing namespace and file layout; keep related workers and RTC code in their dedicated directories.
- Prefer concise, imperative commit subjects aligned with existing history (examples:
fix: download,enhance(rtc): ...). - Clojure map keyword name should prefer
-instead of_, e.g.:user-idinstead of:user_id.
Testing Guidelines
- Unit tests live in
src/test/and should be runnable viabb dev:lint-and-test. - Name tests after their namespaces; use
-vto target a specific test case. - Run lint/tests before submitting PRs; keep changes green.
Commit & Pull Request Guidelines
- Commit subjects are short and imperative; optional scope prefixes appear (e.g.,
fix:orenhance(rtc):). - PRs should describe the behavior change, link relevant issues, and note any test coverage added or skipped.
Agent-Specific Notes
- Review notes live in
prompts/review.md; check them when preparing changes. - DB-sync feature guide for AI agents:
docs/agent-guide/db-sync/db-sync-guide.md. - DB-sync protocol reference:
docs/agent-guide/db-sync/protocol.md. - For db-sync D1 schema changes, add or update a Cloudflare worker SQL migration under
deps/db-sync/worker/migrations/; do not rely on ad hoc runtime-only schema migration code. - New properties should be added to
logseq.db.frontend.property/built-in-properties. - Avoid creating new class or property unless you have to.
- Avoid shadow var, e.g.
bytesshould be named aspayload.