apx-example 0.2.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. apx_example-0.3.1/PKG-INFO +84 -0
  2. apx_example-0.3.1/README.md +68 -0
  3. apx_example-0.3.1/apx_example/abc.py +36 -0
  4. apx_example-0.3.1/apx_example/checks.py +23 -0
  5. apx_example-0.3.1/apx_example/cloud.py +37 -0
  6. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example/plugin.py +12 -2
  7. apx_example-0.3.1/apx_example/spec.py +31 -0
  8. apx_example-0.3.1/apx_example/target.py +94 -0
  9. apx_example-0.3.1/apx_example.egg-info/PKG-INFO +84 -0
  10. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example.egg-info/SOURCES.txt +6 -1
  11. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example.egg-info/requires.txt +1 -1
  12. {apx_example-0.2.0 → apx_example-0.3.1}/pyproject.toml +2 -2
  13. {apx_example-0.2.0 → apx_example-0.3.1}/tests/test_plugin.py +7 -22
  14. apx_example-0.3.1/tests/test_target.py +83 -0
  15. apx_example-0.2.0/PKG-INFO +0 -45
  16. apx_example-0.2.0/README.md +0 -29
  17. apx_example-0.2.0/apx_example/target.py +0 -56
  18. apx_example-0.2.0/apx_example.egg-info/PKG-INFO +0 -45
  19. {apx_example-0.2.0 → apx_example-0.3.1}/LICENSE +0 -0
  20. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example/__init__.py +0 -0
  21. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example/cli.py +0 -0
  22. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example/overlays/cloud/example/DEPLOY.md +0 -0
  23. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example/overlays/cloud/example/deploy/run.sh +0 -0
  24. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example/overlays/index.json +0 -0
  25. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example/release.py +0 -0
  26. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example/rules.py +0 -0
  27. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example/tools.py +0 -0
  28. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example.egg-info/dependency_links.txt +0 -0
  29. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example.egg-info/entry_points.txt +0 -0
  30. {apx_example-0.2.0 → apx_example-0.3.1}/apx_example.egg-info/top_level.txt +0 -0
  31. {apx_example-0.2.0 → apx_example-0.3.1}/setup.cfg +0 -0
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: apx-example
3
+ Version: 0.3.1
4
+ Summary: Template for an Action Platform plugin: tools, a CLI command, an overlay, a release strategy, a replaced slot, lifecycle hooks.
5
+ Author-email: Action Platform <cloud@actionplatform.io>
6
+ License-Expression: Apache-2.0
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: action-platform>=0.32
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest>=8; extra == "dev"
13
+ Requires-Dist: ruff>=0.6; extra == "dev"
14
+ Requires-Dist: action-platform[mcp]; extra == "dev"
15
+ Dynamic: license-file
16
+
17
+ <p align="center">
18
+ <img src="https://raw.githubusercontent.com/actionplatform/action-platform/master/docs/assets/icon.svg" alt="Action Platform" width="120">
19
+ </p>
20
+
21
+ <h1 align="center">apx-example</h1>
22
+
23
+ <p align="center">
24
+ <strong>Template for an Action Platform plugin: every extension point once, small enough to read in one sitting.</strong>
25
+ </p>
26
+
27
+ <p align="center">
28
+ <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>
29
+ <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>
30
+ <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>
31
+ <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>
32
+ <img alt="Python" src="https://img.shields.io/badge/python-%E2%89%A53.11-3776ab?style=flat-square&logo=python&logoColor=white">
33
+ </p>
34
+
35
+ ---
36
+
37
+ 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.
38
+
39
+ ## What you get
40
+
41
+ | File | Extension point |
42
+ |---|---|
43
+ | `plugin.py` | the `Plugin`: slug, `needs`, `options` (one with a setup button), `register`, `after_release`, `after_deploy` |
44
+ | `tools.py` | MCP tools `example_hello` and `example_remember`, with input and output schemas; `remember` writes the plugin's options store |
45
+ | `cli.py` | `action-platform example hello` |
46
+ | `rules.py` | a replaced core slot (`gitflow_rules`) — stricter branch kinds while the plugin is enabled |
47
+ | `release.py` | named providers: `[release] strategy = "calver"`, `[release] changelog = "plain"` |
48
+ | `target.py` | the `DeployTarget` for the `example` cloud — `preflight`, `readiness`, `deploy`, `verify`, `diagnose`, `delete` — composing the parts below through `parts(spec)` |
49
+ | `abc.py`, `spec.py` | one ABC per responsibility (`Cloud`, `Readiness`); a frozen `Spec` per call |
50
+ | `cloud.py`, `checks.py` | the implementations: the overlay's script (streams its output to the job log), the readiness checks |
51
+ | `tests/fake.py`, `tests/live/` | the cloud in memory for fast tests; a suite against the real destination, skipped without it |
52
+ | `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 |
53
+
54
+ ## For agents and editors
55
+
56
+ `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.
57
+
58
+ ## Use this template
59
+
60
+ 1. Create a repository from it, named `apx-<slug>`.
61
+ 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`.
62
+ 3. Delete what you do not need; a plugin with only `plugin.py` and one tool is fine.
63
+ 4. `pip install -e ".[dev]"`, `pytest`, `action-platform plugin list` (shows `example` once installed).
64
+ 5. Publish to PyPI; open a pull request to [plugins-index](https://github.com/actionplatform/plugins-index) with `<slug>.json`.
65
+
66
+ ## Rules
67
+
68
+ - `register` only declares; no I/O, threads or connections at import or in `register`.
69
+ - No monkey-patching of `action_platform.*` — replace a slot (`surface.core.replace`) or ask for a hook.
70
+ - `needs` lists every host you talk to and every environment variable you read.
71
+
72
+ 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).
73
+
74
+ ## How it fits in Action Platform
75
+
76
+ 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).
77
+
78
+ ## Contributing
79
+
80
+ 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).
81
+
82
+ ## License
83
+
84
+ Apache 2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,68 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/actionplatform/action-platform/master/docs/assets/icon.svg" alt="Action Platform" width="120">
3
+ </p>
4
+
5
+ <h1 align="center">apx-example</h1>
6
+
7
+ <p align="center">
8
+ <strong>Template for an Action Platform plugin: every extension point once, small enough to read in one sitting.</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <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>
13
+ <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>
14
+ <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>
15
+ <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>
16
+ <img alt="Python" src="https://img.shields.io/badge/python-%E2%89%A53.11-3776ab?style=flat-square&logo=python&logoColor=white">
17
+ </p>
18
+
19
+ ---
20
+
21
+ 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.
22
+
23
+ ## What you get
24
+
25
+ | File | Extension point |
26
+ |---|---|
27
+ | `plugin.py` | the `Plugin`: slug, `needs`, `options` (one with a setup button), `register`, `after_release`, `after_deploy` |
28
+ | `tools.py` | MCP tools `example_hello` and `example_remember`, with input and output schemas; `remember` writes the plugin's options store |
29
+ | `cli.py` | `action-platform example hello` |
30
+ | `rules.py` | a replaced core slot (`gitflow_rules`) — stricter branch kinds while the plugin is enabled |
31
+ | `release.py` | named providers: `[release] strategy = "calver"`, `[release] changelog = "plain"` |
32
+ | `target.py` | the `DeployTarget` for the `example` cloud — `preflight`, `readiness`, `deploy`, `verify`, `diagnose`, `delete` — composing the parts below through `parts(spec)` |
33
+ | `abc.py`, `spec.py` | one ABC per responsibility (`Cloud`, `Readiness`); a frozen `Spec` per call |
34
+ | `cloud.py`, `checks.py` | the implementations: the overlay's script (streams its output to the job log), the readiness checks |
35
+ | `tests/fake.py`, `tests/live/` | the cloud in memory for fast tests; a suite against the real destination, skipped without it |
36
+ | `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 |
37
+
38
+ ## For agents and editors
39
+
40
+ `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.
41
+
42
+ ## Use this template
43
+
44
+ 1. Create a repository from it, named `apx-<slug>`.
45
+ 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`.
46
+ 3. Delete what you do not need; a plugin with only `plugin.py` and one tool is fine.
47
+ 4. `pip install -e ".[dev]"`, `pytest`, `action-platform plugin list` (shows `example` once installed).
48
+ 5. Publish to PyPI; open a pull request to [plugins-index](https://github.com/actionplatform/plugins-index) with `<slug>.json`.
49
+
50
+ ## Rules
51
+
52
+ - `register` only declares; no I/O, threads or connections at import or in `register`.
53
+ - No monkey-patching of `action_platform.*` — replace a slot (`surface.core.replace`) or ask for a hook.
54
+ - `needs` lists every host you talk to and every environment variable you read.
55
+
56
+ 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).
57
+
58
+ ## How it fits in Action Platform
59
+
60
+ 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).
61
+
62
+ ## Contributing
63
+
64
+ 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).
65
+
66
+ ## License
67
+
68
+ Apache 2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,36 @@
1
+ """One contract per responsibility of the deploy target. A real plugin adds one ABC per thing it talks to (the API, the registry, the domains…); the target only composes them."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from abc import ABC, abstractmethod
6
+ from typing import TYPE_CHECKING
7
+
8
+ if TYPE_CHECKING:
9
+ from action_platform.core.context import Check
10
+
11
+ from apx_example.spec import Spec
12
+
13
+
14
+ class Cloud(ABC):
15
+ """The destination: what a deploy changes there, and what it holds now."""
16
+
17
+ @abstractmethod
18
+ def ship(self, spec: Spec) -> str | None:
19
+ """Put `spec.version` on `spec.stage`; the URL it answers on, if any. Raises `DeployError` with the reason when it fails."""
20
+
21
+ @abstractmethod
22
+ def version(self, spec: Spec) -> str | None:
23
+ """The version running on `spec.stage`, or None."""
24
+
25
+ @abstractmethod
26
+ def remove(self, spec: Spec) -> None:
27
+ """Tear `spec.stage` down; nothing to do is fine."""
28
+
29
+
30
+ class Readiness(ABC):
31
+ """One check a deploy has to pass, run without building or changing anything."""
32
+
33
+ id: str
34
+
35
+ @abstractmethod
36
+ def run(self, spec: Spec) -> Check: ...
@@ -0,0 +1,23 @@
1
+ """Readiness, one class per check. Add one per failure a user will really hit: credentials, permissions, the destination's state."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from action_platform.core.context import Check
6
+
7
+ from apx_example.abc import Readiness
8
+ from apx_example.spec import Spec
9
+
10
+
11
+ class OverlayCheck(Readiness):
12
+ id = "example.overlay"
13
+
14
+ def run(self, spec: Spec) -> Check:
15
+ if spec.script.exists():
16
+ return Check(self.id, True, "deploy/run.sh is there")
17
+
18
+ return Check(
19
+ self.id,
20
+ False,
21
+ "deploy/run.sh not found",
22
+ fix="action-platform cloud set example",
23
+ )
@@ -0,0 +1,37 @@
1
+ """The example cloud: the overlay's `deploy/run.sh`, and a file per scope that remembers what was shipped. Replace it with your cloud's API or CLI; keep the `Cloud` contract."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from action_platform.core.exception import DeployError
6
+ from action_platform.core.process import stream
7
+
8
+ from apx_example.abc import Cloud
9
+ from apx_example.spec import SCRIPT, Spec
10
+
11
+ STATE = ".example"
12
+
13
+
14
+ class ScriptCloud(Cloud):
15
+ def ship(self, spec: Spec) -> str | None:
16
+ result = stream(
17
+ ["sh", str(SCRIPT)],
18
+ cwd=spec.root,
19
+ env={**spec.env, "SCOPE": spec.stage, "VERSION": spec.version},
20
+ )
21
+
22
+ if not result.ok:
23
+ raise DeployError(f"deploy/run.sh failed: {result.output.strip()[-500:]}")
24
+
25
+ state = spec.root / STATE
26
+ state.mkdir(exist_ok=True)
27
+ (state / spec.stage).write_text(spec.version)
28
+
29
+ return None
30
+
31
+ def version(self, spec: Spec) -> str | None:
32
+ path = spec.root / STATE / spec.stage
33
+
34
+ return path.read_text().strip() if path.exists() else None
35
+
36
+ def remove(self, spec: Spec) -> None:
37
+ (spec.root / STATE / spec.stage).unlink(missing_ok=True)
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  from pathlib import Path
6
6
 
7
- from action_platform.abc import Plugin, Surface
7
+ from action_platform.abc import Option, Plugin, Surface
8
8
  from action_platform.core.context import Context, DeployResult
9
9
  from action_platform.logging import logger
10
10
 
@@ -16,8 +16,18 @@ from apx_example.tools import register_tools
16
16
  class ExamplePlugin(Plugin):
17
17
  slug = "example"
18
18
  description = "Template plugin: a tool, a command, a deploy target with readiness, an overlay, a release strategy, stricter git-flow"
19
- min_core = "0.26"
19
+ min_core = "0.32"
20
20
  needs = ["nothing outside this machine"]
21
+ options = [
22
+ Option(
23
+ "greeting",
24
+ "Greeting",
25
+ "text",
26
+ help="The word example_hello says. The button opens where a value would come from.",
27
+ action_label="Open the docs",
28
+ action_url="https://github.com/actionplatform/apx-example?org={organization}",
29
+ ),
30
+ ]
21
31
 
22
32
  @property
23
33
  def overlays(self) -> Path:
@@ -0,0 +1,31 @@
1
+ """What one call is about, resolved once from the context — the target keeps nothing between calls."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+
8
+ from action_platform.core.context import Context
9
+
10
+ SCRIPT = Path("deploy") / "run.sh"
11
+
12
+
13
+ @dataclass(frozen=True)
14
+ class Spec:
15
+ root: Path
16
+ stage: str
17
+ version: str
18
+ env: dict[str, str]
19
+
20
+ @classmethod
21
+ def of(cls, ctx: Context) -> Spec:
22
+ return cls(
23
+ root=ctx.repo_root,
24
+ stage=ctx.stage or "dev",
25
+ version=ctx.next_version,
26
+ env=dict(ctx.env),
27
+ )
28
+
29
+ @property
30
+ def script(self) -> Path:
31
+ return self.root / SCRIPT
@@ -0,0 +1,94 @@
1
+ """The deploy target: the core's `DeployTarget` contract, composing one implementation per responsibility (`abc.py`). It decides nothing about the cloud itself — that lives in `cloud.py` and `checks.py`."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+
8
+ from action_platform.abc import DeployTarget
9
+ from action_platform.core.context import Check, Context, DeployResult, Diagnosis
10
+ from action_platform.core.exception import DeployError
11
+ from action_platform.logging import logger
12
+
13
+ from apx_example.abc import Cloud, Readiness
14
+ from apx_example.checks import OverlayCheck
15
+ from apx_example.cloud import ScriptCloud
16
+ from apx_example.spec import Spec
17
+
18
+
19
+ @dataclass(frozen=True)
20
+ class Parts:
21
+ cloud: Cloud
22
+
23
+
24
+ class ExampleTarget(DeployTarget):
25
+ name = "example"
26
+
27
+ def __init__(self, **_: object) -> None:
28
+ self._last: Context | None = None
29
+
30
+ def spec(self, ctx: Context) -> Spec:
31
+ self._last = ctx
32
+
33
+ return Spec.of(ctx)
34
+
35
+ def parts(self, spec: Spec) -> Parts:
36
+ """One implementation per responsibility; a test or a subclass swaps one here."""
37
+ return Parts(cloud=ScriptCloud())
38
+
39
+ def checks(self, spec: Spec) -> list[Readiness]:
40
+ return [OverlayCheck()]
41
+
42
+ def preflight(self, ctx: Context) -> None:
43
+ blocking = [c for c in self.readiness(ctx) if c.blocking]
44
+
45
+ if blocking:
46
+ raise DeployError("; ".join(f"{c.id}: {c.detail}" for c in blocking))
47
+
48
+ def readiness(self, ctx: Context) -> list[Check]:
49
+ spec = self.spec(ctx)
50
+
51
+ return [check.run(spec) for check in self.checks(spec)]
52
+
53
+ def deploy(self, ctx: Context) -> DeployResult:
54
+ spec = self.spec(ctx)
55
+
56
+ try:
57
+ url = self.parts(spec).cloud.ship(spec)
58
+ except DeployError as e:
59
+ logger.info("example: %s failed on %s", spec.version, spec.stage)
60
+
61
+ return DeployResult(
62
+ ok=False, target=self.name, version=spec.version, error=str(e)
63
+ )
64
+
65
+ logger.info("example: deployed %s to %s", spec.version, spec.stage)
66
+
67
+ return DeployResult(ok=True, target=self.name, version=spec.version, url=url)
68
+
69
+ def verify(self, version: str, stage: str | None = None) -> bool:
70
+ spec = self._spec_for(stage)
71
+
72
+ return self.parts(spec).cloud.version(spec) == version
73
+
74
+ def diagnose(self, ctx: Context) -> Diagnosis:
75
+ spec = self.spec(ctx)
76
+ running = self.parts(spec).cloud.version(spec)
77
+
78
+ return Diagnosis(
79
+ ok=running is not None,
80
+ target=self.name,
81
+ status="running" if running else "missing",
82
+ version=running,
83
+ details={"scope": spec.stage},
84
+ )
85
+
86
+ def delete(self, ctx: Context) -> None:
87
+ spec = self.spec(ctx)
88
+ self.parts(spec).cloud.remove(spec)
89
+
90
+ def _spec_for(self, stage: str | None) -> Spec:
91
+ """`verify` comes without a context: the last one this target saw, on the stage asked for."""
92
+ base = Spec.of(self._last or Context(repo_root=Path.cwd()))
93
+
94
+ return Spec(base.root, stage or base.stage, base.version, base.env)
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: apx-example
3
+ Version: 0.3.1
4
+ Summary: Template for an Action Platform plugin: tools, a CLI command, an overlay, a release strategy, a replaced slot, lifecycle hooks.
5
+ Author-email: Action Platform <cloud@actionplatform.io>
6
+ License-Expression: Apache-2.0
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: action-platform>=0.32
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest>=8; extra == "dev"
13
+ Requires-Dist: ruff>=0.6; extra == "dev"
14
+ Requires-Dist: action-platform[mcp]; extra == "dev"
15
+ Dynamic: license-file
16
+
17
+ <p align="center">
18
+ <img src="https://raw.githubusercontent.com/actionplatform/action-platform/master/docs/assets/icon.svg" alt="Action Platform" width="120">
19
+ </p>
20
+
21
+ <h1 align="center">apx-example</h1>
22
+
23
+ <p align="center">
24
+ <strong>Template for an Action Platform plugin: every extension point once, small enough to read in one sitting.</strong>
25
+ </p>
26
+
27
+ <p align="center">
28
+ <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>
29
+ <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>
30
+ <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>
31
+ <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>
32
+ <img alt="Python" src="https://img.shields.io/badge/python-%E2%89%A53.11-3776ab?style=flat-square&logo=python&logoColor=white">
33
+ </p>
34
+
35
+ ---
36
+
37
+ 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.
38
+
39
+ ## What you get
40
+
41
+ | File | Extension point |
42
+ |---|---|
43
+ | `plugin.py` | the `Plugin`: slug, `needs`, `options` (one with a setup button), `register`, `after_release`, `after_deploy` |
44
+ | `tools.py` | MCP tools `example_hello` and `example_remember`, with input and output schemas; `remember` writes the plugin's options store |
45
+ | `cli.py` | `action-platform example hello` |
46
+ | `rules.py` | a replaced core slot (`gitflow_rules`) — stricter branch kinds while the plugin is enabled |
47
+ | `release.py` | named providers: `[release] strategy = "calver"`, `[release] changelog = "plain"` |
48
+ | `target.py` | the `DeployTarget` for the `example` cloud — `preflight`, `readiness`, `deploy`, `verify`, `diagnose`, `delete` — composing the parts below through `parts(spec)` |
49
+ | `abc.py`, `spec.py` | one ABC per responsibility (`Cloud`, `Readiness`); a frozen `Spec` per call |
50
+ | `cloud.py`, `checks.py` | the implementations: the overlay's script (streams its output to the job log), the readiness checks |
51
+ | `tests/fake.py`, `tests/live/` | the cloud in memory for fast tests; a suite against the real destination, skipped without it |
52
+ | `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 |
53
+
54
+ ## For agents and editors
55
+
56
+ `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.
57
+
58
+ ## Use this template
59
+
60
+ 1. Create a repository from it, named `apx-<slug>`.
61
+ 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`.
62
+ 3. Delete what you do not need; a plugin with only `plugin.py` and one tool is fine.
63
+ 4. `pip install -e ".[dev]"`, `pytest`, `action-platform plugin list` (shows `example` once installed).
64
+ 5. Publish to PyPI; open a pull request to [plugins-index](https://github.com/actionplatform/plugins-index) with `<slug>.json`.
65
+
66
+ ## Rules
67
+
68
+ - `register` only declares; no I/O, threads or connections at import or in `register`.
69
+ - No monkey-patching of `action_platform.*` — replace a slot (`surface.core.replace`) or ask for a hook.
70
+ - `needs` lists every host you talk to and every environment variable you read.
71
+
72
+ 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).
73
+
74
+ ## How it fits in Action Platform
75
+
76
+ 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).
77
+
78
+ ## Contributing
79
+
80
+ 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).
81
+
82
+ ## License
83
+
84
+ Apache 2.0 — see [LICENSE](LICENSE).
@@ -2,10 +2,14 @@ LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
4
  apx_example/__init__.py
5
+ apx_example/abc.py
6
+ apx_example/checks.py
5
7
  apx_example/cli.py
8
+ apx_example/cloud.py
6
9
  apx_example/plugin.py
7
10
  apx_example/release.py
8
11
  apx_example/rules.py
12
+ apx_example/spec.py
9
13
  apx_example/target.py
10
14
  apx_example/tools.py
11
15
  apx_example.egg-info/PKG-INFO
@@ -17,4 +21,5 @@ apx_example.egg-info/top_level.txt
17
21
  apx_example/overlays/index.json
18
22
  apx_example/overlays/cloud/example/DEPLOY.md
19
23
  apx_example/overlays/cloud/example/deploy/run.sh
20
- tests/test_plugin.py
24
+ tests/test_plugin.py
25
+ tests/test_target.py
@@ -1,4 +1,4 @@
1
- action-platform>=0.26
1
+ action-platform>=0.32
2
2
 
3
3
  [dev]
4
4
  pytest>=8
@@ -1,12 +1,12 @@
1
1
  [project]
2
2
  name = "apx-example"
3
- version = "0.2.0"
3
+ version = "0.3.1"
4
4
  description = "Template for an Action Platform plugin: tools, a CLI command, an overlay, a release strategy, a replaced slot, lifecycle hooks."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
7
7
  requires-python = ">=3.11"
8
8
  authors = [{ name = "Action Platform", email = "cloud@actionplatform.io" }]
9
- dependencies = ["action-platform>=0.26"]
9
+ dependencies = ["action-platform>=0.32"]
10
10
 
11
11
  [project.optional-dependencies]
12
12
  dev = ["pytest>=8", "ruff>=0.6", "action-platform[mcp]"]
@@ -7,7 +7,7 @@ from pathlib import Path
7
7
  from tempfile import TemporaryDirectory
8
8
 
9
9
  from action_platform.core.flow import gitflow
10
- from action_platform.core.scaffold.templates import Matrix, with_plugin_clouds
10
+ from action_platform.core.scaffold.catalog import Matrix, with_plugin_clouds
11
11
  from action_platform.core.wiring import wired
12
12
  from action_platform.plugins import Loaded, Plugins, PluginState, registry
13
13
 
@@ -54,27 +54,12 @@ class ExamplePluginTest(unittest.TestCase):
54
54
  self.assertEqual([c.name for c in merged.clouds], ["example"])
55
55
  self.assertEqual(merged.cloud("example").source, "example")
56
56
 
57
+ def test_an_option_can_carry_a_setup_button(self):
58
+ greeting = next(o for o in ExamplePlugin.options if o.key == "greeting")
59
+
60
+ self.assertEqual(greeting.as_dict()["action_label"], "Open the docs")
61
+ self.assertIn("{organization}", greeting.action_url)
62
+
57
63
  def test_release_providers(self):
58
64
  self.assertTrue(Calver().next("1.0.0", "patch", False, []).count(".") == 2)
59
65
  self.assertIn("- feat: x", Plain().render("1.0.0", ["feat: x"]))
60
-
61
-
62
- class TargetTest(unittest.TestCase):
63
- def test_readiness_names_the_overlay(self):
64
- from pathlib import Path
65
- from tempfile import TemporaryDirectory
66
-
67
- from action_platform.core.context import Context
68
-
69
- from apx_example.target import ExampleTarget
70
-
71
- with TemporaryDirectory() as tmp:
72
- root = Path(tmp)
73
- missing = ExampleTarget().readiness(Context(repo_root=root, stage="dev"))
74
- (root / "deploy").mkdir()
75
- (root / "deploy" / "run.sh").write_text("#!/bin/sh\necho ok\n")
76
- present = ExampleTarget().readiness(Context(repo_root=root, stage="dev"))
77
-
78
- self.assertFalse(missing[0].ok)
79
- self.assertEqual(missing[0].fix, "action-platform cloud set example")
80
- self.assertTrue(present[0].ok)
@@ -0,0 +1,83 @@
1
+ import unittest
2
+ from pathlib import Path
3
+ from tempfile import TemporaryDirectory
4
+
5
+ from action_platform.core.context import Context
6
+
7
+ from apx_example.target import ExampleTarget, Parts
8
+ from tests.fake import FakeCloud
9
+
10
+
11
+ class FakeTarget(ExampleTarget):
12
+ def __init__(self, cloud: FakeCloud) -> None:
13
+ super().__init__()
14
+ self.cloud = cloud
15
+
16
+ def parts(self, spec):
17
+ return Parts(cloud=self.cloud)
18
+
19
+
20
+ class TargetTest(unittest.TestCase):
21
+ def setUp(self):
22
+ self.tmp = TemporaryDirectory()
23
+ self.addCleanup(self.tmp.cleanup)
24
+ self.root = Path(self.tmp.name)
25
+
26
+ def ctx(self, stage="dev", version="1.0.0"):
27
+ return Context(repo_root=self.root, stage=stage, next_version=version)
28
+
29
+ def test_deploy_ships_the_version_to_the_scope_and_verify_sees_it(self):
30
+ cloud = FakeCloud()
31
+ target = FakeTarget(cloud)
32
+
33
+ result = target.deploy(self.ctx(version="1.2.0"))
34
+
35
+ self.assertTrue(result.ok)
36
+ self.assertEqual(result.url, "https://dev.example.test")
37
+ self.assertTrue(target.verify("1.2.0", "dev"))
38
+ self.assertFalse(target.verify("1.2.0", "prod"))
39
+
40
+ def test_a_failed_ship_is_a_failed_result_with_the_reason(self):
41
+ result = FakeTarget(FakeCloud(fails="quota exceeded")).deploy(self.ctx())
42
+
43
+ self.assertFalse(result.ok)
44
+ self.assertIn("quota exceeded", result.error)
45
+
46
+ def test_diagnose_and_delete(self):
47
+ target = FakeTarget(FakeCloud())
48
+ target.deploy(self.ctx())
49
+
50
+ self.assertEqual(target.diagnose(self.ctx()).version, "1.0.0")
51
+
52
+ target.delete(self.ctx())
53
+
54
+ self.assertEqual(target.diagnose(self.ctx()).status, "missing")
55
+
56
+ def test_readiness_names_the_overlay(self):
57
+ missing = ExampleTarget().readiness(self.ctx())
58
+ (self.root / "deploy").mkdir()
59
+ (self.root / "deploy" / "run.sh").write_text("#!/bin/sh\necho ok\n")
60
+ present = ExampleTarget().readiness(self.ctx())
61
+
62
+ self.assertFalse(missing[0].ok)
63
+ self.assertEqual(missing[0].fix, "action-platform cloud set example")
64
+ self.assertTrue(present[0].ok)
65
+
66
+ def test_the_script_cloud_runs_the_overlay_and_remembers_the_version(self):
67
+ (self.root / "deploy").mkdir()
68
+ (self.root / "deploy" / "run.sh").write_text(
69
+ '#!/bin/sh\necho "$SCOPE $VERSION"\n'
70
+ )
71
+ target = ExampleTarget()
72
+
73
+ self.assertTrue(target.deploy(self.ctx(version="2.0.0")).ok)
74
+ self.assertTrue(target.verify("2.0.0", "dev"))
75
+
76
+ def test_a_failing_script_fails_the_deploy(self):
77
+ (self.root / "deploy").mkdir()
78
+ (self.root / "deploy" / "run.sh").write_text("#!/bin/sh\necho broken; exit 3\n")
79
+
80
+ result = ExampleTarget().deploy(self.ctx())
81
+
82
+ self.assertFalse(result.ok)
83
+ self.assertIn("broken", result.error)
@@ -1,45 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: apx-example
3
- Version: 0.2.0
4
- Summary: Template for an Action Platform plugin: tools, a CLI command, an overlay, a release strategy, a replaced slot, lifecycle hooks.
5
- Author-email: Action Platform <cloud@actionplatform.io>
6
- License-Expression: Apache-2.0
7
- Requires-Python: >=3.11
8
- Description-Content-Type: text/markdown
9
- License-File: LICENSE
10
- Requires-Dist: action-platform>=0.26
11
- Provides-Extra: dev
12
- Requires-Dist: pytest>=8; extra == "dev"
13
- Requires-Dist: ruff>=0.6; extra == "dev"
14
- Requires-Dist: action-platform[mcp]; extra == "dev"
15
- Dynamic: license-file
16
-
17
- # apx-example
18
-
19
- Template for an [Action Platform](https://github.com/actionplatform/action-platform) plugin — an *apx*, Action Platform extension; every package is named `apx-<slug>`. Every extension point once, small enough to read in one sitting:
20
-
21
- | File | Extension point |
22
- |---|---|
23
- | `plugin.py` | the `Plugin`: slug, `needs`, `register`, `after_release`, `after_deploy` |
24
- | `tools.py` | MCP tools `example_hello` and `example_remember`, with input and output schemas; `remember` writes the plugin's options store |
25
- | `cli.py` | `action-platform example hello` |
26
- | `rules.py` | a replaced core slot (`gitflow_rules`) — stricter branch kinds while the plugin is enabled |
27
- | `release.py` | named providers: `[release] strategy = "calver"`, `[release] changelog = "plain"` |
28
- | `target.py` | the `DeployTarget` for the `example` cloud: `preflight`, `readiness` (checks before a deploy), `deploy` (streams its output to the job log), `verify`, `diagnose`, `delete` |
29
- | `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 |
30
-
31
- ## Use this template
32
-
33
- 1. Create a repository from it, named `apx-<slug>`.
34
- 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`.
35
- 3. Delete what you do not need; a plugin with only `plugin.py` and one tool is fine.
36
- 4. `pip install -e ".[dev]"`, `pytest`, `action-platform plugin list` (shows `example` once installed).
37
- 5. Publish to PyPI; open a pull request to [plugins-index](https://github.com/actionplatform/plugins-index) with `<slug>.json`.
38
-
39
- ## Rules
40
-
41
- - `register` only declares; no I/O, threads or connections at import or in `register`.
42
- - No monkey-patching of `action_platform.*` — replace a slot (`surface.core.replace`) or ask for a hook.
43
- - `needs` lists every host you talk to and every environment variable you read.
44
-
45
- 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).
@@ -1,29 +0,0 @@
1
- # apx-example
2
-
3
- Template for an [Action Platform](https://github.com/actionplatform/action-platform) plugin — an *apx*, Action Platform extension; every package is named `apx-<slug>`. Every extension point once, small enough to read in one sitting:
4
-
5
- | File | Extension point |
6
- |---|---|
7
- | `plugin.py` | the `Plugin`: slug, `needs`, `register`, `after_release`, `after_deploy` |
8
- | `tools.py` | MCP tools `example_hello` and `example_remember`, with input and output schemas; `remember` writes the plugin's options store |
9
- | `cli.py` | `action-platform example hello` |
10
- | `rules.py` | a replaced core slot (`gitflow_rules`) — stricter branch kinds while the plugin is enabled |
11
- | `release.py` | named providers: `[release] strategy = "calver"`, `[release] changelog = "plain"` |
12
- | `target.py` | the `DeployTarget` for the `example` cloud: `preflight`, `readiness` (checks before a deploy), `deploy` (streams its output to the job log), `verify`, `diagnose`, `delete` |
13
- | `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 |
14
-
15
- ## Use this template
16
-
17
- 1. Create a repository from it, named `apx-<slug>`.
18
- 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`.
19
- 3. Delete what you do not need; a plugin with only `plugin.py` and one tool is fine.
20
- 4. `pip install -e ".[dev]"`, `pytest`, `action-platform plugin list` (shows `example` once installed).
21
- 5. Publish to PyPI; open a pull request to [plugins-index](https://github.com/actionplatform/plugins-index) with `<slug>.json`.
22
-
23
- ## Rules
24
-
25
- - `register` only declares; no I/O, threads or connections at import or in `register`.
26
- - No monkey-patching of `action_platform.*` — replace a slot (`surface.core.replace`) or ask for a hook.
27
- - `needs` lists every host you talk to and every environment variable you read.
28
-
29
- 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).
@@ -1,56 +0,0 @@
1
- """The deploy target: what the platform calls to ship a release to the `example` cloud. Replace the bodies with your cloud's CLI; keep the shape."""
2
-
3
- from __future__ import annotations
4
-
5
- from action_platform.abc import DeployTarget
6
- from action_platform.core.context import Check, Context, DeployResult, Diagnosis
7
- from action_platform.core.process import stream
8
- from action_platform.logging import logger
9
-
10
-
11
- class ExampleTarget(DeployTarget):
12
- name = "example"
13
-
14
- def preflight(self, ctx: Context) -> None:
15
- if not (ctx.repo_root / "deploy" / "run.sh").exists():
16
- raise FileNotFoundError(
17
- "deploy/run.sh not found: apply the example overlay first"
18
- )
19
-
20
- def readiness(self, ctx: Context) -> list[Check]:
21
- present = (ctx.repo_root / "deploy" / "run.sh").exists()
22
-
23
- return [
24
- Check(
25
- "example.overlay",
26
- present,
27
- "deploy/run.sh is there" if present else "deploy/run.sh not found",
28
- fix=None if present else "action-platform cloud set example",
29
- )
30
- ]
31
-
32
- def deploy(self, ctx: Context) -> DeployResult:
33
- result = stream(
34
- ["sh", "deploy/run.sh"],
35
- cwd=ctx.repo_root,
36
- env={**ctx.env, "SCOPE": ctx.stage},
37
- )
38
- logger.info("example: deployed %s to %s", ctx.next_version, ctx.stage)
39
-
40
- return DeployResult(
41
- ok=result.ok,
42
- target=self.name,
43
- version=ctx.next_version,
44
- error=None if result.ok else result.output,
45
- )
46
-
47
- def verify(self, version: str, stage: str | None = None) -> bool:
48
- return True
49
-
50
- def diagnose(self, ctx: Context) -> Diagnosis:
51
- return Diagnosis(
52
- ok=True, target=self.name, status="example", details={"scope": ctx.stage}
53
- )
54
-
55
- def delete(self, ctx: Context) -> None:
56
- logger.info("example: nothing to tear down for %s", ctx.stage)
@@ -1,45 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: apx-example
3
- Version: 0.2.0
4
- Summary: Template for an Action Platform plugin: tools, a CLI command, an overlay, a release strategy, a replaced slot, lifecycle hooks.
5
- Author-email: Action Platform <cloud@actionplatform.io>
6
- License-Expression: Apache-2.0
7
- Requires-Python: >=3.11
8
- Description-Content-Type: text/markdown
9
- License-File: LICENSE
10
- Requires-Dist: action-platform>=0.26
11
- Provides-Extra: dev
12
- Requires-Dist: pytest>=8; extra == "dev"
13
- Requires-Dist: ruff>=0.6; extra == "dev"
14
- Requires-Dist: action-platform[mcp]; extra == "dev"
15
- Dynamic: license-file
16
-
17
- # apx-example
18
-
19
- Template for an [Action Platform](https://github.com/actionplatform/action-platform) plugin — an *apx*, Action Platform extension; every package is named `apx-<slug>`. Every extension point once, small enough to read in one sitting:
20
-
21
- | File | Extension point |
22
- |---|---|
23
- | `plugin.py` | the `Plugin`: slug, `needs`, `register`, `after_release`, `after_deploy` |
24
- | `tools.py` | MCP tools `example_hello` and `example_remember`, with input and output schemas; `remember` writes the plugin's options store |
25
- | `cli.py` | `action-platform example hello` |
26
- | `rules.py` | a replaced core slot (`gitflow_rules`) — stricter branch kinds while the plugin is enabled |
27
- | `release.py` | named providers: `[release] strategy = "calver"`, `[release] changelog = "plain"` |
28
- | `target.py` | the `DeployTarget` for the `example` cloud: `preflight`, `readiness` (checks before a deploy), `deploy` (streams its output to the job log), `verify`, `diagnose`, `delete` |
29
- | `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 |
30
-
31
- ## Use this template
32
-
33
- 1. Create a repository from it, named `apx-<slug>`.
34
- 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`.
35
- 3. Delete what you do not need; a plugin with only `plugin.py` and one tool is fine.
36
- 4. `pip install -e ".[dev]"`, `pytest`, `action-platform plugin list` (shows `example` once installed).
37
- 5. Publish to PyPI; open a pull request to [plugins-index](https://github.com/actionplatform/plugins-index) with `<slug>.json`.
38
-
39
- ## Rules
40
-
41
- - `register` only declares; no I/O, threads or connections at import or in `register`.
42
- - No monkey-patching of `action_platform.*` — replace a slot (`surface.core.replace`) or ask for a hook.
43
- - `needs` lists every host you talk to and every environment variable you read.
44
-
45
- 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).
File without changes
File without changes