action-platform 0.6.2__tar.gz → 0.6.4__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 (106) hide show
  1. {action_platform-0.6.2 → action_platform-0.6.4}/PKG-INFO +5 -19
  2. {action_platform-0.6.2 → action_platform-0.6.4}/README.md +1 -18
  3. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/__init__.py +1 -1
  4. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/CHANGELOG.md +29 -0
  5. action_platform-0.6.4/action_platform/api/LAST_VERSION +1 -0
  6. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/core/credentials.py +21 -11
  7. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/main.py +2 -0
  8. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/repositories/registry.py +61 -7
  9. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/schemas/__init__.py +4 -0
  10. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/schemas/actions.py +11 -0
  11. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/services/configuration.py +33 -0
  12. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/services/manifest.py +8 -1
  13. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/v1/routers/configuration.py +27 -0
  14. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/flow/git.py +4 -0
  15. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/flow/gitflow.py +45 -6
  16. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/release/release.py +27 -2
  17. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/main.py +3 -0
  18. action_platform-0.6.4/action_platform/observability.py +32 -0
  19. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/providers/source/bitbucket.py +5 -1
  20. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/providers/source/github.py +6 -1
  21. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/providers/source/gitlab.py +11 -2
  22. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/settings.py +5 -0
  23. {action_platform-0.6.2 → action_platform-0.6.4}/pyproject.toml +7 -4
  24. action_platform-0.6.2/action_platform/api/LAST_VERSION +0 -1
  25. {action_platform-0.6.2 → action_platform-0.6.4}/LICENSE +0 -0
  26. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/abc/__init__.py +0 -0
  27. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/abc/ci_runner.py +0 -0
  28. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/abc/deploy_target.py +0 -0
  29. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/abc/source_host.py +0 -0
  30. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/__init__.py +0 -0
  31. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/core/__init__.py +0 -0
  32. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/core/deps.py +0 -0
  33. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/repositories/__init__.py +0 -0
  34. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/schemas/apps.py +0 -0
  35. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/schemas/catalog.py +0 -0
  36. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/services/__init__.py +0 -0
  37. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/services/apps.py +0 -0
  38. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/services/catalog.py +0 -0
  39. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/services/flow.py +0 -0
  40. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/services/git_state.py +0 -0
  41. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/services/lifecycle.py +0 -0
  42. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/v1/__init__.py +0 -0
  43. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/v1/routers/__init__.py +0 -0
  44. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/v1/routers/actions.py +0 -0
  45. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/v1/routers/apps.py +0 -0
  46. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/v1/routers/catalog.py +0 -0
  47. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/api/v1/routers/flow.py +0 -0
  48. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/__init__.py +0 -0
  49. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/__init__.py +0 -0
  50. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/api.py +0 -0
  51. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/branch.py +0 -0
  52. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/cloud.py +0 -0
  53. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/deploy.py +0 -0
  54. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/gitflow.py +0 -0
  55. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/init.py +0 -0
  56. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/install.py +0 -0
  57. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/login.py +0 -0
  58. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/mcp.py +0 -0
  59. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/pr.py +0 -0
  60. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/release.py +0 -0
  61. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/commands/service.py +0 -0
  62. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/cli/setup.py +0 -0
  63. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/__init__.py +0 -0
  64. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/action_platform.py +0 -0
  65. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/config.py +0 -0
  66. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/context.py +0 -0
  67. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/exception.py +0 -0
  68. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/flow/__init__.py +0 -0
  69. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/flow/branching.py +0 -0
  70. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/flow/pullrequest.py +0 -0
  71. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/manifest/__init__.py +0 -0
  72. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/module.py +0 -0
  73. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/release/__init__.py +0 -0
  74. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/release/changelog.py +0 -0
  75. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/release/components.py +0 -0
  76. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/release/deploy.py +0 -0
  77. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/release/versioning.py +0 -0
  78. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/scaffold/__init__.py +0 -0
  79. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/scaffold/generate.py +0 -0
  80. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/scaffold/install.py +0 -0
  81. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/core/scaffold/templates.py +0 -0
  82. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/hooks/__init__.py +0 -0
  83. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/hooks/commit-msg +0 -0
  84. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/hooks/gitflow.sh +0 -0
  85. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/hooks/pre-commit +0 -0
  86. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/hooks/pre-push +0 -0
  87. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/logging.py +0 -0
  88. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/__init__.py +0 -0
  89. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/__main__.py +0 -0
  90. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/annotations.py +0 -0
  91. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/prompts.py +0 -0
  92. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/server.py +0 -0
  93. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/tools/__init__.py +0 -0
  94. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/tools/flow.py +0 -0
  95. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/tools/lifecycle.py +0 -0
  96. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/tools/matrix.py +0 -0
  97. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/tools/project.py +0 -0
  98. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/mcp/tools/remote.py +0 -0
  99. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/providers/__init__.py +0 -0
  100. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/providers/source/__init__.py +0 -0
  101. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/providers/source/generic.py +0 -0
  102. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/providers/source/rest.py +0 -0
  103. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/remote/__init__.py +0 -0
  104. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/remote/client.py +0 -0
  105. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/remote/credentials.py +0 -0
  106. {action_platform-0.6.2 → action_platform-0.6.4}/action_platform/testing/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: action-platform
3
- Version: 0.6.2
3
+ Version: 0.6.4
4
4
  Summary: Your platform team, as a CLI.
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -226,6 +226,7 @@ Provides-Extra: api
226
226
  Provides-Extra: github
227
227
  Provides-Extra: gitlab
228
228
  Provides-Extra: mcp
229
+ Provides-Extra: sentry
229
230
  Requires-Dist: PyGithub ; extra == "github"
230
231
  Requires-Dist: cookiecutter
231
232
  Requires-Dist: fastapi (>=0.115) ; extra == "api"
@@ -235,6 +236,8 @@ Requires-Dist: pydantic
235
236
  Requires-Dist: python-gitlab ; extra == "gitlab"
236
237
  Requires-Dist: python-ulid (>=3.0)
237
238
  Requires-Dist: rich
239
+ Requires-Dist: sentry-sdk (>=2.0) ; extra == "sentry"
240
+ Requires-Dist: sentry-sdk[fastapi] (>=2.0) ; extra == "api"
238
241
  Requires-Dist: typer
239
242
  Requires-Dist: typing-extensions
240
243
  Requires-Dist: uvicorn (>=0.30) ; extra == "api"
@@ -255,26 +258,9 @@ Description-Content-Type: text/markdown
255
258
  </p>
256
259
 
257
260
  <p align="center">
258
- <a href="https://pypi.org/project/action-platform/"><img alt="PyPI" src="https://img.shields.io/pypi/v/action-platform?style=flat-square&logo=pypi&logoColor=white&label=cli&color=2ea44f"></a>
261
+ <a href="https://pypi.org/project/action-platform/"><img alt="CLI" src="https://img.shields.io/pypi/v/action-platform?style=flat-square&logo=pypi&logoColor=white&label=cli&color=2ea44f"></a>
259
262
  <a href="https://hub.docker.com/r/actionplatformio/action-platform-web"><img alt="Web image" src="https://img.shields.io/docker/v/actionplatformio/action-platform-web?sort=semver&style=flat-square&logo=docker&logoColor=white&label=web&color=2496ed"></a>
260
263
  <a href="https://hub.docker.com/r/actionplatformio/action-platform-api"><img alt="API image" src="https://img.shields.io/docker/v/actionplatformio/action-platform-api?sort=semver&style=flat-square&logo=docker&logoColor=white&label=api&color=2496ed"></a>
261
- <a href="https://pypi.org/project/action-platform/"><img alt="Python" src="https://img.shields.io/pypi/pyversions/action-platform?style=flat-square&logo=python&logoColor=white"></a>
262
- <a href="https://pypi.org/project/action-platform/"><img alt="Downloads" src="https://img.shields.io/pypi/dm/action-platform?style=flat-square&color=8250df"></a>
263
- </p>
264
-
265
- <p align="center">
266
- <a href="https://github.com/actionplatform/action-platform/actions/workflows/code-quality.yml"><img alt="Code quality" src="https://img.shields.io/github/actions/workflow/status/actionplatform/action-platform/code-quality.yml?branch=master&style=flat-square&label=code%20quality"></a>
267
- <a href="https://github.com/actionplatform/action-platform/actions/workflows/trivy.yml"><img alt="Trivy" src="https://img.shields.io/github/actions/workflow/status/actionplatform/action-platform/trivy.yml?branch=master&style=flat-square&label=trivy&logo=aquasecurity&logoColor=white"></a>
268
- <a href="https://github.com/actionplatform/action-platform/actions/workflows/docker-publish-images.yml"><img alt="Package Docker" src="https://img.shields.io/github/actions/workflow/status/actionplatform/action-platform/docker-publish-images.yml?style=flat-square&label=images&logo=githubactions&logoColor=white"></a>
269
- <a href="https://github.com/actionplatform/action-platform/releases"><img alt="Release" src="https://img.shields.io/github/v/release/actionplatform/action-platform?style=flat-square&logo=github&label=release"></a>
270
- <a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square"></a>
271
- </p>
272
-
273
- <p align="center">
274
- <a href="https://github.com/actionplatform/templates"><img alt="Templates" src="https://img.shields.io/badge/templates-13%20projects%20%C2%B7%203%20clouds%20%C2%B7%201%20service-6f42c1?style=flat-square"></a>
275
- <a href="docs/mcp.md"><img alt="MCP" src="https://img.shields.io/badge/MCP-17%20local%20%C2%B7%2026%20remote%20tools-000000?style=flat-square&logo=anthropic&logoColor=white"></a>
276
- <a href="docs/git-flow.md"><img alt="Git-flow" src="https://img.shields.io/badge/git--flow-enforced-orange?style=flat-square&logo=git&logoColor=white"></a>
277
- <a href="https://www.conventionalcommits.org"><img alt="Conventional Commits" src="https://img.shields.io/badge/conventional%20commits-1.0.0-fe5196?style=flat-square&logo=conventionalcommits&logoColor=white"></a>
278
264
  </p>
279
265
 
280
266
  ---
@@ -7,26 +7,9 @@
7
7
  </p>
8
8
 
9
9
  <p align="center">
10
- <a href="https://pypi.org/project/action-platform/"><img alt="PyPI" src="https://img.shields.io/pypi/v/action-platform?style=flat-square&logo=pypi&logoColor=white&label=cli&color=2ea44f"></a>
10
+ <a href="https://pypi.org/project/action-platform/"><img alt="CLI" src="https://img.shields.io/pypi/v/action-platform?style=flat-square&logo=pypi&logoColor=white&label=cli&color=2ea44f"></a>
11
11
  <a href="https://hub.docker.com/r/actionplatformio/action-platform-web"><img alt="Web image" src="https://img.shields.io/docker/v/actionplatformio/action-platform-web?sort=semver&style=flat-square&logo=docker&logoColor=white&label=web&color=2496ed"></a>
12
12
  <a href="https://hub.docker.com/r/actionplatformio/action-platform-api"><img alt="API image" src="https://img.shields.io/docker/v/actionplatformio/action-platform-api?sort=semver&style=flat-square&logo=docker&logoColor=white&label=api&color=2496ed"></a>
13
- <a href="https://pypi.org/project/action-platform/"><img alt="Python" src="https://img.shields.io/pypi/pyversions/action-platform?style=flat-square&logo=python&logoColor=white"></a>
14
- <a href="https://pypi.org/project/action-platform/"><img alt="Downloads" src="https://img.shields.io/pypi/dm/action-platform?style=flat-square&color=8250df"></a>
15
- </p>
16
-
17
- <p align="center">
18
- <a href="https://github.com/actionplatform/action-platform/actions/workflows/code-quality.yml"><img alt="Code quality" src="https://img.shields.io/github/actions/workflow/status/actionplatform/action-platform/code-quality.yml?branch=master&style=flat-square&label=code%20quality"></a>
19
- <a href="https://github.com/actionplatform/action-platform/actions/workflows/trivy.yml"><img alt="Trivy" src="https://img.shields.io/github/actions/workflow/status/actionplatform/action-platform/trivy.yml?branch=master&style=flat-square&label=trivy&logo=aquasecurity&logoColor=white"></a>
20
- <a href="https://github.com/actionplatform/action-platform/actions/workflows/docker-publish-images.yml"><img alt="Package Docker" src="https://img.shields.io/github/actions/workflow/status/actionplatform/action-platform/docker-publish-images.yml?style=flat-square&label=images&logo=githubactions&logoColor=white"></a>
21
- <a href="https://github.com/actionplatform/action-platform/releases"><img alt="Release" src="https://img.shields.io/github/v/release/actionplatform/action-platform?style=flat-square&logo=github&label=release"></a>
22
- <a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square"></a>
23
- </p>
24
-
25
- <p align="center">
26
- <a href="https://github.com/actionplatform/templates"><img alt="Templates" src="https://img.shields.io/badge/templates-13%20projects%20%C2%B7%203%20clouds%20%C2%B7%201%20service-6f42c1?style=flat-square"></a>
27
- <a href="docs/mcp.md"><img alt="MCP" src="https://img.shields.io/badge/MCP-17%20local%20%C2%B7%2026%20remote%20tools-000000?style=flat-square&logo=anthropic&logoColor=white"></a>
28
- <a href="docs/git-flow.md"><img alt="Git-flow" src="https://img.shields.io/badge/git--flow-enforced-orange?style=flat-square&logo=git&logoColor=white"></a>
29
- <a href="https://www.conventionalcommits.org"><img alt="Conventional Commits" src="https://img.shields.io/badge/conventional%20commits-1.0.0-fe5196?style=flat-square&logo=conventionalcommits&logoColor=white"></a>
30
13
  </p>
31
14
 
32
15
  ---
@@ -1,6 +1,6 @@
1
1
  """Action Platform __init__ module."""
2
2
 
3
- __version__ = "0.6.2"
3
+ __version__ = "0.6.4"
4
4
  __description__ = "Your platform team, as a CLI."
5
5
 
6
6
  from .core.config import Config
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.5.6 — 2026-09-13
4
+
5
+ ### Features
6
+ - **api:** optional Sentry reporting for the API and the CLI via AP_SENTRY_DSN
7
+
8
+ ### Bug Fixes
9
+ - **api:** sync stashes local changes around the pull instead of refusing
10
+ - **api:** answer 400 instead of 500 when a clone has no platform.toml, and add POST /apps/{id}/install to write it again
11
+
12
+ ## v0.5.5 — 2026-09-13
13
+
14
+ ## v0.5.4 — 2026-09-13
15
+
16
+ ### Bug Fixes
17
+ - **api:** commits on the platform are authored by the signed-in user, with a platform default identity
18
+
19
+ ## v0.5.3 — 2026-09-13
20
+
21
+ ### Bug Fixes
22
+ - list and discard uncommitted changes in the workspace, undo release writes when the commit fails, show the sync error
23
+
24
+ ## v0.5.2 — 2026-09-13
25
+
26
+ ## v0.5.1 — 2026-09-13
27
+
28
+ ## v0.5.0 — 2026-09-13
29
+
30
+ ## v0.4.3 — 2026-09-13
31
+
3
32
  ## v0.4.2 — 2026-09-13
4
33
 
5
34
  ### Bug Fixes
@@ -30,6 +30,8 @@ class SourceCredentials(BaseModel):
30
30
  username: Optional[str] = None
31
31
  base_url: Optional[str] = None
32
32
  owner: Optional[str] = None
33
+ author_name: Optional[str] = None
34
+ author_email: Optional[str] = None
33
35
 
34
36
 
35
37
  def apply(config: Config, creds: Optional[SourceCredentials]) -> Config:
@@ -65,17 +67,25 @@ def git_auth(creds: Optional[SourceCredentials]) -> Iterator[None]:
65
67
 
66
68
  username = creds.username or GIT_USERNAMES.get(creds.kind, "git")
67
69
  helper = '!f() { printf \'username=%s\\npassword=%s\\n\' "$AP_GIT_USER" "$AP_GIT_TOKEN"; }; f'
68
- token = git.AUTH_ENV.set(
69
- {
70
- "AP_GIT_USER": username,
71
- "AP_GIT_TOKEN": creds.token,
72
- "GIT_CONFIG_COUNT": "2",
73
- "GIT_CONFIG_KEY_0": "credential.helper",
74
- "GIT_CONFIG_VALUE_0": "",
75
- "GIT_CONFIG_KEY_1": "credential.helper",
76
- "GIT_CONFIG_VALUE_1": helper,
77
- }
78
- )
70
+ env = {
71
+ "AP_GIT_USER": username,
72
+ "AP_GIT_TOKEN": creds.token,
73
+ "GIT_CONFIG_COUNT": "2",
74
+ "GIT_CONFIG_KEY_0": "credential.helper",
75
+ "GIT_CONFIG_VALUE_0": "",
76
+ "GIT_CONFIG_KEY_1": "credential.helper",
77
+ "GIT_CONFIG_VALUE_1": helper,
78
+ }
79
+
80
+ if creds.author_name and creds.author_email:
81
+ env.update(
82
+ GIT_AUTHOR_NAME=creds.author_name,
83
+ GIT_AUTHOR_EMAIL=creds.author_email,
84
+ GIT_COMMITTER_NAME=creds.author_name,
85
+ GIT_COMMITTER_EMAIL=creds.author_email,
86
+ )
87
+
88
+ token = git.AUTH_ENV.set(env)
79
89
 
80
90
  try:
81
91
  yield
@@ -11,6 +11,7 @@ from action_platform import __version__
11
11
  from action_platform.api.core.deps import get_registry
12
12
  from action_platform.api.v1 import router as v1
13
13
  from action_platform.core.exception import ActionPlatformError
14
+ from action_platform.observability import observe
14
15
  from action_platform.settings import settings
15
16
 
16
17
  OPEN_PATHS = {"/api/version", "/docs", "/openapi.json", "/redoc"}
@@ -19,6 +20,7 @@ OPEN_PATHS = {"/api/version", "/docs", "/openapi.json", "/redoc"}
19
20
  def build(
20
21
  cors_origins: Optional[list[str]] = None, token: Optional[str] = None
21
22
  ) -> FastAPI:
23
+ observe("api")
22
24
  app = FastAPI(title="action-platform", version=__version__)
23
25
  get_registry.cache_clear()
24
26
  expected = settings.API_TOKEN if token is None else token
@@ -210,13 +210,10 @@ class Registry:
210
210
  if upstream.returncode != 0:
211
211
  return entry
212
212
 
213
- pull = subprocess.run(
214
- ["git", "pull", "--quiet", "--ff-only"],
215
- cwd=root,
216
- capture_output=True,
217
- env=git_env(),
218
- text=True,
219
- )
213
+ pull = _pull(root)
214
+
215
+ if pull.returncode != 0 and _blocked_by_local_changes(pull.stderr):
216
+ pull = _pull_over_local_changes(root)
220
217
 
221
218
  if pull.returncode != 0:
222
219
  raise SyncError(_pull_problem(pull.stderr))
@@ -238,6 +235,63 @@ class Registry:
238
235
  shutil.rmtree(path, ignore_errors=True)
239
236
 
240
237
 
238
+ def _pull(root: Path) -> subprocess.CompletedProcess:
239
+ return subprocess.run(
240
+ ["git", "pull", "--quiet", "--ff-only"],
241
+ cwd=root,
242
+ capture_output=True,
243
+ env=git_env(),
244
+ text=True,
245
+ )
246
+
247
+
248
+ def _blocked_by_local_changes(stderr: str) -> bool:
249
+ return "uncommitted changes" in stderr or "would be overwritten" in stderr
250
+
251
+
252
+ def _pull_over_local_changes(root: Path) -> subprocess.CompletedProcess:
253
+ stash = subprocess.run(
254
+ ["git", "stash", "push", "--quiet", "--include-untracked"],
255
+ cwd=root,
256
+ capture_output=True,
257
+ env=git_env(),
258
+ text=True,
259
+ )
260
+
261
+ if stash.returncode != 0:
262
+ return stash
263
+
264
+ pull = _pull(root)
265
+ pop = subprocess.run(
266
+ ["git", "stash", "pop", "--quiet"],
267
+ cwd=root,
268
+ capture_output=True,
269
+ env=git_env(),
270
+ text=True,
271
+ )
272
+
273
+ if pop.returncode != 0:
274
+ for tree in ("stash@{0}^3", "stash@{0}"):
275
+ subprocess.run(
276
+ ["git", "checkout", "--quiet", tree, "--", "."],
277
+ cwd=root,
278
+ capture_output=True,
279
+ env=git_env(),
280
+ )
281
+
282
+ subprocess.run(
283
+ ["git", "reset", "--quiet"], cwd=root, capture_output=True, env=git_env()
284
+ )
285
+ subprocess.run(
286
+ ["git", "stash", "drop", "--quiet"],
287
+ cwd=root,
288
+ capture_output=True,
289
+ env=git_env(),
290
+ )
291
+
292
+ return pull
293
+
294
+
241
295
  def _pull_problem(stderr: str) -> str:
242
296
  text = stderr.strip()
243
297
 
@@ -1,6 +1,7 @@
1
1
  from action_platform.api.schemas.actions import (
2
2
  AddAppRequest,
3
3
  BranchResult,
4
+ Changes,
4
5
  CheckoutRequest,
5
6
  CloudRequest,
6
7
  CommitBranch,
@@ -21,6 +22,7 @@ from action_platform.api.schemas.actions import (
21
22
  Diagnosis,
22
23
  InitRequest,
23
24
  InstallSpec,
25
+ Installed,
24
26
  InitResult,
25
27
  PushRequest,
26
28
  PushResult,
@@ -51,6 +53,7 @@ from action_platform.api.schemas.catalog import (
51
53
  __all__ = [
52
54
  "AddAppRequest",
53
55
  "BranchResult",
56
+ "Changes",
54
57
  "CheckoutRequest",
55
58
  "CloudRequest",
56
59
  "CommitBranch",
@@ -78,6 +81,7 @@ __all__ = [
78
81
  "GitflowRules",
79
82
  "InitRequest",
80
83
  "InstallSpec",
84
+ "Installed",
81
85
  "InitResult",
82
86
  "Matrix",
83
87
  "MatrixCloud",
@@ -10,6 +10,8 @@ class SourceCredentials(BaseModel):
10
10
  token: str
11
11
  username: Optional[str] = None
12
12
  base_url: Optional[str] = None
13
+ author_name: Optional[str] = None
14
+ author_email: Optional[str] = None
13
15
  owner: Optional[str] = None
14
16
 
15
17
 
@@ -167,6 +169,15 @@ class ManifestBody(BaseModel):
167
169
  content: str
168
170
 
169
171
 
172
+ class Installed(BaseModel):
173
+ installed: list[str]
174
+
175
+
176
+ class Changes(BaseModel):
177
+ files: list[str]
178
+ clean: bool
179
+
180
+
170
181
  class CommitBranch(BaseModel):
171
182
  kind: str
172
183
  code: str
@@ -1,3 +1,4 @@
1
+ import subprocess
1
2
  import tomllib
2
3
  from pathlib import Path
3
4
 
@@ -10,6 +11,7 @@ from action_platform.api.services.catalog import resolve_repo
10
11
  from action_platform.core.config import Config
11
12
  from action_platform.core.flow import branching, git, gitflow, pullrequest
12
13
  from action_platform.core.flow.branching import BranchError
14
+ from action_platform.core.scaffold.install import install
13
15
  from action_platform.core.scaffold.generate import apply_cloud, apply_service
14
16
  from action_platform.core.scaffold.templates import TemplateError
15
17
  from action_platform.settings import settings
@@ -67,6 +69,37 @@ class ConfigurationService:
67
69
  "provider": provider or (service.providers[0] if service.providers else ""),
68
70
  }
69
71
 
72
+ def changes(self, id: str) -> dict:
73
+ root = self._root(id)
74
+ status = subprocess.run(
75
+ ["git", "status", "--porcelain=v1", "--untracked-files=all", "-z"],
76
+ cwd=root,
77
+ capture_output=True,
78
+ text=True,
79
+ check=True,
80
+ env=git.git_env(),
81
+ ).stdout
82
+ files = [entry[3:] for entry in status.split("\0") if len(entry) > 3]
83
+
84
+ return {"files": files, "clean": not files}
85
+
86
+ def discard(self, id: str) -> dict:
87
+ root = self._root(id)
88
+ git.run(["reset", "-q", "--hard", "HEAD"], cwd=root)
89
+ git.run(["clean", "-fdq"], cwd=root)
90
+
91
+ return {"clean": True, "files": []}
92
+
93
+ def install_platform(
94
+ self, id: str, type_: str, language: str | None, ci: str | None
95
+ ) -> dict:
96
+ root = self._root(id)
97
+ plan = install(
98
+ root, type_=type_, language=language, ci=ci, name=self.registry.get(id).name
99
+ )
100
+
101
+ return {"installed": plan.created}
102
+
70
103
  def commit(self, id: str, body: CommitRequest) -> dict:
71
104
  root = self._root(id)
72
105
 
@@ -1,11 +1,18 @@
1
1
  import tomllib
2
2
  from pathlib import Path
3
3
 
4
+ from fastapi import HTTPException
5
+
4
6
  from action_platform.settings import settings
5
7
 
6
8
 
7
9
  def read_manifest(root: Path) -> dict:
8
- data = tomllib.loads((root / settings.CONFIG_FILE).read_text())
10
+ path = root / settings.CONFIG_FILE
11
+
12
+ if not path.exists():
13
+ raise HTTPException(400, f"{settings.CONFIG_FILE} not found in {root}")
14
+
15
+ data = tomllib.loads(path.read_text())
9
16
  last = root / settings.LAST_VERSION_FILE
10
17
 
11
18
  return {
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from fastapi import APIRouter, Depends
2
4
 
3
5
  from action_platform.api import schemas
@@ -41,6 +43,31 @@ def add_service(
41
43
  return config.add_service(id, body.name, body.provider, body.source)
42
44
 
43
45
 
46
+ @router.get("/{id}/changes")
47
+ def changes(
48
+ id: str, config: ConfigurationService = Depends(get_configuration)
49
+ ) -> schemas.Changes:
50
+ return config.changes(id)
51
+
52
+
53
+ @router.post("/{id}/install", status_code=201)
54
+ def install_platform(
55
+ id: str,
56
+ body: Optional[schemas.InstallSpec] = None,
57
+ config: ConfigurationService = Depends(get_configuration),
58
+ ) -> schemas.Installed:
59
+ spec = body or schemas.InstallSpec()
60
+
61
+ return config.install_platform(id, spec.type, spec.language, spec.ci)
62
+
63
+
64
+ @router.post("/{id}/discard")
65
+ def discard(
66
+ id: str, config: ConfigurationService = Depends(get_configuration)
67
+ ) -> schemas.Changes:
68
+ return config.discard(id)
69
+
70
+
44
71
  @router.post("/{id}/commit", status_code=201)
45
72
  def commit(
46
73
  id: str,
@@ -74,6 +74,10 @@ def git_env() -> dict[str, str]:
74
74
  from action_platform.settings import settings
75
75
 
76
76
  env = {**os.environ, "GIT_TERMINAL_PROMPT": "0"}
77
+ env.setdefault("GIT_AUTHOR_NAME", settings.GIT_AUTHOR_NAME)
78
+ env.setdefault("GIT_AUTHOR_EMAIL", settings.GIT_AUTHOR_EMAIL)
79
+ env.setdefault("GIT_COMMITTER_NAME", settings.GIT_AUTHOR_NAME)
80
+ env.setdefault("GIT_COMMITTER_EMAIL", settings.GIT_AUTHOR_EMAIL)
77
81
  extra = {**(AUTH_ENV.get() or {})}
78
82
  count = int(extra.get("GIT_CONFIG_COUNT", "0"))
79
83
  policy = {
@@ -9,6 +9,7 @@ from dataclasses import dataclass, field
9
9
  from pathlib import Path
10
10
 
11
11
  from action_platform.core.flow import git
12
+ from action_platform.settings import settings
12
13
  from action_platform.core.flow.git import git_env
13
14
 
14
15
  KINDS = {
@@ -131,8 +132,12 @@ def audit(cwd: Path, since: str | None = None) -> Report:
131
132
  if problem:
132
133
  report.problems.append(problem)
133
134
 
134
- base = since or _merge_base(cwd, branch)
135
- commits = git.commits_since(base, cwd=cwd) if base else []
135
+ if since is None and branch in PROTECTED:
136
+ commits = _commits_on_protected(cwd)
137
+ else:
138
+ base = since or _merge_base(cwd, branch)
139
+ commits = git.commits_since(base, cwd=cwd) if base else []
140
+
136
141
  report.checked_commits = len(commits)
137
142
 
138
143
  for subject in commits:
@@ -140,10 +145,6 @@ def audit(cwd: Path, since: str | None = None) -> Report:
140
145
  if problem:
141
146
  report.problems.append(problem)
142
147
 
143
- problem = check_protected(branch, subject)
144
- if problem and problem not in report.problems:
145
- report.problems.append(problem)
146
-
147
148
  return report
148
149
 
149
150
 
@@ -252,3 +253,41 @@ def _merge_base(cwd: Path, branch: str) -> str | None:
252
253
  continue
253
254
 
254
255
  return None
256
+
257
+
258
+ def _commits_on_protected(cwd: Path) -> list[str]:
259
+ """Subjects to audit on main/master: after the last tag and, once the platform is committed, only on the path down from that commit — history from before the install is not the project's to fix."""
260
+ tag = git.latest_tag(cwd=cwd)
261
+ installed = _platform_commit(cwd)
262
+
263
+ if installed is None:
264
+ return git.commits_since(tag, cwd=cwd) if tag else []
265
+
266
+ args = [
267
+ "log",
268
+ "HEAD",
269
+ f"--ancestry-path={installed}",
270
+ f"^{installed}",
271
+ "--pretty=format:%s",
272
+ ]
273
+
274
+ if tag:
275
+ args.append(f"^{tag}")
276
+
277
+ out = git.run(args, cwd=cwd)
278
+
279
+ return [line for line in out.splitlines() if line.strip()]
280
+
281
+
282
+ def _platform_commit(cwd: Path) -> str | None:
283
+ try:
284
+ out = git.run(
285
+ ["log", "--diff-filter=A", "--format=%H", "--", settings.CONFIG_FILE],
286
+ cwd=cwd,
287
+ )
288
+ except subprocess.CalledProcessError:
289
+ return None
290
+
291
+ lines = out.splitlines()
292
+
293
+ return lines[-1] if lines else None
@@ -102,6 +102,7 @@ def release(
102
102
  logger.info("dry-run enabled, skipping writes")
103
103
  return ctx
104
104
 
105
+ had_changelog = (where / settings.CHANGELOG_FILE).exists()
105
106
  versioning.write(where / settings.LAST_VERSION_FILE, ctx.next_version)
106
107
  changelog.prepend(where / settings.CHANGELOG_FILE, ctx.changelog)
107
108
  synced = versioning.sync_files(where, ctx.next_version)
@@ -111,8 +112,13 @@ def release(
111
112
  for f in (settings.LAST_VERSION_FILE, settings.CHANGELOG_FILE, *synced)
112
113
  ]
113
114
 
114
- git.add(touched, cwd=repo_root)
115
- git.commit(f"chore(release): {comp.label(ctx.next_version)}", cwd=repo_root)
115
+ try:
116
+ git.add(touched, cwd=repo_root)
117
+ git.commit(f"chore(release): {comp.label(ctx.next_version)}", cwd=repo_root)
118
+ except Exception as e:
119
+ _undo_writes(repo_root, touched, had_changelog, where)
120
+ raise ReleaseError(f"could not commit the release: {_stderr(e) or e}") from e
121
+
116
122
  git.create_tag(tag, tag, cwd=repo_root)
117
123
  git.push(cwd=repo_root)
118
124
  git.push_tag(tag, cwd=repo_root)
@@ -132,3 +138,22 @@ def release(
132
138
  raise ReleaseError(f"CI {runner.name} failed")
133
139
 
134
140
  return ctx
141
+
142
+
143
+ def _undo_writes(
144
+ repo_root: Path, touched: list[str], had_changelog: bool, where: Path
145
+ ) -> None:
146
+ git.run(["reset", "-q", "--", *touched], cwd=repo_root)
147
+ tracked = [
148
+ f for f in touched if had_changelog or not f.endswith(settings.CHANGELOG_FILE)
149
+ ]
150
+
151
+ if tracked:
152
+ git.run(["checkout", "--", *tracked], cwd=repo_root)
153
+
154
+ if not had_changelog:
155
+ (where / settings.CHANGELOG_FILE).unlink(missing_ok=True)
156
+
157
+
158
+ def _stderr(e: Exception) -> str:
159
+ return getattr(e, "stderr", "") or ""
@@ -7,9 +7,12 @@ from rich.console import Console
7
7
 
8
8
  from action_platform.cli.setup import app
9
9
  from action_platform.core.exception import ActionPlatformError
10
+ from action_platform.observability import observe
10
11
 
11
12
 
12
13
  def main() -> None:
14
+ observe("cli")
15
+
13
16
  try:
14
17
  app()
15
18
  except ActionPlatformError as e:
@@ -0,0 +1,32 @@
1
+ """Optional Sentry reporting, shared by the CLI and the API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+
7
+ from action_platform import __version__
8
+ from action_platform.settings import settings
9
+
10
+
11
+ def observe(component: str, dsn: Optional[str] = None) -> bool:
12
+ dsn = settings.SENTRY_DSN if dsn is None else dsn
13
+
14
+ if not dsn:
15
+ return False
16
+
17
+ try:
18
+ import sentry_sdk
19
+ except ImportError:
20
+ return False
21
+
22
+ sentry_sdk.init(
23
+ dsn=dsn,
24
+ release=f"{component}@{__version__}",
25
+ environment=settings.SENTRY_ENVIRONMENT,
26
+ send_default_pii=False,
27
+ enable_logs=True,
28
+ traces_sample_rate=settings.SENTRY_TRACES_SAMPLE_RATE,
29
+ )
30
+ sentry_sdk.set_tag("component", component)
31
+
32
+ return True
@@ -36,9 +36,11 @@ class SourceBitbucket(SourceHost):
36
36
  self.api = "https://api.bitbucket.org/2.0"
37
37
  self.web = "https://bitbucket.org"
38
38
 
39
+ def _require_credentials(self) -> None:
39
40
  if not self.token:
40
41
  raise ProviderError(
41
- "no Bitbucket credentials: set ACTION_PLATFORM_BITBUCKET_TOKEN"
42
+ "no Bitbucket credentials for this repository: on the platform, connect a Bitbucket "
43
+ "host in Settings; on the CLI, set ACTION_PLATFORM_BITBUCKET_TOKEN"
42
44
  )
43
45
 
44
46
  def _headers(self) -> dict[str, str]:
@@ -50,6 +52,8 @@ class SourceBitbucket(SourceHost):
50
52
  return {"authorization": f"Bearer {self.token}"}
51
53
 
52
54
  def _rest(self, method: str, path: str, body: dict | None = None):
55
+ self._require_credentials()
56
+
53
57
  return rest.call(method, f"{self.api}{path}", self._headers(), body)
54
58
 
55
59
  def detect(self, remote_url: str) -> bool:
@@ -47,12 +47,16 @@ class SourceGithub(SourceHost):
47
47
  else self.api.removesuffix("/api/v3")
48
48
  )
49
49
 
50
+ def _require_credentials(self) -> None:
50
51
  if not self.token and not shutil.which("gh"):
51
52
  raise ProviderError(
52
- "no GitHub token and no gh CLI: set ACTION_PLATFORM_GITHUB_TOKEN or install https://cli.github.com"
53
+ "no GitHub credentials for this repository: on the platform, connect a GitHub host "
54
+ "in Settings; on the CLI, set ACTION_PLATFORM_GITHUB_TOKEN or install https://cli.github.com"
53
55
  )
54
56
 
55
57
  def _rest(self, method: str, path: str, body: dict | None = None):
58
+ self._require_credentials()
59
+
56
60
  return rest.call(
57
61
  method,
58
62
  f"{self.api}{path}",
@@ -76,6 +80,7 @@ class SourceGithub(SourceHost):
76
80
  return rows[0]
77
81
 
78
82
  def _gh(self, *args: str) -> str:
83
+ self._require_credentials()
79
84
  result = subprocess.run(
80
85
  ["gh", *args, "--repo", self.repo],
81
86
  check=False,
@@ -30,16 +30,25 @@ class SourceGitlab(SourceHost):
30
30
  self.web = (base_url or "https://gitlab.com").rstrip("/")
31
31
  self.api = f"{self.web}/api/v4"
32
32
 
33
+ def _require_credentials(self) -> None:
33
34
  if not self.token:
34
- raise ProviderError("no GitLab token: set ACTION_PLATFORM_GITLAB_TOKEN")
35
+ raise ProviderError(
36
+ "no GitLab credentials for this repository: on the platform, connect a GitLab host "
37
+ "in Settings; on the CLI, set ACTION_PLATFORM_GITLAB_TOKEN"
38
+ )
35
39
 
36
40
  @property
37
41
  def _id(self) -> str:
38
42
  return urllib.parse.quote(self.repo, safe="")
39
43
 
40
44
  def _rest(self, method: str, path: str, body: dict | None = None):
45
+ self._require_credentials()
46
+
41
47
  return rest.call(
42
- method, f"{self.api}{path}", {"private-token": self.token}, body
48
+ method,
49
+ f"{self.api}{path}",
50
+ {"authorization": f"Bearer {self.token}"},
51
+ body,
43
52
  )
44
53
 
45
54
  def detect(self, remote_url: str) -> bool:
@@ -27,6 +27,11 @@ class Settings:
27
27
 
28
28
  GITHUB_TOKEN = os.getenv("ACTION_PLATFORM_GITHUB_TOKEN") or os.getenv("GH_TOKEN")
29
29
  API_TOKEN = os.getenv("AP_API_TOKEN", "")
30
+ SENTRY_DSN = os.getenv("AP_SENTRY_DSN", "")
31
+ SENTRY_ENVIRONMENT = os.getenv("AP_SENTRY_ENVIRONMENT", "production")
32
+ SENTRY_TRACES_SAMPLE_RATE = float(os.getenv("AP_SENTRY_TRACES_SAMPLE_RATE", "0.1"))
33
+ GIT_AUTHOR_NAME = os.getenv("AP_GIT_AUTHOR_NAME", "Action Platform")
34
+ GIT_AUTHOR_EMAIL = os.getenv("AP_GIT_AUTHOR_EMAIL", "cloud@actionplatform.io")
30
35
  GITLAB_TOKEN = os.getenv("ACTION_PLATFORM_GITLAB_TOKEN") or os.getenv(
31
36
  "GITLAB_TOKEN"
32
37
  )
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "action-platform"
3
- version = "0.6.2"
3
+ version = "0.6.4"
4
4
  authors = [
5
5
  { name="Fernando Celmer", email="email@fernandocelmer.com" },
6
6
  ]
@@ -68,11 +68,12 @@ Organization = "https://github.com/actionplatform"
68
68
  github = ["PyGithub"]
69
69
  gitlab = ["python-gitlab"]
70
70
  mcp = ["mcp>=2.0"]
71
- api = ["fastapi>=0.115", "uvicorn>=0.30"]
71
+ sentry = ["sentry-sdk>=2.0"]
72
+ api = ["fastapi>=0.115", "uvicorn>=0.30", "sentry-sdk[fastapi]>=2.0"]
72
73
 
73
74
  [tool.poetry]
74
75
  name = "action-platform"
75
- version = "0.6.2"
76
+ version = "0.6.4"
76
77
  description = "Your platform team, as a CLI."
77
78
  authors = ["Fernando Celmer <email@fernandocelmer.com>"]
78
79
  readme = "README.md"
@@ -92,7 +93,8 @@ action-platform-mcp = "action_platform.mcp.server:main"
92
93
 
93
94
  [tool.poetry.extras]
94
95
  mcp = ["mcp"]
95
- api = ["fastapi", "uvicorn"]
96
+ sentry = ["sentry-sdk"]
97
+ api = ["fastapi", "uvicorn", "sentry-sdk"]
96
98
 
97
99
 
98
100
  [tool.poetry.dependencies]
@@ -107,6 +109,7 @@ cookiecutter = "^2.6.0"
107
109
  mcp = { version = ">=2.0", optional = true }
108
110
  fastapi = { version = ">=0.115", optional = true }
109
111
  uvicorn = { version = ">=0.30", optional = true }
112
+ sentry-sdk = { version = ">=2.0", optional = true, extras = ["fastapi"] }
110
113
 
111
114
  [tool.poetry.group.dev.dependencies]
112
115
  build = "^1.2.2.post1"
@@ -1 +0,0 @@
1
- 0.4.2
File without changes