@pikku/cli 0.12.90 → 0.12.92
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/LICENSE +106 -0
- package/README.md +25 -2
- package/console-app/assets/{index-CSzCJzBb.css → index-D0HG8q0B.css} +1 -1
- package/console-app/assets/{index-C5Bd44e4.js → index-DDpIMCpy.js} +149 -149
- package/console-app/index.html +2 -2
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.js +6 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.json +15 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +43 -0
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
- package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +4 -4
- package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +39 -44
- package/dist/.pikku/function/pikku-functions.gen.js +1 -3
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts +9 -0
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.js +9 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
- package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
- package/dist/.pikku/pikku-meta-service.gen.js +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.d.ts +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js +10 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.json +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts +4 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.js +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js +10 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts +4 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.js +1 -0
- package/dist/.pikku/scenarios/schemas/register.gen.d.ts +4 -0
- package/dist/.pikku/scenarios/schemas/register.gen.js +4 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.js +5 -3
- package/dist/.pikku/schemas/schemas/FabricSecretsListOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/FabricSecretsRotateInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricSecretsRotateOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricSecretsSetOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/ScenarioRunInput.schema.json +1 -1
- package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +1 -1
- package/dist/.pikku/scopes/pikku-scope-types.gen.js +1 -1
- package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
- package/dist/.pikku/workflow/meta/allWorkflow.gen.json +2 -8
- package/dist/.pikku/workflow/pikku-scenario-actors.gen.d.ts +19 -0
- package/dist/.pikku/workflow/pikku-scenario-actors.gen.js +17 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +152 -3
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +39 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
- package/dist/bin/pikku-bin.mjs +2 -2
- package/dist/src/cli.wiring.js +28 -0
- package/dist/src/deploy/analyzer/analyzer.js +22 -5
- package/dist/src/deploy/build-pipeline.js +5 -1
- package/dist/src/fabric/fabric-commands.d.ts +37 -9
- package/dist/src/fabric/fabric-commands.js +12 -0
- package/dist/src/fabric/functions/domains-add.function.d.ts +4 -4
- package/dist/src/fabric/functions/secrets-list.function.d.ts +16 -4
- package/dist/src/fabric/functions/secrets-list.function.js +12 -10
- package/dist/src/fabric/functions/secrets-rotate.function.d.ts +24 -0
- package/dist/src/fabric/functions/secrets-rotate.function.js +36 -0
- package/dist/src/fabric/functions/secrets-set.function.d.ts +8 -4
- package/dist/src/fabric/functions/secrets-set.function.js +18 -7
- package/dist/src/fabric/lib/http.d.ts +7 -1
- package/dist/src/fabric/lib/sealed-box.d.ts +16 -0
- package/dist/src/fabric/lib/sealed-box.js +72 -0
- package/dist/src/functions/commands/dev.js +11 -0
- package/dist/src/functions/commands/load-user-project.d.ts +7 -0
- package/dist/src/functions/commands/load-user-project.js +21 -0
- package/dist/src/functions/commands/pikku-command-bootstrap.js +13 -0
- package/dist/src/functions/commands/scenario-browser.d.ts +84 -0
- package/dist/src/functions/commands/scenario-browser.js +68 -0
- package/dist/src/functions/commands/scenario-environment.d.ts +32 -0
- package/dist/src/functions/commands/scenario-environment.js +61 -0
- package/dist/src/functions/commands/scenario-formatter.d.ts +81 -0
- package/dist/src/functions/commands/scenario-formatter.js +120 -0
- package/dist/src/functions/commands/scenario-ladder.d.ts +66 -0
- package/dist/src/functions/commands/scenario-ladder.js +132 -0
- package/dist/src/functions/commands/scenario-plan.d.ts +61 -0
- package/dist/src/functions/commands/scenario-plan.js +106 -0
- package/dist/src/functions/commands/scenario.d.ts +24 -0
- package/dist/src/functions/commands/scenario.js +322 -50
- package/dist/src/functions/commands/serve.js +2 -0
- package/dist/src/functions/commands/skills.js +27 -61
- package/dist/src/functions/db/db-codegen.d.ts +6 -0
- package/dist/src/functions/db/db-codegen.js +9 -0
- package/dist/src/functions/db/db-migrator.js +14 -0
- package/dist/src/functions/db/local-db.d.ts +8 -0
- package/dist/src/functions/db/local-db.js +24 -2
- package/dist/src/functions/db/migration-identifiers.d.ts +58 -0
- package/dist/src/functions/db/migration-identifiers.js +262 -0
- package/dist/src/functions/db/migration-provenance.d.ts +35 -0
- package/dist/src/functions/db/migration-provenance.js +80 -0
- package/dist/src/functions/db/schema-sql.d.ts +43 -0
- package/dist/src/functions/db/schema-sql.js +135 -0
- package/dist/src/functions/db/sqlite/sqlite-kysely.js +22 -2
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +26 -8
- package/dist/src/functions/wirings/functions/schemas.js +13 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.js +3 -3
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +6 -1
- package/dist/src/functions/wirings/scenarios/register-scenario-instrumentation.d.ts +10 -0
- package/dist/src/functions/wirings/scenarios/register-scenario-instrumentation.js +102 -0
- package/dist/src/functions/wirings/scenarios/scenario-partition.d.ts +42 -0
- package/dist/src/functions/wirings/scenarios/scenario-partition.js +71 -0
- package/dist/src/functions/wirings/scenarios/scenario-schema-partition.d.ts +33 -0
- package/dist/src/functions/wirings/scenarios/scenario-schema-partition.js +49 -0
- package/dist/src/functions/wirings/scenarios/serialize-feature-meta.d.ts +14 -0
- package/dist/src/functions/wirings/scenarios/serialize-feature-meta.js +29 -0
- package/dist/src/functions/wirings/scenarios/serialize-scenario-meta.d.ts +12 -0
- package/dist/src/functions/wirings/scenarios/serialize-scenario-meta.js +56 -0
- package/dist/src/functions/wirings/scenarios/serialize-scenario-registration.d.ts +7 -0
- package/dist/src/functions/wirings/scenarios/serialize-scenario-registration.js +40 -0
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +43 -8
- package/dist/src/functions/wirings/workflow/serialize-scenario-actors.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/serialize-scenario-actors.js +13 -2
- package/dist/src/functions/wirings/workflow/serialize-scenario-step-map.d.ts +4 -0
- package/dist/src/functions/wirings/workflow/serialize-scenario-step-map.js +62 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-bootstrap-map.js +10 -3
- package/dist/src/functions/wirings/workflow/serialize-workflow-map.js +10 -3
- package/dist/src/functions/wirings/workflow/serialize-workflow-meta.js +4 -4
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +232 -3
- package/dist/src/functions/workflows/all.workflow.js +2 -7
- package/dist/src/server/server-ready.d.ts +12 -0
- package/dist/src/server/server-ready.js +12 -0
- package/dist/src/server/spawn-dev-server.d.ts +50 -0
- package/dist/src/server/spawn-dev-server.js +112 -0
- package/dist/src/services.js +12 -1
- package/dist/src/utils/file-writer.js +14 -2
- package/dist/src/utils/meta-diff.js +5 -2
- package/dist/src/utils/pikku-cli-config.d.ts +14 -0
- package/dist/src/utils/pikku-cli-config.js +60 -0
- package/dist/src/utils/remove-legacy-scaffold-file.d.ts +14 -0
- package/dist/src/utils/remove-legacy-scaffold-file.js +23 -0
- package/dist/src/utils/resolve-scenario-actors.d.ts +23 -0
- package/dist/src/utils/resolve-scenario-actors.js +74 -0
- package/dist/src/utils/serialize-schemas.d.ts +3 -1
- package/dist/src/utils/serialize-schemas.js +39 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -8
- package/dist/.pikku/schemas/schemas/PikkuScenarioFunctionsOutput.schema.json +0 -1
- package/dist/src/functions/wirings/scenarios/pikku-command-scenario-functions.d.ts +0 -1
- package/dist/src/functions/wirings/scenarios/pikku-command-scenario-functions.js +0 -31
- package/dist/src/functions/wirings/scenarios/serialize-scenario-functions.d.ts +0 -10
- package/dist/src/functions/wirings/scenarios/serialize-scenario-functions.js +0 -104
- package/skills/pikku-addon/SKILL.md +0 -243
- package/skills/pikku-addon/references/addon-package-manifest.md +0 -63
- package/skills/pikku-ai-agent/SKILL.md +0 -231
- package/skills/pikku-ai-vercel/SKILL.md +0 -82
- package/skills/pikku-ai-voice/SKILL.md +0 -88
- package/skills/pikku-audit/SKILL.md +0 -175
- package/skills/pikku-aws/SKILL.md +0 -111
- package/skills/pikku-backblaze/SKILL.md +0 -71
- package/skills/pikku-better-auth/SKILL.md +0 -298
- package/skills/pikku-cli/SKILL.md +0 -198
- package/skills/pikku-cli/references/complete-example.md +0 -82
- package/skills/pikku-concepts/SKILL.md +0 -250
- package/skills/pikku-concepts/references/concept-mapping.md +0 -556
- package/skills/pikku-concepts/references/packages.md +0 -29
- package/skills/pikku-config/SKILL.md +0 -212
- package/skills/pikku-cron/SKILL.md +0 -214
- package/skills/pikku-deploy-azure/SKILL.md +0 -71
- package/skills/pikku-deploy-cloudflare/SKILL.md +0 -82
- package/skills/pikku-deploy-express/SKILL.md +0 -86
- package/skills/pikku-deploy-fastify/SKILL.md +0 -73
- package/skills/pikku-deploy-lambda/SKILL.md +0 -110
- package/skills/pikku-deploy-nextjs/SKILL.md +0 -78
- package/skills/pikku-deploy-uws/SKILL.md +0 -88
- package/skills/pikku-deps/SKILL.md +0 -98
- package/skills/pikku-emails/SKILL.md +0 -163
- package/skills/pikku-fabric/SKILL.md +0 -318
- package/skills/pikku-fabric-debug/SKILL.md +0 -112
- package/skills/pikku-feature/SKILL.md +0 -258
- package/skills/pikku-gateway-slack/SKILL.md +0 -115
- package/skills/pikku-http/SKILL.md +0 -220
- package/skills/pikku-http/references/http-options.md +0 -55
- package/skills/pikku-i18n/SKILL.md +0 -137
- package/skills/pikku-info/SKILL.md +0 -100
- package/skills/pikku-jose/SKILL.md +0 -105
- package/skills/pikku-kysely/SKILL.md +0 -219
- package/skills/pikku-machine-auth/SKILL.md +0 -183
- package/skills/pikku-mcp/SKILL.md +0 -241
- package/skills/pikku-middleware/SKILL.md +0 -231
- package/skills/pikku-middleware/references/middleware-patterns.md +0 -61
- package/skills/pikku-mongodb/SKILL.md +0 -105
- package/skills/pikku-n8n-import/SKILL.md +0 -109
- package/skills/pikku-n8n-import/SPEC.md +0 -84
- package/skills/pikku-n8n-import/references/addon-mapping.md +0 -121
- package/skills/pikku-n8n-import/references/code-translation.md +0 -121
- package/skills/pikku-n8n-import/references/loops-and-control.md +0 -87
- package/skills/pikku-paraglide/SKILL.md +0 -117
- package/skills/pikku-permissions/SKILL.md +0 -192
- package/skills/pikku-pino/SKILL.md +0 -79
- package/skills/pikku-product-second-opinion/README.md +0 -43
- package/skills/pikku-product-second-opinion/SKILL.md +0 -158
- package/skills/pikku-product-second-opinion/example/sample-report.md +0 -90
- package/skills/pikku-product-second-opinion/references/report-template.md +0 -73
- package/skills/pikku-queue/SKILL.md +0 -240
- package/skills/pikku-react/SKILL.md +0 -212
- package/skills/pikku-react-query/SKILL.md +0 -242
- package/skills/pikku-realtime/SKILL.md +0 -236
- package/skills/pikku-realtime/references/other-routes.md +0 -23
- package/skills/pikku-redis/SKILL.md +0 -90
- package/skills/pikku-rpc/SKILL.md +0 -171
- package/skills/pikku-rtl/SKILL.md +0 -219
- package/skills/pikku-scenario/SKILL.md +0 -215
- package/skills/pikku-schedule/SKILL.md +0 -57
- package/skills/pikku-schema-ajv/SKILL.md +0 -62
- package/skills/pikku-schema-cfworker/SKILL.md +0 -63
- package/skills/pikku-security/SKILL.md +0 -108
- package/skills/pikku-services/SKILL.md +0 -248
- package/skills/pikku-services/references/audit-wire-service.md +0 -34
- package/skills/pikku-software-archaeology/README.md +0 -70
- package/skills/pikku-software-archaeology/SKILL.md +0 -186
- package/skills/pikku-software-archaeology/references/blueprint.schema.json +0 -625
- package/skills/pikku-software-archaeology/references/pikku-mapping.md +0 -49
- package/skills/pikku-software-archaeology/scripts/validate.mjs +0 -173
- package/skills/pikku-tag-middleware/SKILL.md +0 -13
- package/skills/pikku-template-clone/SKILL.md +0 -40
- package/skills/pikku-trigger/SKILL.md +0 -181
- package/skills/pikku-versioning/SKILL.md +0 -173
- package/skills/pikku-websocket/SKILL.md +0 -243
- package/skills/pikku-workflow/SKILL.md +0 -172
- package/skills/pikku-workflow/references/workflow-reference.md +0 -63
- package/skills/pikku-workflows-client/SKILL.md +0 -150
- package/skills/pikku-ws/SKILL.md +0 -47
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pikku-rtl
|
|
3
|
-
description: 'Make a Pikku frontend work in both English (LTR) and Arabic / right-to-left languages. Direction is derived from the active locale, applied once at the document root, and the layout mirrors itself — but only if styling is written flow-relative (margin-inline-start, text-align: start, Mantine ms/me) instead of left/right. TRIGGER when: adding Arabic (or Hebrew/Farsi/Urdu), asked to "support RTL / right-to-left / bidi / mirror the layout", or writing layout styles in an app that may run RTL. Builds on pikku-i18n (an RTL language is just another locale file). DO NOT TRIGGER for backend functions or for LTR-only copy changes.'
|
|
4
|
-
installGroups: [core]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Pikku RTL (Arabic + English)
|
|
8
|
-
|
|
9
|
-
This skill sits **on top of** `pikku-i18n`. That skill maps a locale to `t()`
|
|
10
|
-
tokens; this one adds the second axis: a locale also has a **direction**.
|
|
11
|
-
Arabic is not special-cased — it is just another locale file (`ar.json`,
|
|
12
|
-
registered `satisfies typeof en`) plus the document being told it is `rtl`.
|
|
13
|
-
|
|
14
|
-
## The one idea
|
|
15
|
-
|
|
16
|
-
Set `dir` **once at the document root** from the active locale, then let the
|
|
17
|
-
browser and Mantine mirror everything — _provided_ every custom style is written
|
|
18
|
-
**flow-relative** (start/end), never **physical** (left/right). Get those two
|
|
19
|
-
things right and Arabic, Hebrew, Farsi and Urdu all work with zero per-component
|
|
20
|
-
*layout* code — directional icons still need one manual step, covered below.
|
|
21
|
-
|
|
22
|
-
## Agent Operating Procedure
|
|
23
|
-
|
|
24
|
-
1. **Tokens first.** Every visible string is already a `t()` token via
|
|
25
|
-
`pikku-i18n`. Arabic copy goes in `i18n/ar.json`, mirroring `en.json`'s keys,
|
|
26
|
-
registered with `satisfies typeof en` so a missing key is a compile error.
|
|
27
|
-
2. **Add the direction helper** to the i18n config (one home for locale→dir):
|
|
28
|
-
```ts
|
|
29
|
-
const RTL_LOCALES = new Set(['ar', 'he', 'fa', 'ur'])
|
|
30
|
-
export function localeDir(locale: string = defaultLocale): 'rtl' | 'ltr' {
|
|
31
|
-
return RTL_LOCALES.has(locale.split('-')[0]) ? 'rtl' : 'ltr'
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
(The bundled templates already ship this helper — use it, don't reinvent it.)
|
|
35
|
-
3. **Apply `dir` + `lang` at the root**, once, from the active locale — pick the
|
|
36
|
-
recipe for your framework below.
|
|
37
|
-
4. **Write every layout style flow-relative.** This is the part that actually
|
|
38
|
-
makes mirroring work; see the rules. When editing existing UI to be
|
|
39
|
-
RTL-ready, the job is mostly a search-and-replace of physical properties.
|
|
40
|
-
5. **Flip directional icons** (chevrons, back/forward arrows) — the one thing
|
|
41
|
-
logical properties can't do for you.
|
|
42
|
-
6. Validate with the app's `tsc`, then load `?i18n-debug` / set `dir` and
|
|
43
|
-
eyeball that the layout mirrors and nothing is stuck on the wrong edge.
|
|
44
|
-
|
|
45
|
-
## Flow-relative, not physical — the rules that make it mirror
|
|
46
|
-
|
|
47
|
-
Use the **inline-axis logical** property; never the physical one:
|
|
48
|
-
|
|
49
|
-
| Don't (physical) | Do (flow-relative) |
|
|
50
|
-
| ---------------------------- | -------------------------------------------- |
|
|
51
|
-
| `margin-left` / `marginLeft` | `margin-inline-start` / `marginInlineStart` |
|
|
52
|
-
| `margin-right` | `margin-inline-end` / `marginInlineEnd` |
|
|
53
|
-
| `padding-left/right` | `padding-inline-start/end` |
|
|
54
|
-
| `left: 0` / `right: 0` | `inset-inline-start: 0` / `inset-inline-end` |
|
|
55
|
-
| `text-align: left/right` | `text-align: start / end` |
|
|
56
|
-
| `border-top-left-radius` | `border-start-start-radius` |
|
|
57
|
-
| `float: left/right` | `float: inline-start / inline-end` |
|
|
58
|
-
|
|
59
|
-
In **Mantine**, use the logical style props — they emit the logical CSS above:
|
|
60
|
-
|
|
61
|
-
| Don't | Do |
|
|
62
|
-
| ----------- | ----------- |
|
|
63
|
-
| `ml` / `mr` | `ms` / `me` |
|
|
64
|
-
| `pl` / `pr` | `ps` / `pe` |
|
|
65
|
-
|
|
66
|
-
Mantine's own components already use logical properties internally, so once the
|
|
67
|
-
direction is set they mirror automatically — you only have to be disciplined in
|
|
68
|
-
**your** styles.
|
|
69
|
-
|
|
70
|
-
**Leave flexbox and grid alone.** `display:flex` already follows `dir`:
|
|
71
|
-
`justify-content: flex-start` resolves to the right edge under RTL on its own.
|
|
72
|
-
Never "fix" RTL by swapping to `flex-direction: row-reverse` or reordering DOM —
|
|
73
|
-
that double-flips and breaks the moment direction changes. The DOM order is
|
|
74
|
-
logical order; let `dir` handle the visual order.
|
|
75
|
-
|
|
76
|
-
## Applying direction at the root
|
|
77
|
-
|
|
78
|
-
### Mantine app (e.g. environment-template)
|
|
79
|
-
|
|
80
|
-
Mantine ships first-class RTL: wrap the tree in `DirectionProvider` and set the
|
|
81
|
-
matching `dir` on `<html>`.
|
|
82
|
-
|
|
83
|
-
```tsx
|
|
84
|
-
import { DirectionProvider, MantineProvider } from '@mantine/core'
|
|
85
|
-
import i18n, { detectLocale, localeDir } from './i18n/config'
|
|
86
|
-
|
|
87
|
-
const locale =
|
|
88
|
-
typeof window !== 'undefined' ? detectLocale(window.location.pathname) : 'en'
|
|
89
|
-
const dir = localeDir(locale)
|
|
90
|
-
|
|
91
|
-
if (typeof document !== 'undefined') {
|
|
92
|
-
document.documentElement.lang = locale
|
|
93
|
-
document.documentElement.dir = dir // Mantine + browser read this
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
root.render(
|
|
97
|
-
<DirectionProvider initialDirection={dir}>
|
|
98
|
-
<MantineProvider theme={theme} defaultColorScheme="dark">
|
|
99
|
-
{/* …app… */}
|
|
100
|
-
</MantineProvider>
|
|
101
|
-
</DirectionProvider>
|
|
102
|
-
)
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
To flip direction live (a language switcher) call
|
|
106
|
-
`document.documentElement.setAttribute('dir', localeDir(next))` and Mantine's
|
|
107
|
-
`useDirection().setDirection(dir)`; both read the same value.
|
|
108
|
-
|
|
109
|
-
### Plain Vite SPA (kanban, test-harness vite-spa)
|
|
110
|
-
|
|
111
|
-
No Mantine — just put `dir`/`lang` on `<html>` at bootstrap, after the locale is
|
|
112
|
-
detected (the same `detectLocale` the i18n config uses):
|
|
113
|
-
|
|
114
|
-
```ts
|
|
115
|
-
import { detectLocale, localeDir } from './i18n/config'
|
|
116
|
-
|
|
117
|
-
const locale = detectLocale(window.location.pathname)
|
|
118
|
-
document.documentElement.lang = locale
|
|
119
|
-
document.documentElement.dir = localeDir(locale)
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
Everything below inherits `dir` from `<html>`; logical CSS does the mirroring.
|
|
123
|
-
|
|
124
|
-
### Vite SSR (test-harness vite-ssr)
|
|
125
|
-
|
|
126
|
-
The worker renders the full HTML, so set `lang`/`dir` on the server `<html>`
|
|
127
|
-
from the **URL** locale (the client inherits it on hydration — no flash):
|
|
128
|
-
|
|
129
|
-
```tsx
|
|
130
|
-
import { detectLocale, localeDir } from './i18n/config'
|
|
131
|
-
|
|
132
|
-
const locale = detectLocale(new URL(request.url).pathname)
|
|
133
|
-
const dir = localeDir(locale)
|
|
134
|
-
const html = `<!doctype html>
|
|
135
|
-
<html lang="${locale}" dir="${dir}">
|
|
136
|
-
…
|
|
137
|
-
</html>`
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
i18next's active language must match: call `i18n.changeLanguage(locale)` before
|
|
141
|
-
`renderToString` so the SSR'd text and `dir` agree.
|
|
142
|
-
|
|
143
|
-
### Next.js app-router (test-harness next-ssr / next-static)
|
|
144
|
-
|
|
145
|
-
Set it on the `<html>` in `app/layout.tsx`. With locale-prefixed routes the
|
|
146
|
-
segment gives the locale; for a single-locale build it's a constant:
|
|
147
|
-
|
|
148
|
-
```tsx
|
|
149
|
-
import { localeDir, defaultLocale } from './i18n/config'
|
|
150
|
-
|
|
151
|
-
export default function RootLayout({
|
|
152
|
-
children,
|
|
153
|
-
}: {
|
|
154
|
-
children: React.ReactNode
|
|
155
|
-
}) {
|
|
156
|
-
const locale = defaultLocale // or the [lang] route segment / params
|
|
157
|
-
return (
|
|
158
|
-
<html lang={locale} dir={localeDir(locale)}>
|
|
159
|
-
<body>{children}</body>
|
|
160
|
-
</html>
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
For `output: 'export'` with `/ar` prefixes, derive `locale` from the route
|
|
166
|
-
segment so each statically-exported tree carries the right `dir`.
|
|
167
|
-
|
|
168
|
-
## Directional icons — the manual bit
|
|
169
|
-
|
|
170
|
-
Logical properties mirror box layout, **not glyphs**. An icon that points
|
|
171
|
-
somewhere (chevron, back/next arrow, send, undo) must flip under RTL; a
|
|
172
|
-
non-directional icon (search, settings, avatar) must **not**. Flip with the
|
|
173
|
-
`:dir()` selector — no JS, no per-locale branching:
|
|
174
|
-
|
|
175
|
-
```css
|
|
176
|
-
:dir(rtl) .icon-directional {
|
|
177
|
-
transform: scaleX(-1);
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Or in CSS-in-JS / inline, gate on the resolved direction:
|
|
182
|
-
`transform: localeDir(locale) === 'rtl' ? 'scaleX(-1)' : undefined`.
|
|
183
|
-
Prefer logical icon components if your icon set ships them.
|
|
184
|
-
|
|
185
|
-
## Arabic typography niceties
|
|
186
|
-
|
|
187
|
-
- **Font:** the default Latin stack renders Arabic with the system fallback,
|
|
188
|
-
which is inconsistent. Add an Arabic-capable family (e.g. _Noto Sans Arabic_,
|
|
189
|
-
_IBM Plex Sans Arabic_) to `font-family` so both scripts look intentional.
|
|
190
|
-
- **Numerals:** don't hardcode digits. Format numbers/dates with
|
|
191
|
-
`Intl.NumberFormat`/`Intl.DateTimeFormat` (or i18next formatters) given the
|
|
192
|
-
active locale, so Western vs Arabic-Indic digits follow the locale choice.
|
|
193
|
-
- **Line height:** Arabic diacritics sit tall — a slightly larger `line-height`
|
|
194
|
-
on Arabic body text avoids clipping. Keep it locale-scoped, not global.
|
|
195
|
-
|
|
196
|
-
## Adding Arabic to an existing app — checklist
|
|
197
|
-
|
|
198
|
-
1. `i18n/ar.json` mirroring `en.json`; register
|
|
199
|
-
`ar: { translation: ar satisfies typeof en }` and add `'ar'` to
|
|
200
|
-
`supportedLocales`. (Type-complete or it won't compile — the deploy blocks.)
|
|
201
|
-
2. Confirm the `localeDir` helper includes `ar` (it does by default).
|
|
202
|
-
3. Confirm the root sets `dir` from the locale (recipe above).
|
|
203
|
-
4. Sweep the app's styles: replace every `left/right`, `ml/mr`, `text-align:
|
|
204
|
-
left` with the flow-relative equivalent; revert any manual `row-reverse`.
|
|
205
|
-
5. Flip directional icons.
|
|
206
|
-
6. `tsc`, then load the Arabic route and verify the whole layout mirrors —
|
|
207
|
-
sidebar on the right, text right-aligned, arrows pointing the other way.
|
|
208
|
-
|
|
209
|
-
## What NOT to do
|
|
210
|
-
|
|
211
|
-
- Don't use physical `left`/`right` (or `ml`/`mr`) in any new layout style — even
|
|
212
|
-
in an English-only app. Writing logical from the start is the seam Arabic
|
|
213
|
-
slots into, exactly like tokens are for copy.
|
|
214
|
-
- Don't fake RTL with `flex-direction: row-reverse`, reversed DOM order, or
|
|
215
|
-
per-locale `if (rtl)` layout branches. Set `dir` once; let layout follow.
|
|
216
|
-
- Don't set `dir` on individual components — it belongs on `<html>` so the whole
|
|
217
|
-
document (and Mantine) agrees.
|
|
218
|
-
- Don't translate Arabic copy outside the `t()` token system; an RTL language is
|
|
219
|
-
a normal locale, governed by `pikku-i18n`.
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pikku-scenario
|
|
3
|
-
description: >-
|
|
4
|
-
Use when writing or running Pikku scenarios, or when asked to test Pikku functions or improve
|
|
5
|
-
test coverage. A scenario (pikkuScenario) drives the app the way users do — steps run as actors
|
|
6
|
-
over the real transport against a running server — so a flow doubles as an e2e test and a
|
|
7
|
-
staged/production health check. Covers scenario.do / expectEventually / expectError /
|
|
8
|
-
expectService, actors and environments in pikku.config.json, SCENARIO_ACTOR_SECRET, the
|
|
9
|
-
`pikku scenario list|run` commands, live function coverage via `pikku dev --coverage`, and
|
|
10
|
-
plain unit tests for pure function logic. TRIGGER when: user asks about scenarios, testing a
|
|
11
|
-
Pikku function, test coverage, end-to-end flows, or health checks. DO NOT TRIGGER when: user
|
|
12
|
-
asks about browser/UI e2e (that is @pikku/cucumber, out of scope), running an existing test
|
|
13
|
-
suite (use Bash), or CI configuration.
|
|
14
|
-
installGroups: [core]
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# Pikku Scenarios
|
|
18
|
-
|
|
19
|
-
## Agent Operating Procedure
|
|
20
|
-
|
|
21
|
-
Use this skill as an execution checklist, not reference material.
|
|
22
|
-
|
|
23
|
-
1. Discover before editing: `pikku scenario list` for what exists, `pikku info functions --verbose` for what a scenario can call.
|
|
24
|
-
2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, or build artifacts.
|
|
25
|
-
3. Make the smallest source change that satisfies the task. Keep generated files generated.
|
|
26
|
-
4. Validate with the narrowest relevant command first, then `pikku all --tsc` when functions, wirings or schemas may have changed.
|
|
27
|
-
5. If validation fails, fix the source cause and rerun. Do not paper over generated errors by editing generated files.
|
|
28
|
-
|
|
29
|
-
**`pikku tests` does not exist.** It was removed in #865 — scenarios own coverage now. Any reference you find to it is stale.
|
|
30
|
-
|
|
31
|
-
## What a scenario is
|
|
32
|
-
|
|
33
|
-
A scenario is a `pikkuScenario` export that drives the app **as real actors over the real transport**, against a running server. That is what lets one artifact serve as both an e2e test and a staged/production health check.
|
|
34
|
-
|
|
35
|
-
Consequences that matter, and bite if ignored:
|
|
36
|
-
|
|
37
|
-
- **There is no state reset.** A scenario runs against a live server. Scope what you create (unique ids, your own rows) and never assume a clean database.
|
|
38
|
-
- **Every step needs an actor.** `scenario.do(...)` without `{ actor }` throws `Scenario tried to run '<rpc>' as an internal step…`. There is no bare internal-RPC step.
|
|
39
|
-
- **Actors must be configured and signed in**, or the scenario cannot run.
|
|
40
|
-
|
|
41
|
-
Scenarios live in `srcDirectories` like any other function — by convention `*.scenario.ts`.
|
|
42
|
-
|
|
43
|
-
## Writing one
|
|
44
|
-
|
|
45
|
-
`pikkuScenario` comes from the **generated** workflow types, not `@pikku/core`:
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
import { pikkuScenario } from '#pikku/workflow/pikku-workflow-types.gen.js'
|
|
49
|
-
|
|
50
|
-
export const orderSupportScenario = pikkuScenario<
|
|
51
|
-
{ value?: number },
|
|
52
|
-
{ doubled: number; message: string }
|
|
53
|
-
>({
|
|
54
|
-
title: 'Order support (scenario)',
|
|
55
|
-
tags: ['scenario'],
|
|
56
|
-
func: async ({ logger }, data, { scenario, actors }) => {
|
|
57
|
-
if (!actors?.shopper || !actors?.support) {
|
|
58
|
-
throw new Error(
|
|
59
|
-
'orderSupportScenario needs run actors (shopper + support) — run via `pikku scenario run <environment>`'
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const doubled = await scenario.do(
|
|
64
|
-
'shopper doubles their order',
|
|
65
|
-
'doubleValue',
|
|
66
|
-
{ value: data?.value ?? 21 },
|
|
67
|
-
{ actor: actors.shopper }
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
const settled = await scenario.expectEventually(
|
|
71
|
-
'support sees the greeting settle',
|
|
72
|
-
'formatMessage',
|
|
73
|
-
{ greeting: 'Hello', name: 'Support' },
|
|
74
|
-
(out: { message: string }) => out.message.length > 0,
|
|
75
|
-
{ actor: actors.support, within: '5s', interval: 50 }
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
return { doubled: doubled.result, message: settled.message }
|
|
79
|
-
},
|
|
80
|
-
})
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
A scenario takes the same config fields as a workflow (`title`, `description`, `tags`, `input`/`output`, `auth`, `permissions`, `middleware`, `version`, …). The third argument is the scenario context: `{ scenario, actors }`.
|
|
84
|
-
|
|
85
|
-
### The scenario API
|
|
86
|
-
|
|
87
|
-
| Call | Purpose |
|
|
88
|
-
| --- | --- |
|
|
89
|
-
| `scenario.do(step, rpc, data, { actor })` | Run an RPC as that actor. The step name is what appears in the run output. |
|
|
90
|
-
| `scenario.expectEventually(step, rpc, data, predicate, { actor, within, interval })` | Poll until `predicate(out)` passes or `within` elapses. For anything asynchronous — queues, workers, eventual state. |
|
|
91
|
-
| `scenario.expectError(step, rpc, data, { actor, matches })` | Assert the call **fails**. For fault injection and negative paths. |
|
|
92
|
-
| `scenario.expectService(step, 'service.method', { actor, calledWith })` | Assert a stubbed service was called. Requires the server to run with `--test`. |
|
|
93
|
-
|
|
94
|
-
`expectEventually` is **scenario-only**. Calling it from a `pikkuWorkflowFunc` is a critical inspector error (`PKU675`) pointing you at `pikkuScenario`.
|
|
95
|
-
|
|
96
|
-
Prefer `expectEventually` over sleeping. There is no `beforeEach`/`afterEach` — a scenario is a plain async function.
|
|
97
|
-
|
|
98
|
-
## Configuration
|
|
99
|
-
|
|
100
|
-
Actors and environments live in `pikku.config.json`:
|
|
101
|
-
|
|
102
|
-
```json
|
|
103
|
-
{
|
|
104
|
-
"scenarios": {
|
|
105
|
-
"actors": {
|
|
106
|
-
"shopper": {
|
|
107
|
-
"email": "shopper@actors.local",
|
|
108
|
-
"name": "Shopper",
|
|
109
|
-
"jobTitle": "First-time buyer",
|
|
110
|
-
"personality": "Impatient shopper who abandons slow checkouts"
|
|
111
|
-
},
|
|
112
|
-
"support": { "email": "support@actors.local", "name": "Support" }
|
|
113
|
-
},
|
|
114
|
-
"environments": {
|
|
115
|
-
"local": {
|
|
116
|
-
"apiUrl": "http://localhost:4077",
|
|
117
|
-
"signInPath": "/api/auth/sign-in/actor"
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
- `environments.<name>.apiUrl` is required. `signInPath` defaults to `/auth/sign-in/actor`, `rpcPath` to `/rpc`.
|
|
125
|
-
- **`SCENARIO_ACTOR_SECRET` is an environment variable and never goes in `pikku.config.json`.** It signs actors in. `pikku scenario run` throws without it; a server auto-building actors warns and runs without them.
|
|
126
|
-
|
|
127
|
-
## Running
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
pikku scenario list # name [tags] + description; takes no options
|
|
131
|
-
SCENARIO_ACTOR_SECRET=… pikku scenario run local
|
|
132
|
-
SCENARIO_ACTOR_SECRET=… pikku scenario run local --flows orderSupportScenario
|
|
133
|
-
SCENARIO_ACTOR_SECRET=… pikku scenario run local --tags smoke,scenario
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
`run` takes the environment as a **required positional** — the key from `scenarios.environments`. `--flows`/`-f` filters by scenario name, `--tags`/`-t` by tag (match-any).
|
|
137
|
-
|
|
138
|
-
Output is `PASS <name> (<ms>) → <output>` / `FAIL <name> (<ms>): <error>`, then `N/M scenarios passed against '<env>'`.
|
|
139
|
-
|
|
140
|
-
**Exit code is 1** if any scenario fails *or* if no scenario matched the filter — a typo'd `--flows` is a hard error, not a silent zero-run pass. It throws outright on an unknown environment, an unknown flow name, or a missing `SCENARIO_ACTOR_SECRET`.
|
|
141
|
-
|
|
142
|
-
## Coverage
|
|
143
|
-
|
|
144
|
-
Coverage is attributed by running scenarios against a server that is collecting it. It is **not** derived from unit tests.
|
|
145
|
-
|
|
146
|
-
Prerequisites in `pikku.config.json`:
|
|
147
|
-
|
|
148
|
-
```json
|
|
149
|
-
{ "scaffold": { "scenarios": "auth" }, "verboseMeta": true }
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
`scaffold.scenarios` generates the coverage and stub RPCs into your project (`pikkuScenarioTakeLiveCoverage`, `pikkuScenarioResetLiveCoverage`, `pikkuScenarioResetStubs`, `pikkuScenarioGetStubCalls`), so scenario runs work against any server. `verboseMeta` is required — the coverage RPC reads the verbose functions meta and returns `null` without it.
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
pikku dev --coverage # V8 precise coverage, in-process
|
|
156
|
-
pikku dev --coverage --test # also enable stubs (needed for expectService)
|
|
157
|
-
SCENARIO_ACTOR_SECRET=… pikku scenario run local --coverage
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
The run resets coverage before each scenario and snapshots after, writing **`<outDir>/coverage/scenario-coverage.json`**:
|
|
161
|
-
|
|
162
|
-
```jsonc
|
|
163
|
-
{ "generatedAt": "…", "environment": "local", "scenarios": { "<name>": { /* FunctionCoverageReport */ } } }
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Coverage is best-effort: it disables itself with a warning if the server is not collecting or the first actor cannot invoke, and it needs at least one configured actor. If you get no coverage, check those first.
|
|
167
|
-
|
|
168
|
-
**There is no AI-prompt output.** The old `--ai-out` flag died with `pikku tests`; nothing replaced it. To find what needs work, read `scenario-coverage.json` yourself and cross-reference `pikku meta functions list` for input/output schemas.
|
|
169
|
-
|
|
170
|
-
### Filling coverage
|
|
171
|
-
|
|
172
|
-
1. `pikku scenario run <env> --coverage`, then read `<outDir>/coverage/scenario-coverage.json` to see what is unexercised.
|
|
173
|
-
2. `pikku meta functions list` for those functions' schemas.
|
|
174
|
-
3. Write a `pikkuScenario` that reaches them **through a real user flow** with an actor — not a scenario per function. Scenarios are flows; coverage is a consequence.
|
|
175
|
-
4. Re-run to confirm.
|
|
176
|
-
|
|
177
|
-
## Unit tests for pure logic
|
|
178
|
-
|
|
179
|
-
Scenarios are the repo-idiomatic way to test functions, and the only thing that contributes to live coverage. For pure logic with heavy branching, a plain unit test calling `func` directly is still valid and cheap:
|
|
180
|
-
|
|
181
|
-
```typescript
|
|
182
|
-
import { describe, test } from 'node:test'
|
|
183
|
-
import assert from 'node:assert'
|
|
184
|
-
|
|
185
|
-
describe('createTodo', () => {
|
|
186
|
-
test('creates a todo', async () => {
|
|
187
|
-
const services = { todoStore: { add: async (title: string) => ({ id: '1', title }) } }
|
|
188
|
-
const result = await createTodo.func(services as any, { title: 'Buy milk' })
|
|
189
|
-
assert.equal(result.title, 'Buy milk')
|
|
190
|
-
})
|
|
191
|
-
})
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
node --import tsx --test src/**/*.test.ts
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
Services are plain objects — a Pikku function is pure business logic, so a mock is just the shape the function destructures. Build real services via the `pikkuServices` / `pikkuWireServices` factories when a test needs them.
|
|
199
|
-
|
|
200
|
-
## Red flags
|
|
201
|
-
|
|
202
|
-
| Smell | Why it's wrong |
|
|
203
|
-
| --- | --- |
|
|
204
|
-
| `pikku tests …` | Removed in #865. Use `pikku scenario`. |
|
|
205
|
-
| `.feature` files / Gherkin for function tests | Scenarios are TypeScript, not Gherkin. The in-process cucumber function world was deleted. |
|
|
206
|
-
| `scenario.do(...)` with no `{ actor }` | Throws. Every step runs as somebody. |
|
|
207
|
-
| A scenario per function | Scenarios are user flows. One flow covers many functions; that is the point. |
|
|
208
|
-
| Assuming a clean database | There is no state reset — it may be a staging server. Scope what you create. |
|
|
209
|
-
| `sleep()` before asserting | Use `expectEventually`. |
|
|
210
|
-
| `expectEventually` in a `pikkuWorkflowFunc` | `PKU675` — scenario-only. |
|
|
211
|
-
| Coverage silently 0 | Server not run with `--coverage`, `verboseMeta` off, `scaffold.scenarios` unset, or no actors configured. |
|
|
212
|
-
|
|
213
|
-
`@pikku/cucumber` is a **browser/e2e** harness (`Actor`, `BrowserWorld`, `PersonaData`, `DbUtils`) — out of scope here.
|
|
214
|
-
|
|
215
|
-
See `pikku-concepts` for the core mental model.
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pikku-schedule
|
|
3
|
-
description: >-
|
|
4
|
-
Use when setting up in-memory cron scheduling in a Pikku app. Covers InMemorySchedulerService
|
|
5
|
-
for running scheduled tasks. TRIGGER when: code uses InMemorySchedulerService,
|
|
6
|
-
PikkuTaskScheduler, or user asks about in-memory scheduling, cron jobs without external
|
|
7
|
-
dependencies, or @pikku/schedule. DO NOT TRIGGER when: user asks about cron wiring (use
|
|
8
|
-
pikku-cron) or queue-based scheduling with BullMQ/PgBoss (use pikku-queue).
|
|
9
|
-
installGroups: [core]
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Pikku Schedule (In-Memory Scheduler)
|
|
13
|
-
|
|
14
|
-
## Agent Operating Procedure
|
|
15
|
-
|
|
16
|
-
Use this skill as an execution checklist, not reference material.
|
|
17
|
-
|
|
18
|
-
1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
|
|
19
|
-
2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
|
|
20
|
-
3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
|
|
21
|
-
4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
|
|
22
|
-
5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
|
|
23
|
-
|
|
24
|
-
`@pikku/schedule` provides an in-memory cron scheduler for running Pikku scheduled functions without external dependencies like Redis or PostgreSQL.
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
yarn add @pikku/schedule
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## API Reference
|
|
33
|
-
|
|
34
|
-
### `InMemorySchedulerService`
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
import { InMemorySchedulerService } from '@pikku/schedule'
|
|
38
|
-
|
|
39
|
-
const scheduler = new InMemorySchedulerService()
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Implements the scheduler service interface. Schedules are held in memory — they do not survive process restarts. Suitable for development and single-instance deployments.
|
|
43
|
-
|
|
44
|
-
## Usage Patterns
|
|
45
|
-
|
|
46
|
-
### Basic Setup
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
import { InMemorySchedulerService } from '@pikku/schedule'
|
|
50
|
-
|
|
51
|
-
const createSingletonServices = pikkuServices(async (config) => {
|
|
52
|
-
const scheduler = new InMemorySchedulerService()
|
|
53
|
-
return { config, scheduler }
|
|
54
|
-
})
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
For distributed or persistent scheduling, use BullMQ (`BullSchedulerService`) or PgBoss (`PgBossSchedulerService`) from the queue packages instead. See `pikku-queue` for details.
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pikku-schema-ajv
|
|
3
|
-
description: >-
|
|
4
|
-
Use when setting up JSON schema validation with AJV in a Pikku app. Covers AjvSchemaService for
|
|
5
|
-
request/response validation. TRIGGER when: code uses AjvSchemaService, user asks about AJV, JSON
|
|
6
|
-
schema validation, or @pikku/schema-ajv. DO NOT TRIGGER when: user asks about Cloudflare Workers
|
|
7
|
-
schema validation (use pikku-schema-cfworker).
|
|
8
|
-
installGroups: [core]
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Pikku Schema AJV (JSON Schema Validation)
|
|
12
|
-
|
|
13
|
-
## Agent Operating Procedure
|
|
14
|
-
|
|
15
|
-
Use this skill as an execution checklist, not reference material.
|
|
16
|
-
|
|
17
|
-
1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
|
|
18
|
-
2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
|
|
19
|
-
3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
|
|
20
|
-
4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
|
|
21
|
-
5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
|
|
22
|
-
|
|
23
|
-
`@pikku/schema-ajv` provides JSON schema validation using [AJV](https://ajv.js.org/). Implements the `SchemaService` interface from `@pikku/core`. This is the default schema validator for Node.js environments.
|
|
24
|
-
|
|
25
|
-
## Installation
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
yarn add @pikku/schema-ajv
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## API Reference
|
|
32
|
-
|
|
33
|
-
### `AjvSchemaService`
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
import { AjvSchemaService } from '@pikku/schema-ajv'
|
|
37
|
-
|
|
38
|
-
const schema = new AjvSchemaService(logger: Logger)
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
**Methods:**
|
|
42
|
-
|
|
43
|
-
- `compileSchema(schema: string, value: any): void` — Compile and register a JSON schema
|
|
44
|
-
- `validateSchema(schemaName: string, json: any): void` — Validate data against a compiled schema (throws on failure)
|
|
45
|
-
- `getSchemaNames(): Set<string>` — Get all registered schema names
|
|
46
|
-
- `getSchemaKeys(schemaName: string): string[]` — Get property keys for a schema
|
|
47
|
-
|
|
48
|
-
## Usage Patterns
|
|
49
|
-
|
|
50
|
-
### With Pikku Services
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
import { AjvSchemaService } from '@pikku/schema-ajv'
|
|
54
|
-
|
|
55
|
-
const createSingletonServices = pikkuServices(async (config) => {
|
|
56
|
-
const logger = new ConsoleLogger()
|
|
57
|
-
const schema = new AjvSchemaService(logger)
|
|
58
|
-
return { config, logger, schema }
|
|
59
|
-
})
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Pikku automatically uses the schema service to validate function inputs and outputs when schemas are defined in your function definitions.
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pikku-schema-cfworker
|
|
3
|
-
description: >-
|
|
4
|
-
Use when setting up JSON schema validation for Cloudflare Workers in a Pikku app. Covers
|
|
5
|
-
CFWorkerSchemaService as a lightweight alternative to AJV. TRIGGER when: code uses
|
|
6
|
-
CFWorkerSchemaService, user asks about schema validation on Cloudflare Workers, or
|
|
7
|
-
@pikku/schema-cfworker. DO NOT TRIGGER when: user asks about AJV schema validation (use
|
|
8
|
-
pikku-schema-ajv).
|
|
9
|
-
installGroups: [core, fabric]
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Pikku Schema CFWorker (Cloudflare Workers Validation)
|
|
13
|
-
|
|
14
|
-
## Agent Operating Procedure
|
|
15
|
-
|
|
16
|
-
Use this skill as an execution checklist, not reference material.
|
|
17
|
-
|
|
18
|
-
1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
|
|
19
|
-
2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
|
|
20
|
-
3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
|
|
21
|
-
4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
|
|
22
|
-
5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
|
|
23
|
-
|
|
24
|
-
`@pikku/schema-cfworker` provides JSON schema validation using [@cfworker/json-schema](https://github.com/cfworker/cfworker), a lightweight validator compatible with Cloudflare Workers (no `eval` or `new Function`). Implements the `SchemaService` interface from `@pikku/core`.
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
yarn add @pikku/schema-cfworker
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## API Reference
|
|
33
|
-
|
|
34
|
-
### `CFWorkerSchemaService`
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
import { CFWorkerSchemaService } from '@pikku/schema-cfworker'
|
|
38
|
-
|
|
39
|
-
const schema = new CFWorkerSchemaService(logger: Logger)
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Methods:**
|
|
43
|
-
|
|
44
|
-
- `compileSchema(schema: string, value: any): void` — Compile and register a JSON schema
|
|
45
|
-
- `validateSchema(schemaName: string, json: any): void` — Validate data against a compiled schema (throws on failure)
|
|
46
|
-
- `getSchemaNames(): Set<string>` — Get all registered schema names
|
|
47
|
-
- `getSchemaKeys(schemaName: string): string[]` — Get property keys for a schema
|
|
48
|
-
|
|
49
|
-
## Usage Patterns
|
|
50
|
-
|
|
51
|
-
### With Cloudflare Workers
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
import { CFWorkerSchemaService } from '@pikku/schema-cfworker'
|
|
55
|
-
|
|
56
|
-
const createSingletonServices = pikkuServices(async (config) => {
|
|
57
|
-
const logger = new ConsoleLogger()
|
|
58
|
-
const schema = new CFWorkerSchemaService(logger)
|
|
59
|
-
return { config, logger, schema }
|
|
60
|
-
})
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Use this instead of `@pikku/schema-ajv` when deploying to Cloudflare Workers, as AJV uses `eval` which is not permitted in the Workers runtime.
|