Skip to content
This repository was archived by the owner on May 1, 2026. It is now read-only.

Commit fabe8e3

Browse files
kerimclaude
andcommitted
v2.2.0: Layer authoritative upstream docs + RCmerci skill cross-refs
Adds Layer 1 (seven files mirrored verbatim from logseq/logseq libs/development-notes/ into skill/references/logseq-official/, refreshed via scripts/sync-logseq-docs.sh) so Claude reaches official API ground truth directly. SKILL.md reorganized into three layers with explicit precedence: Layer 1 wins on API facts; Layer 2 (preserved production patterns from logseq-checklist v1.0.0) wins on real-world pitfalls; Layer 3 points at sibling skills including RCmerci's logseq-schema and logseq-electron-debug. Mixed-license repo: MIT for skill content, AGPL-3.0 for the mirrored subfolder (full license text committed, README notes the boundary). CLAUDE.md File Structure and Rule #1 updated to reflect new scripts/ and gitignored upstream/ at repo root. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b916251 commit fabe8e3

21 files changed

Lines changed: 4165 additions & 149 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111
# Temp files
1212
*.tmp
1313
*.bak
14+
15+
# Local mirror of upstream Logseq repo (populated by scripts/sync-logseq-docs.sh)
16+
upstream/logseq-repo/

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# Changelog
22

3+
## [2.2.0] - 2026-04-16
4+
5+
### Added
6+
7+
- **Layer 1: Authoritative upstream docs** — seven files mirrored verbatim from [logseq/logseq `libs/development-notes/`](https://github.com/logseq/logseq/tree/master/libs/development-notes) into `skill/references/logseq-official/`:
8+
- `AGENTS.md` — AI-agent development guide (SDK repo structure, conventions)
9+
- `starter_guide.md` — plugin bootstrap (Node, TypeScript, hello world)
10+
- `db_properties_skill.md` — DB properties SDK reference
11+
- `db_properties_guide.md` — File graph vs DB graph property storage
12+
- `db_query_guide.md` — Datascript query reference (`logseq.DB.q`, `datascriptQuery`, parameterized Datalog)
13+
- `db_tag_property_idents_notes.md` — Ident system and namespace conventions
14+
- `experiments_api_guide.md``logseq.Experiments` API (React integration, custom renderers)
15+
- **`scripts/sync-logseq-docs.sh`** — refreshes mirrored docs from upstream via shallow+sparse `git clone`. Idempotent (SHA-based), atomic writes, fails loudly on upstream path renames.
16+
- **`upstream/logseq-repo/`** — gitignored local mirror, populated by the sync script.
17+
- **SKILL.md layered structure** with explicit precedence note: Layer 1 (upstream ground truth) → Layer 2 (production patterns) → Layer 3 (related skills). Layer 1 wins on API facts; Layer 2 wins on real-world pitfalls.
18+
- **Layer 3 cross-references** to RCmerci's skills (`logseq-schema` for Datascript schema, `logseq-electron-debug` for Chrome DevTools against Logseq), plus existing `logseq-db-knowledge` and `logseq-cli-skill`.
19+
- **Cross-links** added to the five supplementary reference files (`core-apis.md`, `queries-and-database.md`, `event-handling.md`, `property-management.md`, `plugin-architecture.md`) pointing at their corresponding Layer 1 file (or noting "supplementary — no Layer 1 equivalent").
20+
21+
### Changed
22+
23+
- **CLAUDE.md** (repo root) — File Structure diagram now includes `scripts/` and gitignored `upstream/`; Important Rule #1 refined from "only edit files in skill/" to "skill content lives in `skill/` only; repo-maintenance files may be added or modified at repo root" (reflects pre-existing practice with README/CHANGELOG/LICENSE/.gitignore).
24+
- **README.md** — new "Mirrored upstream docs" section and explicit license boundary between MIT (skill content) and AGPL-3.0 (mirrored subfolder).
25+
26+
### Preserved
27+
28+
- **`references/tag-detection.md`** and **`references/pitfalls-and-solutions.md`** — unchanged; unique production-tested contributions not covered in Layer 1.
29+
30+
### License
31+
32+
- Repo root remains **MIT**.
33+
- `skill/references/logseq-official/` is **AGPL-3.0** (full license text in that subfolder's `LICENSE`, attribution in its `README.md`). Redistribution of modifications to mirrored content must comply with AGPL-3.0.
34+
335
## [2.1.0] - 2025-12-18
436

537
### Added

CLAUDE.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This project follows the standardized skill workflow. The skill files are in the
77

88
### Important Rules
99

10-
1. **Only edit files in the `skill/` folder** - Never edit `~/.claude/skills/` directly (it's a symlink to this folder)
10+
1. **Skill content lives in `skill/` only**the `skill/` folder is symlinked to `~/.claude/skills/logseq-db-plugin-api-skill/`. Never edit the symlink target directly; always edit through `skill/` in this repo. Repo-maintenance files (`scripts/`, `upstream/`, `CHANGELOG.md`, `README.md`, `LICENSE`, `.gitignore`) may be added or modified at repo root.
1111
2. **Update README.md** if functionality changes
1212
3. **Ask user to review changes** before committing
1313
4. **Commit and push** after user approval (if remote exists)
@@ -19,22 +19,31 @@ logseq-db-plugin-api-skill/
1919
├── skill/ # Symlinked to ~/.claude/skills/logseq-db-plugin-api-skill/
2020
│ ├── SKILL.md # The actual skill definition
2121
│ └── references/ # Modular detailed documentation
22+
│ ├── logseq-official/ # Mirrored upstream docs from logseq/logseq (AGPL-3.0)
23+
│ │ ├── AGENTS.md, starter_guide.md, db_*.md, experiments_api_guide.md
24+
│ │ ├── LICENSE # Full AGPL-3.0 text
25+
│ │ ├── README.md # Attribution + license boundary
26+
│ │ └── .last-synced-sha
2227
│ ├── core-apis.md
2328
│ ├── event-handling.md
2429
│ ├── plugin-architecture.md
2530
│ ├── property-management.md
2631
│ ├── queries-and-database.md
2732
│ ├── tag-detection.md
2833
│ └── pitfalls-and-solutions.md
34+
├── scripts/ # Repo-maintenance scripts
35+
│ └── sync-logseq-docs.sh # Refreshes skill/references/logseq-official/
36+
├── upstream/ # Gitignored — local mirror of logseq/logseq
37+
│ └── logseq-repo/ # Shallow+sparse clone, populated by sync script
2938
├── README.md # GitHub install instructions
3039
├── CLAUDE.md # This file - workflow instructions
3140
├── CHANGELOG.md # Version history
32-
└── LICENSE # MIT License
41+
└── LICENSE # MIT License (covers all content except skill/references/logseq-official/)
3342
```
3443

3544
### Before Committing
3645

37-
- [ ] Changes are in `skill/` folder only
46+
- [ ] Skill content changes are in `skill/` only; repo-maintenance changes (scripts/, upstream/, CHANGELOG, README) are allowed at root
3847
- [ ] README.md updated if needed
3948
- [ ] User has reviewed changes
4049
- [ ] Version number updated (if applicable)

README.md

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,61 @@
11
# Logseq DB Plugin API Skill
22

3-
**Version**: 2.1.0
4-
**Updated**: 2025-12-18
3+
**Version**: 2.2.0
4+
**Updated**: 2026-04-16
55

6-
A comprehensive Claude Code skill for developing Logseq plugins specifically for **DB (database) graphs**, now with modular documentation and production-tested patterns.
6+
A comprehensive Claude Code skill for developing Logseq plugins specifically for **DB (database) graphs**, now with authoritative upstream docs mirrored from logseq/logseq, modular documentation, and production-tested patterns.
77

88
## Overview
99

1010
This skill provides essential knowledge for building Logseq plugins that work with the new DB graph architecture. It covers the complete plugin API verified against LSPlugin.ts TypeScript definitions, including tag/class management (with **CORRECTED method names**), property handling (with **complete upsertProperty signature**), icon management, tag inheritance, comprehensive type definitions, and proper Vite bundling setup.
1111

1212
**Target Audience**: Developers building plugins for Logseq DB graphs using Claude Code.
1313

14+
## What's New in v2.2.0
15+
16+
### Authoritative Upstream Docs + Related Skills 📚
17+
18+
This release layers the Logseq core team's own agent-oriented documentation on top of the existing production patterns, and points to two related skills from Logseq core dev RCmerci.
19+
20+
**New Layer 1 (authoritative upstream)**: Seven files mirrored verbatim from [logseq/logseq `libs/development-notes/`](https://github.com/logseq/logseq/tree/master/libs/development-notes), refreshed via `scripts/sync-logseq-docs.sh`:
21+
22+
- `AGENTS.md`, `starter_guide.md`, `db_properties_skill.md`, `db_properties_guide.md`, `db_query_guide.md`, `db_tag_property_idents_notes.md`, `experiments_api_guide.md`
23+
24+
These live in `skill/references/logseq-official/` and are licensed **AGPL-3.0** (see License boundary below).
25+
26+
**New Layer 3 (related skills)**: cross-references to [RCmerci's skills](https://github.com/RCmerci/skills):
27+
28+
- `logseq-schema` — authoritative Datascript schema for Datalog queries
29+
- `logseq-electron-debug` — Chrome DevTools against running Logseq
30+
31+
Install separately from RCmerci's repo; SKILL.md points at them for discoverability.
32+
33+
**SKILL.md reorganized** into 3 layers with explicit precedence: Layer 1 wins on API facts, Layer 2 (existing production patterns) wins on real-world pitfalls.
34+
35+
**No existing content removed.** All v2.1.0 references preserved and back-linked.
36+
37+
## Mirrored Upstream Docs
38+
39+
### What's mirrored
40+
41+
Files under `skill/references/logseq-official/` are copied verbatim from [logseq/logseq](https://github.com/logseq/logseq) master branch via a shallow + sparse git clone at `upstream/logseq-repo/` (gitignored).
42+
43+
Refresh command (from repo root):
44+
45+
```bash
46+
bash scripts/sync-logseq-docs.sh
47+
```
48+
49+
The script is idempotent — if upstream HEAD matches the recorded `.last-synced-sha`, it exits without rewriting. Each mirrored file carries a 3-line HTML-comment footer recording the upstream commit SHA and fetch timestamp.
50+
51+
### License boundary
52+
53+
- The root `LICENSE` file is **MIT** and covers the skill's own original content (SKILL.md, most of `skill/references/`, scripts, docs).
54+
- The subfolder `skill/references/logseq-official/` is **AGPL-3.0**. Its own `LICENSE` file (full AGPL-3.0 text) and `README.md` (attribution + source URLs) make the boundary explicit.
55+
- **If you redistribute modifications** to files in `skill/references/logseq-official/`, the AGPL-3.0 copyleft applies. The MIT license at repo root does **not** extend into that subfolder.
56+
57+
See [`skill/references/logseq-official/README.md`](./skill/references/logseq-official/README.md) for full attribution and [`skill/references/logseq-official/LICENSE`](./skill/references/logseq-official/LICENSE) for the AGPL-3.0 text.
58+
1459
## What's New in v2.1.0
1560

1661
### Advanced Query Patterns 🔍
@@ -522,7 +567,12 @@ Contributions are welcome! If you discover new API features, better patterns, or
522567

523568
## License
524569

525-
MIT License - feel free to use, modify, and distribute.
570+
**Mixed-license repository**:
571+
572+
- **MIT License** covers the skill's original content (root `LICENSE`): `SKILL.md`, most of `skill/references/`, `scripts/`, root documentation.
573+
- **AGPL-3.0** covers mirrored upstream content under `skill/references/logseq-official/` (see `skill/references/logseq-official/LICENSE`). These files are reproduced verbatim from [logseq/logseq](https://github.com/logseq/logseq) with attribution footers.
574+
575+
Redistributing modifications to files under `skill/references/logseq-official/` requires AGPL-3.0 compliance. All other content is MIT — feel free to use, modify, and distribute.
526576

527577
## Support
528578

scripts/sync-logseq-docs.sh

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/usr/bin/env bash
2+
#
3+
# sync-logseq-docs.sh — Mirror logseq/logseq libs/development-notes/ into
4+
# skill/references/logseq-official/ via shallow+sparse git clone.
5+
#
6+
# Usage (from repo root):
7+
# bash scripts/sync-logseq-docs.sh
8+
#
9+
# Idempotent: if upstream HEAD matches .last-synced-sha, exits 0 without rewriting.
10+
# Atomic: all copies use .tmp files and are moved into place only after every file succeeds.
11+
# Trap cleans up .tmp files on any error.
12+
13+
set -euo pipefail
14+
15+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
16+
cd "$REPO_ROOT"
17+
18+
UPSTREAM_DIR="upstream/logseq-repo"
19+
UPSTREAM_URL="https://github.com/logseq/logseq.git"
20+
UPSTREAM_PATH="libs/development-notes"
21+
TARGET_DIR="skill/references/logseq-official"
22+
SHA_FILE="$TARGET_DIR/.last-synced-sha"
23+
24+
EXPECTED_FILES=(
25+
"AGENTS.md"
26+
"starter_guide.md"
27+
"db_properties_skill.md"
28+
"db_properties_guide.md"
29+
"db_query_guide.md"
30+
"db_tag_property_idents_notes.md"
31+
"experiments_api_guide.md"
32+
)
33+
34+
trap 'rm -f "$TARGET_DIR"/*.tmp 2>/dev/null || true' EXIT
35+
36+
mkdir -p "$TARGET_DIR"
37+
38+
if [[ ! -d "$UPSTREAM_DIR/.git" ]]; then
39+
echo "==> First run: shallow+sparse clone of $UPSTREAM_URL"
40+
mkdir -p upstream
41+
git clone --depth 1 --filter=blob:none --no-checkout "$UPSTREAM_URL" "$UPSTREAM_DIR"
42+
git -C "$UPSTREAM_DIR" sparse-checkout init --cone
43+
git -C "$UPSTREAM_DIR" sparse-checkout set "$UPSTREAM_PATH"
44+
git -C "$UPSTREAM_DIR" checkout
45+
else
46+
echo "==> Refreshing $UPSTREAM_DIR"
47+
git -C "$UPSTREAM_DIR" pull --ff-only
48+
fi
49+
50+
UPSTREAM_SHA="$(git -C "$UPSTREAM_DIR" rev-parse HEAD)"
51+
52+
if [[ -f "$SHA_FILE" ]] && [[ "$(cat "$SHA_FILE")" == "$UPSTREAM_SHA" ]]; then
53+
echo "==> Already up to date at $UPSTREAM_SHA"
54+
exit 0
55+
fi
56+
57+
echo "==> Verifying all $([[ ${#EXPECTED_FILES[@]} -gt 0 ]] && echo ${#EXPECTED_FILES[@]}) expected files exist upstream"
58+
for f in "${EXPECTED_FILES[@]}"; do
59+
if [[ ! -f "$UPSTREAM_DIR/$UPSTREAM_PATH/$f" ]]; then
60+
echo "ERROR: expected file missing upstream: $UPSTREAM_PATH/$f" >&2
61+
echo "ERROR: upstream may have been reorganized; inspect $UPSTREAM_DIR/$UPSTREAM_PATH/" >&2
62+
exit 1
63+
fi
64+
done
65+
66+
FETCHED_AT="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
67+
echo "==> Copying files (SHA=$UPSTREAM_SHA, fetched=$FETCHED_AT)"
68+
69+
for f in "${EXPECTED_FILES[@]}"; do
70+
SRC="$UPSTREAM_DIR/$UPSTREAM_PATH/$f"
71+
TMP="$TARGET_DIR/$f.tmp"
72+
DST="$TARGET_DIR/$f"
73+
cp "$SRC" "$TMP"
74+
# Normalize: some upstream files lack a trailing newline. Add one if missing,
75+
# so the footer append doesn't corrupt the final content line. This normalization
76+
# is deliberate and documented in skill/references/logseq-official/README.md.
77+
if [[ -n "$(tail -c 1 "$TMP")" ]]; then
78+
printf '\n' >> "$TMP"
79+
fi
80+
# Append 3-line footer: blank line + 2 HTML comments
81+
printf '\n<!-- logseq-mirror: commit=%s fetched=%s -->\n<!-- logseq-mirror: upstream=https://github.com/logseq/logseq/blob/%s/%s/%s -->\n' \
82+
"$UPSTREAM_SHA" "$FETCHED_AT" "$UPSTREAM_SHA" "$UPSTREAM_PATH" "$f" >> "$TMP"
83+
mv "$TMP" "$DST"
84+
done
85+
86+
echo "==> Extracting upstream LICENSE.md (AGPL-3.0) via git show"
87+
# LICENSE.md at repo root is not in sparse-checkout; read from git object store instead
88+
# (Named LICENSE.md in logseq/logseq; we save it as LICENSE for clarity in this subfolder)
89+
git -C "$UPSTREAM_DIR" show HEAD:LICENSE.md > "$TARGET_DIR/LICENSE"
90+
91+
echo "$UPSTREAM_SHA" > "$SHA_FILE"
92+
93+
echo "==> Synced ${#EXPECTED_FILES[@]} files + LICENSE at SHA $UPSTREAM_SHA"

0 commit comments

Comments
 (0)