Workspace patcher
workspace_patcher
Workspace patcher — patch root files after member scaffold.
Provides idempotent patching functions for workspace root files
(Makefile, mkdocs.yml, pyproject.toml, ci.yml, publish.yml, release.yml)
when a new member sub-package is added via scaffold --member.
patch_all(root, member_name)
Run all workspace patches for member_name.
Calls each patch_* function and collects the names of
successfully patched files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Workspace root directory. |
required |
member_name
|
str
|
Name of the new member package. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of patched file names (relative to root). |
Source code in packages/axm-init/src/axm_init/adapters/workspace_patcher.py
patch_ci(root, member_name)
Add member_name to CI matrix package list.
Inserts the package name in the strategy.matrix.package list
of .github/workflows/ci.yml.
Idempotent — skips if already present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Workspace root directory. |
required |
member_name
|
str
|
Name of the new member package. |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in packages/axm-init/src/axm_init/adapters/workspace_patcher.py
patch_makefile(root, member_name)
Append per-package test/lint targets for member_name.
Adds test-<name> and lint-<name> Makefile targets.
Idempotent — skips if targets already exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Workspace root directory. |
required |
member_name
|
str
|
Name of the new member package. |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in packages/axm-init/src/axm_init/adapters/workspace_patcher.py
patch_mkdocs(root, member_name)
Add !include nav entry for member_name.
Appends a nav entry referencing the member's mkdocs.yml
so the monorepo plugin picks it up.
Idempotent — skips if entry already exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Workspace root directory. |
required |
member_name
|
str
|
Name of the new member package. |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in packages/axm-init/src/axm_init/adapters/workspace_patcher.py
patch_publish(root, member_name)
Add tag trigger pattern for member_name.
Adds a <member_name>/v* tag pattern to the publish workflow's
on.push.tags or on.release trigger.
Idempotent — skips if already present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Workspace root directory. |
required |
member_name
|
str
|
Name of the new member package. |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in packages/axm-init/src/axm_init/adapters/workspace_patcher.py
patch_pyproject(root, member_name)
Add member_name to workspace dependencies and UV sources.
Adds the package to [project.dependencies] and adds a
[tool.uv.sources.<member_name>] entry with workspace = true.
Idempotent — skips if already present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Workspace root directory. |
required |
member_name
|
str
|
Name of the new member package. |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in packages/axm-init/src/axm_init/adapters/workspace_patcher.py
patch_release(root, member_name)
Add tag trigger and detect block for member_name in release.yml.
Adds a <member_name>/v* tag pattern and a corresponding
detect block (elif branch) to the release workflow so git-cliff
scopes changelogs per-package.
Idempotent — skips if already present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Workspace root directory. |
required |
member_name
|
str
|
Name of the new member package. |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in packages/axm-init/src/axm_init/adapters/workspace_patcher.py
patch_testpaths(root, member_name)
Ensure root testpaths includes packages/<member_name>/tests.
Adds the test directory of member_name to
[tool.pytest.ini_options].testpaths in the root pyproject.toml.
Creates the section if it doesn't exist.
Idempotent — skips if path already listed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Workspace root directory. |
required |
member_name
|
str
|
Name of the new member package. |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |