create-rigline-plugin 1.0.0-alpha.1 → 1.0.0-alpha.4
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/README.md +3 -0
- package/package.json +5 -2
- package/template/.github/workflows/ci.yml +62 -0
- package/template/.github/workflows/release.yml +130 -0
- package/template/README.md +37 -1
- package/template/gitignore +1 -0
- package/template/package.json +1 -1
- package/template/plugins/__NAME__/package.json +2 -0
- package/template/plugins/__NAME__/src/index.ts +18 -0
package/README.md
CHANGED
|
@@ -42,4 +42,7 @@ is the one ordering dependency in the whole arrangement.
|
|
|
42
42
|
|
|
43
43
|
[Authoring guide](https://github.com/Rigline/Rigline/blob/main/docs/authoring.md)
|
|
44
44
|
|
|
45
|
+
[Changelog](https://github.com/Rigline/Rigline/blob/main/CHANGELOG.md) — every package in this
|
|
46
|
+
workspace shares it, and one version number.
|
|
47
|
+
|
|
45
48
|
MIT.
|
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.4",
|
|
4
4
|
"description": "Scaffold a workspace for Claude Code VS Code extension plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rigline",
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
"author": "Lionell Pack",
|
|
21
21
|
"type": "module",
|
|
22
22
|
"license": "MIT",
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22.12.0"
|
|
25
|
+
},
|
|
23
26
|
"files": [
|
|
24
27
|
"dist",
|
|
25
28
|
"!dist/**/*.map",
|
|
@@ -29,7 +32,7 @@
|
|
|
29
32
|
"create-rigline-plugin": "./dist/index.js"
|
|
30
33
|
},
|
|
31
34
|
"devDependencies": {
|
|
32
|
-
"@rigline/plugin-api": "1.0.0-alpha.
|
|
35
|
+
"@rigline/plugin-api": "1.0.0-alpha.4"
|
|
33
36
|
},
|
|
34
37
|
"scripts": {
|
|
35
38
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Your plugins, checked on every push and every pull request. The release workflow runs the same
|
|
2
|
+
# steps again before it stages anything, so this is the copy that tells you early — and the copy a
|
|
3
|
+
# contributor's pull request gets, which is the whole reason it is separate.
|
|
4
|
+
#
|
|
5
|
+
# There is no lint step because this workspace ships no linter. Add one here if you add one.
|
|
6
|
+
name: CI
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
# GitHub takes no expression here, so your default branch cannot be filled in for you. These
|
|
11
|
+
# are the two common names; edit if yours is neither.
|
|
12
|
+
branches: [main, master]
|
|
13
|
+
pull_request:
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
# A push supersedes the run before it on the same ref, and a pull request supersedes its own last
|
|
19
|
+
# push. Two runs of one ref prove the same thing, and the newer one is what is being asked about.
|
|
20
|
+
concurrency:
|
|
21
|
+
group: ci-${{ github.ref }}
|
|
22
|
+
cancel-in-progress: true
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
check:
|
|
26
|
+
name: Node ${{ matrix.node }}
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
strategy:
|
|
29
|
+
# Every rung reports. A failure on the floor and a failure on the newest runtime are
|
|
30
|
+
# different bugs, and cancelling the rest hides which one this is.
|
|
31
|
+
fail-fast: false
|
|
32
|
+
matrix:
|
|
33
|
+
# The first is the floor this workspace's package.json declares in `engines`, pinned
|
|
34
|
+
# exactly so that the number claimed is a number something ran; the others float to the
|
|
35
|
+
# latest of their major, which says the major is supported rather than that a patch was
|
|
36
|
+
# tested. Cutting this to one rung is a reasonable thing to do — then drop the `engines`
|
|
37
|
+
# claim to match, because a floor nothing runs on is a guess.
|
|
38
|
+
node: ["22.12.0", "24", "26"]
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v5
|
|
41
|
+
|
|
42
|
+
# Pinned exactly rather than to the major: this action's `v6` tag still resolves to the last
|
|
43
|
+
# release before pnpm v12 support, and `v4` runs on a runner runtime GitHub has deprecated.
|
|
44
|
+
- uses: pnpm/action-setup@v6.1.0
|
|
45
|
+
|
|
46
|
+
# After pnpm, never before: `cache: pnpm` asks pnpm where its store is.
|
|
47
|
+
- uses: actions/setup-node@v5
|
|
48
|
+
with:
|
|
49
|
+
node-version: ${{ matrix.node }}
|
|
50
|
+
cache: pnpm
|
|
51
|
+
|
|
52
|
+
# Needs `pnpm-lock.yaml` committed, which is why nothing ignores it. Installing what the
|
|
53
|
+
# lockfile says is the point: a run that resolved its own dependencies would be testing
|
|
54
|
+
# something nobody has.
|
|
55
|
+
- run: pnpm install --frozen-lockfile
|
|
56
|
+
|
|
57
|
+
- run: pnpm typecheck
|
|
58
|
+
|
|
59
|
+
# Before the tests, because a test that imports a built entry should import this build.
|
|
60
|
+
- run: pnpm build
|
|
61
|
+
|
|
62
|
+
- run: pnpm test
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
|
|
61
|
+
# npm binds a provenance attestation to the package's `repository` field, so a package
|
|
62
|
+
# without one cannot be staged with `--provenance` at all. Asked here, before the build, so
|
|
63
|
+
# that the answer is a package name rather than an error about attestations two minutes in.
|
|
64
|
+
# A dry run is checked too: a rehearsal that skips this rehearses a different release.
|
|
65
|
+
- name: Refuse a publishable package with no repository
|
|
66
|
+
run: |
|
|
67
|
+
node -e '
|
|
68
|
+
const fs = require("fs");
|
|
69
|
+
const dirs = fs.existsSync("plugins") ? fs.readdirSync("plugins") : [];
|
|
70
|
+
const missing = [];
|
|
71
|
+
for (const dir of dirs) {
|
|
72
|
+
const path = `plugins/${dir}/package.json`;
|
|
73
|
+
if (!fs.existsSync(path)) continue;
|
|
74
|
+
const manifest = JSON.parse(fs.readFileSync(path, "utf8"));
|
|
75
|
+
if (!manifest.private && !manifest.repository) missing.push(manifest.name || dir);
|
|
76
|
+
}
|
|
77
|
+
if (missing.length === 0) process.exit(0);
|
|
78
|
+
console.log(`::error::No "repository" field in ${missing.join(", ")}. npm binds a provenance attestation to it, so --provenance cannot stage a package without one.`);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
'
|
|
81
|
+
|
|
82
|
+
# Pinned exactly rather than to the major: this action's `v6` tag still resolves to the last
|
|
83
|
+
# release before pnpm v12 support, and `v4` runs on a runner runtime GitHub has deprecated.
|
|
84
|
+
- uses: pnpm/action-setup@v6.1.0
|
|
85
|
+
- uses: actions/setup-node@v5
|
|
86
|
+
with:
|
|
87
|
+
node-version: 26
|
|
88
|
+
cache: pnpm
|
|
89
|
+
|
|
90
|
+
- run: pnpm install --frozen-lockfile
|
|
91
|
+
- run: pnpm typecheck
|
|
92
|
+
- run: pnpm build
|
|
93
|
+
- run: pnpm test
|
|
94
|
+
|
|
95
|
+
# `generated.ts` is committed, so this needs no installed extension. `rigline codegen` is
|
|
96
|
+
# something you run locally against your own editor and commit the result of.
|
|
97
|
+
- name: Stage
|
|
98
|
+
if: ${{ !inputs.dry_run }}
|
|
99
|
+
run: pnpm stage publish -r --tag ${{ inputs.dist_tag }} --provenance --report-summary --no-git-checks
|
|
100
|
+
|
|
101
|
+
- name: Pack only
|
|
102
|
+
if: ${{ inputs.dry_run }}
|
|
103
|
+
run: pnpm stage publish -r --tag ${{ inputs.dist_tag }} --dry-run --report-summary --no-git-checks
|
|
104
|
+
|
|
105
|
+
# Nothing notifies you that a stage is waiting, and pnpm's publish output carries no stage id
|
|
106
|
+
# to quote (the registry has one; `npm stage list` shows it). So the run summary names what
|
|
107
|
+
# went up and the one command that finishes the job.
|
|
108
|
+
- name: Summarise
|
|
109
|
+
if: always()
|
|
110
|
+
run: |
|
|
111
|
+
if [ ! -f pnpm-publish-summary.json ]; then
|
|
112
|
+
echo "## Nothing was staged" >> "$GITHUB_STEP_SUMMARY"
|
|
113
|
+
echo "" >> "$GITHUB_STEP_SUMMARY"
|
|
114
|
+
echo "Either the run stopped before staging, or every version is already on the registry." >> "$GITHUB_STEP_SUMMARY"
|
|
115
|
+
exit 0
|
|
116
|
+
fi
|
|
117
|
+
node -e '
|
|
118
|
+
const s = JSON.parse(require("fs").readFileSync("pnpm-publish-summary.json", "utf8"));
|
|
119
|
+
const out = [];
|
|
120
|
+
const staged = s.publishedPackages ?? [];
|
|
121
|
+
if (staged.length === 0) {
|
|
122
|
+
out.push("## Nothing was staged", "", "Every version is already on the registry. Bump one to release it.");
|
|
123
|
+
} else {
|
|
124
|
+
out.push("## Staged, and awaiting approval", "", "| package | version |", "| --- | --- |");
|
|
125
|
+
for (const p of staged) out.push(`| \`${p.name}\` | \`${p.version}\` |`);
|
|
126
|
+
out.push("", "**Nobody can install these yet.** On a machine with your npm 2FA:", "", "```", "pnpm stage approve", "```", "",
|
|
127
|
+
"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.");
|
|
128
|
+
}
|
|
129
|
+
require("fs").appendFileSync(process.env.GITHUB_STEP_SUMMARY, out.join("\n") + "\n");
|
|
130
|
+
'
|
package/template/README.md
CHANGED
|
@@ -43,6 +43,11 @@ plugin that one decoration rather than the whole plugin.
|
|
|
43
43
|
lands in the right place, survives a re-render, or costs a row a line of height is a question only
|
|
44
44
|
the app can answer: build, add, reload, look.
|
|
45
45
|
|
|
46
|
+
`.github/workflows/ci.yml` runs typecheck, build and test on every push and every pull request,
|
|
47
|
+
over three Node versions — the same set the release workflow runs, so nothing reaches a release
|
|
48
|
+
that a pull request would not already have failed on. Commit `pnpm-lock.yaml`: CI installs what it
|
|
49
|
+
says rather than resolving its own.
|
|
50
|
+
|
|
46
51
|
## Publishing
|
|
47
52
|
|
|
48
53
|
A plugin is published as an ordinary npm package carrying `rigline.json` and its built entry, and
|
|
@@ -50,7 +55,38 @@ installed with `rigline add <name>`. Nothing about publishing is special: `rigli
|
|
|
50
55
|
everything the entry imports, so a published plugin has no runtime dependency to install, and
|
|
51
56
|
`@rigline/plugin-api` stays a *devDependency*.
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
`.github/workflows/release.yml` does it from CI, with no npm token stored anywhere: GitHub
|
|
59
|
+
authenticates to npm over OIDC, and what the workflow does is *stage* — a version nobody can
|
|
60
|
+
install until you approve it from your own machine with 2FA.
|
|
61
|
+
|
|
62
|
+
pnpm stage approve
|
|
63
|
+
|
|
64
|
+
**One field to fill in before the first publish: `repository`.** npm binds a provenance attestation
|
|
65
|
+
to it, and this workflow stages with provenance, so a package without one cannot be staged at all.
|
|
66
|
+
Nothing can scaffold it for you — a guessed URL would be a wrong one in the registry rather than a
|
|
67
|
+
missing one — so the workflow refuses by name, before it builds anything, until it is there:
|
|
68
|
+
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "git+https://github.com/you/your-repo.git",
|
|
72
|
+
"directory": "plugins/__NAME__"
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
`homepage` and `bugs` are worth the same minute; npm shows them on the package page. A `LICENSE`
|
|
76
|
+
file is not scaffolded either, because the copyright line is yours to write — the manifest says
|
|
77
|
+
MIT, and npm ships a licence file whatever `files` says, so adding one is the whole job. The
|
|
78
|
+
`rigline-plugin` keyword is already there: it is how somebody finds a plugin on npm.
|
|
79
|
+
|
|
80
|
+
Two things to set up once per package, the first time. Publish version one by hand, because a
|
|
81
|
+
package that does not exist yet has nothing for a trusted publisher to attach to — `pnpm publish -r
|
|
82
|
+
--otp <code>`, supplying a one-time password rather than creating a token, so there is nothing to
|
|
83
|
+
store or to revoke afterwards. Then add a trusted publisher in the package's settings on npmjs.com,
|
|
84
|
+
naming this repository and `release.yml` by path, with its permission set to stage-only. The
|
|
85
|
+
workflow's own header repeats both, where you will be when you need them.
|
|
86
|
+
|
|
87
|
+
Adding a second plugin later means one more of each: npm's exchange is per package, so a trusted
|
|
88
|
+
publisher is too. That is friction on a second plugin, never on a second release — `-r` stages only
|
|
89
|
+
what you bumped.
|
|
54
90
|
|
|
55
91
|
## Rules that will cost you if you break them
|
|
56
92
|
|
package/template/gitignore
CHANGED
package/template/package.json
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
"name": "rigline-plugin-__NAME__",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"description": "__DESCRIPTION__",
|
|
5
|
+
"keywords": ["rigline-plugin", "rigline", "claude-code", "vscode"],
|
|
5
6
|
"type": "module",
|
|
6
7
|
"license": "MIT",
|
|
8
|
+
"publishConfig": { "access": "public" },
|
|
7
9
|
"files": ["dist", "rigline.json"],
|
|
8
10
|
"scripts": {
|
|
9
11
|
"build": "rigline build",
|
|
@@ -55,7 +55,25 @@ export default definePlugin({
|
|
|
55
55
|
// a decoration beside it contributes a constant width and the ladder settles.
|
|
56
56
|
const stopWatch = ctx.watch("footerSpacer", (spacer) => ctx.mountBefore(spacer, () => badge));
|
|
57
57
|
|
|
58
|
+
// One line in Rigline's diagnostics panel, under this plugin's name. It declares nothing: the
|
|
59
|
+
// host calls it, hands it nothing, and gets a verdict back.
|
|
60
|
+
//
|
|
61
|
+
// Worth the four lines from the first day, because the failure a plugin has is normally silent.
|
|
62
|
+
// An extension update can leave this one loaded, declared, styled and drawing nothing, and
|
|
63
|
+
// every other line in that panel will say it is fine. Ask the question only your own state can
|
|
64
|
+
// answer — here, whether the badge is actually in the document — and say `n/a` with a reason
|
|
65
|
+
// when there is nothing to report yet.
|
|
66
|
+
//
|
|
67
|
+
// The host runs this about once a second for the life of the window, so read state you already
|
|
68
|
+
// keep. Do not walk the DOM or recompute an answer here; do that work where it already happens.
|
|
69
|
+
const stopCheck = ctx.check("badge is mounted", () =>
|
|
70
|
+
badge.isConnected
|
|
71
|
+
? { verdict: "pass", detail: badgeText(calls) }
|
|
72
|
+
: { verdict: "fail", detail: "the badge is not in the document" },
|
|
73
|
+
);
|
|
74
|
+
|
|
58
75
|
return () => {
|
|
76
|
+
stopCheck();
|
|
59
77
|
stopWatch();
|
|
60
78
|
stopTools();
|
|
61
79
|
stopStyle();
|