Skip to content

Commit ccfc039

Browse files
committed
docs: remove env specific info from CLAUDE.md
1 parent de48381 commit ccfc039

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

CLAUDE.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ Entry point: `src/pumpfun_cli/cli.py` → `pyproject.toml` `[project.scripts] pu
4747

4848
```
4949
src/pumpfun_cli/
50-
├── cli.py # Root Typer app, GlobalState, callback
50+
├── cli.py # Root Typer app, GlobalState, callback, command registration
51+
├── group.py # JsonAwareGroup — allows --json at any argv position
5152
├── crypto.py # AES-256-GCM wallet encryption (scrypt KDF)
5253
├── output.py # render() + error() — TTY-aware output
5354
├── commands/ # Thin CLI layer (config, info, launch, tokens, trade, tx_status, wallet)
54-
├── core/ # Business logic (config, info, launch, pumpswap, tokens, trade, tx_status, wallet)
55+
├── core/ # Business logic (config, info, launch, pumpswap, tokens, trade, tx_status, validate, wallet)
5556
└── protocol/ # Solana primitives (address, client, contracts, curve, idl_parser, instructions, pumpswap)
5657
5758
tests/
@@ -63,10 +64,12 @@ tests/
6364

6465
## Code Conventions
6566

66-
**Output:** Use `render(data, json_mode)` for all output — auto-detects TTY (Rich table) vs pipe (JSON). Use `error(msg, hint, exit_code)` for failures — prints to stderr and raises `SystemExit`. Never use `print()`.
67+
**Output:** Use `render(data, json_mode)` for all output — returns `True` if it emitted JSON (non-TTY or `--json`), `False` in TTY mode. Commands use `if not render(...):` to branch into human-readable output. Use `error(msg, hint, exit_code)` for failures — prints to stderr and raises `SystemExit`. Never use `print()`.
6768

6869
**Error handling:** `error()` raises `SystemExit` — code after it is unreachable. Core functions return `dict` with `"error"` key for expected failures (graduated tokens, not found, slippage exceeded, insufficient_balance). Catch `ValueError` for wrong wallet password in every command that decrypts. Buy/sell functions perform pre-trade balance validation — SOL balance for buys (including fees + ATA rent), token balance for sells with specific amounts.
6970

71+
**Auto-routing:** When `buy_token` / `sell_token` returns `{"error": "graduated"}`, the command layer in `commands/trade.py` automatically retries via `buy_pumpswap` / `sell_pumpswap` (PumpSwap AMM). Never suppress or swallow the `"graduated"` error in core — the routing decision belongs in the command layer.
72+
7073
**Imports:** stdlib → third-party → local. Example:
7174
```python
7275
import asyncio
@@ -84,13 +87,15 @@ from pumpfun_cli.output import render, error
8487

8588
**Async:** All I/O functions are `async def`. Commands bridge with `asyncio.run()`. `RpcClient` is stateless — always call `.close()` in `finally`.
8689

87-
**Config resolution:** `resolve_value(key, env_var, flag)` — flag > env var > config file > default.
90+
**Config resolution:** `resolve_value(key, flag)` — flag > env var (via internal `ENV_MAP`) > config file > default.
8891

8992
## Adding a New Command
9093

9194
1. Add `core/my_feature.py``async def my_operation(rpc_url, keystore_path, password, ...) -> dict`
9295
2. Add `commands/my_feature.py` — Typer wrapper that calls core and renders output
93-
3. Register in `cli.py` with `app.command("my-command")(my_feature_cmd)`
96+
3. Register in `cli.py`:
97+
- Flat command: `app.command("my-command")(my_feature_cmd)`
98+
- Subcommand group: `app.add_typer(my_app, name="group-name")`
9499
4. Add tests in `tests/test_core/test_my_feature.py` with mocked RPC/HTTP
95100

96101
## Working with Solana Accounts
@@ -104,25 +109,24 @@ data = await client.get_account_data(address)
104109
state = idl.decode_account_data(data, "BondingCurve", skip_discriminator=True)
105110

106111
# Build instructions
107-
from pumpfun_cli.protocol.instructions import build_buy_ix
108-
ixs = build_buy_ix(...)
112+
from pumpfun_cli.protocol.instructions import build_buy_exact_sol_in_instructions
113+
ixs = build_buy_exact_sol_in_instructions(idl=idl, mint=mint, user=keypair.pubkey(), ...)
109114
sig = await client.send_tx(ixs, [keypair], compute_units=..., confirm=True)
110115
```
111116

112117
## Environment
113118

114119
```bash
115-
PUMPFUN_RPC=https://... # Solana RPC endpoint (required for trading)
116-
PUMPFUN_PASSWORD=... # Wallet password (for non-interactive use)
120+
PUMPFUN_RPC=https://... # Solana RPC endpoint (required for trading)
121+
PUMPFUN_KEYFILE=/path/to/... # Path to encrypted wallet keystore
122+
PUMPFUN_PRIORITY_FEE=200000 # Priority fee in micro-lamports
123+
PUMPFUN_COMPUTE_UNITS=100000 # Compute unit limit
124+
PUMPFUN_PASSWORD=... # Wallet password (read directly in wallet commands, not via resolve_value)
117125
```
118126

119127
Config file: `~/.config/pumpfun-cli/config.toml`
120128
Wallet keystore: `~/.config/pumpfun-cli/wallet.enc`
121129

122-
## Test Fixtures
123-
124-
- Test wallet pubkey: `2kPYzWkeJCiUEpo7yBNX7jYdwmyqXGrKsjetNJdHPfYz` (password: `testpass123`)
125-
- Test token mint: `72xpy6cejkorDh8gx328CAW3Fq7uCQdCyXkSLAE5to5p` (CLITEST, on bonding curve)
126130

127131
## Hooks
128132

0 commit comments

Comments
 (0)