skillwiki 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +107 -11
- package/package.json +1 -1
- package/skills/.claude-plugin/plugin.json +1 -1
- package/skills/.codex-plugin/plugin.json +1 -1
- package/skills/agents/proj-decide.md +54 -0
- package/skills/agents/proj-distill.md +60 -0
- package/skills/agents/proj-init.md +58 -0
- package/skills/agents/proj-work.md +64 -0
- package/skills/agents/wiki-adapter-prd.md +74 -0
- package/skills/agents/wiki-add-task.md +62 -0
- package/skills/agents/wiki-archive.md +48 -0
- package/skills/agents/wiki-audit.md +46 -0
- package/skills/agents/wiki-canvas.md +44 -0
- package/skills/agents/wiki-crystallize.md +55 -0
- package/skills/agents/wiki-gate-plan-mode.md +57 -0
- package/skills/agents/wiki-ingest.md +68 -0
- package/skills/agents/wiki-lint.md +47 -0
- package/skills/agents/wiki-query.md +57 -0
- package/skills/agents/wiki-reingest.md +60 -0
- package/skills/agents/wiki-sync.md +70 -0
- package/skills/package.json +1 -1
- package/skills/proj-work/SKILL.md +23 -4
- package/skills/using-skillwiki/SKILL.md +11 -36
- package/skills/wiki-add-task/SKILL.md +48 -78
- package/skills/wiki-crystallize/SKILL.md +2 -11
- package/skills/wiki-ingest/SKILL.md +8 -15
- package/skills/wiki-lint/SKILL.md +4 -13
- package/skills/wiki-query/SKILL.md +9 -14
- package/skills/wiki-sync/SKILL.md +62 -37
|
@@ -3,88 +3,113 @@ version: 0.2.1
|
|
|
3
3
|
name: wiki-sync
|
|
4
4
|
description: Safely sync the vault git repository. Runs skillwiki sync status, then guides push or pull with lint guards and conflict resolution.
|
|
5
5
|
---
|
|
6
|
-
|
|
7
6
|
# wiki-sync
|
|
8
|
-
|
|
9
7
|
## When This Skill Activates
|
|
10
|
-
|
|
11
8
|
- User wants to push local vault changes to the remote.
|
|
12
9
|
- User wants to pull remote changes into their local vault.
|
|
13
10
|
- User asks about vault sync status, git state, or multi-device coordination.
|
|
14
11
|
- Periodic maintenance before or after editing sessions.
|
|
15
|
-
|
|
16
12
|
## Pre-orientation reads
|
|
17
|
-
|
|
18
13
|
Standard four reads.
|
|
19
|
-
|
|
20
14
|
## Steps
|
|
21
|
-
|
|
22
15
|
0. Resolve vault: `skillwiki path` (record source for context).
|
|
23
16
|
1. Run `skillwiki sync status <vault>`. Read the JSON output.
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
- Exit code 0: vault is clean (nothing to sync).
|
|
18
|
+
- Exit code 22: warnings — dirty/ahead/behind (needs action).
|
|
26
19
|
2. Present the current state: `status`, `dirty`, `ahead`, `behind`, `last_commit`.
|
|
27
20
|
3. Ask the user which operation they want: **push**, **pull**, or **both** (pull then push).
|
|
28
|
-
|
|
29
21
|
### Push workflow
|
|
30
|
-
|
|
31
22
|
4. If vault is dirty, ask the user to review uncommitted changes before proceeding.
|
|
32
23
|
5. Run `skillwiki lint <vault>`. If errors exist, stop and report — do not push lint errors to remote.
|
|
33
24
|
6. If lint passes (errors = 0), stage and commit:
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
- `git -C <vault> add -A`
|
|
26
|
+
- `git -C <vault> commit -m "sync: vault update $(date -u +%Y-%m-%dT%H:%MZ)"`
|
|
36
27
|
7. Run `git -C <vault> push origin HEAD`. Report result.
|
|
37
28
|
8. Append one `log.md` entry summarizing: files pushed, lint result, commit hash.
|
|
38
|
-
|
|
39
29
|
### Pull workflow
|
|
40
|
-
|
|
41
30
|
9. If vault is dirty, stash first: `git -C <vault> stash push -m "auto-stash before pull $(date -u +%Y-%m-%dT%H:%MZ)"`.
|
|
42
31
|
10. Run `git -C <vault> pull --rebase origin HEAD`. Report result.
|
|
43
32
|
11. If a stash was created, pop it: `git -C <vault> stash pop`.
|
|
44
33
|
12. If conflicts occur during stash pop, identify them and present to the user for resolution (see Conflict Resolution below).
|
|
45
34
|
13. Run `skillwiki lint <vault>` after pull to verify vault integrity.
|
|
46
35
|
14. Append one `log.md` entry summarizing: commits pulled, lint result, any conflicts.
|
|
47
|
-
|
|
48
36
|
### Pull-then-push workflow
|
|
49
|
-
|
|
50
37
|
15. Execute the pull workflow (steps 9-13) first.
|
|
51
38
|
16. Then execute the push workflow (steps 4-8).
|
|
52
|
-
|
|
53
39
|
## Conflict Resolution
|
|
54
|
-
|
|
55
40
|
When merge conflicts are detected:
|
|
56
|
-
|
|
57
41
|
- **Frontmatter conflicts:**
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
- For `updated:` fields: always take the newer timestamp (compare both sides, keep the later one).
|
|
43
|
+
- For all other frontmatter fields: present both versions to the user and ask which to keep.
|
|
60
44
|
- **Body conflicts:**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
45
|
+
- Do not auto-resolve body conflicts.
|
|
46
|
+
- Mark unresolved regions with `???` on a line by itself between the conflicting versions, so the user can see both sides and decide.
|
|
47
|
+
- Example:
|
|
48
|
+
```
|
|
49
|
+
Content from local version
|
|
50
|
+
???
|
|
51
|
+
Content from remote version
|
|
52
|
+
```
|
|
69
53
|
- After resolving conflicts, run `skillwiki lint <vault>` to verify before committing.
|
|
70
|
-
|
|
71
54
|
## Multi-device coordination
|
|
72
|
-
|
|
73
55
|
When the user mentions editing from Obsidian desktop and Claude Code on a server (or any two-device setup):
|
|
74
|
-
|
|
75
56
|
- Recommend pulling before every editing session on each device.
|
|
76
57
|
- Recommend pushing after every editing session on each device.
|
|
77
58
|
- If both devices edit the same page between syncs, conflicts are inevitable — the Conflict Resolution section handles this.
|
|
78
59
|
- Suggest enabling auto-commit in Obsidian (Community Plugins: `obsidian-git`) to reduce dirty-state drift.
|
|
79
|
-
|
|
60
|
+
## Rclone-backed vault with git snapshotting (cron pattern)
|
|
61
|
+
Some deployments use a cloud-backed vault (`rclone mount`) with a separate git repository for versioned snapshots. This pattern separates "live working vault" from "versioned backup".
|
|
62
|
+
### Architecture
|
|
63
|
+
```
|
|
64
|
+
~/wiki → rclone mount to cloud storage (S3/IDrive/etc) — live vault
|
|
65
|
+
~/wiki-git → git repository cloned from GitHub — snapshot target
|
|
66
|
+
cron hourly → rsync ~/wiki/ → ~/wiki-git/ → git commit → git push
|
|
67
|
+
```
|
|
68
|
+
### Implementation (wiki-snapshot.sh)
|
|
69
|
+
```bash
|
|
70
|
+
#!/bin/bash
|
|
71
|
+
WIKI_DIR="/root/wiki"
|
|
72
|
+
GIT_DIR="/root/wiki-git"
|
|
73
|
+
DATE=$(date +%Y%m%d_%H%M%S)
|
|
74
|
+
# Sync from rclone mount to git repo (quiet mode for slow mounts)
|
|
75
|
+
rsync -a --delete -q \
|
|
76
|
+
--exclude='.snapshots' --exclude='.git' --exclude='.obsidian' --exclude='.skillwiki' \
|
|
77
|
+
"$WIKI_DIR/" "$GIT_DIR/"
|
|
78
|
+
cd "$GIT_DIR" || exit 1
|
|
79
|
+
git config user.email "cron@hermes.local"
|
|
80
|
+
git config user.name "Hermes Snapshot"
|
|
81
|
+
# Check for changes
|
|
82
|
+
if [ -z "$(git status --porcelain)" ]; then
|
|
83
|
+
exit 0 # Nothing to commit
|
|
84
|
+
fi
|
|
85
|
+
git add -A
|
|
86
|
+
git commit -m "Snapshot $DATE"
|
|
87
|
+
# Pull with rebase to handle remote changes (e.g., README edits on GitHub)
|
|
88
|
+
if ! git pull --rebase origin main 2>/dev/null; then
|
|
89
|
+
git pull origin main 2>/dev/null || true
|
|
90
|
+
fi
|
|
91
|
+
git push origin main || echo "Push failed"
|
|
92
|
+
```
|
|
93
|
+
### Pitfalls specific to this pattern
|
|
94
|
+
1. **Divergent branches from external pushes**: If something else pushes to the same GitHub repo (manual edits from macOS desktop, GitHub web UI edits, another server), the local `~/wiki-git` will diverge. The `--rebase` flag handles most cases, but if commits conflict:
|
|
95
|
+
```bash
|
|
96
|
+
cd ~/wiki-git
|
|
97
|
+
git rebase --abort 2>/dev/null || true
|
|
98
|
+
git fetch origin main
|
|
99
|
+
git reset --hard origin/main
|
|
100
|
+
bash ~/.hermes/scripts/wiki-snapshot.sh # Re-sync fresh
|
|
101
|
+
```
|
|
102
|
+
**Prevention**: Avoid editing the GitHub repo directly via web interface or uncoordinated clones. The canonical flow is:
|
|
103
|
+
- Server: rclone mount → rsync → git commit → git push
|
|
104
|
+
- macOS/desktop: git pull → edit → git commit → git push → server pulls on next cron
|
|
105
|
+
2. **Slow rsync on rclone mounts**: The rclone FUSE mount can be slow for large directory listings. Use `rsync -q` (quiet) to reduce output overhead, and consider `--delete-delay` instead of `--delete` if file churn is high. The rclone mount latency can cause `du` and `find` operations to timeout — this is normal, not an error.
|
|
106
|
+
3. **Golden Rule violation**: Never mix sync methods on the same vault. If using rclone mount + git snapshotting, do NOT also enable Obsidian Sync, Syncthing, or iCloud on `~/wiki`. The rclone mount IS the sync mechanism.
|
|
107
|
+
4. **Credential exposure**: The rclone mount and git remote use different credentials. Ensure git credentials are cached or use HTTPS with token, but never commit rclone config to git.
|
|
80
108
|
## Stop conditions
|
|
81
|
-
|
|
82
109
|
- `skillwiki sync status` reports `not_a_repo` — the vault is not a git repository. Advise the user to initialize one.
|
|
83
110
|
- Lint errors are found before a push — do not push until resolved.
|
|
84
111
|
- `git push` or `git pull` fails with a network error — report and stop.
|
|
85
|
-
|
|
86
112
|
## Forbidden
|
|
87
|
-
|
|
88
113
|
- Pushing when lint errors exist.
|
|
89
114
|
- Auto-resolving body conflicts without user review.
|
|
90
115
|
- Force-pushing (`git push --force`).
|