Code Generation
engine
¶
Sync engine — orchestrates the full code generation pipeline.
Reads the ASD from .ninjastack/schema.json, detects changes via the differ, runs the appropriate generators, and writes output into the project tree.
SyncResult
dataclass
¶
SyncResult(
generated_files: list[Path] = list(),
diff: ASDDiff | None = None,
skipped: bool = False,
)
Result of a sync operation.
sync
¶
sync(
root: Path | None = None,
output_dir: Path | None = None,
force: bool = False,
) -> SyncResult
Run the full sync pipeline.
| PARAMETER | DESCRIPTION |
|---|---|
root
|
Project root containing .ninjastack/. Defaults to cwd.
TYPE:
|
output_dir
|
Where to write generated code. Defaults to root.
TYPE:
|
force
|
If True, skip change detection and regenerate everything.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SyncResult
|
SyncResult with list of generated files and diff info. |
Source code in libs/ninja-codegen/src/ninja_codegen/engine.py
sync_schema
¶
sync_schema(
schema: AgenticSchema,
root: Path | None = None,
output_dir: Path | None = None,
force: bool = False,
) -> SyncResult
Run the sync pipeline from an in-memory AgenticSchema.
| PARAMETER | DESCRIPTION |
|---|---|
schema
|
The ASD to generate from.
TYPE:
|
root
|
Project root for snapshot storage. Defaults to cwd.
TYPE:
|
output_dir
|
Where to write generated code. Defaults to root.
TYPE:
|
force
|
If True, skip change detection and regenerate everything.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SyncResult
|
SyncResult with list of generated files and diff info. |