-
Notifications
You must be signed in to change notification settings - Fork 400
Add backup CLI, docs, and safer restore ordering #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Codex Agent Guide (pyzk) | ||
|
|
||
| ## Repo overview | ||
| - `zk/` is the library package. The main entry point is `ZK` in `zk/base.py`. | ||
| - `example/` contains minimal usage scripts. | ||
| - `test_machine.py` and `test_backup_restore.py` are hardware-facing CLIs. | ||
| - `docs/` is a Sphinx site (ReadTheDocs compatible). | ||
|
|
||
| ## Key modules | ||
| - `zk/base.py`: core protocol, connection handling, and device operations. | ||
| - `zk/user.py`: `User` model and packing helpers. | ||
| - `zk/finger.py`: `Finger` model and template packing helpers. | ||
| - `zk/attendance.py`: `Attendance` model. | ||
| - `zk/const.py`: protocol constants and flags. | ||
| - `zk/exception.py`: library exceptions. | ||
|
|
||
| ## Safety notes | ||
| - Destructive calls include `clear_data()`, `clear_attendance()`, `poweroff()`, and `restart()`. | ||
| - `unlock()` opens the door/relay on some devices. Treat it as a safety-sensitive operation. | ||
| - Prefer `disable_device()` before bulk reads/writes to avoid inconsistent data. | ||
| - Live capture (`live_capture()`) can hold device state; ensure you exit cleanly. | ||
|
|
||
| ## Common commands | ||
| - Run an example: `python example/get_users.py` (edit IP/port inside the script). | ||
| - Basic device probe: `python test_machine.py -a 192.168.1.201`. | ||
| - Backup/restore CLI (new): `pyzk-backup --help`. | ||
|
|
||
| ## Docs build | ||
| - Build Sphinx docs: `cd docs && make html`. | ||
| - Or: `sphinx-build -b html docs docs/_build/html`. | ||
|
|
||
| ## Hardware-dependent tests | ||
| - Any command that connects to a real device requires a reachable IP/port (default 4370). | ||
| - Use `--force-udp` if TCP is unreliable for a specific model. | ||
| - Time sync and firmware reads may differ by model/firmware version. | ||
|
|
||
| ## Conventions | ||
| - Keep new code Python 2/3 compatible unless explicitly dropping support. | ||
| - Avoid changing protocol details without referencing `docs/_static/Communication_protocol_manual_CMD.pdf`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Codex Agent Guide (pyzk) | ||
|
|
||
| ## Repo overview | ||
| - `zk/` is the library package. The main entry point is `ZK` in `zk/base.py`. | ||
| - `example/` contains minimal usage scripts. | ||
| - `test_machine.py` and `test_backup_restore.py` are hardware-facing CLIs. | ||
| - `docs/` is a Sphinx site (ReadTheDocs compatible). | ||
|
|
||
| ## Key modules | ||
| - `zk/base.py`: core protocol, connection handling, and device operations. | ||
| - `zk/user.py`: `User` model and packing helpers. | ||
| - `zk/finger.py`: `Finger` model and template packing helpers. | ||
| - `zk/attendance.py`: `Attendance` model. | ||
| - `zk/const.py`: protocol constants and flags. | ||
| - `zk/exception.py`: library exceptions. | ||
|
|
||
| ## Safety notes | ||
| - Destructive calls include `clear_data()`, `clear_attendance()`, `poweroff()`, and `restart()`. | ||
| - `unlock()` opens the door/relay on some devices. Treat it as a safety-sensitive operation. | ||
| - Prefer `disable_device()` before bulk reads/writes to avoid inconsistent data. | ||
| - Live capture (`live_capture()`) can hold device state; ensure you exit cleanly. | ||
|
|
||
| ## Common commands | ||
| - Run an example: `python example/get_users.py` (edit IP/port inside the script). | ||
| - Basic device probe: `python test_machine.py -a 192.168.1.201`. | ||
| - Backup/restore CLI (new): `pyzk-backup --help`. | ||
|
|
||
| ## Docs build | ||
| - Build Sphinx docs: `cd docs && make html`. | ||
| - Or: `sphinx-build -b html docs docs/_build/html`. | ||
|
|
||
| ## Hardware-dependent tests | ||
| - Any command that connects to a real device requires a reachable IP/port (default 4370). | ||
| - Use `--force-udp` if TCP is unreliable for a specific model. | ||
| - Time sync and firmware reads may differ by model/firmware version. | ||
|
|
||
| ## Conventions | ||
| - Keep new code Python 2/3 compatible unless explicitly dropping support. | ||
| - Avoid changing protocol details without referencing `docs/_static/Communication_protocol_manual_CMD.pdf`. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # pyzk Roadmap | ||
|
|
||
| This roadmap tracks the next steps for pyzk. It is intentionally high level | ||
| and may change as new devices or protocol details are discovered. | ||
|
|
||
| ## Now | ||
|
|
||
| - Complete the Sphinx documentation with real usage guides. | ||
| - Publish a supported backup/restore CLI (`pyzk-backup`) and helper API. | ||
| - Expand the compatible devices list and add a contribution template. | ||
|
|
||
| ## Next | ||
|
|
||
| - Ship an HTTP REST API server (implementation of the spec in `docs/api_design.rst`). | ||
| - Provide a real-time streaming API (SSE or WebSocket) for live events. | ||
| - Add more example scripts for common tasks (backup, sync time, unlock door). | ||
|
|
||
| ## Later | ||
|
|
||
| - Add automated compatibility tests for known devices. | ||
| - Expand device support for newer firmware families. | ||
| - Optional plugins for exporting data to common systems (CSV, database). |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,139 @@ | ||||||||||||||
| .. toctree:: | ||||||||||||||
| :caption: HTTP & Real-Time API (Spec) | ||||||||||||||
| :name: api_design | ||||||||||||||
|
|
||||||||||||||
| ############################### | ||||||||||||||
| HTTP & Real-Time API (Spec Only) | ||||||||||||||
| ############################### | ||||||||||||||
|
|
||||||||||||||
|
||||||||||||||
| Status | |
| ------ | |
| **Status: Planning / design only – not implemented in the current release.** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLAUDE.md and AGENTS.md have identical content. Consider consolidating these into a single file or clearly documenting why both are needed. Having duplicate files can lead to maintenance issues where one is updated but not the other.