Sunhat 2 is a project CLI for Hardhat 2 and Foundry on EVM and TRON. It selects the framework and target from sunhat.toml, then runs the project's native tools. The npm package is @sun-protocol/sunhat; the executable is sunhat.
Sunhat 1.x is maintenance-only. It receives bug fixes and security updates, with no new features. New development targets Sunhat 2. Existing projects can keep their pinned 1.x dependency while planning migration; the v1 documentation snapshot remains available.
| Area | Sunhat 1.x | Sunhat 2 |
|---|---|---|
| Architecture | Hardhat plugin with a CLI proxy | Project CLI with separate Hardhat and Foundry adapters |
| Configuration | Sunhat's Hardhat plugin API | sunhat.toml binds the framework and target; native framework configuration stays in the project |
| Initialization | Hardhat-oriented scaffold with automatic npm installation | Four framework/target templates, separate dependency installation, and --adopt for existing projects |
| Foundry | Used alongside the Hardhat workflow | Project-local EVM or TRON toolchain installed with sunhat toolchain install |
Commands use the selected framework's syntax: sunhat compile for Hardhat, sunhat build for Foundry, and sunhat test for either. V1 plugin APIs such as deployment tracking and named accounts are not provided by the v2 CLI; migration requires reviewing the project's plugins and scripts.
Use Node.js 20.11 or newer. The default project is Foundry + TRON:
npm install --global @sun-protocol/sunhat@2.0.0
sunhat init counter
cd counter
sunhat toolchain install
sunhat build
sunhat testSee QuickStart for all four project types, local installation, compiler setup, adoption, and command examples.
Use Node.js 24 for repository development:
npm ci
npm run lint
npm run format:check
npm testnpm run test:templates generates Hardhat EVM/TRON projects, installs their dependencies, and runs tsc --noEmit.
npm run pack:check starts without build artifacts, installs the actual tarball in an isolated project, and exercises the installed CLI and all four templates. This check requires npm registry access; Foundry release downloads use local fixtures.
prepack builds the CLI for both npm pack and npm publish.
Runtime tests use temporary CLI copies and release configuration for local archives. Installer tests replace download and extraction dependencies where needed; filesystem replacement and rollback tests use real files and directories.
Source builds reject unused declarations, incomplete return paths, and switch fallthrough. ESLint uses type information for src/ to catch unhandled promises, async callbacks in synchronous APIs, and unsafe type assertions. Template linting does not require installing each generated project's dependencies.
Initialization files and Foundry release data live under templates/<framework>/common/ and templates/<framework>/<target>/. Target files override matching common files. The TOML compatibility note documents the binding syntax baseline and parser limits.