Modularize major-domo skill (1005 -> 173 lines in SKILL.md)
Extract API and CLI references into dedicated files: - SKILL.md (173 lines): routing, safety rules, architecture, common queries - API_REFERENCE.md (99 lines): endpoints, auth, Python client - CLI_REFERENCE.md (115 lines): commands, flag ordering, compliance workflow Total content reduced from 1005 to 387 lines. Context loaded per session drops from 1005 to 173 lines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
db1f2e2d4b
commit
67337a6771
99
skills/major-domo/API_REFERENCE.md
Normal file
99
skills/major-domo/API_REFERENCE.md
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
# Major Domo - API Reference
|
||||||
|
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
All write operations require Bearer token:
|
||||||
|
```bash
|
||||||
|
export API_TOKEN='your-token-here'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environments
|
||||||
|
|
||||||
|
- **Production**: `https://api.sba.manticorum.com/v3/`
|
||||||
|
- **Development**: `http://10.10.0.42:8000/api/v3/`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export DATABASE='prod' # or 'dev'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Endpoints
|
||||||
|
|
||||||
|
### Current Status
|
||||||
|
- `GET /current` - Current season/week status
|
||||||
|
- `GET /current?season={N}` - Specific season status
|
||||||
|
- `PATCH /current/{id}` - Update status (private)
|
||||||
|
|
||||||
|
### Players
|
||||||
|
- `GET /players?season={N}` - List all players in season
|
||||||
|
- `GET /players?team_id={id}` - Players by team
|
||||||
|
- `GET /players?name={name}` - Players by name (exact)
|
||||||
|
- `GET /players/search?q={query}` - Fuzzy search
|
||||||
|
- `GET /players/{id}` - Single player
|
||||||
|
- `PATCH /players/{id}` - Update player (private)
|
||||||
|
|
||||||
|
### Teams
|
||||||
|
- `GET /teams?season={N}` - List teams
|
||||||
|
- `GET /teams?team_abbrev={abbrev}` - By abbreviation
|
||||||
|
- `GET /teams?active_only=true` - Active teams only
|
||||||
|
- `GET /teams/{id}` - Single team
|
||||||
|
- `GET /teams/{id}/roster/{which}` - Roster (current/next)
|
||||||
|
|
||||||
|
### Standings
|
||||||
|
- `GET /standings?season={N}` - All standings
|
||||||
|
- `GET /standings?season={N}&division_abbrev={div}` - By division
|
||||||
|
- `GET /standings/team/{team_id}` - Single team
|
||||||
|
- `POST /standings/s{season}/recalculate` - Recalculate (private)
|
||||||
|
|
||||||
|
### Transactions
|
||||||
|
- `GET /transactions?season={N}` - List transactions
|
||||||
|
- `GET /transactions?season={N}&team_abbrev={abbrev}` - By team
|
||||||
|
- `GET /transactions?season={N}&week_start={W}&week_end={W}` - By week range
|
||||||
|
- `PATCH /transactions/{move_id}` - Update (private)
|
||||||
|
|
||||||
|
### Statistics (Advanced Views)
|
||||||
|
- `GET /views/season-stats/batting?season={N}` - Season batting
|
||||||
|
- Params: `team_id`, `player_id`, `min_pa`, `sort_by`, `sort_order`, `limit`, `offset`
|
||||||
|
- `GET /views/season-stats/pitching?season={N}` - Season pitching
|
||||||
|
- Params: `team_id`, `player_id`, `min_outs`, `sort_by`, `sort_order`, `limit`, `offset`
|
||||||
|
- `POST /views/season-stats/batting/refresh` - Refresh batting (private)
|
||||||
|
- `POST /views/season-stats/pitching/refresh` - Refresh pitching (private)
|
||||||
|
|
||||||
|
### Other Endpoints
|
||||||
|
- `/api/v3/schedules` - Game scheduling
|
||||||
|
- `/api/v3/results` - Game results
|
||||||
|
- `/api/v3/injuries` - Injury tracking
|
||||||
|
- `/api/v3/awards` - League awards
|
||||||
|
- `/api/v3/managers` - Manager profiles
|
||||||
|
- `/api/v3/divisions` - Division info
|
||||||
|
- `/api/v3/draftdata` - Draft status
|
||||||
|
- `/api/v3/draftpicks` - Pick ownership
|
||||||
|
- `/api/v3/draftlist` - Draft priority lists
|
||||||
|
- `/api/v3/keepers` - Keeper selections
|
||||||
|
- `/api/v3/stratgame` - Game data
|
||||||
|
- `/api/v3/stratplay` - Play-by-play
|
||||||
|
- `/api/v3/sbaplayers` - Player pool
|
||||||
|
- `/api/v3/custom_commands` - Custom Discord commands
|
||||||
|
- `/api/v3/help_commands` - Static help text
|
||||||
|
|
||||||
|
## Python API Client
|
||||||
|
|
||||||
|
```python
|
||||||
|
from api_client import MajorDomoAPI
|
||||||
|
|
||||||
|
api = MajorDomoAPI(environment='prod', verbose=True)
|
||||||
|
# Or: api = MajorDomoAPI(environment='dev', token='your-token')
|
||||||
|
|
||||||
|
# Common operations
|
||||||
|
current = api.get_current()
|
||||||
|
team = api.get_team(abbrev='CAR')
|
||||||
|
player = api.get_player(name='Mike Trout', season=12)
|
||||||
|
results = api.search_players(query='trout', season=12, limit=10)
|
||||||
|
roster = api.get_team_roster(team_id=42, which='current')
|
||||||
|
standings = api.get_standings(season=12, division_abbrev='ALE')
|
||||||
|
transactions = api.get_transactions(season=12, team_abbrev='CAR')
|
||||||
|
batting = api.get_season_batting_stats(season=12, min_pa=100, sort_by='woba', limit=50)
|
||||||
|
pitching = api.get_season_pitching_stats(season=12, min_outs=150, sort_by='era', limit=50)
|
||||||
|
```
|
||||||
|
|
||||||
|
**OpenAPI docs**: `http://10.10.0.42/api/docs`
|
||||||
|
**Router source**: `/mnt/NV2/Development/major-domo/database/app/routers_v3/`
|
||||||
115
skills/major-domo/CLI_REFERENCE.md
Normal file
115
skills/major-domo/CLI_REFERENCE.md
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
# Major Domo - CLI Reference
|
||||||
|
|
||||||
|
## Invocation
|
||||||
|
|
||||||
|
**Wrapper**: `majordomo` (alias, uses `uv run`)
|
||||||
|
|
||||||
|
**Full path** (for Claude Code):
|
||||||
|
```bash
|
||||||
|
python3 ~/.claude/skills/major-domo/cli.py <command>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Flag Ordering
|
||||||
|
|
||||||
|
`--env`, `--json`, `--verbose` are **top-level flags** (BEFORE subcommand).
|
||||||
|
`--season` is a **subcommand flag** (AFTER subcommand).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Correct:
|
||||||
|
python3 ~/.claude/skills/major-domo/cli.py --json team get CLS
|
||||||
|
python3 ~/.claude/skills/major-domo/cli.py --env dev team roster CAN
|
||||||
|
|
||||||
|
# Wrong (will error):
|
||||||
|
python3 ~/.claude/skills/major-domo/cli.py team get CLS --json
|
||||||
|
```
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
### Status
|
||||||
|
```bash
|
||||||
|
cli.py status # Current season/week
|
||||||
|
cli.py health # API health check
|
||||||
|
```
|
||||||
|
|
||||||
|
### Players
|
||||||
|
```bash
|
||||||
|
cli.py player get "Mike Trout" # Get player info
|
||||||
|
cli.py player search "trout" # Fuzzy search
|
||||||
|
cli.py player move "Name" TEAM # Move single player
|
||||||
|
cli.py player move --batch "N1:T1,N2:T2" # Batch moves
|
||||||
|
```
|
||||||
|
|
||||||
|
### Teams
|
||||||
|
```bash
|
||||||
|
cli.py team list [--active] # List teams
|
||||||
|
cli.py team get CAR # Team details
|
||||||
|
cli.py team roster CAR # Roster breakdown (Active/Short IL/Long IL)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Standings
|
||||||
|
```bash
|
||||||
|
cli.py standings [--division ALE] # League standings
|
||||||
|
```
|
||||||
|
|
||||||
|
### Transactions
|
||||||
|
```bash
|
||||||
|
cli.py transactions --team CLS --week 9 # Team transactions
|
||||||
|
cli.py transactions list --week-start 1 --week-end 4 # Week range
|
||||||
|
cli.py transactions --player "Mike Trout" # Player transactions
|
||||||
|
cli.py transactions simulate CLS "Stott:CLSMiL,Walker:CLS" # Compliance check (dry run)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Injuries
|
||||||
|
```bash
|
||||||
|
cli.py injuries list --team CLS --active # Active injuries for team
|
||||||
|
cli.py injuries list --sort return-asc # Sort by return date
|
||||||
|
```
|
||||||
|
|
||||||
|
### Statistics
|
||||||
|
```bash
|
||||||
|
cli.py stats batting --sort woba --min-pa 100 --limit 25 # Batting leaders
|
||||||
|
cli.py stats pitching --sort era --min-outs 100 --limit 25 # Pitching leaders
|
||||||
|
cli.py stats batting --team CLS # Team batting
|
||||||
|
```
|
||||||
|
|
||||||
|
### Results & Schedule
|
||||||
|
```bash
|
||||||
|
cli.py results --team CLS --week 9 # Team results
|
||||||
|
cli.py results list --week-start 1 --week-end 4 # Range
|
||||||
|
cli.py schedule --team CLS --week 10 # Team schedule
|
||||||
|
cli.py schedule list --week-start 10 --week-end 12 # Range
|
||||||
|
```
|
||||||
|
|
||||||
|
### Admin (write operations)
|
||||||
|
```bash
|
||||||
|
cli.py admin recalculate-standings # Recalculate standings
|
||||||
|
cli.py admin refresh-batting # Refresh batting view
|
||||||
|
cli.py admin refresh-pitching # Refresh pitching view
|
||||||
|
cli.py admin refresh-stats # Refresh both views
|
||||||
|
cli.py admin refresh-batting --season 11 # Specific season
|
||||||
|
```
|
||||||
|
|
||||||
|
## Key Notes
|
||||||
|
|
||||||
|
- `team get` shows salary_cap in formatted output; use `--json` for all fields
|
||||||
|
- `team roster` shows Active/Short IL/Long IL with WARA values for Active only
|
||||||
|
- "Long IL" = MiL (minor leagues)
|
||||||
|
- For individual player lookups, use `player get "Name"` — bulk queries can timeout
|
||||||
|
- `transactions simulate` validates compliance without making changes
|
||||||
|
- `stats` commands support standard baseball stats sorting (woba, obp, slg, era, whip, fip, etc.)
|
||||||
|
|
||||||
|
## Transaction Compliance Workflow
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Simulate proposed moves (dry run)
|
||||||
|
cli.py transactions simulate CLS "Stott:CLSMiL,Walker:CLS,Castellanos:FA,Martin:CLS"
|
||||||
|
|
||||||
|
# Validates: roster count = 26, total sWAR <= salary_cap, all players exist
|
||||||
|
```
|
||||||
|
|
||||||
|
**Manual verification** (if needed):
|
||||||
|
1. `cli.py team roster ABBREV` → note count and WARA
|
||||||
|
2. `cli.py --json team get ABBREV` → read `salary_cap`
|
||||||
|
3. `cli.py player get "Name"` for each incoming player
|
||||||
|
4. Calculate: current sWAR ± changes <= cap, roster = 26
|
||||||
|
5. `cli.py player move --batch "Name1:Team1,Name2:Team2"`
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user