Skip to content

Commit 09c9c21

Browse files
yaooqinnCopilot
andcommitted
docs: add AGENTS.md for AI coding assistants
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b612d8c commit 09c9c21

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# AGENTS.md
2+
3+
## Project Overview
4+
5+
**spark-history-cli** is a Python CLI for querying the Apache Spark History Server REST API. It also ships two agent skills (`spark-history-cli` and `spark-advisor`) that teach AI coding assistants how to debug and optimize Spark applications.
6+
7+
## Repository Structure
8+
9+
```
10+
spark-history-cli/
11+
├── spark_history_cli/ # Python package
12+
│ ├── cli.py # Click-based CLI entry point (REPL + one-shot)
13+
│ ├── core/ # API client, formatters, data models
14+
│ ├── utils/ # Skill installer, helpers
15+
│ ├── tests/ # pytest test suite
16+
│ └── skills/ # Bundled SKILL.md (installed via `install-skill` command)
17+
├── skills/ # Root-level skills (discovered by `npx skills add`)
18+
│ ├── spark-history-cli/ # CLI usage skill
19+
│ │ ├── SKILL.md
20+
│ │ └── sample_codes/
21+
│ └── spark-advisor/ # Performance diagnosis skill
22+
│ ├── SKILL.md
23+
│ ├── references/ # diagnostics.md, comparison.md
24+
│ └── sample_codes/
25+
├── setup.py # Package metadata, version, entry points
26+
├── CHANGELOG.md # Release history
27+
└── .github/workflows/
28+
├── ci.yml # Tests on push/PR
29+
└── publish.yml # PyPI publish on GitHub Release
30+
```
31+
32+
## Key Development Guidelines
33+
34+
- **Python 3.10+** required
35+
- Install locally: `pip install -e .`
36+
- Run tests: `pytest spark_history_cli/tests/`
37+
- Lint: standard Python conventions, no custom linter configured
38+
- Entry point: `spark_history_cli.cli:main`
39+
40+
## Making Changes
41+
42+
### CLI commands
43+
All commands are in `cli.py` using Click. Each command calls methods on the API client in `core/`. Add new commands by following the existing pattern (Click command → API call → format output).
44+
45+
### Skills
46+
Skills are pure Markdown (SKILL.md) with optional `references/` and `sample_codes/`. The skills in `skills/` (root) are the canonical source — `spark_history_cli/skills/` is a bundled copy for the `install-skill` command.
47+
48+
When updating skills, edit in `skills/` first, then sync to `spark_history_cli/skills/`.
49+
50+
### Diagnostics
51+
All diagnostic rules live in `skills/spark-advisor/references/diagnostics.md`. Rules use data from the standard Spark History Server REST API (`/api/v1/`). No external plugins required.
52+
53+
### Releasing
54+
1. Bump version in `setup.py`
55+
2. Update `CHANGELOG.md`
56+
3. Commit and tag: `git tag v{X.Y.Z}`
57+
4. Create a GitHub Release — `publish.yml` auto-publishes to PyPI via trusted publishing
58+
59+
## Testing
60+
61+
A running Spark History Server is needed for integration tests. Unit tests mock the API. Run:
62+
63+
```bash
64+
pytest spark_history_cli/tests/ -v
65+
```
66+
67+
## Commit Style
68+
69+
Use conventional-ish prefixes: `feat:`, `fix:`, `docs:`, `skills:`, `release:`, `chore:`.

0 commit comments

Comments
 (0)