feat(cli): add unified user operations entrypoint

Add scripts/obsidian-wiki-ops.py as the repo-local command surface for common wiki, Kingdee, timer, daily update, and MCP operations.

Route the existing business and MCP shell wrappers through the unified entrypoint for compatibility, and update docs to recommend the single command path.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests scripts; git diff --check.
This commit is contained in:
Codex
2026-07-06 21:21:14 +00:00
parent 317b0e6feb
commit b85c26e0ba
11 changed files with 306 additions and 71 deletions
+12 -12
View File
@@ -127,7 +127,7 @@ Knowledge that's project-specific goes under `projects/<name>/`. Knowledge that'
|---|---|---|
| `OBSIDIAN_SOURCES_DIR` | Directories with docs to ingest (comma-separated) | *(empty — point agent at specific files)* |
| `OBSIDIAN_BUSINESS_FACTS_DB` | Optional path for structured business facts such as Kingdee orders | `<vault>/_meta/business-facts.sqlite` |
| `.runtime/kingdee.env` | Private local Kingdee sales-order API config created by `obsidian-wiki business config kingdee` | official sales-order URL, blank credentials |
| `.runtime/kingdee.env` | Private local Kingdee sales-order API config created by `scripts/obsidian-wiki-ops.py kingdee config` | official sales-order URL, blank credentials |
| `OBSIDIAN_CATEGORIES` | Wiki page categories | `concepts,entities,skills,references,synthesis,journal` |
| `OBSIDIAN_MAX_PAGES_PER_INGEST` | Max pages updated per ingest | `15` |
| `CLAUDE_HISTORY_PATH` | Where to find Claude data | *auto-discovers from `~/.claude`* |
@@ -159,25 +159,25 @@ Knowledge that's project-specific goes under `projects/<name>/`. Knowledge that'
Use the business fact database for exact operational questions, for example monthly order counts or sales amounts. Do not ingest every order line into the wiki.
```bash
obsidian-wiki business sync kingdee --input ./kingdee-orders.json
scripts/obsidian-wiki-ops.py kingdee sync --input ./kingdee-orders.json
obsidian-wiki business config kingdee
scripts/obsidian-wiki-ops.py kingdee config
# Fill .runtime/kingdee.env, then test login/refresh without syncing orders:
obsidian-wiki business sync kingdee --dry-run-auth
scripts/obsidian-wiki-ops.py kingdee auth-test
obsidian-wiki business sync kingdee \
scripts/obsidian-wiki-ops.py kingdee sync \
--start-bizdate 2026-06-01 \
--end-bizdate 2026-06-30 \
--billstatus C
obsidian-wiki business sync kingdee --incremental
scripts/obsidian-wiki-ops.py kingdee sync --incremental
obsidian-wiki business query "2026年6月接了多少单"
obsidian-wiki business query "2026-06 sales amount"
obsidian-wiki business query "徐丽最近一周订单"
obsidian-wiki business query "徐丽最近一周销售额" --all-staff
obsidian-wiki business sql "SELECT COUNT(*) AS order_count FROM orders"
scripts/obsidian-wiki-ops.py kingdee query "2026年6月接了多少单"
scripts/obsidian-wiki-ops.py kingdee query "2026-06 sales amount"
scripts/obsidian-wiki-ops.py kingdee query "徐丽最近一周订单"
scripts/obsidian-wiki-ops.py kingdee query "徐丽最近一周销售额" --all-staff
scripts/obsidian-wiki-ops.py kingdee sql "SELECT COUNT(*) AS order_count FROM orders"
bash scripts/business_sync_service.sh start --vault /path/to/vault
scripts/obsidian-wiki-ops.py timer install --vault /path/to/vault
```
Without `--input`, the Kingdee sync command creates/reads `.runtime/kingdee.env`, obtains or refreshes an access token, calls the official sales order query API, then stores the fetched JSON response in `<vault>/_meta/business-facts.sqlite`. The private config supports configurable login/token URL, request body, response field paths, refresh URL/body, and required `x-acgw-identity`; fetched tokens are cached in `.runtime/kingdee-token.json`. `.runtime/` is ignored by git.