@ericrisco/rsc 4.2.0 → 4.2.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/manifest.json +1 -1
- package/package.json +1 -1
- package/scripts/lib/review-ledger.js +14 -3
- package/scripts/rsc.js +4 -2
- package/skills/gcp-essentials/SKILL.md +11 -8
- package/skills/gcp-essentials/references/networking-and-sql.md +4 -4
- package/skills/github-actions/SKILL.md +12 -12
- package/skills/github-actions/evals/cases.yaml +1 -1
- package/skills/github-actions/references/caching-and-matrix.md +5 -5
- package/skills/github-actions/references/oidc-deploys.md +4 -4
- package/skills/google-workspace/SKILL.md +15 -11
- package/skills/google-workspace/references/api-recipes.md +2 -2
- package/skills/google-workspace/references/auth-setup.md +1 -1
- package/skills/harness/references/providers.yaml +1 -1
- package/skills/hetzner/SKILL.md +13 -12
- package/skills/hetzner/references/cloud-init.md +4 -2
- package/skills/hetzner/references/plans-and-locations.md +15 -14
- package/skills/huggingface/SKILL.md +15 -15
- package/skills/huggingface/evals/cases.yaml +1 -1
- package/skills/huggingface/references/endpoints-and-spaces.md +5 -3
- package/skills/huggingface/references/hub-and-cli.md +4 -4
- package/skills/huggingface/references/inference-providers.md +1 -1
- package/skills/huggingface/scripts/verify.sh +3 -2
- package/skills/instagram-api/SKILL.md +9 -9
- package/skills/instagram-api/evals/cases.yaml +1 -1
- package/skills/instagram-api/references/insights-metrics.md +1 -1
- package/skills/instagram-api/references/publish-reel.md +8 -7
- package/skills/linkedin-api/SKILL.md +3 -3
- package/skills/linkedin-api/evals/cases.yaml +1 -1
- package/skills/linkedin-api/references/api-reference.md +3 -3
- package/skills/review/SKILL.md +1 -1
- package/skills/typescript/SKILL.md +67 -20
- package/skills/typescript/evals/README.md +3 -3
- package/skills/typescript/evals/cases.yaml +4 -1
- package/skills/typescript/references/build-and-monorepo.md +82 -26
- package/skills/typescript/references/type-system.md +15 -4
- package/skills/typescript/scripts/verify.sh +20 -10
- package/targets/asdd-gate.mjs +9 -1
package/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// One JSONL file, append-only: `finding`, `outcome` and `round` entries. It sits under .rsc/ and is
|
|
10
10
|
// excluded from the sello's candidate like every other journal the harness writes (targets/sello.mjs).
|
|
11
11
|
|
|
12
|
-
import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync } from 'node:fs';
|
|
12
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync } from 'node:fs';
|
|
13
13
|
import { join } from 'node:path';
|
|
14
14
|
import { spawnSync } from 'node:child_process';
|
|
15
15
|
import { criterionRefs } from './review-findings.js';
|
|
@@ -194,7 +194,10 @@ export function round(root, task, { now = new Date().toISOString() } = {}) {
|
|
|
194
194
|
// Records that a review panel ran on a task: which lenses, distinct. Self-attested, like the sello's
|
|
195
195
|
// approve — it binds the claim to a task, it does not prove the review was good. The ship guard reads
|
|
196
196
|
// it: a tier-2 branch does not leave the machine without a panel of the required size on its spec.
|
|
197
|
-
|
|
197
|
+
// `repo` names the reviewed checkout when it is not the ledger's own repository: a child repo or its
|
|
198
|
+
// worktree supervised by a workspace keeps its evidence in the workspace, but the commit reviewed is
|
|
199
|
+
// the child's, and that is the commit the push gate checks the panel against.
|
|
200
|
+
export function panel(root, task, lenses, { now = new Date().toISOString(), repo = root } = {}) {
|
|
198
201
|
if (!QUALIFIED_TASK.test(task)) {
|
|
199
202
|
return { ok: false, message: `rsc: qualify the task with its spec slug, e.g. \`review ledger panel <slug>/closing --lenses correctness,security,tests\`.` };
|
|
200
203
|
}
|
|
@@ -205,8 +208,16 @@ export function panel(root, task, lenses, { now = new Date().toISOString() } = {
|
|
|
205
208
|
const n = budget.count + (!budget.count || budget.panelled ? 1 : 0);
|
|
206
209
|
if (n > MAX_ROUNDS) return { ok: false, message: convergenceMessage(task) };
|
|
207
210
|
// Bound to the commit reviewed: code committed after it is code no panel has seen.
|
|
208
|
-
const r = spawnSync('git', ['-C',
|
|
211
|
+
const r = spawnSync('git', ['-C', repo, 'rev-parse', 'HEAD'], { encoding: 'utf8', windowsHide: true });
|
|
209
212
|
const sha = r.status === 0 ? r.stdout.trim() : null;
|
|
213
|
+
if (repo !== root) {
|
|
214
|
+
// A folder inside some repo resolves HEAD by walking up; only the checkout's own top level counts.
|
|
215
|
+
const top = spawnSync('git', ['-C', repo, 'rev-parse', '--show-toplevel'], { encoding: 'utf8', windowsHide: true });
|
|
216
|
+
const real = (p) => { try { return realpathSync(p); } catch { return null; } };
|
|
217
|
+
if (!sha || top.status !== 0 || real(top.stdout.trim()) !== real(repo)) {
|
|
218
|
+
return { ok: false, message: `rsc: --repo ${repo} is not the top of a git checkout with a commit; name the repository the panel reviewed.` };
|
|
219
|
+
}
|
|
220
|
+
}
|
|
210
221
|
const assigned = panelAssignments(ledger);
|
|
211
222
|
const finding_ids = ledger.filter((e) => e.type === 'finding' && e.task === task && e.round_pending
|
|
212
223
|
&& !assigned.has(JSON.stringify([task, e.id]))).map((e) => e.id);
|
package/scripts/rsc.js
CHANGED
|
@@ -1359,7 +1359,7 @@ async function main() {
|
|
|
1359
1359
|
const USE = [
|
|
1360
1360
|
'Use: npx @ericrisco/rsc review consolidate [report.md|findings.json ...] [--json] [--window <lines>]',
|
|
1361
1361
|
' Without files it reads stdin. Each lens report carries its findings in ```json findings blocks.',
|
|
1362
|
-
' npx @ericrisco/rsc review ledger record <findings.json> [--task <id>] | outcome <id> <fixed|false|intentional|irrelevant|parked> | round <slug>/<task> | panel <slug>/<task> --lenses a,b,c | stats [--json]',
|
|
1362
|
+
' npx @ericrisco/rsc review ledger record <findings.json> [--task <id>] | outcome <id> <fixed|false|intentional|irrelevant|parked> | round <slug>/<task> | panel <slug>/<task> --lenses a,b,c [--repo <reviewed checkout>] | stats [--json]',
|
|
1363
1363
|
' Findings may include criterion and lens; with a qualified --task, recurring criterion objections are reported without dismissing them. round and panel share a three-round budget.',
|
|
1364
1364
|
' npx @ericrisco/rsc review escapes [--since <ref>] [--json]',
|
|
1365
1365
|
].join('\n');
|
|
@@ -1411,7 +1411,9 @@ async function main() {
|
|
|
1411
1411
|
}
|
|
1412
1412
|
if (sub === 'panel') {
|
|
1413
1413
|
if (!a || a.startsWith('--')) return fail(USE);
|
|
1414
|
-
const
|
|
1414
|
+
const { resolve } = await import('node:path');
|
|
1415
|
+
if (flag('repo') === true) return fail('rsc: --repo needs the path of the reviewed checkout, e.g. --repo .worktrees/<branch>');
|
|
1416
|
+
const r = L.panel(root, a, str('lenses'), str('repo') ? { repo: resolve(process.cwd(), str('repo')) } : {});
|
|
1415
1417
|
if (!r.ok) return fail(r.message);
|
|
1416
1418
|
say(r.message);
|
|
1417
1419
|
return;
|
|
@@ -87,9 +87,10 @@ Choosing a role:
|
|
|
87
87
|
|
|
88
88
|
Two hard rules, each with teeth:
|
|
89
89
|
|
|
90
|
-
1. **Never run a workload as the default compute service account.**
|
|
91
|
-
`
|
|
92
|
-
|
|
90
|
+
1. **Never run a workload as the default compute service account.** Unless the org
|
|
91
|
+
enforces `iam.automaticIamGrantsForDefaultServiceAccounts` (the default only for
|
|
92
|
+
orgs created after 2024-05-03), it carries `Editor` on the whole project, so a
|
|
93
|
+
single RCE in your container = full project takeover. Mint a dedicated SA per service and pass it explicitly (see Cloud Run).
|
|
93
94
|
```bash
|
|
94
95
|
gcloud iam service-accounts create api-sa --display-name="api runtime"
|
|
95
96
|
```
|
|
@@ -217,9 +218,11 @@ when you actually need its dedicated cores and faster failover, and drop `--tier
|
|
|
217
218
|
Put the password in Secret Manager, not in a flag or a file:
|
|
218
219
|
|
|
219
220
|
```bash
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
DB_PASS="$(openssl rand -base64 24)" # generate ONCE: the user and the secret must match
|
|
222
|
+
# --password sits in the process list while gcloud runs: run this on your own machine or in Cloud Shell, never on a shared host
|
|
223
|
+
gcloud sql users create app --instance=acme-db --password="$DB_PASS"
|
|
224
|
+
printf '%s' "$DB_PASS" | gcloud secrets create db-password --data-file=-
|
|
225
|
+
unset DB_PASS
|
|
223
226
|
```
|
|
224
227
|
|
|
225
228
|
Attach the instance to Cloud Run — serverless connects over a Unix socket, **no Auth
|
|
@@ -248,7 +251,7 @@ One service, one dedicated SA, exactly the roles it needs — and nothing else.
|
|
|
248
251
|
gcloud iam service-accounts create api-sa --display-name="api runtime"
|
|
249
252
|
SA=api-sa@acme-prod.iam.gserviceaccount.com
|
|
250
253
|
|
|
251
|
-
# Exactly
|
|
254
|
+
# Exactly three predefined roles. No Editor, no Owner.
|
|
252
255
|
gcloud projects add-iam-policy-binding acme-prod \
|
|
253
256
|
--member="serviceAccount:$SA" --role="roles/cloudsql.client"
|
|
254
257
|
gcloud secrets add-iam-policy-binding db-password \
|
|
@@ -296,7 +299,7 @@ attach SQL, mount a secret, full teardown — are in
|
|
|
296
299
|
|
|
297
300
|
| Bad | Good | Why |
|
|
298
301
|
|-----|------|-----|
|
|
299
|
-
| Deploy with no `--service-account` | Pass a dedicated per-service SA | Default compute SA has Editor; an RCE becomes project takeover |
|
|
302
|
+
| Deploy with no `--service-account` | Pass a dedicated per-service SA | Default compute SA usually has Editor; an RCE becomes project takeover |
|
|
300
303
|
| `gcloud iam service-accounts keys create key.json` | Attached SA + Workload Identity Federation | JSON keys are long-lived, leak, and are rarely rotated |
|
|
301
304
|
| `--role=roles/editor` on a workload SA | Scoped predefined roles (`cloudsql.client`, …) | Primitive roles grant far more than the service needs |
|
|
302
305
|
| Bucket public via `allUsers` | Signed URL via `--impersonate-service-account` (+ Token Creator) | A public bucket is a data leak; keyless signing needs `signBlob`, not a key file |
|
|
@@ -16,13 +16,13 @@ gcloud run deploy api --region=europe-west1 \
|
|
|
16
16
|
--vpc-egress=all-traffic
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
- `--vpc-egress=all-traffic` routes all outbound through the VPC. The
|
|
20
|
-
|
|
19
|
+
- `--vpc-egress=all-traffic` routes all outbound through the VPC. The value `all` is a
|
|
20
|
+
deprecated alias — write `all-traffic`.
|
|
21
21
|
- `--vpc-egress=private-ranges-only` sends only RFC-1918 traffic through the VPC and
|
|
22
22
|
lets public traffic exit directly — use it when only the DB is private.
|
|
23
23
|
|
|
24
|
-
The
|
|
25
|
-
do not provision a new connector for greenfield work.
|
|
24
|
+
The Serverless VPC Access connector (`--vpc-connector`) works but is not the
|
|
25
|
+
recommendation for new work; do not provision a new connector for greenfield work.
|
|
26
26
|
|
|
27
27
|
## Cloud SQL private IP
|
|
28
28
|
|
|
@@ -59,8 +59,8 @@ jobs:
|
|
|
59
59
|
test:
|
|
60
60
|
runs-on: ubuntu-latest
|
|
61
61
|
steps:
|
|
62
|
-
- uses: actions/checkout@
|
|
63
|
-
- uses: actions/setup-node@
|
|
62
|
+
- uses: actions/checkout@v7 # first-party, current major
|
|
63
|
+
- uses: actions/setup-node@v7
|
|
64
64
|
with:
|
|
65
65
|
node-version: 22
|
|
66
66
|
cache: npm # built-in lockfile-keyed cache
|
|
@@ -72,26 +72,26 @@ jobs:
|
|
|
72
72
|
Why those three lines are not optional:
|
|
73
73
|
- `permissions: contents: read` at the top — **default token permissions may be write**, and a leaked write token can push tags or publish packages. Widen per job and only to what that job needs (`packages: write` to publish, `id-token: write` for OIDC), never at the top.
|
|
74
74
|
- `concurrency` + `cancel-in-progress: true` — without it every push to an open PR leaves the old run finishing and billing. One group per ref keeps at most one running + one pending.
|
|
75
|
-
- `actions/checkout@
|
|
75
|
+
- `actions/checkout@v7`, `setup-node@v7` are the current majors (checkout v7.0.1, setup-node v7.1.0). Node 20 was removed as an action runtime on **2026-09-23**; runners now execute every JS action on **Node 24**, so stay on majors built for it. checkout v7 also refuses to check out a fork PR under `pull_request_target` / `workflow_run` unless you set `allow-unsafe-pr-checkout: true` — never set it.
|
|
76
76
|
|
|
77
77
|
## Caching
|
|
78
78
|
|
|
79
79
|
Two mechanisms, in order of preference:
|
|
80
80
|
|
|
81
81
|
1. **Built-in `cache:` on `setup-*`** — `setup-node`, `setup-python`, `setup-go`, etc. cache the package manager's store keyed on the lockfile. Free, one line. Use it.
|
|
82
|
-
2. **`actions/cache@
|
|
82
|
+
2. **`actions/cache@v6`** — for anything else (build output, custom tool dirs, compiled artifacts).
|
|
83
83
|
|
|
84
84
|
The cache key is the whole game. A cache is **immutable once written for a key** — if your key never changes, you cache stale deps forever.
|
|
85
85
|
|
|
86
86
|
```yaml
|
|
87
87
|
# Bad — fixed key never invalidates; you restore yesterday's broken node_modules forever
|
|
88
|
-
- uses: actions/cache@
|
|
88
|
+
- uses: actions/cache@v6
|
|
89
89
|
with:
|
|
90
90
|
path: ~/.npm
|
|
91
91
|
key: npm-cache
|
|
92
92
|
|
|
93
93
|
# Good — key changes when the lockfile changes; restore-keys gives a warm partial hit
|
|
94
|
-
- uses: actions/cache@
|
|
94
|
+
- uses: actions/cache@v6
|
|
95
95
|
with:
|
|
96
96
|
path: ~/.npm
|
|
97
97
|
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
|
@@ -114,17 +114,17 @@ jobs:
|
|
|
114
114
|
max-parallel: 4
|
|
115
115
|
matrix:
|
|
116
116
|
os: [ubuntu-latest, macos-latest]
|
|
117
|
-
node: [
|
|
117
|
+
node: [22, 24, 26]
|
|
118
118
|
exclude:
|
|
119
119
|
- os: macos-latest # don't pay the macOS multiplier on every version
|
|
120
|
-
node:
|
|
120
|
+
node: 22
|
|
121
121
|
include:
|
|
122
|
-
- os: ubuntu-latest #
|
|
122
|
+
- os: ubuntu-latest # matches an existing cell: adds lint: true to it, no new cell
|
|
123
123
|
node: 24
|
|
124
124
|
lint: true
|
|
125
125
|
steps:
|
|
126
|
-
- uses: actions/checkout@
|
|
127
|
-
- uses: actions/setup-node@
|
|
126
|
+
- uses: actions/checkout@v7
|
|
127
|
+
- uses: actions/setup-node@v7
|
|
128
128
|
with: { node-version: "${{ matrix.node }}", cache: npm }
|
|
129
129
|
- run: npm ci && npm test
|
|
130
130
|
```
|
|
@@ -209,7 +209,7 @@ deploy:
|
|
|
209
209
|
id-token: write
|
|
210
210
|
contents: read
|
|
211
211
|
steps:
|
|
212
|
-
- uses: actions/checkout@
|
|
212
|
+
- uses: actions/checkout@v7
|
|
213
213
|
- uses: aws-actions/configure-aws-credentials@<full-40-char-sha>
|
|
214
214
|
with:
|
|
215
215
|
role-to-assume: arn:aws:iam::123456789012:role/gh-deploy
|
|
@@ -36,7 +36,7 @@ should_not_trigger:
|
|
|
36
36
|
capability:
|
|
37
37
|
- scenario: "I have a Node 20 service in a GitHub repo. Give me a hardened CI + deploy pipeline that tests on a matrix of node versions and deploys to AWS on tag pushes without static credentials."
|
|
38
38
|
must_include:
|
|
39
|
-
- "First-party actions on current majors (checkout@
|
|
39
|
+
- "First-party actions on current majors (checkout@v7, setup-node@v7); third-party actions pinned to a full 40-char commit SHA."
|
|
40
40
|
- "Top-level permissions set to contents: read, widened per job only where needed."
|
|
41
41
|
- "Built-in npm cache via setup-node (cache: npm) keyed on the lockfile."
|
|
42
42
|
- "A test job using strategy.matrix across multiple node versions."
|
|
@@ -39,7 +39,7 @@ For image builds inside a workflow, cache layers with the GitHub Actions cache b
|
|
|
39
39
|
|
|
40
40
|
## Matrix shaping
|
|
41
41
|
|
|
42
|
-
`include` adds cells or extra variables; `exclude` removes specific combinations. They compose: the matrix is built, `exclude` prunes, then `include` appends.
|
|
42
|
+
`include` adds cells or extra variables; `exclude` removes specific combinations. They compose: the matrix is built, `exclude` prunes, then `include` is applied — an entry whose original keys all match an existing cell only adds its extra variables to that cell; any other entry appends a new cell.
|
|
43
43
|
|
|
44
44
|
```yaml
|
|
45
45
|
strategy:
|
|
@@ -47,12 +47,12 @@ strategy:
|
|
|
47
47
|
max-parallel: 6
|
|
48
48
|
matrix:
|
|
49
49
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
50
|
-
node: [
|
|
50
|
+
node: [22, 24, 26]
|
|
51
51
|
exclude:
|
|
52
|
-
- { os: windows-latest, node:
|
|
53
|
-
- { os: macos-latest, node:
|
|
52
|
+
- { os: windows-latest, node: 22 } # drop an unsupported combo
|
|
53
|
+
- { os: macos-latest, node: 22 }
|
|
54
54
|
include:
|
|
55
|
-
- { os: ubuntu-latest, node: 24, coverage: true } #
|
|
55
|
+
- { os: ubuntu-latest, node: 24, coverage: true } # matches an existing cell: adds coverage to it
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
- `fail-fast: false` — every cell reports, even after one fails. Use it for compatibility matrices where you want the full grid of results.
|
|
@@ -103,11 +103,11 @@ jobs:
|
|
|
103
103
|
build:
|
|
104
104
|
runs-on: ubuntu-latest
|
|
105
105
|
steps:
|
|
106
|
-
- uses: actions/checkout@
|
|
107
|
-
- uses: actions/setup-node@
|
|
106
|
+
- uses: actions/checkout@v7
|
|
107
|
+
- uses: actions/setup-node@v7
|
|
108
108
|
with: { node-version: 24, cache: npm }
|
|
109
109
|
- run: npm ci && npm run build
|
|
110
|
-
- uses: actions/upload-artifact@
|
|
110
|
+
- uses: actions/upload-artifact@v7
|
|
111
111
|
with: { name: dist, path: dist/ }
|
|
112
112
|
|
|
113
113
|
deploy:
|
|
@@ -118,7 +118,7 @@ jobs:
|
|
|
118
118
|
id-token: write # OIDC; no static keys
|
|
119
119
|
contents: read
|
|
120
120
|
steps:
|
|
121
|
-
- uses: actions/download-artifact@
|
|
121
|
+
- uses: actions/download-artifact@v8
|
|
122
122
|
with: { name: dist, path: dist/ }
|
|
123
123
|
- uses: aws-actions/configure-aws-credentials@<full-40-char-sha>
|
|
124
124
|
with:
|
|
@@ -84,8 +84,8 @@ https://www.googleapis.com/auth/drive.file
|
|
|
84
84
|
|
|
85
85
|
## Build the authed client
|
|
86
86
|
|
|
87
|
-
Node uses `googleapis` (latest
|
|
88
|
-
`google-auth-library` (
|
|
87
|
+
Node uses `googleapis` (latest 190.x, maintenance mode — bugs/security only) with
|
|
88
|
+
`google-auth-library` (11.x). Python uses `google-auth` +
|
|
89
89
|
`google-api-python-client`. The impersonation line is the `subject` / `with_subject`.
|
|
90
90
|
|
|
91
91
|
```javascript
|
|
@@ -172,17 +172,21 @@ sheets.spreadsheets().values().update(
|
|
|
172
172
|
|
|
173
173
|
The per-user ceiling is the one that bites a cron looping over a mailbox.
|
|
174
174
|
|
|
175
|
-
- **Gmail:** 1.2M units/min per project, **6,000 units/min per user
|
|
176
|
-
|
|
175
|
+
- **Gmail:** 1.2M units/min per project, **6,000 units/min per user**.
|
|
176
|
+
Costs: `messages.send` 100, `messages.get` 20 (60 with `format=full|raw`), `messages.list` 5,
|
|
177
177
|
`messages.modify` 5, `drafts.create` 10. Hard cap **500 recipients/message**.
|
|
178
|
-
- **Drive:** 1M units/min per project, **325,000 units/min per user**, 1
|
|
179
|
-
egress.
|
|
178
|
+
- **Drive:** 1M units/min per project, **325,000 units/min per user**, 1 TiB/day
|
|
179
|
+
egress per project (not yet enforced), 750 GB/day upload per user.
|
|
180
180
|
- **Sheets:** read and write each 300/min per project, **60/min per user**; 429
|
|
181
181
|
on overage; 180s request timeout; keep payloads under ~2 MB.
|
|
182
|
-
- **
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
- **Tiering (Gmail, Calendar, Drive):** baseline quotas apply to new projects
|
|
183
|
+
since 2026-05-01. Since 2026-11-24 there is a free **Standard Tier** and a
|
|
184
|
+
billed **Scaled Tier**; higher REST quotas need Scaled Tier (linked billing) or
|
|
185
|
+
the internal-use exception. From **2027-02-01** AI agents must use the Workspace
|
|
186
|
+
MCP servers — agents calling REST directly are held to Standard Tier quotas.
|
|
187
|
+
From **2027-04-01** Standard limits are enforced on every project and Scaled
|
|
188
|
+
Tier usage past the daily no-charge allowance is billed. Treat quota as a cost
|
|
189
|
+
line, not a free ceiling.
|
|
186
190
|
|
|
187
191
|
Three habits keep you under it:
|
|
188
192
|
|
|
@@ -227,7 +231,7 @@ def with_backoff(call, max_retries=6, max_backoff=64):
|
|
|
227
231
|
| `unauthorized_client` | SA client ID / scope not authorized for DWD | Add the client ID + **exact** scopes in Admin console Manage DWD |
|
|
228
232
|
| `403 insufficient permissions` | Scope too narrow, or API not enabled | Widen to the right scope (still least), enable the API |
|
|
229
233
|
| `403 rateLimitExceeded` / `429` | Per-user or per-project quota hit | Exponential backoff + jitter; batch; spread load |
|
|
230
|
-
| `400 failedPrecondition` on
|
|
234
|
+
| `400 failedPrecondition` ("Precondition check failed") on Gmail | No `subject`: the bare SA has no mailbox | Set `subject` to a real Workspace user and finish DWD |
|
|
231
235
|
| `invalid_grant` | Clock skew or stale/rotated key | Sync clock; re-issue the key |
|
|
232
236
|
|
|
233
237
|
## Anti-patterns
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# API recipes — extended Node + Python
|
|
2
2
|
|
|
3
3
|
Longer, copy-paste recipes that did not fit in SKILL.md. All assume an authed
|
|
4
|
-
client built per SKILL.md "Build the authed client". Versions as of 2026-
|
|
5
|
-
`googleapis` latest
|
|
4
|
+
client built per SKILL.md "Build the authed client". Versions as of 2026-11-25:
|
|
5
|
+
`googleapis` latest 190.x (maintenance mode), `google-auth-library` 11.x.
|
|
6
6
|
|
|
7
7
|
## Gmail — raw MIME with an attachment
|
|
8
8
|
|
|
@@ -94,7 +94,7 @@ genuinely cannot federate, and then secret-manage + rotate them.
|
|
|
94
94
|
| `unauthorized_client` | Client ID/scope not authorized for DWD | Add client ID + exact scopes in Manage DWD |
|
|
95
95
|
| `403 accessNotConfigured` / `SERVICE_DISABLED` | API not enabled on the project | Enable it in the Cloud console |
|
|
96
96
|
| `403 insufficient permissions` | Scope too narrow for the call | Use the correct (still least) scope |
|
|
97
|
-
| `400 failedPrecondition` | `subject`
|
|
97
|
+
| `400 failedPrecondition` ("Precondition check failed") | Gmail called as the bare SA, no `subject` — an SA has no mailbox | Set `subject` to a Workspace user and authorize DWD |
|
|
98
98
|
| `invalid_grant` | Clock skew, or rotated/revoked key | Sync clock (NTP); re-issue key |
|
|
99
99
|
| `404` on a user's resource via SA, no DWD | SA can't see resources it doesn't own | Share the resource to the SA, or impersonate via DWD |
|
|
100
100
|
| `403 rateLimitExceeded` / `429` | Per-user/project quota hit | Exponential backoff + jitter; batch; spread load |
|
|
@@ -911,7 +911,7 @@ providers:
|
|
|
911
911
|
: "${MINIMAX_API_KEY:?MINIMAX_API_KEY not set}"
|
|
912
912
|
case "${MINIMAX_REGION:-global}" in
|
|
913
913
|
global) base_url="https://api.minimax.io/v1" ;;
|
|
914
|
-
cn) base_url="https://api.
|
|
914
|
+
cn) base_url="https://api.minimaxi.com/v1" ;;
|
|
915
915
|
*) echo "MINIMAX_REGION must be global or cn" >&2; exit 1 ;;
|
|
916
916
|
esac
|
|
917
917
|
curl -fsS --max-time 30 "$base_url/models" -H "Authorization: Bearer $MINIMAX_API_KEY" |
|
package/skills/hetzner/SKILL.md
CHANGED
|
@@ -9,8 +9,8 @@ origin: risco
|
|
|
9
9
|
# Hetzner — the cheap European box, made safe and reproducible
|
|
10
10
|
|
|
11
11
|
Hetzner Cloud is chosen for one reason: price/performance. A 2 vCPU / 4 GB AMD
|
|
12
|
-
box
|
|
13
|
-
include 20 TB of egress. The risk is that "cheap" becomes "unhardened and
|
|
12
|
+
box (CPX22) lists at about €19.49/mo, the EU Intel line (CX23) at about €5.49
|
|
13
|
+
when it is orderable, and EU locations include 20 TB of egress. The risk is that "cheap" becomes "unhardened and
|
|
14
14
|
unmonitored" — a root-SSH box on a public IPv4 with password auth on. Your job
|
|
15
15
|
is to make the cheap box **safe** and **reproducible**: every server comes up
|
|
16
16
|
from a committed cloud-init file and a Cloud Firewall ruleset, never from
|
|
@@ -19,15 +19,16 @@ a pet.
|
|
|
19
19
|
|
|
20
20
|
## Decide before you create
|
|
21
21
|
|
|
22
|
-
Pick the line, then the location. Prices are
|
|
23
|
-
|
|
22
|
+
Pick the line, then the location. Prices are new-order prices after the
|
|
23
|
+
2026-06-15 adjustment (existing servers keep their old price until rescaled);
|
|
24
|
+
treat exact cents as "verify in the console."
|
|
24
25
|
|
|
25
26
|
| Line | Chip | When to pick | Price band | EU-only? |
|
|
26
27
|
|---|---|---|---|---|
|
|
27
|
-
| **CX** | Intel (shared) | Cost-optimized, tiny EU workloads | ~€
|
|
28
|
-
| **CPX** | AMD (shared) | Default for apps; best general value | CPX22 ~€
|
|
29
|
-
| **CAX** | ARM64 (shared) | Cheapest per-core; ARM-clean workloads |
|
|
30
|
-
| **CCX** | Dedicated vCPU | Steady CPU load, no noisy-neighbor | CCX13 ~€
|
|
28
|
+
| **CX** | Intel (shared) | Cost-optimized, tiny EU workloads | ~€5.49/mo (2 vCPU/4 GB/40 GB); often out of stock | Yes |
|
|
29
|
+
| **CPX** | AMD (shared) | Default for apps; best general value | CPX22 ~€19.49; larger sizes: check `hcloud server-type list` | No |
|
|
30
|
+
| **CAX** | ARM64 (shared) | Cheapest per-core; ARM-clean workloads | CAX11 ~€5.99; cheapest per-core | Yes |
|
|
31
|
+
| **CCX** | Dedicated vCPU | Steady CPU load, no noisy-neighbor | CCX13 ~€42.99 (2 vCPU/8 GB) | No |
|
|
31
32
|
|
|
32
33
|
Rules:
|
|
33
34
|
|
|
@@ -49,7 +50,7 @@ Full dated matrix, latency notes, and the no-SLA / no-managed-DB reality:
|
|
|
49
50
|
|
|
50
51
|
## Provision reproducibly
|
|
51
52
|
|
|
52
|
-
Install the official CLI (latest **v1.
|
|
53
|
+
Install the official CLI (latest **v1.70.2**, released 2026-10-23) and create a
|
|
53
54
|
context (the token comes from the project's *Security → API tokens*, Read &
|
|
54
55
|
Write):
|
|
55
56
|
|
|
@@ -72,8 +73,8 @@ hcloud server create \
|
|
|
72
73
|
--user-data-from-file cloud-init.yaml
|
|
73
74
|
```
|
|
74
75
|
|
|
75
|
-
Use `--location
|
|
76
|
-
|
|
76
|
+
Use `--location`: the `datacenter` property was removed from Servers and Primary
|
|
77
|
+
IPs in the API on 2026-07-01, and hcloud v1.67.0 dropped the `--datacenter` flag. Trimmed cloud-init
|
|
77
78
|
skeleton (full annotated file in `references/cloud-init.md`):
|
|
78
79
|
|
|
79
80
|
```yaml
|
|
@@ -185,7 +186,7 @@ This skill stops at a clean, hardened host. Then route the install/deploy:
|
|
|
185
186
|
| Snapshot treated as backup | One stale manual image, no rotation, no schedule | Enable the Backups add-on or push to off-box storage |
|
|
186
187
|
| US location, then surprised by the bill | US/Singapore include far less than EU's 20 TB egress | EU location for egress-heavy apps; check the traffic cap first |
|
|
187
188
|
| IPv6-only to save €0.50 | Registry/CI/mirror pulls over IPv4-only break | Keep one IPv4 unless every upstream is confirmed dual-stack |
|
|
188
|
-
| Using `--datacenter` |
|
|
189
|
+
| Using `--datacenter` | Removed from the API (2026-07-01) and from hcloud (v1.67.0) | Use `--location` |
|
|
189
190
|
|
|
190
191
|
## Verify
|
|
191
192
|
|
|
@@ -32,13 +32,15 @@ packages:
|
|
|
32
32
|
- unattended-upgrades
|
|
33
33
|
|
|
34
34
|
# --- drop-in sshd hardening (braces) so an image default can't re-enable it ---
|
|
35
|
+
# sshd keeps the FIRST value it reads and loads drop-ins in lexical order, so the
|
|
36
|
+
# file must sort before the image's 50-cloud-init.conf: 00-, never 99-.
|
|
35
37
|
write_files:
|
|
36
|
-
- path: /etc/ssh/sshd_config.d/
|
|
38
|
+
- path: /etc/ssh/sshd_config.d/00-hardening.conf
|
|
37
39
|
content: |
|
|
38
40
|
PermitRootLogin no
|
|
39
41
|
PasswordAuthentication no
|
|
40
42
|
PubkeyAuthentication yes
|
|
41
|
-
|
|
43
|
+
KbdInteractiveAuthentication no
|
|
42
44
|
# Optional: move the port. Obscurity, not security — keep key-only + firewall regardless.
|
|
43
45
|
# Port 2222
|
|
44
46
|
- path: /etc/apt/apt.conf.d/20auto-upgrades
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
# Reference: plans, prices, locations, reliability
|
|
2
2
|
|
|
3
|
-
Dated figures (
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Dated figures (new-order prices after the **2026-06-15 price adjustment**, which
|
|
4
|
+
followed a first round on 2026-04-01). Existing servers keep their price until
|
|
5
|
+
they are rescaled — treat exact cents as "verify in the console," use these as
|
|
6
|
+
bands for the decision.
|
|
6
7
|
|
|
7
8
|
## Plan matrix
|
|
8
9
|
|
|
9
|
-
| Plan | Chip | vCPU / RAM / disk | Price band (post-2026-
|
|
10
|
+
| Plan | Chip | vCPU / RAM / disk | Price band (post-2026-06-15) | EU-only? | Pick when |
|
|
10
11
|
|---|---|---|---|---|---|
|
|
11
|
-
| CX23-class | Intel (shared) | 2 / 4 GB / 40 GB | ~€
|
|
12
|
-
| CPX22 | AMD (shared) | 2 / 4 GB / 80 GB | ~€
|
|
13
|
-
| CPX32 | AMD (shared) | 4 / 8 GB / 160 GB |
|
|
14
|
-
| CPX42 | AMD (shared) | 8 / 16 GB / 320 GB |
|
|
15
|
-
| CAX (ARM64) | Ampere (shared) | varies | cheapest per-core | Yes | ARM-clean workloads, max cores/€ |
|
|
16
|
-
| CCX13 | Dedicated vCPU | 2 / 8 GB | ~€
|
|
12
|
+
| CX23-class | Intel (shared) | 2 / 4 GB / 40 GB | ~€5.49/mo (often out of stock) | Yes | Cheapest viable, tiny EU workloads |
|
|
13
|
+
| CPX22 | AMD (shared) | 2 / 4 GB / 80 GB | ~€19.49/mo | No | Default app box, best value |
|
|
14
|
+
| CPX32 | AMD (shared) | 4 / 8 GB / 160 GB | verify (`hcloud server-type list`) | No | Mid app + small DB |
|
|
15
|
+
| CPX42 | AMD (shared) | 8 / 16 GB / 320 GB | verify (`hcloud server-type list`) | No | Heavier services |
|
|
16
|
+
| CAX (ARM64) | Ampere (shared) | varies | CAX11 ~€5.99/mo; cheapest per-core | Yes | ARM-clean workloads, max cores/€ |
|
|
17
|
+
| CCX13 | Dedicated vCPU | 2 / 8 GB | ~€42.99/mo | No | Steady CPU, no noisy-neighbor |
|
|
17
18
|
|
|
18
19
|
## IPv4 / IPv6 economics
|
|
19
20
|
|
|
@@ -47,10 +48,10 @@ thing you're accepting — not also an unhardened, un-monitored host.
|
|
|
47
48
|
|
|
48
49
|
## Sources
|
|
49
50
|
|
|
50
|
-
- hcloud CLI v1.
|
|
51
|
-
- `datacenter`
|
|
52
|
-
- Price
|
|
51
|
+
- hcloud CLI v1.70.2 (2026-10-23): github.com/hetznercloud/cli/releases
|
|
52
|
+
- `datacenter` removal (API 2026-07-01, `--datacenter` flag dropped in v1.67.0): hcloud CLI CHANGELOG
|
|
53
|
+
- Price adjustments (2026-04-01, 2026-06-15): docs.hetzner.com/general/infrastructure-and-availability/price-adjustment/
|
|
53
54
|
- Plans/prices/traffic/locations/reliability: betterstack.com Hetzner Cloud review + hetzner.com/cloud
|
|
54
55
|
- Firewall layers + cloud-init: community.hetzner.com tutorials
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
Prices and CLI facts re-checked 2026-11-25.
|
|
@@ -30,7 +30,7 @@ did not need.
|
|
|
30
30
|
|
|
31
31
|
| Situation | Use | Why |
|
|
32
32
|
|---|---|---|
|
|
33
|
-
| Try a model now, low/dev volume, own no infra | **Inference Providers router** (`InferenceClient`) | Fastest path; monthly credits
|
|
33
|
+
| Try a model now, low/dev volume, own no infra | **Inference Providers router** (`InferenceClient`) | Fastest path; pay-as-you-go (PRO includes monthly credits, Free has none). |
|
|
34
34
|
| CPU task: embeddings, text-ranking, text-classification, small BERT/GPT-2 | `provider="hf-inference"` | That is exactly its remaining niche as of July 2025. |
|
|
35
35
|
| Big LLM (8B, 70B, 405B) through HF | router with a **partner provider** (Together/Fireworks/Cerebras/DeepInfra…) | `hf-inference` does not serve big LLMs — it will 404 or stall. |
|
|
36
36
|
| Steady prod traffic, need fixed latency/SLA | **dedicated Inference Endpoint** + scale-to-zero | Predictable, autoscaling, billed per minute. |
|
|
@@ -41,14 +41,14 @@ did not need.
|
|
|
41
41
|
## Auth & install
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
pip install
|
|
44
|
+
pip install huggingface_hub # 2.4.0; needs Python >=3.10
|
|
45
45
|
pip install transformers # 5.x line, PyTorch-first, optional/local
|
|
46
46
|
hf auth login # stores a token; or export HF_TOKEN=...
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
- **The CLI is `hf
|
|
50
|
-
`hf upload`, `hf
|
|
51
|
-
|
|
49
|
+
- **The CLI is `hf`**, shaped `hf <resource> <action>` (`hf auth login`, `hf download`,
|
|
50
|
+
`hf upload`, `hf repos create`, `hf jobs run`). `huggingface_hub` 2.0 removed the
|
|
51
|
+
`huggingface-cli` entry point and the singular `hf repo` group — scripts that call them fail.
|
|
52
52
|
- **Never hardcode a `hf_...` token in code** — tokens leak the moment the file hits git. Read
|
|
53
53
|
from the environment instead:
|
|
54
54
|
|
|
@@ -91,8 +91,8 @@ client = OpenAI(
|
|
|
91
91
|
- **`InferenceClient.post()` was removed** (dropped in hub v0.31.0). Use the task methods:
|
|
92
92
|
`chat.completions.create()`, `text_generation()`, `feature_extraction()` (embeddings),
|
|
93
93
|
`text_to_image()`, `automatic_speech_recognition()`.
|
|
94
|
-
- **Credits are real and small**: Free
|
|
95
|
-
(shared). Past that you are pay-as-you-go and must buy credits. Budget accordingly — why: a
|
|
94
|
+
- **Credits are real and small**: Free users get none (buy credits first), PRO $2.00/mo,
|
|
95
|
+
Team/Enterprise $2.00 per seat (shared). Past that you are pay-as-you-go and must buy credits. Budget accordingly — why: a
|
|
96
96
|
chat loop on a 70B model burns the free tier in minutes.
|
|
97
97
|
- A **Custom Provider Key** bypasses HF billing entirely (the provider bills you; HF credits do
|
|
98
98
|
not apply). For org billing, pass `bill_to="org-name"` (header `X-HF-Bill-To`).
|
|
@@ -103,7 +103,7 @@ client = OpenAI(
|
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
105
|
hf download meta-llama/Llama-3.1-8B-Instruct --include "*.safetensors"
|
|
106
|
-
hf
|
|
106
|
+
hf repos create my-org/my-model --repo-type model
|
|
107
107
|
hf upload my-org/my-model ./out --commit-message "v1 weights"
|
|
108
108
|
```
|
|
109
109
|
|
|
@@ -134,7 +134,7 @@ commit. Match the model to your constraint; do not grab whatever is trending.
|
|
|
134
134
|
Move off the router when you need fixed latency/SLA, or the router's PAYG cost stops being
|
|
135
135
|
predictable. An Endpoint is your own autoscaling deployment.
|
|
136
136
|
|
|
137
|
-
- Pricing: CPU from ~$0.
|
|
137
|
+
- Pricing: CPU from ~$0.033/core/hr, GPU from ~$0.50/hr (A10G ~$1.00/hr, H200 on AWS ~$5.00/hr, H100 on GCP ~$10.00/hr),
|
|
138
138
|
**billed per minute** even though shown hourly.
|
|
139
139
|
- Enable **scale-to-zero** for bursty traffic — it parks at $0 when idle and cold-starts on the
|
|
140
140
|
next request. A bursty 100–1000 req/day workload typically lands at **$20–60/mo**.
|
|
@@ -143,7 +143,7 @@ predictable. An Endpoint is your own autoscaling deployment.
|
|
|
143
143
|
|
|
144
144
|
## Spaces + ZeroGPU
|
|
145
145
|
|
|
146
|
-
A Space hosts a demo app with a public URL. **ZeroGPU** grabs an
|
|
146
|
+
A Space hosts a demo app with a public URL. **ZeroGPU** grabs half an NVIDIA RTX Pro 6000 Blackwell (48GB; `size="xlarge"` for the full 96GB at 2x quota) only
|
|
147
147
|
while a decorated function runs, then releases it.
|
|
148
148
|
|
|
149
149
|
```python
|
|
@@ -162,12 +162,12 @@ def generate(prompt: str) -> str:
|
|
|
162
162
|
```python
|
|
163
163
|
from transformers import pipeline
|
|
164
164
|
pipe = pipeline("text-generation", model="meta-llama/Llama-3.1-8B-Instruct",
|
|
165
|
-
device_map="auto",
|
|
165
|
+
device_map="auto", dtype="auto")
|
|
166
166
|
print(pipe("Hello", max_new_tokens=64)[0]["generated_text"])
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
- `pipeline("task", model=...)` for quick use; `AutoModelForCausalLM.from_pretrained(...)` when
|
|
170
|
-
you need control over generation/quantization. Set `device_map`/`torch_dtype`
|
|
170
|
+
you need control over generation/quantization. Set `device_map`/`dtype` explicitly (`torch_dtype` is deprecated).
|
|
171
171
|
- Use local only when you are **offline, data-private, or already on a GPU**. Otherwise the
|
|
172
172
|
router is far less ops than babysitting CUDA and weights.
|
|
173
173
|
|
|
@@ -179,13 +179,13 @@ print(pipe("Hello", max_new_tokens=64)[0]["generated_text"])
|
|
|
179
179
|
| `provider="hf-inference"` for a 70B/405B LLM | CPU niche; 404s or stalls | Route to a partner provider (Together/Fireworks/Cerebras) |
|
|
180
180
|
| `api_key="hf_abc123..."` in code | Token leaks in git history | Read `os.environ["HF_TOKEN"]` |
|
|
181
181
|
| Spin up a dedicated Endpoint just to try a model | Burns money idle | Use the router first; graduate only on real traffic |
|
|
182
|
-
| Assuming router calls are free/unlimited | Free
|
|
182
|
+
| Assuming router calls are free/unlimited | Free accounts get no monthly credits; PRO $2/mo | Budget credits; expect PAYG |
|
|
183
183
|
| ZeroGPU under Streamlit/Docker SDK | Unsupported, silently no GPU | Use the Gradio SDK |
|
|
184
|
-
| `huggingface-cli ...` in
|
|
184
|
+
| `huggingface-cli ...` / `hf repo ...` in scripts | Removed in `huggingface_hub` 2.0; the command fails | Use `hf ...` / `hf repos ...` |
|
|
185
185
|
| OpenAI base URL other than `https://router.huggingface.co/v1` | Won't reach the HF router | Use that exact host |
|
|
186
186
|
|
|
187
187
|
## verify.sh
|
|
188
188
|
|
|
189
189
|
`scripts/verify.sh [TARGET]` is a static, read-only linter (no network, no token). It flags the
|
|
190
190
|
hard violations above — `.post(`, hardcoded `hf_` tokens, big-LLM-to-`hf-inference`, wrong router
|
|
191
|
-
host
|
|
191
|
+
host, the removed `huggingface-cli`. It exits 0 on a clean or empty target.
|
|
@@ -37,5 +37,5 @@ capability:
|
|
|
37
37
|
- "InferenceClient or the OpenAI-compatible router base URL https://router.huggingface.co/v1"
|
|
38
38
|
- "a partner provider (e.g. together/fireworks), not hf-inference, for the 8B LLM"
|
|
39
39
|
- "HF_TOKEN read from the environment, never a hardcoded hf_ literal"
|
|
40
|
-
- "cost awareness:
|
|
40
|
+
- "cost awareness: no monthly credits on Free, PRO $2/mo, then pay-as-you-go, no markup"
|
|
41
41
|
- "a dedicated Inference Endpoint with scale-to-zero as the graduation path when traffic is steady"
|