CLI Reference
This page summarizes command surfaces exactly as implemented in cli/src.
Command tree
text
pwa-kit
init [dir] [options]
sync [--dry-run] [--validate]init validation rules
From CLI source (utils/validation.ts):
- URL must start with
https://and match host/path pattern. - Bundle ID must match reverse-domain-like pattern.
- Colors must be 6-digit hex (
#RRGGBB). - Orientation must be
any|portrait|landscape. - Display must be
standalone|fullscreen.
init manifest behavior
init attempts to fetch manifest data in this order:
- Parse
<link rel="manifest" ...>from start URL HTML. - Fallback paths:
/manifest.json/manifest.webmanifest/site.webmanifest
When found, it uses values for:
name/short_namebackground_colortheme_colororientationdisplay- best icon candidate (prefers largest non-maskable)
sync failure behavior
sync --validate throws errors on mismatches, including:
- Bundle ID mismatch
WKAppBoundDomainsmismatch- Orientation mismatch
- Missing privacy keys for enabled features
- Missing
remote-notificationbackground mode fornotifications - Out-of-date icon variants relative to
AppIcon-source.png
Practical command snippets
Bootstrap project in a new directory:
bash
npx @pwa-kit/cli init my-pwa-ios --url "https://app.example.com"
open my-pwa-ios/PWAKitApp.xcodeprojRe-validate after config edits:
bash
npx @pwa-kit/cli sync --validatePreview changes without writing:
bash
npx @pwa-kit/cli sync --dry-run