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:
+18
-18
@@ -17,27 +17,27 @@ The wiki remains the place for context: customer background, project history, sa
|
||||
## Commands
|
||||
|
||||
```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 the login/refresh flow:
|
||||
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 --start-modifytime "2026-07-01 00:00:00"
|
||||
obsidian-wiki business sync kingdee --incremental
|
||||
obsidian-wiki business query "2026年6月接了多少单"
|
||||
obsidian-wiki business query "2026-06 sales amount"
|
||||
obsidian-wiki business query "2026-06 top customer"
|
||||
obsidian-wiki business query "徐丽最近一周订单"
|
||||
obsidian-wiki business query "徐丽最近一周接了多少单"
|
||||
obsidian-wiki business query "徐丽最近一周销售额" --all-staff
|
||||
obsidian-wiki business query "按组织列出订单" --fallback-sql "SELECT org_name, COUNT(*) AS order_count FROM orders GROUP BY org_name"
|
||||
obsidian-wiki business sql "SELECT COUNT(*) AS order_count FROM orders"
|
||||
scripts/obsidian-wiki-ops.py kingdee sync --start-modifytime "2026-07-01 00:00:00"
|
||||
scripts/obsidian-wiki-ops.py kingdee sync --incremental
|
||||
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 "2026-06 top customer"
|
||||
scripts/obsidian-wiki-ops.py kingdee query "徐丽最近一周订单"
|
||||
scripts/obsidian-wiki-ops.py kingdee query "徐丽最近一周接了多少单"
|
||||
scripts/obsidian-wiki-ops.py kingdee query "徐丽最近一周销售额" --all-staff
|
||||
scripts/obsidian-wiki-ops.py kingdee query "按组织列出订单" --fallback-sql "SELECT org_name, COUNT(*) AS order_count FROM orders GROUP BY org_name"
|
||||
scripts/obsidian-wiki-ops.py kingdee sql "SELECT COUNT(*) AS order_count FROM orders"
|
||||
```
|
||||
|
||||
When `--input` is omitted, sync reads `.runtime/kingdee.env`, gets or refreshes an access token, calls the official Kingdee sales order API, and stores the returned rows. If the file does not exist, `business sync kingdee` creates the template and asks you to fill it before retrying.
|
||||
@@ -45,9 +45,9 @@ When `--input` is omitted, sync reads `.runtime/kingdee.env`, gets or refreshes
|
||||
For unattended sync, install the user-level systemd timer:
|
||||
|
||||
```bash
|
||||
bash scripts/business_sync_service.sh start --vault /path/to/vault
|
||||
bash scripts/business_sync_service.sh run-now --vault /path/to/vault
|
||||
bash scripts/business_sync_service.sh status
|
||||
scripts/obsidian-wiki-ops.py timer install --vault /path/to/vault
|
||||
scripts/obsidian-wiki-ops.py timer run-now --vault /path/to/vault
|
||||
scripts/obsidian-wiki-ops.py timer status
|
||||
```
|
||||
|
||||
The timer defaults to daily `07:10` with a 15-minute randomized delay. It runs incremental Kingdee sync with a 48-hour lookback window.
|
||||
@@ -115,7 +115,7 @@ If no fixed template matches, callers may provide guarded SQL through `business
|
||||
|
||||
## Incremental Sync
|
||||
|
||||
`obsidian-wiki business sync kingdee --incremental` uses Kingdee `start_modifytime`.
|
||||
`scripts/obsidian-wiki-ops.py kingdee sync --incremental` uses Kingdee `start_modifytime`.
|
||||
|
||||
- First run without a cursor: fetches the last 7 days.
|
||||
- Later runs: starts from the saved cursor minus 48 hours.
|
||||
|
||||
Reference in New Issue
Block a user