Add a wizard that sets up the submitter for a program #11

Merged
jeff merged 1 commit from setup-submitter into main 2026-10-14 01:38:23 -05:00
Owner

For #8. #8 closes once the wizard has been run for jeff/clipwatch.

tools/setup-submitter <owner>/<repo> is run by an administrator, with fj logged in. Each stage either checks something or confirms before changing anything:

  1. Checks fj is logged in as an administrator and the program's repository exists.
  2. Creates winget-bot (restricted, max_repo_creation: 0, no organizations), or resets its password if it already exists. The password is random and is kept only while the wizard runs.
  3. Makes it a write collaborator on jeff/winget-pkgs.
  4. Allows only jeff to merge to main. Today's protection blocks direct pushes and requires the check, but has no merge whitelist, so anyone with write access could merge a passing pull request. That would have included the bot.
  5. Makes a token for that one program, winget-submit-<owner>-<repo>, limited to jeff/winget-pkgs through Forgejo 16's repository-specific tokens. Scopes: write:repository, write:issue, and read:user, which jeff/winget-submit needs to read its own name and email for the commit. The password reaches curl on stdin, never the command line, and the token is never printed.
  6. Sets the token as WINGET_BOT_TOKEN on the program with fj secret set.
  7. Uses the token to check it can do what the action does (read its user, list pull requests, create and delete a branch), that user_can_push and user_can_merge on main are false, and that it can't reach the program's own repository.

A token per program means one can be revoked without touching the others, and the wizard is re-run for each new program. CONTRIBUTING describes it, and the devshell gains curl and jq. bash -n passes. Shellcheck's only findings are info notes about library functions this wizard doesn't use, plus one false positive inside the library, which comes from mattpocock/skills 1.3.1 (MIT) and is unchanged. Its copyright is credited in the SPDX header.

Not yet run. Running it is the first real test of stages 2–7.

🤖 Generated with Claude Code

https://claude.ai/code/session_01D31MsLkM9DkCauP1EB2zgw

For #8. #8 closes once the wizard has been run for `jeff/clipwatch`. `tools/setup-submitter <owner>/<repo>` is run by an administrator, with `fj` logged in. Each stage either checks something or confirms before changing anything: 1. Checks `fj` is logged in as an administrator and the program's repository exists. 2. Creates `winget-bot` (`restricted`, `max_repo_creation: 0`, no organizations), or resets its password if it already exists. The password is random and is kept only while the wizard runs. 3. Makes it a write collaborator on `jeff/winget-pkgs`. 4. **Allows only `jeff` to merge to `main`.** Today's protection blocks direct pushes and requires the check, but has no merge whitelist, so anyone with write access could merge a passing pull request. That would have included the bot. 5. Makes a token for that one program, `winget-submit-<owner>-<repo>`, limited to `jeff/winget-pkgs` through Forgejo 16's repository-specific tokens. Scopes: `write:repository`, `write:issue`, and `read:user`, which `jeff/winget-submit` needs to read its own name and email for the commit. The password reaches curl on stdin, never the command line, and the token is never printed. 6. Sets the token as `WINGET_BOT_TOKEN` on the program with `fj secret set`. 7. Uses the token to check it can do what the action does (read its user, list pull requests, create and delete a branch), that `user_can_push` and `user_can_merge` on `main` are false, and that it can't reach the program's own repository. A token per program means one can be revoked without touching the others, and the wizard is re-run for each new program. CONTRIBUTING describes it, and the devshell gains `curl` and `jq`. `bash -n` passes. Shellcheck's only findings are info notes about library functions this wizard doesn't use, plus one false positive inside the library, which comes from mattpocock/skills 1.3.1 (MIT) and is unchanged. Its copyright is credited in the SPDX header. Not yet run. Running it is the first real test of stages 2–7. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01D31MsLkM9DkCauP1EB2zgw
add a wizard that sets up the submitter for a program
All checks were successful
test / test (push) Successful in 1m52s
test / publish (push) Has been skipped
test / test (pull_request) Successful in 1m44s
test / publish (pull_request) Has been skipped
74d8ff81c1
tools/setup-submitter <owner>/<repo> creates winget-bot if needed, as a
restricted user that can create no repositories or organizations, makes
it a write collaborator here, restricts merging to main to jeff, makes a
token for that one program limited to this repository, stores it as the
program's WINGET_BOT_TOKEN, and checks what the token can and cannot do.

The token has read:user beside write:repository and write:issue, because
jeff/winget-submit reads its own user to author the commit. The wizard
library above its STAGES marker is from mattpocock/skills, unchanged.

Refs #8

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01D31MsLkM9DkCauP1EB2zgw
jeff merged commit 9fd1181114 into main 2026-10-14 01:38:23 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jeff/winget-pkgs!11
No description provided.