create-rigline-plugin 1.0.0-alpha.1 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/template/.github/workflows/release.yml +105 -0
- package/template/README.md +16 -1
- package/template/gitignore +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rigline-plugin",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
4
4
|
"description": "Scaffold a workspace for Claude Code VS Code extension plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rigline",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"create-rigline-plugin": "./dist/index.js"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@rigline/plugin-api": "1.0.0-alpha.
|
|
32
|
+
"@rigline/plugin-api": "1.0.0-alpha.2"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Publish your plugins to npm, without an npm token ever being stored here.
|
|
2
|
+
#
|
|
3
|
+
# GitHub authenticates to npm over OIDC, so the secret this workflow would otherwise need does not
|
|
4
|
+
# exist. What it does is *stage*: a staged version sits in a queue that nobody can install until you
|
|
5
|
+
# approve it from your own machine with 2FA. Approving says you meant to ship it.
|
|
6
|
+
#
|
|
7
|
+
# pnpm stage approve
|
|
8
|
+
#
|
|
9
|
+
# Before this works, once per package, on npmjs.com:
|
|
10
|
+
#
|
|
11
|
+
# 1. Publish the first version by hand. A package that does not exist yet has nothing for a
|
|
12
|
+
# trusted publisher to attach to: `pnpm publish -r --otp <code>` (a one-time password, not a
|
|
13
|
+
# token — there is then nothing to store or revoke).
|
|
14
|
+
# 2. Add a trusted publisher under the package's settings, naming this repository and this file
|
|
15
|
+
# by path. Renaming this file breaks the exchange until the entry is edited to match.
|
|
16
|
+
# Set its permission to stage-only.
|
|
17
|
+
#
|
|
18
|
+
# `-r` stages every package in the workspace whose version is not already on the registry, in
|
|
19
|
+
# dependency order, so bumping one plugin releases one plugin.
|
|
20
|
+
name: Release
|
|
21
|
+
|
|
22
|
+
on:
|
|
23
|
+
workflow_dispatch:
|
|
24
|
+
inputs:
|
|
25
|
+
dist_tag:
|
|
26
|
+
description: The tag these versions go to. A prerelease belongs on `next`, not `latest`.
|
|
27
|
+
type: choice
|
|
28
|
+
options: [latest, next]
|
|
29
|
+
default: latest
|
|
30
|
+
dry_run:
|
|
31
|
+
description: Build, test and pack, but stage nothing
|
|
32
|
+
type: boolean
|
|
33
|
+
default: false
|
|
34
|
+
|
|
35
|
+
permissions:
|
|
36
|
+
contents: read
|
|
37
|
+
|
|
38
|
+
concurrency:
|
|
39
|
+
group: release
|
|
40
|
+
cancel-in-progress: false
|
|
41
|
+
|
|
42
|
+
jobs:
|
|
43
|
+
stage:
|
|
44
|
+
name: Stage to npm
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
permissions:
|
|
47
|
+
contents: read
|
|
48
|
+
# What lets the runner ask GitHub for the token npm exchanges for a publishing one. Without
|
|
49
|
+
# it there is nothing to send, and pnpm falls back to looking for a credential that is not
|
|
50
|
+
# here — reporting that as a warning, not an error, so read the log rather than the tick.
|
|
51
|
+
id-token: write
|
|
52
|
+
steps:
|
|
53
|
+
- name: Refuse anything but the default branch
|
|
54
|
+
if: github.ref_name != github.event.repository.default_branch
|
|
55
|
+
run: |
|
|
56
|
+
echo "::error::Releases go from ${{ github.event.repository.default_branch }}."
|
|
57
|
+
exit 1
|
|
58
|
+
|
|
59
|
+
- uses: actions/checkout@v5
|
|
60
|
+
- uses: pnpm/action-setup@v4
|
|
61
|
+
- uses: actions/setup-node@v5
|
|
62
|
+
with:
|
|
63
|
+
node-version: 26
|
|
64
|
+
cache: pnpm
|
|
65
|
+
|
|
66
|
+
- run: pnpm install --frozen-lockfile
|
|
67
|
+
- run: pnpm typecheck
|
|
68
|
+
- run: pnpm build
|
|
69
|
+
- run: pnpm test
|
|
70
|
+
|
|
71
|
+
# `generated.ts` is committed, so this needs no installed extension. `rigline codegen` is
|
|
72
|
+
# something you run locally against your own editor and commit the result of.
|
|
73
|
+
- name: Stage
|
|
74
|
+
if: ${{ !inputs.dry_run }}
|
|
75
|
+
run: pnpm stage publish -r --tag ${{ inputs.dist_tag }} --provenance --report-summary --no-git-checks
|
|
76
|
+
|
|
77
|
+
- name: Pack only
|
|
78
|
+
if: ${{ inputs.dry_run }}
|
|
79
|
+
run: pnpm stage publish -r --tag ${{ inputs.dist_tag }} --dry-run --report-summary --no-git-checks
|
|
80
|
+
|
|
81
|
+
# Nothing notifies you that a stage is waiting, and npm returns no stage id to quote, so the
|
|
82
|
+
# run summary names what went up and the one command that finishes the job.
|
|
83
|
+
- name: Summarise
|
|
84
|
+
if: always()
|
|
85
|
+
run: |
|
|
86
|
+
if [ ! -f pnpm-publish-summary.json ]; then
|
|
87
|
+
echo "## Nothing was staged" >> "$GITHUB_STEP_SUMMARY"
|
|
88
|
+
echo "" >> "$GITHUB_STEP_SUMMARY"
|
|
89
|
+
echo "Either the run stopped before staging, or every version is already on the registry." >> "$GITHUB_STEP_SUMMARY"
|
|
90
|
+
exit 0
|
|
91
|
+
fi
|
|
92
|
+
node -e '
|
|
93
|
+
const s = JSON.parse(require("fs").readFileSync("pnpm-publish-summary.json", "utf8"));
|
|
94
|
+
const out = [];
|
|
95
|
+
const staged = s.publishedPackages ?? [];
|
|
96
|
+
if (staged.length === 0) {
|
|
97
|
+
out.push("## Nothing was staged", "", "Every version is already on the registry. Bump one to release it.");
|
|
98
|
+
} else {
|
|
99
|
+
out.push("## Staged, and awaiting approval", "", "| package | version |", "| --- | --- |");
|
|
100
|
+
for (const p of staged) out.push(`| \`${p.name}\` | \`${p.version}\` |`);
|
|
101
|
+
out.push("", "**Nobody can install these yet.** On a machine with your npm 2FA:", "", "```", "pnpm stage approve", "```", "",
|
|
102
|
+
"It lists what is queued and takes the batch under one one-time password. A version you would rather not ship needs no action — do not approve it, and it expires.");
|
|
103
|
+
}
|
|
104
|
+
require("fs").appendFileSync(process.env.GITHUB_STEP_SUMMARY, out.join("\n") + "\n");
|
|
105
|
+
'
|
package/template/README.md
CHANGED
|
@@ -50,7 +50,22 @@ installed with `rigline add <name>`. Nothing about publishing is special: `rigli
|
|
|
50
50
|
everything the entry imports, so a published plugin has no runtime dependency to install, and
|
|
51
51
|
`@rigline/plugin-api` stays a *devDependency*.
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
`.github/workflows/release.yml` does it from CI, with no npm token stored anywhere: GitHub
|
|
54
|
+
authenticates to npm over OIDC, and what the workflow does is *stage* — a version nobody can
|
|
55
|
+
install until you approve it from your own machine with 2FA.
|
|
56
|
+
|
|
57
|
+
pnpm stage approve
|
|
58
|
+
|
|
59
|
+
Two things to set up once per package, the first time. Publish version one by hand, because a
|
|
60
|
+
package that does not exist yet has nothing for a trusted publisher to attach to — `pnpm publish -r
|
|
61
|
+
--otp <code>`, supplying a one-time password rather than creating a token, so there is nothing to
|
|
62
|
+
store or to revoke afterwards. Then add a trusted publisher in the package's settings on npmjs.com,
|
|
63
|
+
naming this repository and `release.yml` by path, with its permission set to stage-only. The
|
|
64
|
+
workflow's own header repeats both, where you will be when you need them.
|
|
65
|
+
|
|
66
|
+
Adding a second plugin later means one more of each: npm's exchange is per package, so a trusted
|
|
67
|
+
publisher is too. That is friction on a second plugin, never on a second release — `-r` stages only
|
|
68
|
+
what you bumped.
|
|
54
69
|
|
|
55
70
|
## Rules that will cost you if you break them
|
|
56
71
|
|
package/template/gitignore
CHANGED