Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Project templates

Platform spec feature

Project templates

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

What this feature specifies

Project templatesbeskid.template.v1, project/workspace/item scaffolding, {{ }} placeholders, GUID regeneration, path/git/registry sources, update checks, and corelib policy on instantiated hosts.

Implementation anchors

  • Planned template engine under compiler/crates/beskid_cli/src/template/
  • compiler/crates/beskid_analysis/src/projects/model.rsProjectKind::Template
  • pckg/src/Server/Services/PackageArtifactValidator.cs — template profile
  • First-party packages beskid.templates.console, beskid.templates.lib, beskid.templates.project

Contract statement

Beskid templates are versioned trees of files plus a beskid.template.v1 manifest that drives project, workspace, and item scaffolding. Templates may be sourced from a pckg template package, a local directory, or a git URL (with optional subdirectory and ref). Instantiation must support interactive prompts and non-interactive CLI flags for the same symbol set.

Template content is not required to build as a standalone runnable project before instantiation; authors validate templates by instantiating into a scratch directory and running beskid build / beskid test on the output.

Any host project shape (Host, Mod, or future kinds) may appear in template output—templates impose no restriction on scaffolded project.type or targets.

Inputs and outputs

InputDescription
Template sourceRegistry package (packageKind: template), filesystem path, or git remote + ref
User parametersSymbol values from flags and/or prompts
Output locationNew directory, existing project root (item templates), or workspace root
OutputFiles on disk: optional Workspace.proj, one or more Project.proj trees, .bd sources, supporting assets
Side effectsPost-actions (see flow); beskid lock recommended for project/workspace outputs
CorelibEvery instantiated host project must resolve corelib implicitly—see design model

State model

StateLocationLifecycle
Installed template snapshotUser-level tooling cache (exact path normative in beskid new)Updated on beskid new install and when update check finds a newer registry version
Template manifest.beskid/template.json at template root inside package or git checkoutImmutable for a given package version / git ref
Authoring projectProject.proj with type: TemplatePublished as template package; excluded from normal app compile graphs
Instantiation sessionEphemeralSymbol table → file operations → post-actions

Algorithms and flow

High-level flow is specified in flow and algorithm. Update detection runs on each use of a template (registry, path, or git) before instantiation.

Edge cases and errors

  • Yanked registry template version: CLI must emit a warning and may continue if the user does not abort (see contracts).
  • Output exists: project/workspace templates must fail by default when the target directory is non-empty unless --force (exact flag in beskid new).
  • Item template target not inside a discovered Project.proj: must error with E19xx diagnostic.
  • Invalid {{ }}: unresolved placeholders after substitution must fail instantiation.
  • GUID list: every guid in the guids array must be replaced with a newly generated guid preserving source format—see design model.

Compatibility and versioning

  • Engine schema: beskid.template.v1 (breaking changes require new schema id and migration notes).
  • Template packages use the same registry-assigned semver as library packages; template identity string includes package id and version.
  • No host constraints block (OS, SDK version, etc.)—templates are always eligible when installed.

Security and performance notes

  • Post-actions are not whitelist-gated; manifest declares action ids and arguments. Hosts must document supported actions; unknown actions should warn and skip (not fail entire run) unless --strict-post-actions is set (see beskid new).
  • Git templates must pin ref by default (--git-ref); floating default branch is allowed only when explicitly requested.
  • Large template trees should use sources.exclude aggressively to avoid copying build artifacts.

Examples

See examples for console app, class library, workspace, item, and template-authoring samples.

Verification and traceability

  • Schema fixtures: beskid.template.v1 golden files under planned compiler/crates/beskid_tests/src/projects/templates/
  • Round-trip: instantiate → beskid lockbeskid build for first-party beskid.templates.*
  • Item template: add file under existing Project.projbeskid analyze clean

Decisions

No open decisions. Closed choices are normative ADRs under adr/ (D-TOOL-SCAFF-0001D-TOOL-SCAFF-0010); use the reader ADRs tab for detail. Legacy decisions record is a migration index only.

Articles