From af83f4b4c8da374f58400c5303096a4b7317cdcd Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 20 May 2026 22:58:14 +0400 Subject: [PATCH] refactor: rename .oikb.yaml top-level key from sync: to sources: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backward compatible — both sync: and sources: are accepted, sources: takes precedence. --- README.md | 6 +++--- src/oikb/cli.py | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 74b5dac..2b01e42 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Features: ```yaml # .oikb.yaml -sync: +sources: - source: github:owner/repo kb-id: team-wiki interval: 1h @@ -119,7 +119,7 @@ Some connectors need an optional extra: `pip install oikb[gdrive]`, `pip install Route files from a single source to different Knowledge Bases by glob pattern: ```yaml -sync: +sources: - source: github:owner/repo routes: "docs/**/*.md": docs-kb @@ -131,7 +131,7 @@ sync: Narrow what gets synced with include/exclude globs: ```yaml -sync: +sources: - source: github:owner/repo kb-id: docs-only filter: diff --git a/src/oikb/cli.py b/src/oikb/cli.py index fe9ab36..1d55610 100644 --- a/src/oikb/cli.py +++ b/src/oikb/cli.py @@ -282,10 +282,12 @@ def _load_oikb_yaml() -> list[dict] | None: with open(yaml_path) as f: data = yaml.safe_load(f) - if not data or "sync" not in data: + if not data: return None - return data["sync"] + # Prefer sources: (new), fall back to sync: (legacy). + entries = data.get("sources") or data.get("sync") + return entries or None # ── sync ──────────────────────────────────────────────────────── @@ -747,7 +749,7 @@ def daemon(port: int, no_server: bool, config_file: str | None): import yaml with open(config_file) as f: data = yaml.safe_load(f) - entries = data.get("sync", []) if data else [] + entries = (data.get("sources") or data.get("sync", [])) if data else [] else: entries = _load_oikb_yaml()