Files
obsidian-wiki/scripts/obsidian-wiki-ops.py
T
Codex 2396bd2d3e refactor(mcp): extract order services into independent project
Remove Kingdee sync, business CLI/MCP tools, and internal order-query routing
now owned by the separate kingdee-orders-mcp project. Keep Wiki retrieval,
file assets and ingest available in code while its deployed service is off.
Retain legacy response fields with business access disabled, and document
migration ownership and rollback without exposing credentials or data.

Validation: 174 Wiki tests pass. Independent order service verified with
36 template parity checks, authenticated HTTP queries, and a real sync.
2026-10-31 07:41:18 +00:00

88 lines
2.1 KiB
Python
Executable File

#!/usr/bin/env python3
"""Single user-facing operations entrypoint for this repository."""
from __future__ import annotations
import subprocess
import sys
from pathlib import Path
from typing import Sequence
SCRIPT_DIR = Path(__file__).resolve().parent
REPO_ROOT = SCRIPT_DIR.parent
for path in (REPO_ROOT, SCRIPT_DIR):
if str(path) not in sys.path:
sys.path.insert(0, str(path))
from obsidian_wiki.cli import main as obsidian_cli_main
import manage_mcp_service
HELP_TEXT = """obsidian-wiki user operations
Usage:
scripts/obsidian-wiki-ops.py help
scripts/obsidian-wiki-ops.py setup [args...]
scripts/obsidian-wiki-ops.py info
scripts/obsidian-wiki-ops.py file-index rebuild [args...]
scripts/obsidian-wiki-ops.py mcp start [args...]
scripts/obsidian-wiki-ops.py mcp tools list
scripts/obsidian-wiki-ops.py mcp status
scripts/obsidian-wiki-ops.py mcp stop
scripts/obsidian-wiki-ops.py mcp uninstall
scripts/obsidian-wiki-ops.py daily-update [args...]
Notes:
Use --help after any forwarded command to see that command's detailed options.
"""
CLI_COMMANDS = {
"setup",
"list",
"info",
"file-index",
"mcp-server",
"bot-view",
}
def print_help() -> int:
print(HELP_TEXT, end="")
return 0
def run_script(script_name: str, args: Sequence[str]) -> int:
script = SCRIPT_DIR / script_name
completed = subprocess.run([str(script), *args], check=False)
return int(completed.returncode)
def main(argv: Sequence[str] | None = None) -> int:
args = list(sys.argv[1:] if argv is None else argv)
if not args or args[0] in {"help", "-h", "--help"}:
return print_help()
command, *rest = args
if command in CLI_COMMANDS:
return obsidian_cli_main([command, *rest])
if command == "mcp":
return manage_mcp_service.main(rest)
if command == "daily-update":
return run_script("daily-update.sh", rest)
print(f"Unknown command: {command}", file=sys.stderr)
print("Run `scripts/obsidian-wiki-ops.py help` for available operations.", file=sys.stderr)
return 2
if __name__ == "__main__":
raise SystemExit(main())