Commands

paf help, paf --help, paf -h, or paf on its own prints the list:

paf: gives each family or face its own pebble-app-framework, and builds and checks it in place

usage: paf <command> [args]

  sync [unit] [--locked] [--force]
                               fill each unit's paf/ from its pinned tag and install its node_modules
  status                       each unit's faces, tag, the newest framework tag, and whether it is ready
  pin <unit> <tag|latest>
                               move a unit to another tag and fill its paf/, printing the breaking entries between them first
  use <unit> local [path]      point a unit's paf/ at a local framework clone, builds included
  use <unit> pinned            put it back on its tag
  build <face|all> [--clean] [--dev]
                               build a face in its unit (not on Windows itself), clean when message keys, dependencies, or the framework changed,
                               and in dev mode with --dev
  gen <face> <kind|all> [args]
                               run one generator the framework, a listed plugin, or the unit offers for a face,
                               or all it has inputs for
  check [unit]                 run every check the framework and the listed plugins ship, in every unit or one
  tool <face> <name> [args]    run a tool a listed plugin offers, such as clay-preview or tap-walk
  run <unit|face> <script> [args]
                               run any npm script in a unit
  test | typecheck [unit]      run the unit's own test script, or tsc on its own tsconfigs, in every unit or one
  lint [unit] [--fix]          lint a unit with what a listed plugin offers, or its own lint script, in every unit or one
  format [unit] [--check]      format a unit's files the same way, or with --check say which would change
  doctor                       check git, node, the pins, the unit layout, the SDK, and the workflows

A unit is a folder with a paf.config.json: a family or a face of its own under watchfaces/, watchapps/, or
plugins/, or the repo root for a repo that is one face or one family. PAF_HOME moves the cache. PAF_REPO
fetches the framework from another URL or path.

The examples on this page come from two face repos. my-face is a single face of the same name at its root. The other keeps several units under watchfaces/, among them the my-family family with its face-a and face-b faces.

What Every Command Shares

Naming a Unit. Wherever a command takes [unit], a face name works too and picks the unit that holds it. So paf sync face-a syncs the whole my-family family. Leaving the unit out runs every unit in the repo.

One Unit at a Time. sync, check, test, typecheck, lint, and format take at most one unit, and stop when given two:

$ paf sync a b
paf: paf sync takes one unit and was given 2: a, b. Run it once for each, or with none for every unit

Flags. sync, status, pin, use, check, test, typecheck, lint, format, and doctor refuse a flag they do not take, so a mistyped --locked in CI stops rather than running a sync that writes:

$ paf status --verbose
paf: paf status has no flag --verbose

build, gen, run, and tool pass every argument on to what they run.

Readying a Unit. build, gen, check, tool, run, test, typecheck, lint, and format sync the unit before they run anything, so they take care of a fresh clone or a pin a teammate moved. They only fetch the framework when the cache lacks the pinned commit, so they work offline once a unit has synced. sync, pin, and use <unit> pinned always fetch. status and doctor never do.

Node. build, gen, check, tool, lint, and format run the framework's own scripts, and refuse a Node outside the range in paf/package.json.

Exit Codes. 0 when everything passed, 1 when anything failed. gen and tool exit with the code of the script they ran. A command that runs over every unit carries on past a failing one, then names each that failed, such as sync failed in watchfaces/my-family. An error paf stops on is printed to stderr, starting paf:.

paf sync

paf sync [unit] [--locked] [--force]

Fills each unit's paf/ from its pinned tag and installs its node_modules. It fetches the framework once, then for each unit records the tag's commit if paf.config.json has none, refills paf/ when the commit or the listed plugins changed, and installs when the lock, the system, or a package.json in paf/ changed. A unit already in step is left alone, so a sync with nothing to do prints nothing.

A first sync in a fresh clone:

$ paf sync
my-face: paf/ is on v4.0.0 (4002539), 214 files
my-face: installing node_modules, which brings the lock up to date if the framework moved

added 216 packages in 2s

--locked is for CI. It installs with npm ci from the lock and never writes paf.config.json or the lock. It stops when a unit has no package-lock.json, when paf.config.json records no commit, or when a unit is on a local framework.

--force reinstalls a node_modules installed from the other system, such as from WSL when running on Windows. Without it paf stops rather than replace it.

paf checks every unit before the fetch, so it reports a pin it cannot fill, or a unit it would refuse, even offline.

paf status

paf status

Shows each unit, its faces, the tag it pins, the newest framework tag paf fills, and whether it is ready to build. It changes nothing and never fetches, so LATEST is as of the last fetch.

$ paf status
UNIT                     FACES                   TAG     LATEST  STATE
watchfaces/face-c        face-c                  v4.0.0  v4.0.0  ready
watchfaces/face-d        face-d                  v4.0.0  v4.0.0  ready
watchfaces/my-family     face-a, face-b          v4.0.0  v4.0.0  ready
watchfaces/other-family  face-e, face-f, face-g  v4.0.0  v4.0.0  ready
LATEST is the newest framework tag paf fills as of the last fetch, a release when there is one, and paf sync fetches again.

toolchain: SDK 4.33.1 active. v4.0.0 was built with 4.33.1

STATE is one of:

  • ready: paf/ and node_modules match the pin.
  • needs paf sync: paf/ is missing or on another commit, a listed plugin is missing, or the install is behind.
  • node_modules from linux or from win32: installed from the other system. See paf sync and --force.
  • local, <path>: on a local framework clone through paf use.
  • problem: <message>: the unit could not be read, with the reason.

A face shows as ? when its appinfo cannot be read.

The toolchain line compares the SDK pebble --version reports with the SDK each framework tag was built with.

paf pin

paf pin <unit> <tag|latest>

Moves one unit to another framework tag, fills its paf/, and installs. Naming a face moves the whole family it belongs to. latest is the newest release of framework 4 or later, or the newest release candidate when there is no release yet.

Before it writes anything it checks that the tag is a version tag of framework 4 or later, that the framework has it, and that it has every plugin the unit lists. Then it prints what changed between the two tags in the framework changelog: every breaking entry in full, and a count of the rest. It ends with the generators to run, since a new framework can change what they write.

Moving my-family to a newer tag prints this, with the parts in angle brackets filled in:

$ paf pin my-family latest
my-family: v4.0.0 to <new tag>
Breaking
  - **Breaking:** <each breaking entry between the two tags>
<n> other changelog entries. The full list is in paf/CHANGELOG.md once the pin moves
then run paf gen <face> all for face-a, face-b
watchfaces/my-family: paf/ is on <new tag> (<commit>), <n> files
watchfaces/my-family: installing node_modules, which brings the lock up to date if the framework moved

Moving back to an older tag lists what is being left behind instead. A unit that pins nothing yet prints first pin in place of the old tag.

Pinning the tag a unit is already on syncs it, and takes the new commit if the tag moved since it was recorded:

$ paf pin my-face latest
my-face is already on v4.0.0

A unit already on a tag newer than latest, such as a release candidate, stays where it is with paf pin <unit> latest. A unit on a local framework moves off it onto the tag.

paf use

paf use <unit> local [path]
paf use <unit> pinned

local fills a unit's paf/ from a framework clone on disk, working tree included, so uncommitted edits reach the build. The path defaults to a pebble-app-framework folder beside the repo. From then on every command that readies the unit copies the clone again first, and skips the copy when nothing changed.

$ paf use my-face local /home/me/src/pebble-app-framework
my-face: paf/ is on 8b45d9e from /home/me/src/pebble-app-framework, working tree included, 214 files
paf sync --locked refuses until paf use my-face pinned

The clone has to be framework 4 or later, with a src/package.json named pebble-app-framework. Its specs, fixtures, and the plugins the unit does not list are left out, the same as from a tag.

pinned puts the unit back on its tag. If the sync refuses, the local copy stays in place.

$ paf use my-face pinned
my-face: paf/ is on v4.0.0 (4002539), 214 files

paf build

paf build <face|all> [--clean] [--dev] [args]

Builds a face into a .pbw with the framework's build script. It runs on WSL, Linux, or macOS with the Pebble SDK, and refuses on Windows itself. all builds every face in the repo and carries on past a failing one.

For each face the script compiles the phone code into each target's sandbox, reads which features that code passes startPebbleApp, and writes each sandbox's manifest with the message keys those features and the face's plugin defines bring added after the face's own, as The Keys a Face Does Not List covers. It then loads the face's settings page from that code, the way the phone builds it, once for each platform the face targets. It writes the page's choice counts and defaults into targets/<target>/page/settings_page.h, which the watch's settings take their counts and defaults from, as Counts from the Settings Page and Defaults from the Settings Page cover, and says so in a line such as read my-face's settings page and wrote 6 choice counts and 20 defaults into page/settings_page.h. Then it runs pebble build in each sandbox. A face whose page script reaches for something the build's stand-in phone lacks as it loads stops the build there.

The script checks the parts of the appinfo that need no features before it compiles anything, so a define, a providers list, a plugin's keys without its define, or a dev setting it refuses leaves the sandboxes as they were. It checks the keys once it has read the features, so a key group or a providers list the whole list cannot back stops it with the new phone code compiled into emit/ and nothing else written.

Before it writes the header, the script checks the page and stops with a line naming the face and the fix on any of these:

  • a control whose messageKey the appinfo does not declare
  • a _REQUEST key in messageKeys that no feature passed to startPebbleApp answers
  • a customClay that is not written with the function keyword
  • a choice whose default is not one of its options, a key that opens on two defaults, a default past its key's count, or a default for a shared KNOWN_* setting of the wrong kind or too long for its field
  • an option too long for a shared text KNOWN_* setting's buffer, such as a date format option over 15 bytes
  • a Goal Met Vibration option the watch cannot play as written, or Custom with no Custom Vibration Pattern row
  • a weather or calendar source default that the face's own picker does not offer, or that the page does not open on, matched without regard to case

paf keeps a record of what each face's last passing build was made from, in targets/.paf-build.json. The next build starts clean on its own when the face's message keys, the unit's lock, or the framework in paf/ changed since then, or when there is no passing build to go on from, and it names the reason. The script also starts a sandbox clean when the keys it writes differ from the ones that sandbox's last passing build recorded, which covers a feature passed in code or a plugin define turned on:

$ paf build my-face
== my-face: no passing build here to go on from, so this one is clean ==
Sandbox targets/my-face is ready (source face my-face 1.0.0, watchface=true).
built emit/ for my-face and copied 2 generated components into targets/my-face/emit/src/pkjs/
== building my-face (face my-face) ==
…
[177/177] Creating app_bundle:  -> build/my-face.pbw
'build' finished successfully (1.742s)

On a local framework, an edit to the framework only makes the build clean when it touches the waf/ helpers, since waf tracks the rest itself.

--clean forces a clean build.

--dev builds the face in dev mode, on framework 6.0.0 or later, on the dev plugin's fixture, with the walk and the clock the unit's paf.dev.config.json gives that face, as the dev plugin covers. A unit that does not list the plugin stops the build, so paf build all --dev fails each face in such a unit and carries on past it. A plugin app has no watch code for dev mode to change, so paf build all --dev passes over one with a line saying so, and a plugin app named on its own with --dev stops the build. paf hands the flag on to the framework's build script with the rest. An older framework passes it on to pebble build, which refuses it. A switch between a dev build and a normal one needs no clean build.

Every other argument goes on to pebble build. The .pbw lands in targets/<face>/build/. It carries no source map for the phone code. pebble-js-app.js.map stays beside it in build/, which is where pebble logs reads it to turn a stack trace from the phone back into source lines.

paf gen

paf gen <face> <kind|all> [args]

Runs a generator for a face. The framework, each listed plugin, and the unit itself can offer generators. paf gen <face> <kind> runs one, whatever the face holds, with any arguments typed after it.

all runs every generator the face has inputs for, in order, and stops at the first that fails with its exit code. It takes no arguments, since each generator gets its own. Each prints a heading as it starts:

$ paf gen my-face all
== gen clay: my-face ==
wrote src/pkjs/clay/panel-picker.g.js (24000 bytes)
== gen icons: my-face ==
…

A face with nothing to generate prints <face> has nothing to generate. An unknown kind names what the unit does offer:

$ paf gen my-face nope
paf: no generator called nope. What the unit lists offers clay, icons, thumbnails, and background, and no plugin the unit leaves out offers it either

When a plugin the unit leaves out offers it, the message names that plugin to list instead. The order all runs in is under Generators.

paf check

paf check [unit]

Runs every check the framework and the listed plugins ship, such as whether each face's generated output is current. Every check runs to the end, so one failure never hides another.

$ paf check
== check: my-face ==
Clay components: every face is current
icons: every face is current
thumbnails: every face is current

For a stale face, run its generators again with paf gen <face> all.

paf tool

paf tool <face> <name> [args]

Runs a tool a listed plugin offers, with the face first and every argument after the name passed on exactly as typed, -h and -- included. The dev plugin offers clay-preview, tap-walk, and thumbnails:

paf tool face-a clay-preview

An unknown name lists the tools the unit has:

$ paf tool my-face nope
paf: no tool called nope. What the unit lists offers clay-preview, tap-walk, and thumbnails, and no plugin the unit leaves out offers it either

paf run

paf run <unit|face> <script> [args]

Runs one of the unit's own npm scripts, after readying the unit. Any arguments go after a --, and a -- typed first is dropped, so these are the same:

paf run my-family test:coverage --reporter=dot
paf run my-family test:coverage -- --reporter=dot

It exits 0 or 1, whatever code npm returned.

paf test

paf test [unit]

Runs the unit's own test script, in every unit or one:

$ paf test
== test: my-face ==

> test
> vitest run --config config/vitest.config.ts
…

paf typecheck

paf typecheck [unit]

Runs tsc --noEmit on every tsconfig.json and tsconfig.*.json the unit holds, with the TypeScript the unit installed. It skips paf/ and its swap folders, targets/, node_modules/, vendor/, coverage/, and dot folders other than .github/.

$ paf typecheck
== typecheck: my-face config/tsconfig.builder.json ==
== typecheck: my-face config/tsconfig.json ==
== typecheck: my-face config/tsconfig.spec.json ==
== typecheck: my-face config/tsconfig.tools.json ==
== typecheck: my-face tsconfig.json ==

A unit with no tsconfig fails rather than passing with nothing checked.

paf lint

paf lint [unit] [--fix]

Lints a unit with the listed plugin that offers it, normally the framework's code-style. A unit listing none runs its own lint script. One with neither fails, and names the plugin to list when the framework has one that offers it.

$ paf lint
== lint: my-face ==
linted with paf/plugins/code-style/eslint.config.ts

--fix fixes what it can.

paf format

paf format [unit] [--check]

Formats a unit the same way. code-style runs Prettier over its CSS, JSON, and YAML once the unit sets "code-style": { "prettier": true } under plugins.

--check writes nothing and lists the files that would change.

$ paf format --check
== format: my-face ==
all 22 files are formatted

paf doctor

paf doctor

Checks the whole setup without changing anything:

  • git on the PATH, and Node against each unit's framework range
  • paf/, its swap folders, and targets/ are gitignored in every unit
  • no lib/ left from paf 1.0.0, no appinfo left in config/, and the workspaces set
  • every listed plugin is in paf/, and no swap folder is left over
  • every unit is on its pin, the same as paf status
  • the active SDK against the SDK each tag was built with
  • the repo's workflows load the framework's actions at the newest pinned tag or later
$ paf doctor
ok       git version 2.43.0
ok       node 24.18.0
ok       every unit on a tag matches its pin
ok       pebble-tool 5.0.40
ok       SDK 4.33.1 is what v4.0.0 was built with (face-c, face-d, my-family, other-family)

Each line starts with ok, problem, behind, note, or skipped. An SDK older than a tag was built with is behind, and a newer one is only a note. Without pebble, as on Windows outside WSL, the SDK line is skipped. It exits 1 when there is any problem or behind.