Scaffolder
scaffolder
Shared scaffolding seam.
Single source of truth for the pieces that both the CLI (:mod:axm_init.cli)
and the MCP tool (:mod:axm_init.tools.scaffold) need when scaffolding a
workspace member: the copier template-variable build, workspace-root
resolution, and workspace-name read. Neither interface layer keeps a private
copy of this logic.
build_member_data(member_name, workspace_name, scaffold_data, *, license_holder=None)
Build copier template variables for a workspace member scaffold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
member_name
|
str
|
Name of the new member package. |
required |
workspace_name
|
str
|
Parent workspace name (used for URLs). |
required |
scaffold_data
|
Mapping[str, str]
|
Caller identity fields — |
required |
license_holder
|
str | None
|
Explicit LICENSE holder; falls back to |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
The template-variable dict passed verbatim to copier. Identical inputs |
dict[str, str]
|
yield a byte-identical dict whatever the calling interface. |
Source code in packages/axm-init/src/axm_init/core/scaffolder.py
next_experiment_index(experiments_dir)
Return the next free experiment index inside experiments_dir.
The index belongs to the scaffolding layer, never to the copier template:
an experiment directory is named {index:02d}-{slug}, so the next free
index is one past the highest index already present. A missing or empty
experiments/ directory yields 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experiments_dir
|
Path
|
The paper's |
required |
Returns:
| Type | Description |
|---|---|
int
|
The next free one-based index. |
Source code in packages/axm-init/src/axm_init/core/scaffolder.py
read_workspace_name(workspace_root)
Read the workspace name from pyproject.toml or fall back to dir name.
Source code in packages/axm-init/src/axm_init/core/scaffolder.py
resolve_workspace_root(target_path)
Resolve the workspace root for target_path, or None.
Returns target_path itself when it is a workspace root, the parent
workspace root when target_path is a member, and None otherwise.