✨ feat: P-37 onboard sets the FIGMA_LIBRARY secret itself

Merged
AT
1mo ago
+229-18

Slice: #88

Since P-23, onboard printed gh secret set FIGMA_LIBRARY --repo … --body …
for the owner to run, but the owner stays signed out of gh for good
(P-35). Now onboard sets the secret itself.

  • src/secrets.ts (new): setSecret GETs the repository's Actions
    public key, seals the value as a libsodium sealed box
    (crypto_box_seal) and PUTs the secret through the REST API with the
    one-run owner token. Failures say why without the value.
  • onboard: when it takes a Figma file key out of older settings, the
    question now says it will set it as the FIGMA_LIBRARY secret as you;
    the sign-in is that run's one browser approval, with the scopes of the
    features the run ends with (so --add board in the same run still
    gets project). A value that is not a file key is not stored; the owner
    is told where in the repository's settings to set the right one. No
    gh command is printed anywhere.
  • Dependency: libsodium-wrappers 0.8.4 (with its libsodium,
    1.8 MB unpacked, no other dependencies). It is the reference
    implementation of crypto_box_seal, actively maintained, and what
    GitHub's own docs use for this API. The smaller alternatives were
    worse: tweetnacl (175 kB) has no sealed box and no BLAKE2b for its
    nonce and has had no release since 2020; the @noble packages would
    mean assembling the sealed box (X25519 + BLAKE2b nonce +
    XSalsa20-Poly1305) from primitives here. Node's own crypto lacks
    XSalsa20 and variable-length BLAKE2b.
  • It is imported dynamically, inside setSecret: the shared checks run
    node .process-rules/src/cli.ts with no packages installed, so a static
    import would break every client's checks. Checked by running the CLI
    from a copy of src with no node_modules.
  • Tests: the PUT body opens, with the test's key pair, to the library key,
    sent as the owner with the key's id; the key never appears in output,
    questions or any request in the clear; nothing tells the owner to run
    gh; a refused PUT or a missing sign-in stops the run.
  • README, decisions record, roadmap row. No version bump: the batch release PR bumps it.

Builds on #95 (P-36), now merged.

Live proof

After the batch release is tagged and installed, in a process-rules-sandbox clone on its default branch:

process-rules onboard

Then git status --short prints nothing, and onboard printed AthyaBot's pull request link.

🤖 Generated with Claude Code