Data Model: Doctrine Org Init From Template

No persistent database. Entities are in-memory / filesystem values for one org init invocation.

Entities

RenderRequest

FieldTypeRules
pack_pathPathDestination directory (PACK_PATH). Distinct from local_path.
templatestr \None
org_namestr \None
local_pathstr \None
branchstr \None
forceboolOverwrite existing pack_path when true.

Invariants

  • If template is None: org_name / local_path / branch must not be required.
  • If template is set: org_name must be present and pass validation before write.
  • pack_path and local_path are never aliased.

ResolvedTemplateSource

FieldTypeRules
kindlocal \git
rootPathReadable directory root to copy from
refstr \None
cleanupboolTrue when root is a temp clone that must be removed after render

ValidationResult

FieldTypeRules
okbool
rule_idstr \None
messagestr \None

IgnoreRules

FieldTypeRules
patternslist[str]From .templateignore plus built-ins (.git/, .templateignore)
matches(rel_path)boolTrue → exclude from copy

State transitions (template path)

inputs → validate(org_name, local_path, branch+template)
      → resolve(template, branch) → source tree
      → ensure pack_path writable (exists/force)
      → copy(source → pack_path, ignore)
      → substitute(pack_path, org_name, local_path)
      → assert_no_leftover_tokens(pack_path)
      → success | rollback partial destination on failure after write start

Atomicity: Prefer write into a temp directory beside or under PACK_PATH then replace/move into place when PACK_PATH did not exist; when --force on an existing tree, document best-effort replace and clean up temp on failure. Minimal scaffold path keeps today’s direct write behaviour for compatibility.

Token values

TokenSource fieldNotes
{{ORG_NAME}}validated org_namePlain-text replace
{{LOCAL_PATH}}resolved local_pathDefault pack