create-genlayer-app
v0.1.0
Published
Scaffold a GenLayer intelligent-contract project. Fixes the defects in `genlayer new` v0.39.1.
Maintainers
Readme
create-genlayer-app
A scaffolder for GenLayer intelligent-contract projects, designed to be donated upstream rather than to compete with it.
genlayer new <name> (in genlayer-cli v0.39.1) ships a working but
stale template: the contract pins the local-only runner alias
py-genlayer:test and cannot be deployed to any GenLayer network; the
generated project version-drifts on genlayer-js; and the test layout
contradicts the official genlayer-dev skill. This package produces the
same kind of project without those defects, using the same contract
APIs and the same skill layout, so the two scaffolders stay in lock-step
and the upstream patches remain drop-in.
Where this lives. This package's source, issues, and homepage are in the contributor's own GitHub namespace (
PratikshaGayen), not thegenlayerlabsorg. If the team adopts this upstream, the URLs below move to thegenlayerlabsorg at that point — not before.
npx create-genlayer-app my-app
cd my-app
npm install
genvm-lint check contracts/storage.py
pytest tests/direct/ -vWhat you get
- Storage contract (
minimal) or LLM contract (llm). - React or Vue 3 frontend wired to it via
genlayer-js. - Wallet connect (
window.ethereum), one read call, one write call — exactly enough to exercise the full SDK surface without becoming an example app. tests/direct/running in milliseconds viagenlayer-test(no server, no Docker). Thellmtemplate also exercises the production string-parse path of the LLM response handler.tests/integration/stub for Studio/testnet runs.gltest.config.yamlwith the v0.29.x schema, sopytestandgltestboth work out of the box.genvm-linterpinned inrequirements.txt.
Template x frontend matrix
| | react | vue |
|---|---|---|
| minimal (storage) | yes | yes |
| llm (WizardOfCoin, run_nondet_unsafe) | yes | yes |
All 4 combinations are exercised by .github/workflows/ci.yml on every
push and PR, on ubuntu-latest and windows-latest.
Quickstart
npx create-genlayer-app my-app
# (interactive) pick template + frontend, or pass them:
npx create-genlayer-app my-app --template minimal --frontend react --yes
cd my-app
npm install
pip install -r requirements.txt
genvm-lint check contracts/storage.py
pytest tests/direct/ -v
genlayer deploy --contract contracts/storage.py # then set VITE_CONTRACT_ADDRESSComparison vs genlayer new v0.39.1
This is the honest version. Every row links to the evidence in
docs/GAP-ANALYSIS.md. Defect numbers match
the gap-analysis table.
| # | Defect in genlayer new v0.39.1 | genlayer new | create-genlayer-app |
|---|---|---|---|
| 1 | Contract pins the local-only test runner alias — cannot deploy to testnet. Evidence | pins py-genlayer:test | pins py-genlayer:1jb45aa8ynh2a9c9xn3b7qqh8sm5q93hwfp7jqmwsfhh8jpz09h6 (matches the official genlayer-dev skill) |
| 2 | genlayer-js version drift inside one project (^0.9.0 at root, 0.8.0 exact in app/). Evidence | drift | single pinned version in both package.json and app/package.json; CI asserts no drift |
| 3 | No gltest.config.yaml (the gltest CLI warns on first run). Evidence | missing | ships with the v0.29.x schema (paths, networks, environment) |
| 4 | Single flat test/ folder; docs prescribe tests/direct/ + tests/integration/. Evidence | flat test/ | tests/direct/ (runs via pytest, no Docker) + tests/integration/ stub |
| 5 | 7 files of hand-rolled JSON-RPC vendored into every user project. Evidence | tools/{calldata,transactions,accounts,...}.py | not vendored; the SDKs cover it |
| 6 | genvm-linter missing from requirements.txt. Evidence | missing | pinned at genvm-linter==0.11.0 |
| 7 | One hardcoded Vue/football-bets template. Evidence | Vue 3 only, betting app only | two templates (minimal, llm) x two frontends (react, vue); no betting app |
| 8 | Equivalent-principle example uses strict_eq for an LLM call (always fails consensus). Evidence | gl.eq_principle.strict_eq(nondet) on LLM output | run_nondet_unsafe with partial-field comparison — the shape the official docs prescribe |
This package is not trying to be a better genlayer new for end users —
the official CLI is the right place for that. It is a clean, narrow
proposal for the fixes themselves, designed so that every one of the 8
patches can be backported to genlayer-cli/templates/default/ as a
small, reviewable PR. See docs/SUBMISSION.md
for the adoption path.
Verified
- CLI: scaffolds all 4 (template, frontend) combinations with zero manual edits.
genvm-lint check: passes for both contracts (StorageandWizardOfCoin).pytest tests/direct/ -v: 5/5 pass onminimal+react, 5/5 onminimal+vue, 10/10 onllm+react, 10/10 onllm+vue— on Python 3.12 via thegenlayer-test0.29.2 pytest plugin.- CI matrix: 2 OS (ubuntu-latest, windows-latest) x 2 templates x
2 frontends = 8 cells, all green on a clean runner. The Windows
conftest shim is covered by
windows-latestso a Windows-only regression cannot slip through. - Invariant checks in CI: single
genlayer-jsversion across the whole tree; nopy-genlayer:test/:latestanywhere.
Not verified (be honest)
- Integration tests (
tests/integration/) are stubbed. They need a running Studio or testnet to exercise. CI does not run them. genlayer-jsAPI surface: the frontend importscreateClient,readContract,writeContract,connect, andwaitForTransactionReceipt— all of which are documented in the upstream README. The build succeeds and the call sites type-check, but they have not been exercised against a live chain in this repo.genvm-lint"newer runner available" notice: the linter reports a newer runner hash than the one this template pins. The pinned hash is the one published by the officialgenlayer-devskill at the time of writing; the linter is a stronger source of truth for what is available, the skill is the source of truth for what is documented and tested against this template.- No npm publish yet. The package is ready to be published
(
npm pack --dry-runreports the intended tarball contents); the publish call is yours.
Project layout
.
├── .github/workflows/ci.yml # 8-cell matrix; scaffold, lint, test, invariants
├── src/ # TypeScript CLI (commander + @clack/prompts + tsup)
├── templates/ # minimal/ and llm/
├── tests/scaffold.test.ts # vitest snapshot of all 4 combinations
├── docs/
│ ├── ROADMAP.md # the plan this repo was built against
│ ├── GAP-ANALYSIS.md # 8 defects, each with file:line evidence
│ ├── SUBMISSION.md # the portal submission write-up
│ └── phase1-drafts/ # 6 GitHub issue drafts (5 against genlayer-cli,
│ # 1 against genlayer-test)
└── package.jsonCredits
Template structure and CLI ergonomics follow
genlayerlabs/genlayer-cli's
conventions; runner-hash sourcing follows
genlayerlabs/skills's
genlayer-dev skill. Both are upstream GenLayer projects; the
corrections here are aimed at those repos, not at replacing them.
License
MIT, matching genlayer-cli's
license so upstream adoption has no legal friction. See
LICENSE.
