Initial commit: Last-Z Gift Center CLI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
31
CLAUDE.md
Normal file
31
CLAUDE.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Run the CLI
|
||||
python giftcenter.py login
|
||||
python giftcenter.py redeem <gift_code>
|
||||
|
||||
# Override UID without editing .env
|
||||
python giftcenter.py --uid <uid> login
|
||||
python giftcenter.py --uid <uid> redeem <gift_code>
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
UID is read from the `UID` environment variable, typically set in `.env`. The `--uid` flag on any subcommand overrides it.
|
||||
|
||||
## Architecture
|
||||
|
||||
Single-file Python CLI (`giftcenter.py`) using `argparse` subcommands:
|
||||
|
||||
- `login` → `cmd_login()` — GET `/getcodeuser.php?uid=...`, displays account info
|
||||
- `redeem <code>` → `cmd_redeem()` — GET `/code.php` with `Usertoken` header and `uid`/`code` params
|
||||
|
||||
API responses use numeric error codes (`code` field) for login and string error codes (`errorCode` field, value `"ok"` on success) for redemption. Error mappings are in `LOGIN_ERRORS` and `REDEEM_ERRORS` constants. UI text is in Traditional Chinese.
|
||||
Reference in New Issue
Block a user