Skip to content

yggdrasil.loki.scaffold

scaffold

Project scaffolding — a ready-to-push repo from scratch, any language.

Loki's "new project" path: lay down a clean, git-initialised repository with a README, a composed .gitignore, and one folder per language — each with src/ + tests/ and a pre-built manifest (pyproject.toml for Python, package.json for TypeScript, Cargo.toml for Rust, go.mod for Go) — then make the initial commit so it's ready to git push to GitHub.

Data over code: the per-language layout lives in :data:LANGUAGES (manifest + src/tests starter files + ignore lines); :func:scaffold_project just renders the templates, writes the tree, and runs git. Add a language by adding a row, not a branch.

ScaffoldResult dataclass

ScaffoldResult(
    name: str,
    path: str,
    preset: str,
    languages: list[str] = list(),
    cloud: list[str] = list(),
    unknown_languages: list[str] = list(),
    files: list[str] = list(),
    git: bool = False,
    push: str = "",
)

Bases: DictResult

What a scaffold produced (mapping-compatible; to_dict for JSON).

resolve_languages

resolve_languages(text: str) -> list[str]

The languages named in text (word-boundary match) → canonical keys.

Empty when none are mentioned — the caller defaults (to Python). Used by the autonomous router so "scaffold a rust + python cli" picks both.

resolve_preset

resolve_preset(text: str) -> str

The app preset named in text, or "lib" (per-language skeleton).

resolve_cloud

resolve_cloud(text: str) -> list[str]

Cloud deploy targets named in text (aws / databricks).

scaffold_project

scaffold_project(
    name: str,
    languages: Optional[list[str]] = None,
    *,
    preset: str = "lib",
    cloud: Optional[list[str]] = None,
    base_dir: Optional[str] = None,
    description: Optional[str] = None,
    git: bool = True
) -> ScaffoldResult

Create a ready-to-push project tree, then git init + initial commit.

preset="lib" (default) lays down one <language>/ folder per language (src/tests + manifest). A full-app preset (e.g. "fullstack-realtime") lays down a coherent runnable app instead — a real-time FastAPI backend (WebSocket + SSE), a live frontend, Docker + CI — and cloud=["aws","databricks"] adds the matching deploy add-ons. Returns the path, file list, languages/preset/cloud used, and the push hint.