Metadata-Version: 2.4
Name: apx-example
Version: 0.3.1
Summary: Template for an Action Platform plugin: tools, a CLI command, an overlay, a release strategy, a replaced slot, lifecycle hooks.
Author-email: Action Platform <cloud@actionplatform.io>
License-Expression: Apache-2.0
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: action-platform>=0.32
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Requires-Dist: action-platform[mcp]; extra == "dev"
Dynamic: license-file

<p align="center">
  <img src="https://raw.githubusercontent.com/actionplatform/action-platform/master/docs/assets/icon.svg" alt="Action Platform" width="120">
</p>

<h1 align="center">apx-example</h1>

<p align="center">
  <strong>Template for an Action Platform plugin: every extension point once, small enough to read in one sitting.</strong>
</p>

<p align="center">
  <a href="https://pypi.org/project/apx-example/"><img alt="PyPI" src="https://img.shields.io/pypi/v/apx-example?style=flat-square&logo=pypi&logoColor=white&color=2ea44f"></a>
  <a href="https://github.com/actionplatform/apx-example/releases/latest"><img alt="Release" src="https://img.shields.io/github/v/release/actionplatform/apx-example?style=flat-square&logo=github&color=2ea44f"></a>
  <a href="https://github.com/actionplatform/apx-example/actions/workflows/code-quality.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/actionplatform/apx-example/code-quality.yml?branch=master&style=flat-square&label=ci"></a>
  <a href="https://github.com/actionplatform/apx-example/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/pypi/l/apx-example?style=flat-square&color=blue"></a>
  <img alt="Python" src="https://img.shields.io/badge/python-%E2%89%A53.11-3776ab?style=flat-square&logo=python&logoColor=white">
</p>

---

Writing a plugin from the documentation alone means guessing the shape: where the tools go, how a deploy target composes its parts, what a fake looks like in tests. **apx-example** is that shape, working: an *apx*, an [Action Platform](https://github.com/actionplatform/action-platform) extension; every package is named `apx-<slug>`. Copy it, rename it, delete what you do not need — a plugin with only `plugin.py` and one tool is fine.

## What you get

| File | Extension point |
|---|---|
| `plugin.py` | the `Plugin`: slug, `needs`, `options` (one with a setup button), `register`, `after_release`, `after_deploy` |
| `tools.py` | MCP tools `example_hello` and `example_remember`, with input and output schemas; `remember` writes the plugin's options store |
| `cli.py` | `action-platform example hello` |
| `rules.py` | a replaced core slot (`gitflow_rules`) — stricter branch kinds while the plugin is enabled |
| `release.py` | named providers: `[release] strategy = "calver"`, `[release] changelog = "plain"` |
| `target.py` | the `DeployTarget` for the `example` cloud — `preflight`, `readiness`, `deploy`, `verify`, `diagnose`, `delete` — composing the parts below through `parts(spec)` |
| `abc.py`, `spec.py` | one ABC per responsibility (`Cloud`, `Readiness`); a frozen `Spec` per call |
| `cloud.py`, `checks.py` | the implementations: the overlay's script (streams its output to the job log), the readiness checks |
| `tests/fake.py`, `tests/live/` | the cloud in memory for fast tests; a suite against the real destination, skipped without it |
| `overlays/` | a cloud overlay `example` — plain files, copied as they are by `action-platform cloud set example`; add a `cookiecutter.json` only when the files need rendering |

## For agents and editors

`SPEC.md` is the contract a plugin follows. `skills/create-plugin/SKILL.md` walks an agent through creating `apx-<slug>` from here — installable in Claude Code (`/plugin marketplace add actionplatform/apx-example`, then `/plugin install apx-example@apx-example`), read by Codex through `.codex-plugin/`, and mirrored for Cursor in `.cursor/rules/plugin.mdc`. `AGENTS.md` holds the repository rules every agent reads.

## Use this template

1. Create a repository from it, named `apx-<slug>`.
2. Rename `apx_example` → `apx_<slug>`, `example` → `<slug>` in `pyproject.toml` (package name, entry points), `plugin.py` (`slug`), `target.py` (`name`), `cli.py`, `overlays/index.json`.
3. Delete what you do not need; a plugin with only `plugin.py` and one tool is fine.
4. `pip install -e ".[dev]"`, `pytest`, `action-platform plugin list` (shows `example` once installed).
5. Publish to PyPI; open a pull request to [plugins-index](https://github.com/actionplatform/plugins-index) with `<slug>.json`.

## Rules

- `register` only declares; no I/O, threads or connections at import or in `register`.
- No monkey-patching of `action_platform.*` — replace a slot (`surface.core.replace`) or ask for a hook.
- `needs` lists every host you talk to and every environment variable you read.

Reference: [writing a plugin](https://github.com/actionplatform/action-platform/blob/master/docs/contribute_plugins.md) · [plugins](https://github.com/actionplatform/action-platform/blob/master/docs/use_plugins.md).

## How it fits in Action Platform

Everything cloud-specific or service-specific in [Action Platform](https://github.com/actionplatform/action-platform) is a plugin: deploy targets, CI runners, access providers, release strategies, changelog formats, MCP tools, CLI commands and cloud overlays. The real ones — [apx-aws-lambda](https://github.com/actionplatform/apx-aws-lambda), [apx-dokploy](https://github.com/actionplatform/apx-dokploy), [apx-jenkins](https://github.com/actionplatform/apx-jenkins) and [apx-sentry](https://github.com/actionplatform/apx-sentry) — follow the same contract, and the catalog is [plugins-index](https://github.com/actionplatform/plugins-index).

## Contributing

Git-flow branches (`<kind>/<issue>-slug`), Conventional Commits and one pull request per change, as in the [main repository's guide](https://github.com/actionplatform/action-platform/blob/master/CONTRIBUTING.md). Rules for contributors and agents are in [`AGENTS.md`](AGENTS.md); the contract is [`SPEC.md`](SPEC.md).

## License

Apache 2.0 — see [LICENSE](LICENSE).
