@pikku/skills 0.12.63 → 0.12.64

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/skills",
3
- "version": "0.12.63",
3
+ "version": "0.12.64",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pikkujs/pikku.git",
@@ -197,7 +197,7 @@ function authMiddleware(req, res, next) {
197
197
  **Pikku:**
198
198
 
199
199
  ```typescript
200
- import { authBearer } from '@pikku/core/middleware'
200
+ import { authBearer } from '#pikku/middleware'
201
201
 
202
202
  // One line - handles token extraction, JWT verification, session population
203
203
  addHTTPMiddleware('*', [authBearer({})])
@@ -137,11 +137,11 @@ the manifest alone. Fix the contract or bump the version, then run it again.
137
137
  `check` is a within-repo gate — "you changed a contract without bumping
138
138
  `version:`". `release` is a release question — "what does this build owe the
139
139
  clients of the last release, and how do we ship it?". The baseline is
140
- `surface.pikku.json`, the snapshot committed by the previous release.
140
+ `pikku.surface.json`, the snapshot committed by the previous release.
141
141
 
142
142
  ```bash
143
143
  npx pikku release init # first run: snapshot + CHANGELOG.md
144
- npx pikku release diff # vs surface.pikku.json
144
+ npx pikku release diff # vs pikku.surface.json
145
145
  npx pikku release diff --against https://api.acme.com/surface.json # vs any baseline
146
146
  npx pikku release diff --fail-on major # PR gate
147
147
  npx pikku release snapshot --out surface.json # write a snapshot
@@ -162,7 +162,7 @@ writes it; it never commits, tags or pushes. Who does that is your call — you
162
162
  with plain git, or a platform with its own credentials.
163
163
 
164
164
  `prepare` runs on a checkout of `origin/staging` after `pikku all`. It diffs the
165
- surface against `surface.pikku.json`, reads the commits production does not have
165
+ surface against `pikku.surface.json`, reads the commits production does not have
166
166
  yet, bumps `package.json`, prepends a `CHANGELOG.md` section and rewrites the
167
167
  snapshot. No commits since the last release means nothing to release. It
168
168
  refuses when `main` has commits `staging` lacks (merge `main` into `staging`
@@ -174,7 +174,7 @@ Shipping is then one commit on top of that trunk sha:
174
174
 
175
175
  ```bash
176
176
  npx pikku release prepare
177
- git add package.json CHANGELOG.md surface.pikku.json
177
+ git add package.json CHANGELOG.md pikku.surface.json
178
178
  git commit -m "release: v0.4.0"
179
179
  git tag v0.4.0
180
180
  git push --atomic origin HEAD:staging HEAD:main v0.4.0
@@ -82,7 +82,7 @@ wireHTTP({
82
82
  Runs before everything else, across every wire type: HTTP, Queue, Channel, Trigger, Scheduler, Workflow, Agent, CLI, MCP. Use it for cross-cutting concerns (e.g. telemetry) that must wrap every invocation regardless of transport.
83
83
 
84
84
  ```typescript
85
- import { addGlobalMiddleware } from '@pikku/core/middleware'
85
+ import { addGlobalMiddleware } from '#pikku/middleware'
86
86
  import { telemetryOuter, telemetryInner } from '@pikku/core/middleware'
87
87
 
88
88
  addGlobalMiddleware([telemetryOuter({ environmentId: env.STAGE_ID })]) // wraps the full call
@@ -95,7 +95,7 @@ addGlobalMiddleware([telemetryInner({ environmentId: env.STAGE_ID })]) // closes
95
95
 
96
96
  ```typescript
97
97
  import { addHTTPMiddleware } from '@pikku/core/http'
98
- import { cors, authBearer } from '@pikku/core/middleware'
98
+ import { cors, authBearer } from '#pikku/middleware'
99
99
 
100
100
  // All routes
101
101
  addHTTPMiddleware('*', [
@@ -239,11 +239,29 @@ pikku.fetch.setHeader('x-tenant', tenantId)
239
239
  `authHeaders.jwt` becomes `Authorization: Bearer …` and `authHeaders.apiKey`
240
240
  becomes `X-API-KEY`; setting a JWT takes precedence over an API key.
241
241
 
242
+ ## Generated client files
243
+
244
+ Name any of these under `clientFiles` in `pikku.config.json` and `pikku all` writes them, with
245
+ import paths computed from the config:
246
+
247
+ - `typesFile` — `RPCInput<'name'>`, `RPCOutput<'name'>`, `FlattenedRPCMap` (and `AnalyticsEvent`
248
+ when `scaffold.analytics` is on). Use these instead of reaching into the functions package.
249
+ - `envFile` — `apiUrl()`, `basePath()`, `appHref(path)`.
250
+ - `rpcFile` — `rpc()`, a client for code outside React such as a route `beforeLoad`. It forwards
251
+ the request cookie during SSR (TanStack Start). Needs `envFile`.
252
+ - `authClientFile` — the Better Auth client glue from `@pikku/better-auth/client`. Needs
253
+ `rpcFile`, `envFile` and a `getSession` function; `clientAuth` sets the login and home paths.
254
+
255
+ In `vite.config.ts`, `pikkuVite()` from `@pikku/vite` adds `testIds()` and, with Better Auth, the
256
+ dev cross-site session plugin. `pikku dev` runs every frontend that sets `dev.command`
257
+ (`--frontend a,b`, `--no-frontends`) and creates `BETTER_AUTH_SECRET` in `.env` on first run.
258
+
242
259
  ## What NOT to do
243
260
 
244
261
  - Don't instantiate `PikkuFetch`/`PikkuRPC` inside a component — `createPikku`
245
262
  goes once at the app root, the instance flows through Context.
246
263
  - Don't call `usePikkuRPC()` outside a `<PikkuProvider>` — it throws.
264
+ - Don't copy a `rpc.ts` or `env.ts` between apps — generate them with `rpcFile` and `envFile`.
247
265
  - Don't write a custom RPC client. The generated one already covers every
248
266
  exposed function with full types.
249
267
  - Don't hardcode user-facing strings. Every display string goes through an
@@ -44,7 +44,7 @@ permissions were removed in #972. Authorization lives on the function's own
44
44
  ### `pikkuChannelMiddleware(fn)`
45
45
 
46
46
  ```typescript
47
- import { pikkuChannelMiddleware } from '@pikku/core/middleware'
47
+ import { pikkuChannelMiddleware } from '#pikku/middleware'
48
48
 
49
49
  const middleware = pikkuChannelMiddleware(async (services, event, next) => {
50
50
  // Transform or filter events before/after
@@ -98,7 +98,7 @@ Authorization is not a wiring concern — declare it on the function via `permis
98
98
  ### Middleware
99
99
 
100
100
  ```typescript
101
- import { cors, authBearer } from '@pikku/core/middleware'
101
+ import { cors, authBearer } from '#pikku/middleware'
102
102
 
103
103
  // Global middleware
104
104
  addHTTPMiddleware('*', [
@@ -206,7 +206,7 @@ export const getBook = pikkuFunc({
206
206
 
207
207
  // wirings/books.http.ts — same defineHTTPRoutes/wireHTTPRoutes shape as the Route Groups example above
208
208
  import { addHTTPMiddleware } from '#pikku/middleware'
209
- import { cors, authBearer } from '@pikku/core/middleware'
209
+ import { cors, authBearer } from '#pikku/middleware'
210
210
 
211
211
  addHTTPMiddleware('*', [cors(), authBearer()])
212
212
  ```