Skip to content

feat: asobi init --template <engine> scaffolder#31

Merged
Taure merged 2 commits into
mainfrom
feat/init-template
Jul 7, 2026
Merged

feat: asobi init --template <engine> scaffolder#31
Taure merged 2 commits into
mainfrom
feat/init-template

Conversation

@Taure

@Taure Taure commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Implements #29 (onboarding upgrade). asobi init <dir> --template <engine> fetches a runnable demo into a fresh directory so first success needs no glue code.

asobi init mygame --template godot   # -> project.godot, scenes, scripts, README, ...
asobi init mygame                    # unchanged: server-only Lua starter

Design (architecture-guardian approved)

  • Templates = the existing demo repos (asobi-{defold,godot,unity}-demo), the single source of truth - no parallel templates to drift. Each demo's own (cross-platform) README documents starting the backend + opening in the engine, so next-steps just point there.
  • Pinned by immutable commit SHA. The demos have no release tags yet; pinning by SHA honours 'never main'. Follow-up: cut demo release tags and switch Ref to tags.
  • --template replaces the default scaffold entirely; no-flag init is byte-for-byte unchanged.

Security (extracting a downloaded archive)

  • Strips the <repo>-<sha>/ wrapper; safeJoin rejects absolute paths and .. traversal; symlinks/hardlinks/devices are skipped (never materialised from the archive); file-count + total-byte caps guard against bombs; refuses a non-empty target dir.

Tests

  • Unit: engine registry, prefix strip + write, traversal rejection, symlink skip, empty-dir requirement, unknown-engine error.
  • TestFetchE2E (network, gated by ASOBI_TEMPLATE_E2E=1) is the anti-drift guard the guardian asked for: fetches the pinned defold demo and asserts game.project extracts. Verified locally (defold fetch + real init --template godot run).

gofmt / go vet / go build / go test ./... all clean.

Next in the initiative: #30 (asobi dev), then asobi_site#80 (samples gallery).

Taure added 2 commits July 7, 2026 09:51
Fetch a runnable client+backend demo (defold|godot|unity) into a fresh
dir, so first success needs no glue. Templates are the existing demo repos
pinned by immutable commit (single source of truth, no parallel templates);
each demo's README documents the backend + engine steps.

Extraction is defensive against hostile archives: strips the wrapper dir,
rejects path traversal and absolute paths, skips symlinks/hardlinks, and
caps file count + total bytes. No-flag 'asobi init' behaviour is unchanged.

Closes #29.
The demo repos now auto-cut tags via a release workflow, so pin by tag
instead of commit SHA (asobi-{defold,godot,unity}-demo v0.1.0).
@Taure
Taure merged commit 1b68652 into main Jul 7, 2026
1 check passed
@Taure
Taure deleted the feat/init-template branch July 7, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant