symfonic.cli.init¶
init ¶
Project scaffolder -- renders the symfonic init starter template.
The scaffolder walks src/symfonic/cli/templates/ and emits every
file into <output_dir>/<project_name>/. .j2 files are rendered
with Jinja2 using a context derived from the CLI arguments; plain
files are copied verbatim. The function is fully offline -- no HTTP
calls during init.
Component filtering is handled in two complementary ways:
-
File-level skip -- entire template files that belong exclusively to an omitted component are not written at all (e.g.
app/auth/,alembic/versions/002_chats.py,webapp/). -
Jinja2 conditionals -- cross-cutting concerns inside a single file (e.g. router imports in
app/main.py) are gated with{% if has_auth %}/{% if has_chats %}etc. so the rendered output is clean regardless of which components are selected.
ScaffolderError ¶
Bases: RuntimeError
Raised when the scaffolder cannot complete generation.
scaffold ¶
scaffold(project_name: str, components: list[str], llm_provider: str, output_dir: Path, force: bool = False) -> Path
Generate a starter project under <output_dir>/<project_name>/.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_name
|
str
|
Directory-safe slug (letters, digits, dashes, underscores). |
required |
components
|
list[str]
|
Subset of |
required |
llm_provider
|
str
|
One of |
required |
output_dir
|
Path
|
Parent directory where the project folder will be created. |
required |
force
|
bool
|
If True, overwrite files in an existing target directory instead of failing. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The absolute path of the newly-created project directory. |
Raises:
| Type | Description |
|---|---|
ScaffolderError
|
When inputs are invalid or the target directory already exists (and force is False). |