Add the puga command and plan pull; document the UI plan workflow
- pyproject.toml + puga/cli.py: `pip install -e .` installs a `puga <tool>` command, so no venv path is needed (replaces requirements.txt) - tools/plan_push.py: `pull <uuid>` reads a plan (incl. UI edits) back into a YAML spec; recipe entries may carry an amount so switched-off recipes round trip; fixes a variable that overwrote the plan name in build_payload, with a regression test - README: usage with the puga command, and a section on working on the same plans in the PRUNplanner UI and from Claude (write, edit in UI, read back) - CLAUDE.md updated accordingly Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,17 @@ Plutonium–gallium alloy (Pu–Ga) is a specialized metallic blend of plutonium
|
||||
|
||||
## How it is meant to be used
|
||||
|
||||
Open Claude Code in this folder. `CLAUDE.md` is loaded automatically: it tells Claude who the player is, which tools exist, which numbers to trust, and how to answer. Claude also reads `empire/PROFILE.md` (who you are, how you want answers) if you have one. Then just ask, e.g. *"what should I build on Sunday?"*, *"is BHP still worth it?"*, *"simulate my HWP plan"*. Every tool is also a normal command line script, so you can run them yourself.
|
||||
Open Claude Code in this folder. `CLAUDE.md` is loaded automatically: it tells Claude which tools exist, which numbers to trust, and how to answer. Claude also reads `empire/PROFILE.md` (who you are, how you want answers) if you have one. Then just ask, e.g. *"what should I build on Sunday?"*, *"is BHP still worth it?"*, *"how long until I can afford it?"*. Claude answers by running the tools against live market data and your own company data, instead of guessing. Every tool is also a normal command (`puga <tool>`), so you can run them yourself.
|
||||
|
||||
### Plans: you and Claude work on the same plans
|
||||
|
||||
The PRUNplanner web UI is where you look at a plan and tweak it. Claude works on the very same plans through the PRUNplanner API, so either of you can pick up where the other stopped:
|
||||
|
||||
1. Claude works out a setup with the tools (`scan`, `chain`, `simulate`) and **writes it as a plan into your PRUNplanner account** (`puga plan`), named `[PuGa] ...`.
|
||||
2. You **open it in PRUNplanner**, check the simulation, change buildings, recipes, housing, experts or COGC, and save.
|
||||
3. Claude **reads your saved version back** (`puga plan pull <uuid>` gives an editable YAML file, `puga simulate --uuid <uuid>` re-simulates it with your edits) and carries on from there: re-pricing it, comparing variants, or adjusting it.
|
||||
|
||||
Only plans named `[PuGa] ...` are ever written or deleted; your other plans are only read. Writing is a dry run unless you (or Claude, after you ask) pass `--apply`.
|
||||
|
||||
Everything the tools print is an **estimate** from public and personal game data. Prices move; re-run before acting.
|
||||
|
||||
@@ -39,7 +49,7 @@ Everything the tools print is an **estimate** from public and personal game data
|
||||
**Your own position**
|
||||
- `state`: syncs `empire/state/company.yaml` from FIO: cash, permits, buildings, real production efficiency, storage and ships.
|
||||
- `simulate`: a Python replica of the PRUNplanner simulator (workforce, efficiency, material I/O, profit), verified against screenshots of it. Reads a local plan or a saved plan from your account, and reports the real new capex (planned minus already built).
|
||||
- `plan_push`: creates, updates and deletes plans in your PRUNplanner account from small YAML files (examples in `plans/examples/`). Dry run by default; only plans named `[PuGa] ...` can be written or deleted.
|
||||
- `plan` (plan_push): reads plans from your PRUNplanner account into small YAML files and writes them back (create, update, delete), so you and Claude can edit the same plan, you in the UI and Claude in code. Dry run by default; only plans named `[PuGa] ...` can be written or deleted.
|
||||
|
||||
**Knowledge for Claude** (`CLAUDE.md`, `docs/`)
|
||||
- Verified game mechanics, the market-saturation design, a decision log and a roadmap (`docs/`). Everything specific to your own empire (profile, state, plans, notes) lives in the gitignored `empire/` folder, so this repo can stay public.
|
||||
@@ -52,9 +62,10 @@ Requires Python 3.12 or newer and git.
|
||||
git clone <repo-url> PuGa
|
||||
cd PuGa
|
||||
|
||||
# 1. virtual environment
|
||||
# 1. virtual environment; installs the `puga` command into it
|
||||
python3 -m venv .venv
|
||||
.venv/bin/pip install -r requirements.txt
|
||||
.venv/bin/pip install -e ".[dev]"
|
||||
source .venv/bin/activate # once per shell, so `puga` is on your PATH
|
||||
|
||||
# 2. keys
|
||||
cp .env.example .env
|
||||
@@ -65,8 +76,8 @@ $EDITOR .env # fill in the values below
|
||||
tools/refresh_refs.sh
|
||||
|
||||
# 4. check it works
|
||||
.venv/bin/python -m pytest
|
||||
.venv/bin/python tools/price.py BHP --cx AI1
|
||||
puga test
|
||||
puga price BHP --cx AI1
|
||||
```
|
||||
|
||||
### `.env`
|
||||
@@ -82,18 +93,26 @@ tools/refresh_refs.sh
|
||||
| `COMPANY_CODE` | your company code (used by `tools/state.py` for the first sync) |
|
||||
| `DEFAULT_CX`, `DEFAULT_REGION` | default exchange (`AI1` = Antares) and region |
|
||||
|
||||
Only the public data works without keys (prices, recipes, planets). Your own data needs the FIO extension for the browser client to have uploaded it recently: run `tools/state.py sync` and check the `as_of` time.
|
||||
Only the public data works without keys (prices, recipes, planets). Your own data needs the FIO extension for the browser client to have uploaded it recently: run `puga state sync` and check the `as_of` time.
|
||||
|
||||
## Usage
|
||||
|
||||
`puga help` lists the tools; `puga <tool> --help` shows the options.
|
||||
|
||||
```sh
|
||||
.venv/bin/python tools/state.py sync # refresh your company state from FIO
|
||||
.venv/bin/python tools/scan.py --cogc METALLURGY --experts METALLURGY=2 --min-n 3 --top 20
|
||||
.venv/bin/python tools/scan.py --planet ZV-307d --min-n 3 # a specific planet
|
||||
.venv/bin/python tools/scan.py --min-n 3 --json rows.json && .venv/bin/python tools/persistence.py rows.json
|
||||
.venv/bin/python tools/chain.py KV --qty 13
|
||||
.venv/bin/python tools/simulate.py plans/examples/hwp_buildout.yaml --basis vwap30
|
||||
.venv/bin/python tools/plan_push.py plans/examples/hwp_buildout.yaml # dry run; add --apply to write
|
||||
puga state sync # refresh your company state from FIO
|
||||
puga price BHP --cx AI1 # prices, VWAP, volume, fill price for a quantity
|
||||
puga scan --cogc METALLURGY --experts METALLURGY=2 --min-n 3 --top 20
|
||||
puga scan --planet ZV-307d --min-n 3 # a specific planet
|
||||
puga scan --min-n 3 --json rows.json && puga persistence rows.json
|
||||
puga chain KV --qty 13 # make-vs-buy and input sourcing
|
||||
puga simulate plans/examples/hwp_buildout.yaml --basis vwap30
|
||||
|
||||
puga plan list # plans in your PRUNplanner account
|
||||
puga plan pull <uuid> -o my_plan.yaml # read a plan (including your UI edits) into a YAML file
|
||||
puga plan my_plan.yaml # dry run: validated summary of what would be written
|
||||
puga plan my_plan.yaml --apply # write it to your account as a [PuGa] plan
|
||||
puga simulate --uuid <uuid> # simulate the plan as saved in your account
|
||||
```
|
||||
|
||||
## Layout
|
||||
|
||||
Reference in New Issue
Block a user