Skip to content

feat: @polkadot-apps/cli#75

Open
charlesHetterich wants to merge 51 commits intomainfrom
ch/cli
Open

feat: @polkadot-apps/cli#75
charlesHetterich wants to merge 51 commits intomainfrom
ch/cli

Conversation

@charlesHetterich
Copy link
Copy Markdown
Collaborator

@charlesHetterich charlesHetterich commented Apr 7, 2026

Closes #69

Ports the CLI from playground-app/cli into apps/cli/, rebuilt on top of @polkadot-apps/* packages with QR mobile signing via @polkadot-apps/terminal.

Commands re-interpreted according to the requirements doc.

Installs as dot. Compiled to a standalone binary via bun build --compile and distributed through GitHub Releases.

Commands

Command Description
dot init Set up dev environment (Rust toolchain, gh CLI) and authenticate via QR mobile login
dot deploy Deploy contracts, frontend to Bulletin, and optionally publish to playground registry (--playground)
dot build Detect and build contracts (Rust) and frontend
dot remix Fork an app — interactive picker or dot remix <domain>
dot info <domain> Show detailed app information from the registry
dot update Self-update from GitHub Releases

Key integration points

  • QR logindot init pairs with the Polkadot mobile wallet via @polkadot-apps/terminal. Session persists to ~/.polkadot-apps/, subsequent runs skip QR.
  • Mobile signingdot deploy --playground signs registry transactions via the paired mobile wallet. Signing requests are serialized through a mutex so the QR session handles one at a time while transactions confirm in parallel.
  • Frontend deploy — Uses bulletin-deploy library API (not shelled out). Storage uses the pool signer, DotNS domain registration uses the QR signer.
  • Playground metadata — Reads from package.json fields (playground:domain, playground:name, playground:description, playground:tag, playground:icon, playground:branch) instead of dot.json.
  • Chain connection — Uses @polkadot-apps/chain-client (getChainAPI) with @polkadot-apps/contracts (ContractManager) for registry contract calls. Best-block via atBest: true InkSdk.
  • Signer resolution — QR session → --suri //Alice (dev) → ~/.polkadot/accounts.json (legacy mnemonic fallback).

Infrastructure

  • apps/ workspace directory added alongside packages/ and examples/
  • Turbo, vitest, biome, typedoc configs updated for apps/
  • install.sh for end-user installation from GitHub Releases (uses gh for private repo auth)
  • pnpm cli:install for local dev (compiles binary to ~/.polkadot/bin/dot)
  • Release workflow extended with bun binary compilation + GitHub Release creation
  • Temporary cli-dev-release.yml workflow for testing releases from this branch

Tests

In-source tests for all utility functions across CLI files (config, connection, project, ui, and command helpers). Command orchestrators are excluded from coverage via config since Istanbul can't selectively ignore chained Commander expressions. 922 tests, all passing.


Before Merging

Depends on two external PRs being merged and published:

  1. @polkadot-apps/terminalrh-terminal PR. Once merged, the terminal package becomes a workspace package.
  2. bulletin-deployAdd Mobile Signer. Adds signer/signerAddress options for QR signing in DotNS operations.

Once those land, the following temporary items in this PR need to be updated:

  • apps/cli/package.json: Change "@polkadot-apps/terminal": "file:...""workspace:*"
  • apps/cli/package.json: Change "bulletin-deploy": "file:..." → published npm version
  • package.json: Remove the root postinstall that runs patch-wasm.sh (terminal's own postinstall handles it as a workspace package)
  • .github/workflows/cli-dev-release.yml: Delete this temporary dev release workflow

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 97.38% (🎯 90%) 1716 / 1762
🔵 Statements 96.94% (🎯 90%) 1806 / 1863
🔵 Functions 96.23% (🎯 90%) 409 / 425
🔵 Branches 90.63% (🎯 90%) 871 / 961
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/contracts/src/wrap.ts 100% 93.61% 100% 100%
Generated in workflow #272 for commit 14d4a9f by the Vitest Coverage Report Action

…ucture

- Commander.js CLI at `apps/cli/` installing as `dot`, with --help and --version
- `pnpm cli:install` compiles standalone binary to ~/.dot/bin/dot via bun and configures PATH
- Release workflow extended: compiles 4 platform binaries and creates GitHub Release with them
- `install.sh` for end-user installation from GitHub Releases
- Turbo, workspace, and catalog wired up for the new `apps/` directory
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Apr 8, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedbulletin-deploy@​0.6.47410010096100
Addedcommander@​12.1.09810010087100

View full report

@charlesHetterich charlesHetterich changed the title initial scaffolding of cli package feat: @polkadot-apps/cli Apr 8, 2026
…info, update

- Remove: new, publish, search, setup, account, template
- Add: build (native contract+frontend detection), test (vitest+cargo), update (self-update from GitHub Releases)
- Rewrite init: toolchain setup (Rust nightly, cargo-pvm-contract, gh CLI), QR auth stubbed
- Rewrite deploy: unified pipeline with --playground flag (absorbs old publish/ship)
- Rewrite remix: interactive app picker when no domain given, --quest flag stubbed
…l` packageaimplement QR login in dot init via @polkadot-apps/terminal

- Real QR code pairing + on-chain attestation via host-papp SDK
- Sessions persist to ~/.polkadot-apps/, subsequent runs skip QR
- Add @polkadot-apps/terminal (temporary file: link) and ws dependencies
- Root postinstall patches verifiablejs WASM for bun compatibility
- Skip cdm postinstall if .cdm/ already exists
- Update CLAUDE.md with current CLI command reference
- contracts/wrap.ts: retry queries with dev fallback origin for unmapped accounts
…yground registry

- Use bulletin-deploy library API instead of shelling out to npx (pass QR signer for DotNS)
- Read playground metadata from package.json playground:* fields instead of dot.json
- Signing mutex ensures QR session handles one request at a time while transactions confirm in parallel
- Add spinner done state tracking for parallel operation error handling
@charlesHetterich charlesHetterich marked this pull request as ready for review April 13, 2026 05:01
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Apr 13, 2026

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

ReinhardHatko and others added 27 commits April 14, 2026 17:01
… bun is broken. so we need to make releases using mac runners until this is fixed in bun
- Fix deploy ignoring dot.json: loadPlaygroundConfig now falls back to
  dot.json when package.json playground:* fields are missing, fixing the
  remix→deploy workflow
- Fix command injection: replace shell string interpolation with
  execFileSync for cdm deploy (--suri) and git clone (repo/branch)
- Fix --suri ignored for frontend deploy: bulletin-deploy now receives
  the already-resolved signer when --suri is set
- Fix connection leak: lift conn to top-level try/finally in deploy
- Fix only paseo works: remove polkadot/preview-net from CHAINS and
  CHAIN_TO_ENV since they're not available in chain-client presets
- Remove dead code: strip unused assetHub/bulletin URLs from config.ts
- Consolidate WebSocket polyfill into shared polyfill.ts with guard
- Import CLI version from package.json (single source of truth)
- Share detectPackageManager/hasContracts/getBuildCommand via project.ts
- Fix build/deploy hardcoding pnpm: detect package manager dynamically
- Fix init.ts early process.exit: doQrLogin returns boolean instead
- Fix info.ts process.exit in finally block
- Improve remix domain randomness: crypto.randomBytes (16M options vs 100)
- Add comments to empty catch blocks for debuggability
Extract all toolchain checks (rustup, nightly, rust-src, cdm, IPFS)
into ensureToolchain() in project.ts. Called automatically at the start
of deploy, build, and remix commands — silent when everything is
installed, shows real install output (stdio: inherit) when installing.

- dot init: verbose mode with checkmarks per tool
- dot deploy/build/remix: quiet mode, only prints during installs
- IPFS: auto-install via brew (macOS) or official tarball, auto-init
- All install commands use stdio: inherit for visible progress
- Exclude apps/cli/** from coverage thresholds
- Pass Alice as defaultOrigin to ContractManager so read-only queries
  don't spam "[contracts] No origin configured" warnings on every call
- Add process.exit(0) at end of remix to prevent Bun stream cleanup
  crash (TypeError: undefined is not an object at handleResult)
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.

Add CLI to polkadot apps.

3 participants