polylith-cli 1.45.3__tar.gz → 1.47.0__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.
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/PKG-INFO +1 -1
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/README.md +36 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/base_creation/SKILL.md +56 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/brick_removal/SKILL.md +27 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/check/SKILL.md +61 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/component_creation/SKILL.md +59 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/concepts/SKILL.md +58 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/dependency_management/SKILL.md +48 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/dependency_visualization/SKILL.md +82 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/diff/SKILL.md +68 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/libs/SKILL.md +51 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/project_management/SKILL.md +101 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/sync/SKILL.md +79 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/testing/SKILL.md +129 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/workspace_inspection/SKILL.md +64 -0
- polylith_cli-1.47.0/polylith_cli/.agents/skills/polylith/workspace_setup/SKILL.md +104 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/cli/create.py +4 -2
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/pyproject.toml +1 -1
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/README.md +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/alias/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/alias/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/bricks/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/bricks/base.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/bricks/brick.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/bricks/component.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/building/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/building/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/building/paths.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/check/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/check/collect.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/check/report.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/cli/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/cli/__main__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/cli/build.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/cli/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/cli/env.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/cli/options.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/cli/test.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/commands/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/commands/check.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/commands/create.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/commands/deps.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/commands/diff.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/commands/info.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/commands/libs.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/commands/sync.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/commands/test.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/configuration/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/configuration/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/deps/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/deps/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/deps/report.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/development/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/development/development.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/diff/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/diff/collect.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/diff/report.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/dirs/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/dirs/dirs.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/distributions/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/distributions/caching.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/distributions/collect.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/distributions/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/environment/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/environment/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/files/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/files/files.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/imports/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/imports/grouping.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/imports/parser.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/imports/usages.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/info/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/info/collect.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/info/report.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/interactive/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/interactive/project.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/interface/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/interface/collect.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/interface/interfaces.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/interface/parser.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/interface/report.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/interface/usage.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/libs/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/libs/grouping.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/libs/lock_files.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/libs/report.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/libs/stdlib.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/output/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/output/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/parsing/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/parsing/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/parsing/rewrite.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/project/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/project/create.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/project/get.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/project/parser.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/project/templates.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/readme/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/readme/readme.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/repo/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/repo/get.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/repo/repo.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/reporting/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/reporting/theme.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/sync/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/sync/collect.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/sync/report.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/sync/update.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/test/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/test/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/test/report.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/test/tests.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/toml/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/toml/core.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/workspace/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/workspace/create.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/workspace/paths.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/yaml/__init__.py +0 -0
- {polylith_cli-1.45.3 → polylith_cli-1.47.0}/polylith_cli/polylith/yaml/core.py +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# Polylith Skills
|
|
3
|
+
|
|
4
|
+
> **Note for contributors:** this README is a **human reference**. The agent loads each `*/SKILL.md` independently via the skill loader; this file is **not** auto-loaded with any skill. Anything an agent must know to act has to live in the relevant `SKILL.md` itself, not here.
|
|
5
|
+
|
|
6
|
+
## Available Skills
|
|
7
|
+
|
|
8
|
+
| Skill | Command | Purpose |
|
|
9
|
+
|---------------------------|--------------------|----------------------------------------------------------------------------------------------------------|
|
|
10
|
+
| [Workspace Setup](./workspace_setup/SKILL.md) | `poly create workspace` | Initialize a Polylith workspace (`workspace.toml`, top-level dirs). |
|
|
11
|
+
| [Component Creation](./component_creation/SKILL.md) | `poly create component` | Create a reusable brick (business logic, domain, capability). |
|
|
12
|
+
| [Base Creation](./base_creation/SKILL.md) | `poly create base` | Create an entry-point brick (HTTP API, CLI, Lambda handler). |
|
|
13
|
+
| [Project Management](./project_management/SKILL.md) | `poly create project` | Create a deployable project that references bricks. |
|
|
14
|
+
| [Brick Removal](./brick_removal/SKILL.md) | — | Safely delete a component or base (no `poly remove` exists). |
|
|
15
|
+
| [Sync](./sync/SKILL.md) | `poly sync` | Update each project's brick list to match actual imports. |
|
|
16
|
+
| [Workspace Inspection](./workspace_inspection/SKILL.md) | `poly info` | Show brick × project usage (which projects use which bricks). |
|
|
17
|
+
| [Dependency Visualization](./dependency_visualization/SKILL.md) | `poly deps` | Show brick × brick dependencies and interface compliance. |
|
|
18
|
+
| [Testing](./testing/SKILL.md) | `poly test diff` | List bricks/projects affected by **test-code** changes since a tag. |
|
|
19
|
+
| [Diff](./diff/SKILL.md) | `poly diff` | List bricks whose **implementation** changed since a tag. |
|
|
20
|
+
| [Check](./check/SKILL.md) | `poly check` | Validate the workspace (CI gate; exits 1 on failure). |
|
|
21
|
+
| [Libs](./libs/SKILL.md) | `poly libs` | Inspect third-party libraries per project. |
|
|
22
|
+
| [Concepts](./concepts/SKILL.md) | — | Provides foundational knowledge about Polylith architecture and terminology. |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## For humans — getting started
|
|
27
|
+
|
|
28
|
+
1. **Set up the workspace** — [Workspace Setup](./workspace_setup/SKILL.md).
|
|
29
|
+
2. **Understand the basics** — [Concepts](./concepts/SKILL.md).
|
|
30
|
+
3. **Create bricks** — [Component Creation](./component_creation/SKILL.md) and [Base Creation](./base_creation/SKILL.md).
|
|
31
|
+
4. **Create deployable projects** — [Project Management](./project_management/SKILL.md).
|
|
32
|
+
5. **Remove bricks safely** — [Brick Removal](./brick_removal/SKILL.md).
|
|
33
|
+
6. **Sync brick usage** — [Sync](./sync/SKILL.md).
|
|
34
|
+
7. **Inspect** — [Workspace Inspection](./workspace_inspection/SKILL.md) (brick × project) and [Dependency Visualization](./dependency_visualization/SKILL.md) (brick × brick).
|
|
35
|
+
8. **Validate** — [Check](./check/SKILL.md) (CI gate) and [Libs](./libs/SKILL.md) (library inspection).
|
|
36
|
+
9. **Diff between releases** — [Diff](./diff/SKILL.md) and [Testing](./testing/SKILL.md).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polylith-base-creation
|
|
3
|
+
description: Create a Polylith base with `poly create base` — the entry point of a deployable application (HTTP API, CLI, message-queue consumer, AWS Lambda handler, GCP Cloud Function, scheduled job). Use when the user wants to add a service, API, endpoint, handler, or any new entry point to a Polylith workspace.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Base Creation Skill
|
|
7
|
+
|
|
8
|
+
> 💡 **Terminology:** this skill uses Polylith terms like *brick*, *base*, *namespace*, and *theme*. If they're unfamiliar, load `polylith-concepts` first.
|
|
9
|
+
|
|
10
|
+
## Quick command
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uv run poly create base --name api
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Command prefix:** If you do not know the package manager, list lock files with `ls uv.lock poetry.lock pdm.lock 2>/dev/null` (a `pyproject.toml` is always present, so it tells you nothing on its own). Use `uv run poly` (uv), `poetry poly` (poetry), `pdm run poly` (pdm), `hatch run poly` (hatch), or `poly` (activated venv). Examples below use `uv run`.
|
|
17
|
+
|
|
18
|
+
> A **base** is the entry point of a deployable application. For non-entry-point reusable code (business logic, capabilities), use `polylith-component-creation` instead.
|
|
19
|
+
|
|
20
|
+
## Command reference
|
|
21
|
+
|
|
22
|
+
| Option | Required | Default | Description |
|
|
23
|
+
|-----------------|----------|---------|--------------------------------------------|
|
|
24
|
+
| `--name` | yes | — | Name of the base (also the package name). |
|
|
25
|
+
| `--description` | no | `""` | Optional human-readable description. |
|
|
26
|
+
|
|
27
|
+
## What gets created (loose theme)
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
bases/<namespace>/api/
|
|
31
|
+
├── __init__.py # Public interface — empty; add re-exports here
|
|
32
|
+
└── core.py # Implementation — empty; user fills it in
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If `[tool.polylith.test].enabled = true` in `workspace.toml`, the CLI also creates `test/bases/<namespace>/api/test_core.py`.
|
|
36
|
+
|
|
37
|
+
For the `tdd` theme layout (`bases/api/{src,test}/<namespace>/api/...`), load the `polylith-workspace-setup` skill.
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Minimal
|
|
43
|
+
uv run poly create base --name api
|
|
44
|
+
|
|
45
|
+
# With description
|
|
46
|
+
uv run poly create base --name consumer --description "Kafka order consumer"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Notes for the agent
|
|
50
|
+
- `core.py` is **empty boilerplate** — there is no FastAPI/Typer/Lambda scaffolding. Fill it in manually after creation if asked.
|
|
51
|
+
- `__init__.py` is also empty. By Polylith convention it should re-export the brick's public symbols, so consumers import `from <namespace>.api import …` rather than reaching into `core.py`.
|
|
52
|
+
- A new base is **not** wired into any project. To wire it: load `polylith-sync` and run `poly sync`, or run `poly create project` (the interactive prompt will offer to attach the base).
|
|
53
|
+
- The same command works for both `loose` and `tdd` themes — the CLI reads `[tool.polylith.structure].theme` from `workspace.toml`.
|
|
54
|
+
|
|
55
|
+
## Verification
|
|
56
|
+
After creation, verify the base exists using your file tools (e.g., check `bases/<namespace>/<name>/__init__.py`). Then, you will likely need to populate `core.py` and `__init__.py` using your file writing tools since they are created empty.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polylith-brick-removal
|
|
3
|
+
description: Safely remove a Polylith brick (component or base) from the workspace. Use when the user wants to delete, remove, or tear down a component or base.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Brick Removal Skill
|
|
7
|
+
|
|
8
|
+
> 💡 **Terminology:** this skill uses Polylith terms like *brick*, *component*, *base*, and *development project*. If they're unfamiliar, load `polylith-concepts` first.
|
|
9
|
+
|
|
10
|
+
There is no `poly remove` CLI command. Removing a brick is a manual process.
|
|
11
|
+
|
|
12
|
+
## Steps to remove a brick
|
|
13
|
+
|
|
14
|
+
1. **Delete the source code:**
|
|
15
|
+
Delete the brick's directory under `components/<namespace>/<name>` or `bases/<namespace>/<name>`.
|
|
16
|
+
2. **Delete the tests:**
|
|
17
|
+
Delete the brick's test directory under `test/components/<namespace>/<name>` or `test/bases/<namespace>/<name>`.
|
|
18
|
+
3. **Remove from projects:**
|
|
19
|
+
Search across all `projects/*/pyproject.toml` files and remove the brick from the `[tool.polylith.bricks]` section.
|
|
20
|
+
4. **Remove from the development project:**
|
|
21
|
+
Remove the brick from the `[tool.polylith.bricks]` section in the root `pyproject.toml` (the development project).
|
|
22
|
+
5. **Sync and Check:**
|
|
23
|
+
Run `poly sync` (load `polylith-sync`) and `poly check` (load `polylith-check`) to ensure the workspace is valid and no other bricks were importing the deleted brick.
|
|
24
|
+
|
|
25
|
+
## Notes for the agent
|
|
26
|
+
- Always use your directory and file tools to verify the paths before deleting.
|
|
27
|
+
- If `poly check` fails after removal, it means another brick was depending on the removed brick. You must fix the importing brick.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polylith-check
|
|
3
|
+
description: Validate a Polylith workspace with `poly check` — the canonical CI gate. Verifies brick imports against project `pyproject.toml`s, third-party library declarations vs. the lock file, and (under `--strict`) cross-project version consistency. Exits 1 on failure. Use when the user wants to lint, validate, verify, or CI-gate a Polylith workspace.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Check Skill
|
|
7
|
+
|
|
8
|
+
## Quick command
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
uv run poly check
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Command prefix:** If you do not know the package manager, list lock files with `ls uv.lock poetry.lock pdm.lock 2>/dev/null` (a `pyproject.toml` is always present, so it tells you nothing on its own). Use `uv run poly` (uv), `poetry poly` (poetry), `pdm run poly` (pdm), `hatch run poly` (hatch), or `poly` (activated venv). Examples below use `uv run`.
|
|
15
|
+
|
|
16
|
+
> ⚠ **Run `poly sync` first** if bricks have been added/removed since the last commit, otherwise sync-related findings will dominate the report. Load `polylith-sync` if needed.
|
|
17
|
+
> ⚠ **Exit code 1 = failure** — this is the right command to wrap in CI.
|
|
18
|
+
|
|
19
|
+
## Typical CI usage
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv run poly sync --quiet # Make sure brick lists are current (--quiet avoids the interactive prompt)
|
|
23
|
+
uv run poly check # Validate; build fails if non-zero
|
|
24
|
+
|
|
25
|
+
# (Optional) scope test runs to bricks whose implementation changed.
|
|
26
|
+
# `poly diff --bricks --short` emits a comma-separated list, which becomes a
|
|
27
|
+
# pytest `-k` expression (`log,message` → `pytest -k "log or message"`).
|
|
28
|
+
changes="$(uv run poly diff --bricks --short)"
|
|
29
|
+
[ -n "$changes" ] && uv run pytest -k "${changes//,/ or }"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> Use `poly diff` (implementation diff) for "run tests for what changed". Use `poly test diff --short` if you specifically want to scope on **test-code** changes — load `polylith-testing` for that variant. Both feed the same `pytest -k` recipe.
|
|
33
|
+
|
|
34
|
+
## What it verifies
|
|
35
|
+
- Every brick imported by another brick is listed in the consuming project's `[tool.polylith.bricks]`.
|
|
36
|
+
- Every third-party library imported by a project's bricks is declared in that project's `dependencies` and present in the lock file.
|
|
37
|
+
|
|
38
|
+
## Command reference
|
|
39
|
+
|
|
40
|
+
| Option | Default | Description |
|
|
41
|
+
|----------------|---------|---------------------------------------------------------------------------------------------------------|
|
|
42
|
+
| `--strict` | `false` | Stricter name/version matching across projects (catches version drift). |
|
|
43
|
+
| `--verbose` | `false` | Print extra context, including lock-file lookups. |
|
|
44
|
+
| `--quiet` | `false` | Suppress output. Exit code unchanged. |
|
|
45
|
+
| `--alias` | — | Comma-separated `import_name=package_name` aliases. |
|
|
46
|
+
| `--directory` | cwd | Limit the check to projects whose path matches this directory. |
|
|
47
|
+
|
|
48
|
+
## Examples
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Standard CI gate
|
|
52
|
+
uv run poly check
|
|
53
|
+
|
|
54
|
+
# One project only
|
|
55
|
+
uv run poly check --directory projects/user_api
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Common failure modes & Auto-Fixes
|
|
59
|
+
1. **Missing Brick Error:** If the error says a brick imports another brick that isn't in `[tool.polylith.bricks]` → run `poly sync` (load `polylith-sync`).
|
|
60
|
+
2. **Missing Dependency Error:** If the error says a brick imports a third-party library not listed in the project's `dependencies` → load `polylith-dependency-management` and add the library to the project's `pyproject.toml`.
|
|
61
|
+
3. **Version Drift Error:** Under `--strict`, if versions of the same library diverge between projects → inspect `pyproject.toml` or load `polylith-libs` to find the drift, then align versions (or rely on a single root lock file).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polylith-component-creation
|
|
3
|
+
description: Create a Polylith component with `poly create component` — a reusable, isolated brick implementing business logic, a feature, a domain module, or a capability. Use when adding non-entry-point code that bases or other components will import.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Component Creation Skill
|
|
7
|
+
|
|
8
|
+
> 💡 **Terminology:** this skill uses Polylith terms like *brick*, *component*, *namespace*, and *theme*. If they're unfamiliar, load `polylith-concepts` first.
|
|
9
|
+
|
|
10
|
+
## Quick command
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uv run poly create component --name user_service
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Command prefix:** If you do not know the package manager, list lock files with `ls uv.lock poetry.lock pdm.lock 2>/dev/null` (a `pyproject.toml` is always present, so it tells you nothing on its own). Use `uv run poly` (uv), `poetry poly` (poetry), `pdm run poly` (pdm), `hatch run poly` (hatch), or `poly` (activated venv). Examples below use `uv run`.
|
|
17
|
+
|
|
18
|
+
> A **component** is reusable, non-entry-point code (business logic, domain features, capabilities). For entry points (HTTP API, CLI, Lambda handler), use `polylith-base-creation` instead.
|
|
19
|
+
|
|
20
|
+
## Command reference
|
|
21
|
+
|
|
22
|
+
| Option | Required | Default | Description |
|
|
23
|
+
|-----------------|----------|---------|---------------------------------------------------|
|
|
24
|
+
| `--name` | yes | — | Name of the component (also the package name). |
|
|
25
|
+
| `--description` | no | `""` | Optional human-readable description. |
|
|
26
|
+
|
|
27
|
+
## What gets created (loose theme)
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
components/<namespace>/user_service/
|
|
31
|
+
├── __init__.py # Public interface — empty; add re-exports here
|
|
32
|
+
└── core.py # Implementation — empty; user fills it in
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If `[tool.polylith.test].enabled = true` in `workspace.toml`, the CLI also creates `test/components/<namespace>/user_service/test_core.py`.
|
|
36
|
+
|
|
37
|
+
For the `tdd` theme layout (`components/user_service/{src,test}/<namespace>/user_service/...`), load `polylith-workspace-setup`.
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Minimal
|
|
43
|
+
uv run poly create component --name user_service
|
|
44
|
+
|
|
45
|
+
# With description
|
|
46
|
+
uv run poly create component --name greeting --description "Greeting domain"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Notes for the agent
|
|
50
|
+
- Both `core.py` and `__init__.py` are **empty boilerplate**. The component is not "ready" — the user fills in `core.py`, then re-exports its public API from `__init__.py`:
|
|
51
|
+
```python
|
|
52
|
+
# components/<namespace>/user_service/__init__.py
|
|
53
|
+
from <namespace>.user_service.core import create_user, get_user
|
|
54
|
+
```
|
|
55
|
+
- Consumers import via the public interface (`from <namespace>.user_service import create_user`), never via `core.py` directly. `poly deps --interface` (load `polylith-dependency-visualization`) flags violations.
|
|
56
|
+
- A new component is **not** automatically used by any project. It is registered in a project once a base (or another component already in the project) imports it — then run `poly sync` (load `polylith-sync`).
|
|
57
|
+
|
|
58
|
+
## Verification
|
|
59
|
+
After creation, verify the component exists using your file tools (e.g., check `components/<namespace>/<name>/__init__.py`). Then, you will likely need to populate `core.py` and `__init__.py` using your file writing tools since they are created empty.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polylith-concepts
|
|
3
|
+
description: Provides foundational knowledge about Polylith architecture, including the glossary (bases, components, projects, workspaces), theme layouts, and package manager mapping. Use this when you need to understand Polylith terminology or how the repository is structured conceptually before taking action.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Polylith Concepts & Glossary
|
|
7
|
+
|
|
8
|
+
## Glossary
|
|
9
|
+
|
|
10
|
+
### Bricks
|
|
11
|
+
The fundamental units of code in Polylith — **components** and **bases**. Bricks are reusable, isolated, and organized under a single **namespace**.
|
|
12
|
+
|
|
13
|
+
### Components
|
|
14
|
+
Reusable, isolated bricks that implement business logic or capabilities. Components are consumed by bases and by other components, never the other way around.
|
|
15
|
+
|
|
16
|
+
### Bases
|
|
17
|
+
Bricks that serve as the **entry point** of a deployable application — for example HTTP APIs, CLIs, message-queue consumers, AWS Lambda handlers, GCP Cloud Functions, or scheduled jobs. A base wires together components and exposes the application to its runtime.
|
|
18
|
+
|
|
19
|
+
### Namespace
|
|
20
|
+
The top-level Python package name under which all bricks live (e.g. `mycompany`). Defined once in `[tool.polylith].namespace` in `workspace.toml`; shared by every brick.
|
|
21
|
+
|
|
22
|
+
### Workspace
|
|
23
|
+
The root directory of a Polylith repository. Contains `workspace.toml`, the root `pyproject.toml` (which **is** the development project), the `bases/`, `components/`, `projects/`, and `development/` directories, and a single shared lock file.
|
|
24
|
+
|
|
25
|
+
### Projects
|
|
26
|
+
Lightweight `pyproject.toml` configurations under `projects/<name>/` that **reference bricks** to produce deployable artifacts (Docker images, wheels, Lambda packages). Projects contain no Python source code of their own.
|
|
27
|
+
|
|
28
|
+
### Development Project
|
|
29
|
+
The root `pyproject.toml` itself — a single, unified Python environment that includes **every** brick and **every** dependency (production and dev). Used for local development, REPL sessions, and notebooks under `development/`.
|
|
30
|
+
|
|
31
|
+
### Dependencies
|
|
32
|
+
- The **development project** (root `pyproject.toml`) holds **all** dependencies, including dev-only ones.
|
|
33
|
+
- Each **project** under `projects/` holds only its **production** dependencies.
|
|
34
|
+
- With **uv workspaces**, individual projects don't need to pin third-party versions — the root `pyproject.toml` and the shared lock file pin versions centrally.
|
|
35
|
+
|
|
36
|
+
## Package & Dependency Management mapping
|
|
37
|
+
|
|
38
|
+
The `poly` CLI is package-manager-agnostic — only the **command prefix** changes. Each SKILL.md repeats the prefix detection rule inline so the agent doesn't need this README to act. The full table:
|
|
39
|
+
|
|
40
|
+
| Tool | Detection signal | Command prefix |
|
|
41
|
+
|-------------------------------|------------------------------------------------------------------------|-------------------|
|
|
42
|
+
| **uv** (recommended) | `uv.lock` present, or `[tool.uv]` in `pyproject.toml` | `uv run poly …` |
|
|
43
|
+
| **Poetry** | `[tool.poetry]` in `pyproject.toml`, `poetry.lock` | `poetry poly …` (via `poetry-polylith-plugin`) |
|
|
44
|
+
| **PDM** | `[tool.pdm]` in `pyproject.toml`, `pdm.lock` | `pdm run poly …` |
|
|
45
|
+
| **Hatch** | `[tool.hatch]` in `pyproject.toml` | `hatch run poly …`|
|
|
46
|
+
| **Rye** | `requirements.lock` + `[tool.rye]` | `rye run poly …` |
|
|
47
|
+
| **Activated virtualenv** | `$VIRTUAL_ENV` set, or none of the above | `poly …` |
|
|
48
|
+
|
|
49
|
+
If multiple signals are present, prefer the lock file that exists, then `[tool.<x>]` markers, then plain `poly`.
|
|
50
|
+
|
|
51
|
+
## Themes
|
|
52
|
+
|
|
53
|
+
`[tool.polylith.structure].theme` controls the on-disk brick layout:
|
|
54
|
+
|
|
55
|
+
- **`loose`** (recommended) — flat `<bricks_dir>/<namespace>/<brick>/` directories with tests in a top-level `test/` folder. Used by `python-polylith` itself and by most public examples.
|
|
56
|
+
- **`tdd`** — each brick is its own directory with `src/` and `test/` siblings.
|
|
57
|
+
|
|
58
|
+
> The CLI default for `poly create workspace --theme` is **`tdd`**. Always pass `--theme loose` explicitly when loose is wanted.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polylith-dependency-management
|
|
3
|
+
description: Add or manage third-party dependencies in a Polylith workspace. Use when the user wants to install a new library (e.g., requests, fastapi) for a brick or project.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Dependency Management Skill
|
|
7
|
+
|
|
8
|
+
> 💡 **Terminology:** this skill uses Polylith terms like *brick*, *project*, and *development project*. If they're unfamiliar, load `polylith-concepts` first.
|
|
9
|
+
|
|
10
|
+
Polylith manages third-party dependencies differently than standard Python projects.
|
|
11
|
+
|
|
12
|
+
## Rules for adding dependencies
|
|
13
|
+
|
|
14
|
+
1. **The Development Project (Root):**
|
|
15
|
+
**Every** third-party library used anywhere in the workspace must be added to the root `pyproject.toml` (the development project). This ensures local REPLs, tests, and the shared lockfile work correctly. Use your package manager (e.g., `uv add <package>`, `poetry add <package>`) at the workspace root.
|
|
16
|
+
2. **Deployable Projects (`projects/<name>`):**
|
|
17
|
+
If a library is required for production by a specific deployable project, it must **also** be added to that project's `pyproject.toml` under `projects/<name>/`. Do this by manually editing the `dependencies` array in `projects/<name>/pyproject.toml`.
|
|
18
|
+
|
|
19
|
+
> ⚠ **Never add dependencies to a brick's directory.** Bricks do not have their own `pyproject.toml` files.
|
|
20
|
+
|
|
21
|
+
## Example Workflow: Adding `requests` to an `api` project
|
|
22
|
+
|
|
23
|
+
1. Install it at the root so the lockfile updates and it's available for local development:
|
|
24
|
+
```bash
|
|
25
|
+
uv add requests
|
|
26
|
+
```
|
|
27
|
+
2. Manually add it to the deployable project that needs it:
|
|
28
|
+
Edit `projects/api/pyproject.toml`.
|
|
29
|
+
|
|
30
|
+
**Important Versioning Rule:** Before adding the dependency to the project, check the root `pyproject.toml`. If it contains a `[tool.uv.workspace]` section (e.g., `members = ["projects/*"]`), then `uv workspaces` is enabled.
|
|
31
|
+
|
|
32
|
+
If `uv workspaces` is enabled, **do not specify the version** in the project's `pyproject.toml`. Just use the package name, because versions are centrally pinned in the root. If workspaces are not enabled, then you should specify the version.
|
|
33
|
+
|
|
34
|
+
```toml
|
|
35
|
+
# WITH uv/poetry workspaces enabled (Recommended):
|
|
36
|
+
dependencies = [
|
|
37
|
+
"requests"
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
# WITHOUT workspaces enabled:
|
|
41
|
+
dependencies = [
|
|
42
|
+
"requests>=2.31.0"
|
|
43
|
+
]
|
|
44
|
+
```
|
|
45
|
+
3. Run `poly check` (load `polylith-check`) to verify the workspace is valid. `poly check` will catch if a project imports `requests` but forgot to declare it in its `pyproject.toml`.
|
|
46
|
+
|
|
47
|
+
## Notes for the agent
|
|
48
|
+
- Use `poly libs` (load `polylith-libs`) to inspect current dependency usage across projects.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polylith-dependency-visualization
|
|
3
|
+
description: Visualize **brick × brick** dependencies with `poly deps` — find circular dependencies, inspect a brick's public interface, and detect interface-bypass violations. Use for "what depends on what", "circular deps", "interface violation". For brick × project usage, use `polylith-workspace-inspection`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Dependency Visualization Skill
|
|
7
|
+
|
|
8
|
+
## Quick command
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
uv run poly deps
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Command prefix:** If you do not know the package manager, list lock files with `ls uv.lock poetry.lock pdm.lock 2>/dev/null` (a `pyproject.toml` is always present, so it tells you nothing on its own). Use `uv run poly` (uv), `poetry poly` (poetry), `pdm run poly` (pdm), `hatch run poly` (hatch), or `poly` (activated venv). Examples below use `uv run`.
|
|
15
|
+
|
|
16
|
+
> **`poly deps` vs `poly info`:**
|
|
17
|
+
> - `poly deps` → **brick × brick** (dependencies between bricks; interface compliance).
|
|
18
|
+
> - `poly info` → **brick × project** (which projects use which brick). Load `polylith-workspace-inspection`.
|
|
19
|
+
> ⚠ `poly deps` does **not** fail on warnings (circular deps, interface violations are informational). For pass/fail, use `poly check` (load `polylith-check`).
|
|
20
|
+
|
|
21
|
+
## Command reference
|
|
22
|
+
|
|
23
|
+
| Option | Default | Description |
|
|
24
|
+
|----------------|---------|----------------------------------------------------------------------------------------------|
|
|
25
|
+
| `--brick` | — | Restrict output to the named brick. |
|
|
26
|
+
| `--interface` | `false` | Show the brick's public interface and flag bricks that bypass it. |
|
|
27
|
+
| `--save` | `false` | Persist the report to a file under the workspace's output dir. |
|
|
28
|
+
| `--directory` | cwd | Restrict analysis to projects whose path matches this directory. |
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Full matrix
|
|
34
|
+
uv run poly deps
|
|
35
|
+
|
|
36
|
+
# One brick + interface compliance check
|
|
37
|
+
uv run poly deps --brick message --interface
|
|
38
|
+
|
|
39
|
+
# Save report
|
|
40
|
+
uv run poly deps --save
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Output format
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
d g
|
|
47
|
+
a r m
|
|
48
|
+
t e e s
|
|
49
|
+
a e k s c
|
|
50
|
+
b t a s h
|
|
51
|
+
a i f l a e
|
|
52
|
+
s n k o g m
|
|
53
|
+
brick e g a g e a
|
|
54
|
+
─────────────────────────────────────────────
|
|
55
|
+
greeting - - - - - -
|
|
56
|
+
kafka - - - ✔ - -
|
|
57
|
+
message ✔ - ✔ - - ✔
|
|
58
|
+
greet_api - ✔ - ✔ - -
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`✔` = row brick imports column brick.
|
|
62
|
+
|
|
63
|
+
### Warning messages
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
ℹ brick_a is used by brick_b and also uses brick_a. # circular
|
|
67
|
+
ℹ Found in brick_a: helloworld is not part of the public interface of brick_b. # interface violation
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Fixing an interface violation
|
|
71
|
+
|
|
72
|
+
When `--interface` reports a violation:
|
|
73
|
+
1. Identify the offending import in the violating brick (e.g. `from <ns>.brick_b.internal import helloworld`).
|
|
74
|
+
2. Add `helloworld` to `<ns>/brick_b/__init__.py`:
|
|
75
|
+
```python
|
|
76
|
+
from <ns>.brick_b.internal import helloworld
|
|
77
|
+
```
|
|
78
|
+
3. Update the importer to `from <ns>.brick_b import helloworld`.
|
|
79
|
+
4. Re-run `poly deps --interface` to confirm.
|
|
80
|
+
|
|
81
|
+
## Notes for the agent
|
|
82
|
+
- Circular deps usually mean two bricks share a concept that should be extracted into a third brick — flag this for the user; don't silently break the cycle by hiding imports.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polylith-diff
|
|
3
|
+
description: List Polylith bricks whose **implementation** changed since a git tag using `poly diff`. Use for release notes, selective deploys ("which projects need rebuilding?"), and PR scope review. For TEST-code diffs, use `polylith-testing` instead.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diff Skill
|
|
7
|
+
|
|
8
|
+
## Quick command
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# Human-readable (default)
|
|
12
|
+
uv run poly diff
|
|
13
|
+
|
|
14
|
+
# Pipe-friendly: comma-separated list of changed bricks (use this in scripts)
|
|
15
|
+
uv run poly diff --bricks --short
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
> **Agent rule of thumb:** when the goal is to *do something* with the result (run pytest, drive a deploy script, render a list), reach for `--bricks --short` first. The default output is for human readers.
|
|
19
|
+
|
|
20
|
+
**Command prefix:** If you do not know the package manager, list lock files with `ls uv.lock poetry.lock pdm.lock 2>/dev/null` (a `pyproject.toml` is always present, so it tells you nothing on its own). Use `uv run poly` (uv), `poetry poly` (poetry), `pdm run poly` (pdm), `hatch run poly` (hatch), or `poly` (activated venv). Examples below use `uv run`.
|
|
21
|
+
|
|
22
|
+
> **`poly diff` vs `poly test diff`:**
|
|
23
|
+
> - `poly diff` → brick **implementation** changes since a tag (drives releases/deploys).
|
|
24
|
+
> - `poly test diff` → **test-code** changes since a tag (drives selective test runs). Load `polylith-testing`.
|
|
25
|
+
|
|
26
|
+
## Tag selection
|
|
27
|
+
- Default: latest git tag matching `[tool.polylith.tag.patterns].stable` from `workspace.toml` (e.g. `stable-*`).
|
|
28
|
+
- `--since <ref>` — pin a specific tag, branch, or commit-ish. The CLI tries to resolve `<ref>` as a configured pattern key first, then falls through to using it literally with `git diff <ref>`.
|
|
29
|
+
|
|
30
|
+
## Command reference
|
|
31
|
+
|
|
32
|
+
| Option | Default | Description |
|
|
33
|
+
|--------------|---------------------|------------------------------------------------------------------------------------------------------------|
|
|
34
|
+
| `--since` | latest matching tag | Reference tag (or branch/commit) to diff against. |
|
|
35
|
+
| `--short` | `false` | Compact output. Combined with `--bricks`, emits a comma-separated list of brick names — pipe-friendly. |
|
|
36
|
+
| `--bricks` | `false` | Print the list of bricks that changed (human-readable on its own; CSV when paired with `--short`). |
|
|
37
|
+
| `--deps` | `false` | With `--bricks`, also print bricks that **depend on** the changed bricks (transitive impact). |
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Default: against latest stable-* tag
|
|
43
|
+
uv run poly diff
|
|
44
|
+
|
|
45
|
+
# Selective deploy: every brick changed (incl. transitive consumers) since a release tag
|
|
46
|
+
uv run poly diff --since stable-4 --bricks --deps
|
|
47
|
+
|
|
48
|
+
# Pipe-friendly: comma-separated names of bricks changed vs. main
|
|
49
|
+
uv run poly diff --since main --bricks --short
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Running tests for changed bricks
|
|
53
|
+
|
|
54
|
+
The established Polylith pattern is to feed `--bricks --short` straight into `pytest -k`: brick names become an `or`-expression that pytest matches against test IDs, so the agent doesn't need to resolve namespace / theme / base-vs-component.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
changes="$(uv run poly diff --bricks --short)"
|
|
58
|
+
[ -n "$changes" ] && uv run pytest -k "${changes//,/ or }"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Example: `--bricks --short` outputs `log,message` → pytest runs as `pytest -k "log or message"`, collecting every test whose ID contains `log` or `message` (matches `test/components/<ns>/log/...` and `test/bases/<ns>/log/...` alike).
|
|
62
|
+
|
|
63
|
+
> ⚠ `pytest -k` does **substring** matching, so a brick named `log` will also match tests whose name contains `log` (e.g. an unrelated `logger` brick or a `test_login` function). For short/generic brick names, fall back to passing explicit test directories.
|
|
64
|
+
|
|
65
|
+
## Notes for the agent
|
|
66
|
+
- Operates on git's view of the working tree — uncommitted changes since the tag count as changed.
|
|
67
|
+
- If no matching tag exists and `--since` isn't passed, the command prints `No matching tags or commits found in repository.` and exits 0. Guard scripts so they don't run `pytest -k ""` (which would collect nothing or, worse, every test depending on the version).
|
|
68
|
+
- Map changed bricks → projects with `poly info` (load `polylith-workspace-inspection`) to drive selective deploys.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polylith-libs
|
|
3
|
+
description: Inspect third-party libraries used per Polylith project with `poly libs`. Use when the user wants to see dependency usage, audit version drift across projects, find which projects use a given library, or compare library declarations vs. the lock file. Read-only — for a CI gate use `polylith-check` instead.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Libs Skill
|
|
7
|
+
|
|
8
|
+
## Quick command
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
uv run poly libs
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Command prefix:** If you do not know the package manager, list lock files with `ls uv.lock poetry.lock pdm.lock 2>/dev/null` (a `pyproject.toml` is always present, so it tells you nothing on its own). Use `uv run poly` (uv), `poetry poly` (poetry), `pdm run poly` (pdm), `hatch run poly` (hatch), or `poly` (activated venv). Examples below use `uv run`.
|
|
15
|
+
|
|
16
|
+
> `poly libs` **reports**; `poly check` **fails the build**. Use `libs` for inspection, `check` for CI (load `polylith-check`).
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
- A Polylith workspace with at least one project.
|
|
20
|
+
- A lock file at the root (`uv.lock`, `poetry.lock`, or `pdm.lock`).
|
|
21
|
+
|
|
22
|
+
## Command reference
|
|
23
|
+
|
|
24
|
+
| Option | Default | Description |
|
|
25
|
+
|----------------|---------|--------------------------------------------------------------------------------------------------------|
|
|
26
|
+
| `--strict` | `false` | Stricter matching of names and versions across projects. |
|
|
27
|
+
| `--directory` | cwd | Limit output to projects whose path matches this directory. |
|
|
28
|
+
| `--alias` | — | Comma-separated `import_name=package_name` aliases. |
|
|
29
|
+
| `--short` | `false` | Compact view — useful for wide workspaces. |
|
|
30
|
+
| `--save` | `false` | Persist the report to a file under the workspace's output dir. |
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Full library × project matrix
|
|
36
|
+
uv run poly libs
|
|
37
|
+
|
|
38
|
+
# Strict version-drift detection
|
|
39
|
+
uv run poly libs --strict
|
|
40
|
+
|
|
41
|
+
# Compact view for many projects
|
|
42
|
+
uv run poly libs --short
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## How to read it
|
|
46
|
+
- Rows are third-party libraries; columns are projects.
|
|
47
|
+
- `✔` = the library is used by that project.
|
|
48
|
+
- A library used by multiple projects with **different versions** = version drift. Fix by aligning versions in the relevant project `pyproject.toml`s, or by relying on a central lock file (uv workspaces).
|
|
49
|
+
|
|
50
|
+
## Notes for the agent
|
|
51
|
+
- `poly libs` is **read-only** — it never modifies `pyproject.toml` or the lock file.
|