@pikku/cli 0.12.91 → 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.
Files changed (222) hide show
  1. package/LICENSE +106 -0
  2. package/console-app/assets/{index-CpkvmAGb.js → index-DDpIMCpy.js} +149 -149
  3. package/console-app/index.html +1 -1
  4. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  5. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  6. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  7. package/dist/.pikku/cli/pikku-cli-channel.js +6 -1
  8. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
  9. package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
  10. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
  11. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
  12. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.json +15 -0
  13. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  14. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  15. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  16. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +21 -0
  17. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  18. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  19. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  20. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  21. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  22. package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
  23. package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
  24. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  25. package/dist/.pikku/function/pikku-functions-meta.gen.json +35 -40
  26. package/dist/.pikku/function/pikku-functions.gen.js +1 -3
  27. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  28. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  29. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  30. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  31. package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts +2 -1
  32. package/dist/.pikku/pikku-bootstrap-scenarios.gen.js +2 -1
  33. package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
  34. package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
  35. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  36. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  37. package/dist/.pikku/pikku-services.gen.d.ts +1 -1
  38. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  39. package/dist/.pikku/pikku-types.gen.js +1 -1
  40. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  41. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  42. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
  43. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  44. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  45. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  46. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +1 -1
  47. package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js +1 -1
  48. package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts +1 -1
  49. package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js +1 -1
  50. package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts +1 -1
  51. package/dist/.pikku/scenarios/schemas/register.gen.d.ts +4 -0
  52. package/dist/.pikku/scenarios/schemas/register.gen.js +4 -0
  53. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  54. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  55. package/dist/.pikku/schemas/register.gen.js +5 -3
  56. package/dist/.pikku/schemas/schemas/FabricSecretsListOutput.schema.json +1 -1
  57. package/dist/.pikku/schemas/schemas/FabricSecretsRotateInput.schema.json +1 -0
  58. package/dist/.pikku/schemas/schemas/FabricSecretsRotateOutput.schema.json +1 -0
  59. package/dist/.pikku/schemas/schemas/FabricSecretsSetOutput.schema.json +1 -1
  60. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  61. package/dist/.pikku/schemas/schemas/ScenarioRunInput.schema.json +1 -1
  62. package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +1 -1
  63. package/dist/.pikku/scopes/pikku-scope-types.gen.js +1 -1
  64. package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +1 -1
  65. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  66. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  67. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  68. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  69. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  70. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  71. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  72. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  73. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  74. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  75. package/dist/.pikku/workflow/meta/allWorkflow.gen.json +2 -8
  76. package/dist/.pikku/workflow/pikku-scenario-actors.gen.d.ts +1 -1
  77. package/dist/.pikku/workflow/pikku-scenario-actors.gen.js +1 -1
  78. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
  79. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  80. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  81. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  82. package/dist/bin/pikku-bin.mjs +2 -2
  83. package/dist/src/cli.wiring.js +6 -0
  84. package/dist/src/deploy/analyzer/analyzer.js +22 -5
  85. package/dist/src/deploy/build-pipeline.js +5 -1
  86. package/dist/src/fabric/fabric-commands.d.ts +37 -9
  87. package/dist/src/fabric/fabric-commands.js +12 -0
  88. package/dist/src/fabric/functions/domains-add.function.d.ts +4 -4
  89. package/dist/src/fabric/functions/secrets-list.function.d.ts +16 -4
  90. package/dist/src/fabric/functions/secrets-list.function.js +12 -10
  91. package/dist/src/fabric/functions/secrets-rotate.function.d.ts +24 -0
  92. package/dist/src/fabric/functions/secrets-rotate.function.js +36 -0
  93. package/dist/src/fabric/functions/secrets-set.function.d.ts +8 -4
  94. package/dist/src/fabric/functions/secrets-set.function.js +18 -7
  95. package/dist/src/fabric/lib/http.d.ts +7 -1
  96. package/dist/src/fabric/lib/sealed-box.d.ts +16 -0
  97. package/dist/src/fabric/lib/sealed-box.js +72 -0
  98. package/dist/src/functions/commands/dev.js +9 -0
  99. package/dist/src/functions/commands/pikku-command-bootstrap.js +1 -0
  100. package/dist/src/functions/commands/scenario-browser.d.ts +17 -2
  101. package/dist/src/functions/commands/scenario-browser.js +16 -8
  102. package/dist/src/functions/commands/scenario-environment.d.ts +32 -0
  103. package/dist/src/functions/commands/scenario-environment.js +61 -0
  104. package/dist/src/functions/commands/scenario.d.ts +6 -0
  105. package/dist/src/functions/commands/scenario.js +14 -9
  106. package/dist/src/functions/commands/skills.js +27 -61
  107. package/dist/src/functions/db/db-codegen.d.ts +6 -0
  108. package/dist/src/functions/db/db-codegen.js +9 -0
  109. package/dist/src/functions/db/db-migrator.js +14 -0
  110. package/dist/src/functions/db/local-db.d.ts +8 -0
  111. package/dist/src/functions/db/local-db.js +24 -2
  112. package/dist/src/functions/db/migration-identifiers.d.ts +58 -0
  113. package/dist/src/functions/db/migration-identifiers.js +262 -0
  114. package/dist/src/functions/db/migration-provenance.d.ts +35 -0
  115. package/dist/src/functions/db/migration-provenance.js +80 -0
  116. package/dist/src/functions/db/schema-sql.d.ts +43 -0
  117. package/dist/src/functions/db/schema-sql.js +135 -0
  118. package/dist/src/functions/db/sqlite/sqlite-kysely.js +22 -2
  119. package/dist/src/functions/wirings/functions/schemas.js +13 -1
  120. package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +6 -1
  121. package/dist/src/functions/wirings/scenarios/register-scenario-instrumentation.d.ts +10 -0
  122. package/dist/src/functions/wirings/scenarios/register-scenario-instrumentation.js +102 -0
  123. package/dist/src/functions/wirings/scenarios/scenario-partition.d.ts +13 -0
  124. package/dist/src/functions/wirings/scenarios/scenario-partition.js +15 -2
  125. package/dist/src/functions/wirings/scenarios/scenario-schema-partition.d.ts +33 -0
  126. package/dist/src/functions/wirings/scenarios/scenario-schema-partition.js +49 -0
  127. package/dist/src/functions/workflows/all.workflow.js +2 -7
  128. package/dist/src/utils/file-writer.js +14 -2
  129. package/dist/src/utils/pikku-cli-config.d.ts +14 -0
  130. package/dist/src/utils/pikku-cli-config.js +34 -0
  131. package/dist/src/utils/remove-legacy-scaffold-file.d.ts +14 -0
  132. package/dist/src/utils/remove-legacy-scaffold-file.js +23 -0
  133. package/dist/src/utils/serialize-schemas.d.ts +3 -1
  134. package/dist/src/utils/serialize-schemas.js +39 -4
  135. package/dist/tsconfig.tsbuildinfo +1 -1
  136. package/package.json +9 -9
  137. package/dist/.pikku/schemas/schemas/PikkuScenarioFunctionsOutput.schema.json +0 -1
  138. package/dist/src/functions/wirings/scenarios/pikku-command-scenario-functions.d.ts +0 -1
  139. package/dist/src/functions/wirings/scenarios/pikku-command-scenario-functions.js +0 -31
  140. package/dist/src/functions/wirings/scenarios/serialize-scenario-functions.d.ts +0 -10
  141. package/dist/src/functions/wirings/scenarios/serialize-scenario-functions.js +0 -104
  142. package/skills/pikku-addon/SKILL.md +0 -243
  143. package/skills/pikku-addon/references/addon-package-manifest.md +0 -63
  144. package/skills/pikku-ai-agent/SKILL.md +0 -231
  145. package/skills/pikku-ai-vercel/SKILL.md +0 -82
  146. package/skills/pikku-ai-voice/SKILL.md +0 -88
  147. package/skills/pikku-audit/SKILL.md +0 -175
  148. package/skills/pikku-aws/SKILL.md +0 -111
  149. package/skills/pikku-backblaze/SKILL.md +0 -71
  150. package/skills/pikku-better-auth/SKILL.md +0 -298
  151. package/skills/pikku-cli/SKILL.md +0 -198
  152. package/skills/pikku-cli/references/complete-example.md +0 -82
  153. package/skills/pikku-concepts/SKILL.md +0 -250
  154. package/skills/pikku-concepts/references/concept-mapping.md +0 -556
  155. package/skills/pikku-concepts/references/packages.md +0 -29
  156. package/skills/pikku-config/SKILL.md +0 -212
  157. package/skills/pikku-cron/SKILL.md +0 -214
  158. package/skills/pikku-deploy-azure/SKILL.md +0 -71
  159. package/skills/pikku-deploy-cloudflare/SKILL.md +0 -82
  160. package/skills/pikku-deploy-express/SKILL.md +0 -86
  161. package/skills/pikku-deploy-fastify/SKILL.md +0 -73
  162. package/skills/pikku-deploy-lambda/SKILL.md +0 -110
  163. package/skills/pikku-deploy-nextjs/SKILL.md +0 -78
  164. package/skills/pikku-deploy-uws/SKILL.md +0 -88
  165. package/skills/pikku-deps/SKILL.md +0 -98
  166. package/skills/pikku-emails/SKILL.md +0 -163
  167. package/skills/pikku-fabric/SKILL.md +0 -318
  168. package/skills/pikku-fabric-debug/SKILL.md +0 -112
  169. package/skills/pikku-feature/SKILL.md +0 -258
  170. package/skills/pikku-gateway-slack/SKILL.md +0 -115
  171. package/skills/pikku-http/SKILL.md +0 -220
  172. package/skills/pikku-http/references/http-options.md +0 -55
  173. package/skills/pikku-i18n/SKILL.md +0 -137
  174. package/skills/pikku-info/SKILL.md +0 -100
  175. package/skills/pikku-jose/SKILL.md +0 -105
  176. package/skills/pikku-kysely/SKILL.md +0 -219
  177. package/skills/pikku-machine-auth/SKILL.md +0 -183
  178. package/skills/pikku-mcp/SKILL.md +0 -241
  179. package/skills/pikku-middleware/SKILL.md +0 -231
  180. package/skills/pikku-middleware/references/middleware-patterns.md +0 -61
  181. package/skills/pikku-mongodb/SKILL.md +0 -105
  182. package/skills/pikku-n8n-import/SKILL.md +0 -109
  183. package/skills/pikku-n8n-import/SPEC.md +0 -84
  184. package/skills/pikku-n8n-import/references/addon-mapping.md +0 -121
  185. package/skills/pikku-n8n-import/references/code-translation.md +0 -121
  186. package/skills/pikku-n8n-import/references/loops-and-control.md +0 -87
  187. package/skills/pikku-paraglide/SKILL.md +0 -117
  188. package/skills/pikku-permissions/SKILL.md +0 -192
  189. package/skills/pikku-pino/SKILL.md +0 -79
  190. package/skills/pikku-product-second-opinion/README.md +0 -43
  191. package/skills/pikku-product-second-opinion/SKILL.md +0 -158
  192. package/skills/pikku-product-second-opinion/example/sample-report.md +0 -90
  193. package/skills/pikku-product-second-opinion/references/report-template.md +0 -73
  194. package/skills/pikku-queue/SKILL.md +0 -240
  195. package/skills/pikku-react/SKILL.md +0 -212
  196. package/skills/pikku-react-query/SKILL.md +0 -242
  197. package/skills/pikku-realtime/SKILL.md +0 -236
  198. package/skills/pikku-realtime/references/other-routes.md +0 -23
  199. package/skills/pikku-redis/SKILL.md +0 -90
  200. package/skills/pikku-rpc/SKILL.md +0 -171
  201. package/skills/pikku-rtl/SKILL.md +0 -219
  202. package/skills/pikku-scenario/SKILL.md +0 -382
  203. package/skills/pikku-schedule/SKILL.md +0 -57
  204. package/skills/pikku-schema-ajv/SKILL.md +0 -62
  205. package/skills/pikku-schema-cfworker/SKILL.md +0 -63
  206. package/skills/pikku-security/SKILL.md +0 -108
  207. package/skills/pikku-services/SKILL.md +0 -248
  208. package/skills/pikku-services/references/audit-wire-service.md +0 -34
  209. package/skills/pikku-software-archaeology/README.md +0 -70
  210. package/skills/pikku-software-archaeology/SKILL.md +0 -186
  211. package/skills/pikku-software-archaeology/references/blueprint.schema.json +0 -625
  212. package/skills/pikku-software-archaeology/references/pikku-mapping.md +0 -49
  213. package/skills/pikku-software-archaeology/scripts/validate.mjs +0 -173
  214. package/skills/pikku-tag-middleware/SKILL.md +0 -13
  215. package/skills/pikku-template-clone/SKILL.md +0 -40
  216. package/skills/pikku-trigger/SKILL.md +0 -181
  217. package/skills/pikku-versioning/SKILL.md +0 -173
  218. package/skills/pikku-websocket/SKILL.md +0 -243
  219. package/skills/pikku-workflow/SKILL.md +0 -172
  220. package/skills/pikku-workflow/references/workflow-reference.md +0 -63
  221. package/skills/pikku-workflows-client/SKILL.md +0 -150
  222. package/skills/pikku-ws/SKILL.md +0 -47
@@ -1,318 +0,0 @@
1
- ---
2
- name: pikku-fabric
3
- description: 'Build and convert apps for the Pikku Fabric platform. Covers SQLite/libSQL database setup with Kysely, fabric project layout, deploy provider config, `fabric.config.json`, and the pikku-verify workflow. TRIGGER when: user is working on a Fabric-hosted Pikku project, converting an app to Fabric format, or asking about Fabric deployment, database, or project conventions. DO NOT TRIGGER when: user is working on a generic (non-Fabric) Pikku deployment — use pikku-deploy-cloudflare, pikku-deploy-fastify, etc. instead.'
4
- installGroups: [fabric]
5
- ---
6
-
7
- # Pikku Fabric
8
-
9
- ## Agent Operating Procedure
10
-
11
- Use this skill as an execution checklist, not reference material.
12
-
13
- 1. **Run structural validation first.** Before any edit, run:
14
- ```bash
15
- pikku fabric validate --json
16
- ```
17
- This prints every missing file, misconfigured field, and dependency gap with a `fixHint`. Address all `error` findings before proceeding — they block deploy. Resolve `warn` findings before testing — they cause runtime failures. `info` findings are best-practice gaps that are safe to defer.
18
- 2. 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
- 3. 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
- 4. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
21
- 5. 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
- 6. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
23
-
24
- Fabric is a serverless deployment platform for Pikku apps. Every Fabric app runs on Cloudflare Workers with a SQLite database (via libSQL/Turso). This skill covers what's unique to Fabric. For general Pikku concepts, function authoring, HTTP wiring, and more, see `pikku-concepts`, `pikku-http`, `pikku-services`, etc.
25
-
26
- ## Before you start
27
-
28
- Always run project discovery first:
29
-
30
- ```bash
31
- yarn pikku meta context --json
32
- ```
33
-
34
- In OpenCode, call the `pikku-meta` tool before grepping or editing a Fabric app.
35
-
36
- - Use `section: "context"` for the project map: functions, wires, workflows, capabilities, and source files.
37
- - Use `section: "clients"` before frontend/RPC work.
38
- - Use `section: "functions"` to list function ids, then `section: "function", id: "<functionId>"` for one function.
39
- - Use `section: "schemas"` to list schema names. Only request full JSON Schema bodies with `schemas: ["SchemaName"]` for the specific schemas needed.
40
-
41
- Do not load every schema body by default; that wastes context and usually makes the model worse.
42
-
43
- For database work in OpenCode:
44
-
45
- - Use `pikku-db` for the actual attached Fabric database state: tables, columns, foreign keys, and applied migrations.
46
- - Use `pikku-meta` `section: "schemas"` for code-level JSON Schema contracts, not database introspection.
47
- - Do not inspect database credentials or connect to the database directly; Fabric Control already exposes the safe introspection surface.
48
-
49
- ## Database: SQLite via libSQL
50
-
51
- Fabric apps use SQLite, accessed via Kysely with the libSQL HTTP adapter. NOT PostgreSQL, NOT D1.
52
-
53
- ### Setup in `services.ts`
54
-
55
- ```typescript
56
- import { Kysely, CamelCasePlugin } from 'kysely'
57
- import { LibsqlWebDialect } from '@pikku/kysely-sqlite'
58
- import type { DB } from '#pikku/db/schema.gen.js'
59
-
60
- const databaseUrl = await variables.get('DATABASE_URL')
61
- let kysely: Kysely<DB>
62
- if (databaseUrl) {
63
- kysely = new Kysely<DB>({
64
- dialect: new LibsqlWebDialect({ url: databaseUrl }),
65
- plugins: [new CamelCasePlugin()],
66
- })
67
- } else if (existingServices?.kysely) {
68
- kysely = existingServices.kysely as Kysely<DB>
69
- } else {
70
- throw new Error('kysely not provided and DATABASE_URL is unset')
71
- }
72
- ```
73
-
74
- Fabric injects `DATABASE_URL` as a variable binding when the stage starts. In local dev, `pikku db migrate` uses a local `dev.db` SQLite file.
75
-
76
- ### Migrations
77
-
78
- Migrations are plain `.sql` files at the **project root**, in a directory named
79
- for the engine — `db/sqlite/` for SQLite/libSQL stages, `db/postgres/` for
80
- Postgres ones. Never `db/migrations/`, and never under `packages/functions/`:
81
- the deploy pipeline stages `db/<engine>/*.sql` from the root and applies them
82
- after upload, so a migration anywhere else is silently never run.
83
-
84
- ```
85
- db/sqlite/
86
- 0001-init.sql
87
- 0002-add-users.sql
88
- ```
89
-
90
- Numbers must be consecutive and gap-free, and an applied migration is frozen —
91
- correct a mistake with a new forward migration, never by editing or renaming one
92
- that has already run (the recorded hash will no longer match).
93
-
94
- Run migrations: `pikku db migrate`. It also regenerates `.pikku/db/schema.gen.ts`
95
- (Kysely types) and `.pikku/db/zod.gen.ts` — there is no separate types step.
96
-
97
- **NEVER hand-edit the generated schema** — write a migration and re-run.
98
-
99
- A Better Auth app has a second constraint: the plugins you enable (`admin()`,
100
- `actor()`, …) each declare columns, and `pikku db migrate` refuses to run while
101
- the applied schema is missing any of them. `pikku db generate` writes the
102
- migration that closes the gap.
103
-
104
- ### Column conventions
105
-
106
- - Use `SERIAL`/`INTEGER PRIMARY KEY AUTOINCREMENT` for IDs
107
- - Use `TEXT` for strings, `INTEGER` for booleans (0/1) and timestamps (Unix ms)
108
- - Use `CHECK` constraints sparingly — prefer app-level validation
109
- - Table and column names: snake_case in SQL, camelCase in TypeScript (via `CamelCasePlugin`)
110
-
111
- ## Deploy Provider
112
-
113
- `pikku.config.json` (in the project root, not `packages/functions/`) **must** declare the Fabric deploy provider:
114
-
115
- ```json
116
- {
117
- "deploy": {
118
- "providers": {
119
- "cloudflare": "@pikkufabric/deploy-cloudflare"
120
- }
121
- }
122
- }
123
- ```
124
-
125
- Without this, `pikku deploy plan --provider cloudflare` uses the OSS adapter which lacks Fabric's workflow service wiring.
126
-
127
- The Fabric adapter automatically:
128
-
129
- - Injects `SQLiteKyselyWorkflowService` when `DATABASE_URL` is bound
130
- - Sets up the libSQL workflow queue
131
- - Wires `workflowQueues: true` for the scaffold
132
-
133
- No manual workflow service setup is needed.
134
-
135
- ## Project Layout
136
-
137
- ```
138
- packages/functions/
139
- src/
140
- functions/ # Business logic — one pikkuFunc/workflow per file
141
- wirings/ # Transport bindings
142
- *.http.ts # wireHTTP / defineHTTPRoutes / wireHTTPRoutes
143
- *.channel.ts # wireChannel
144
- *.queue.ts # wireQueueWorker
145
- *.schedule.ts # wireScheduler
146
- *.mcp.ts # wireMCPTool
147
- *.cli.ts # wireCLI
148
- services.ts # pikkuServices factory (singleton)
149
- middleware.ts # Shared middleware
150
- permissions.ts # Shared permissions
151
- .pikku/
152
- db/schema.gen.ts # Kysely types, written by `pikku db migrate` — NEVER hand-edit
153
- apps/app/ # Frontend(s)
154
- db/sqlite/ # Plain .sql migrations, numbered, gap-free (project root)
155
- pikku.config.json # Pikku + deploy config (project root)
156
- pikkufabric.config.json # Fabric project link + frontends (project root)
157
- ```
158
-
159
- ## `pikkufabric.config.json`
160
-
161
- Links the repo to a Fabric project and declares its frontends:
162
-
163
- ```json
164
- {
165
- "projectId": "my-project-id",
166
- "production": {
167
- "domain": "example.com"
168
- },
169
- "frontends": {
170
- "app": {
171
- "cwd": "apps/app",
172
- "primary": true,
173
- "deploy": true,
174
- "kind": "ssr",
175
- "dev": {
176
- "command": ["yarn", "dev"],
177
- "port": 7105,
178
- "healthPath": "/"
179
- }
180
- }
181
- }
182
- }
183
- ```
184
-
185
- - `projectId`: written by `pikku fabric init` / `link`. Templates ship the
186
- `__PROJECT_ID__` placeholder — that is *not* a link, and the CLI treats it as
187
- unlinked.
188
- - `production.domain`: optional custom domain. Production always maps to `main`;
189
- without a domain it lives on the platform `*.pikkufabric.app` hostnames.
190
- - `frontends`: each entry declares a frontend app with its dev command and port
191
-
192
- ## RPC is the default transport
193
-
194
- In Fabric apps, most features don't need HTTP wirings. Just write the function with `expose: true` — Pikku generates an RPC client and React Query hooks automatically.
195
-
196
- ```typescript
197
- export const listTasks = pikkuSessionlessFunc({
198
- expose: true,
199
- readonly: true,
200
- func: async ({ kysely }, {}) => {
201
- return { tasks: await kysely.selectFrom('tasks').selectAll().execute() }
202
- },
203
- })
204
- ```
205
-
206
- Add `wireHTTP` only when you need a specific REST shape (webhooks, third-party callers).
207
-
208
- ### Transport rule
209
-
210
- - Always use RPC first.
211
- - If the function should be callable from the app or other generated clients, prefer `expose: true`.
212
- - Use `expose: true` for public/generated client access unless the user explicitly wants a private function.
213
- - Do not add HTTP routes unless the user explicitly asks for HTTP/REST, or the project settings explicitly require HTTP transport.
214
- - Every new or changed function must have a real description.
215
- - If function metadata would show `missing description`, the work is not finished yet.
216
-
217
- ## Run it locally
218
-
219
- A Fabric app is two processes: the pikku API server (`:3000`) and the frontend
220
- (vite). The starter template's `bun run dev` starts **both** and takes the whole
221
- session down if either dies — a frontend running against a dead API looks like an
222
- app bug and is the single most common way to waste an hour here.
223
-
224
- ```bash
225
- bun run prebuild # pikku all — codegen must be current before the server boots
226
- bun run dev
227
- ```
228
-
229
- Then open the app, sign up as a real user, and click through what you built.
230
- **HTTP 200 is not evidence.** These are client-rendered pages: the server returns
231
- 200 with an empty shell, so a page whose component throws still looks fine to
232
- curl. Either open it in a browser or drive it headlessly and assert on rendered
233
- text.
234
-
235
- Secrets come from `process.env`, which the CLI populates from a `.env` in the
236
- working directory. `BETTER_AUTH_SECRET` is required — without it the first
237
- sign-up fails with `Requested secret not found`, which names no key and points at
238
- no file. The starter template generates one on first `bun run dev`.
239
-
240
- If you are running the two processes yourself rather than through the template's
241
- script, run `pikku dev` from the **project root** (it resolves `srcDirectories`
242
- relative to the config, so a nested cwd yields a doubled watch path and no hot
243
- reload).
244
-
245
- ## Deploy
246
-
247
- ```bash
248
- pikku fabric login # opens a browser; needs a human, wait for it
249
- pikku fabric init https://github.com/<owner>/<repo>
250
- pikku fabric validate # must pass clean
251
- pikku fabric deploy plan --production
252
- pikku fabric deploy apply --production --auto-apply
253
- ```
254
-
255
- `apply` confirms before deploying, and with no TTY to ask — CI, an agent shell —
256
- it refuses rather than hangs. `--auto-apply` supplies that confirmation; drop it
257
- only when a human is at a real terminal.
258
-
259
- `init` adopts a **GitHub** repo, and adoption goes through the Pikku Fabric
260
- GitHub App — the app has to be installed on the account or org that owns the
261
- repo, and if it is installed with "selected repositories" this one must be in
262
- the selection. There is no CLI flag that works around a missing installation:
263
- `init` returns "Connect the GitHub account '<owner>'". Send the user to install
264
- it, or create the project in the console instead (which provisions a Fabric-hosted
265
- git repo you push to) and write the returned `projectId` into
266
- `pikkufabric.config.json` yourself.
267
-
268
- Deploy refuses to run unless the target branch equals its upstream — the guard
269
- compares `main` against `main@{upstream}`. So the remote you pushed to must be
270
- the one the branch tracks; a stale `origin` left over from scaffolding blocks
271
- the deploy with "local HEAD … ≠ remote …" even though your code is pushed.
272
- `git branch --set-upstream-to=<remote>/main main` before deploying.
273
-
274
- ## Versioning
275
-
276
- Functions with `expose: true` are versioned via `versions.pikku.json`. When you change a function's input or output schema, you must bump its version number — otherwise `pikku all` will report a breaking change and callers' generated clients become stale.
277
-
278
- The `pikku-verify` tool catches this automatically.
279
-
280
- ## After every code change
281
-
282
- Always call the `pikku-verify` tool after modifying functions, wirings, or schemas. It runs:
283
-
284
- 1. `pikku all` — regenerates all codegen, checks version compliance
285
- 2. `tsc --noEmit` — validates TypeScript types
286
-
287
- The output card shows whether any breaking changes were detected.
288
-
289
- ## Hard rules
290
-
291
- These apply in every Fabric app:
292
-
293
- - **No `process.env`** — use `variables.get('NAME')` and `secrets.getSecret('NAME')`. Declare with `wireVariable` / `wireSecret`.
294
- - **No `as any`** — fix types properly.
295
- - **No generic `Error`** — throw `NotFoundError`, `ConflictError`, `BadRequestError`, `UnauthorizedError` from `@pikku/core/errors`.
296
- - **No auth checks in function bodies** — use `permissions:` field on the function config with a `pikkuPermission` factory.
297
- - **No hand-editing `.pikku/db/schema.gen.ts`** — write a migration and re-run `pikku db migrate`.
298
- - **One runtime unit per file** — never define multiple functions/workflows in a single source file.
299
- - **Workflow steps don't need manual wiring** — `pikkuSessionlessFunc` step functions in `*.steps.ts` files are auto-discovered by codegen.
300
-
301
- ## Converting an existing app to Fabric format
302
-
303
- Start by running the structural validator — it tells you exactly what is missing:
304
-
305
- ```bash
306
- pikku fabric validate --json
307
- ```
308
-
309
- Fix every `error` and `warn` in the output before continuing. Then:
310
-
311
- 1. **Replace the database layer**: swap PostgreSQL/MySQL queries for Kysely + libSQL. Convert schema to SQLite-compatible SQL migrations in `db/sqlite/`.
312
- 2. **Replace route handlers with pikkuFuncs**: extract business logic into `pikkuFunc`/`pikkuSessionlessFunc`, add `wireHTTP` or `expose: true` for transport.
313
- 3. **Replace DI/IoC with pikkuServices**: move service construction to `createSingletonServices` in `services.ts`.
314
- 4. **Replace `process.env` calls** with `wireVariable`/`wireSecret` + `variables.get()`.
315
- 5. **Add `pikku.config.json`** at project root with `srcDirectories`, `outDir`, and `clientFiles`.
316
- 6. **Add `fabric.config.json`** at project root with `projectId`, `production.branch`, and `frontends`.
317
- 7. **Run `pikku all`** — verify codegen succeeds and there are no type errors.
318
- 8. **Run `pikku fabric validate`** once more to confirm no structural issues remain.
@@ -1,112 +0,0 @@
1
- ---
2
- name: pikku-fabric-debug
3
- description: 'Debug a deployed Fabric stage from the CLI — read logs, find recent errors, follow a single request end-to-end by traceId, and check request/error/latency metrics. TRIGGER when: a deployed Fabric app is erroring, timing out, or behaving differently than local; the user asks "why is prod failing", "check the logs", "what happened to this request"; or a deploy succeeded but the app misbehaves. DO NOT TRIGGER when: the failure reproduces locally (debug it locally), the deploy itself failed (use pikku-fabric — that is a build/config problem, not a runtime one), or the project is not deployed to Fabric.'
4
- installGroups: [fabric]
5
- ---
6
-
7
- # Debugging a deployed Fabric stage
8
-
9
- ## Agent Operating Procedure
10
-
11
- Use this skill as an execution checklist, not reference material.
12
-
13
- 1. Reproduce locally first. If it fails locally too, debug it there — the
14
- deployed stage adds cost and latency to every iteration.
15
- 2. Start from `errors`, not `logs`. Errors are already filtered and carry the
16
- traceId that unlocks the rest.
17
- 3. Follow one trace end-to-end before forming a theory. A single failing request
18
- tells you more than a hundred unrelated log lines.
19
- 4. Fix the source cause and redeploy. Never leave the diagnosis at "it is flaky".
20
- 5. Confirm the fix against the same stage — recheck `errors` for the function.
21
-
22
- Every command below requires a logged-in CLI and a linked project. Both fail
23
- with the exact remediation if not:
24
-
25
- ```
26
- Not logged in. Run `pikku fabric login` first.
27
- No fabric project linked. Run `pikku fabric link` first.
28
- ```
29
-
30
- ## The loop
31
-
32
- **1 — What is broken?**
33
-
34
- ```bash
35
- pikku fabric errors -b main # branch defaults to main
36
- pikku fabric errors -b main --function createOrder
37
- ```
38
-
39
- Prints a `WHEN | FUNCTION | TRACE | MESSAGE` table. The message is **truncated
40
- to 100 characters** — treat it as a label, not the full error. The TRACE column
41
- is the input to the next step.
42
-
43
- **2 — What happened in that one request?**
44
-
45
- ```bash
46
- pikku fabric trace <traceId> -b main
47
- pikku fabric trace <traceId> -b main --json
48
- ```
49
-
50
- `--branch` is **required** here (no default). Each event prints as:
51
-
52
- ```
53
- <timestamp> <scriptName> <wireType>:<wireId> <duration>ms — <error|message|outcome>
54
- ```
55
-
56
- This is the whole request across the stage — every unit it touched, in order,
57
- with per-event durations. The last event before the failure is where to look.
58
-
59
- **3 — Is it one request or the whole stage?**
60
-
61
- ```bash
62
- pikku fabric metrics -b main # last 24h
63
- pikku fabric metrics -b main --hours 2 --function createOrder
64
- ```
65
-
66
- Rows are `reqs= err= (rate%) avg= min= max=` per bucket. A single bad request
67
- with a healthy error rate is a data problem; a climbing error rate is a
68
- deployment or dependency problem. `--json` additionally returns a `wireTypes`
69
- breakdown (requests per http/queue/scheduler/…) that the table output omits.
70
-
71
- **4 — Wider context around the failure**
72
-
73
- ```bash
74
- pikku fabric logs -b main
75
- pikku fabric logs -b main --level warn
76
- pikku fabric logs -b main -f # follow
77
- ```
78
-
79
- `--branch` is **required** — `logs` throws `Specify --branch <branch-name>.`
80
- without it, even though the flag reads as optional.
81
-
82
- **5 — Is the running code the code you think it is?**
83
-
84
- ```bash
85
- pikku fabric status # active + in-flight deployment, per stage, with gitSha
86
- ```
87
-
88
- Check this *before* deep-diving. A stage still serving an older `gitSha`, or a
89
- deploy stuck in flight, explains a whole class of "my fix did nothing".
90
-
91
- ## Known gaps — do not misread these as bugs in your app
92
-
93
- - **`pikku fabric logs --since` and `--deployment` are accepted and ignored.**
94
- They are declared as options but the command never reads them, so
95
- `--since 15m` silently returns the same default window as no flag at all. Do
96
- not conclude "nothing happened in the last 15 minutes" from it. Narrow by
97
- `--level`, or by `--function` via `errors`, instead.
98
- - **`--follow` is a 2-second client-side poll, not a server stream.** It
99
- dedups against what it already printed, so it behaves like `tail -f`, but new
100
- entries can appear up to ~2s late and it holds the process open until killed.
101
-
102
- ## What NOT to do
103
-
104
- - **Do not SSH anywhere or query the telemetry backend directly.** These
105
- commands are the supported surface; anything lower-level is Fabric-internal
106
- and will not exist for your project.
107
- - **Do not debug by redeploying with added `console.log`s.** Get the traceId,
108
- read the trace. A deploy cycle per hypothesis is the slow path.
109
- - **Do not read the truncated `errors` message as the full error.** Always
110
- confirm against `trace` before changing code.
111
- - **Do not treat an empty `errors` table as "the app is fine"** — a request that
112
- returns a wrong 200 logs nothing. Check `metrics` for the outcome mix.
@@ -1,258 +0,0 @@
1
- ---
2
- name: pikku-feature
3
- description: 'Drive create-a-feature work for a Pikku project: discover project context, work on a feature branch, implement + verify + commit, and ask the user to review via the diff. TRIGGER when: the user asks to "create a feature", "build a todo app", "add X to my Pikku project", "wire up a new endpoint", or anything that implies turning a natural-language request into Pikku functions/wirings/migrations. DO NOT TRIGGER when: the user asks for a one-off code edit in an existing function, or asks about Pikku concepts (use pikku-concepts).'
4
- installGroups: [core]
5
- allowed-tools: Bash(yarn pikku meta *), Bash(yarn pikku all *), Bash(yarn tsc), Bash(git status *), Bash(git diff *), Bash(git switch *), Bash(git checkout *), Bash(git checkout -b *), Bash(git add *), Bash(git commit *), Bash(git log *), Bash(git branch *)
6
- argument-hint: '<feature description>'
7
- ---
8
-
9
- # Pikku Create-a-Feature
10
-
11
- ## Agent Operating Procedure
12
-
13
- Use this skill as an execution checklist, not reference material.
14
-
15
- 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.
16
- 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.
17
- 3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
18
- 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.
19
- 5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
20
-
21
- End-to-end flow: **discover → state intent → branch → implement → verify → commit → hand to reviewer**.
22
-
23
- There is **no plan JSON**. The branch + diff IS the contract. The reviewer
24
- sees real, compiled, working code. Apply = merge. Reject = `git branch -D`.
25
-
26
- ## Stage 1 — Discover
27
-
28
- Run **once** at the start of every feature request:
29
-
30
- ```bash
31
- yarn pikku meta context --json
32
- ```
33
-
34
- This single call returns functions, wires, middleware, permissions, workflows,
35
- `capabilities` (which wire types are in use), and `layout` (where new files
36
- should land).
37
-
38
- Only fall back to targeted commands when you need full input/output JSON
39
- schemas (`yarn pikku meta functions get <id>`) or workflow steps
40
- (`yarn pikku meta workflows get <id>`).
41
-
42
- **Capability rule:** do not introduce new wires of a type whose
43
- `capabilities.<type>` is `false` unless the user explicitly asked for it.
44
-
45
- ## Stage 2 — State intent in plain English (BEFORE writing code)
46
-
47
- Before touching any files, give the user one paragraph stating exactly what
48
- you'll do. This is the lightweight "plan" — it is chat, not JSON.
49
-
50
- > I'll add a `todos` table via a new migration in `sql/`, and two
51
- > `pikkuSessionlessFunc`s (`createTodo`, `listTodos` with
52
- > `readonly: true`) in `packages/functions/src/functions/`. Both
53
- > `expose: true`, so they'll be reachable via the auto-generated RPC
54
- > client and React Query hooks — no HTTP wiring needed. No new
55
- > dependencies. OK to proceed?
56
-
57
- Wait for the user to confirm or redirect. They can ask for changes ("use the
58
- existing tasks table" / "make it a queue not http") in normal chat — no
59
- schema, no JSON, no ceremony.
60
-
61
- **Non-interactive runs (auto mode, CI, batch jobs):** state intent in one
62
- paragraph and proceed without waiting. Surface course corrections promptly
63
- in the post-implementation report.
64
-
65
- ## Stage 3 — Branch off
66
-
67
- After confirmation, ensure the working tree is clean and create a feature
68
- branch off the current default branch (whatever `git branch --show-current`
69
- returns at the start — `main`, `master`, `develop`, all fine):
70
-
71
- ```bash
72
- git status
73
- git switch -c feature/<short-slug>
74
- ```
75
-
76
- If the working tree is dirty, **stop and ask** — never stash silently or
77
- overwrite uncommitted work.
78
-
79
- ## Stage 4 — Implement
80
-
81
- Write the code as a normal human contributor would. Use the project's
82
- existing conventions (look at neighbour files in `srcDirectories[0]/functions/`
83
- and `.../wirings/` for style).
84
-
85
- ### RPC is the default transport
86
-
87
- **Just write the function with `expose: true`** — that's enough to make it
88
- callable. Pikku auto-generates an RPC client (and React Query hooks if the
89
- project's `clientFiles.reactQueryFile` is set) from every exposed function.
90
- You do **not** need an HTTP wiring for callers to reach the function.
91
-
92
- Default flow for a feature:
93
-
94
- 1. Write the function file with `expose: true` (and `readonly: true` for
95
- reads).
96
- 2. Run `pikku all` — RPC map, fetch client, and React Query hooks are
97
- regenerated. Frontends call `useListTodos()` / `mutation.mutate(...)`
98
- without you wiring anything.
99
-
100
- Add an HTTP wiring **only when** the feature genuinely needs a specific
101
- REST shape (third-party callers, webhooks, REST-conventional URLs). Most
102
- in-app features don't.
103
-
104
- ### Hard rules that always apply
105
-
106
- - **`expose: true`** for any function called from a frontend or another
107
- service. Without it the RPC client won't generate hooks for it.
108
- - **`readonly: true` for queries.** Mark read functions as `readonly: true`
109
- on the function config. The runner uses this to enforce read-only sessions
110
- (a write func called under a readonly session is rejected). The RPC layer
111
- also uses it to pick `useQuery` (cacheable) vs `useMutation` for client
112
- hooks. Mutations leave `readonly` unset (or `false`).
113
- - **`kind` ⇔ `auth` coupling for HTTP wirings (when you have one).** If the
114
- function is `pikkuFunc` (session-aware), the HTTP wiring needs
115
- `auth: true`. `pikkuSessionlessFunc` ⇒ `auth: false`. Mismatching is a
116
- hard error (PKU573).
117
- - **HTTP method by intent (when you wire HTTP).** Reads → `GET`. Writes →
118
- `POST`/`PUT`/`PATCH`/`DELETE` per REST conventions.
119
- - **Workflows.** Prefer `pikkuWorkflowGraph` (DSL) over
120
- `pikkuWorkflowComplexFunc`. `mode: 'inline'` is sync; `'distributed'` is
121
- queue-dispatched.
122
- - **Auth checks belong on the function or wiring**, not in function bodies.
123
- Use the `permissions` field with a `pikkuPermission` factory.
124
- - **Throw typed errors** from `@pikku/core/errors` — `NotFoundError`,
125
- `ConflictError`, `BadRequestError`. Never bare `Error`.
126
- - **Migrations are inline SQL files** in the project's migrations dir
127
- (typically `sql/`). Use a numbered prefix matching existing files.
128
- - **Secrets and env-vars: NEVER `process.env`.** Declare them with
129
- `wireSecret` (sensitive) or `wireVariable` (non-sensitive) — both with a
130
- zod schema for type-safe access. Read with
131
- `services.secrets.getSecret('NAME')` or `services.variables.get('NAME')`.
132
- See the **pikku-config** skill for the full pattern (including
133
- OAuth2 credentials). This applies even in `config.ts` and singleton
134
- service factories.
135
-
136
- ### Conventions to copy from neighbours
137
-
138
- Some patterns vary by project; **read a neighbour file before writing**:
139
-
140
- - **Function shape**: zod schemas as exported `const`s (`CreateTodoInput`,
141
- `CreateTodoOutput`) passed to `input`/`output` on the func config — vs
142
- generic-typed config. Schema name **must match codegen expectations** (the
143
- exported const name = the schema name in generated `.gen.json`).
144
- - **Imports**: usually `'#pikku'` for `pikkuFunc` / `pikkuSessionlessFunc`
145
- etc. Copy what neighbours do.
146
- - **Service usage**: e.g. `kysely`, `redis`. Look at how an existing function
147
- destructures services from its first arg. **Check `application-types.d.ts`**
148
- to see whether services like `kysely` are typed (`Kysely<DB>`) or untyped
149
- (`Kysely<any>`) — that drives whether you can lean on generated DB types
150
- or have to coerce manually.
151
- - **DB schema namespace**: many projects put tables under a `CREATE SCHEMA`
152
- (e.g. `app.todos`). Read the first migration in `sql/` to see the
153
- convention; reuse helper functions/triggers (e.g. `update_last_updated_at`)
154
- rather than redefining them.
155
- - **HTTP wiring style** (only relevant if you're adding one). Two common
156
- shapes — match what the project already uses:
157
- - Per-route `wireHTTP({ method, route, func, auth })`.
158
- - Single map: `const routes = defineHTTPRoutes({ auth: false, routes: {
159
- fooName: { method: 'post', route: '/foo', func: fooFunc } }}); wireHTTPRoutes(routes)`.
160
-
161
- For shared wiring files (e.g. `todos.http.ts` holding both create and list):
162
- create the file with imports if it doesn't exist; **append** wire calls and
163
- add missing imports if it does.
164
-
165
- ## Stage 5 — Verify
166
-
167
- Both must complete cleanly **for your changes** before committing:
168
-
169
- ```bash
170
- yarn pikku all
171
- # Type-check the workspaces you touched:
172
- cd packages/functions && npx tsc --noEmit
173
- ```
174
-
175
- Notes on running `tsc`:
176
-
177
- - A root-level `yarn tsc` may be a no-op in monorepos that don't define a
178
- `tsc` script in each workspace. Don't trust an exit-zero from the root if
179
- no actual checking happened — verify by running `npx tsc --noEmit` in the
180
- package(s) you touched.
181
-
182
- ### What "fails" means
183
-
184
- **Trust the exit code, not the stderr noise.** `yarn pikku all` may print
185
- warnings, `[PKUxxx]` messages, even `level: critical` log lines, while
186
- still exiting `0` — those are pre-existing project state, not your
187
- problem. Same for `meta context --json`: it streams logs to stderr that
188
- look scary on a clean baseline. The exit code is the source of truth.
189
-
190
- If a command exits non-zero, that's a real failure — fix or stop.
191
-
192
- ### Baseline noise — only your errors matter
193
-
194
- Many real-world projects ship with pre-existing warnings or errors
195
- (legacy types, version drift, gen-layer messages). Those are not your
196
- problem; do not "fix" them.
197
-
198
- To distinguish your errors from baseline:
199
-
200
- 1. **Before implementing** (Stage 4), capture the baseline:
201
- ```bash
202
- yarn pikku all 2>&1 | tee /tmp/pikku-before.log
203
- ```
204
- 2. **After implementing**, compare:
205
- ```bash
206
- yarn pikku all 2>&1 | tee /tmp/pikku-after.log
207
- diff /tmp/pikku-before.log /tmp/pikku-after.log
208
- ```
209
-
210
- A clean diff means your changes introduced no new issues — even if the
211
- underlying logs both show pre-existing warnings.
212
-
213
- If something genuinely failed because of YOUR change, fix the actual issue.
214
- **Do not** mask errors with `as any`, `@ts-ignore`, or `--no-verify`. If
215
- you're stuck, surface the failure to the user — don't hand them a broken
216
- branch.
217
-
218
- ## Stage 6 — Commit
219
-
220
- ```bash
221
- git add -A
222
- git commit -m "feat: <short title>"
223
- ```
224
-
225
- ## Stage 7 — Hand off
226
-
227
- Tell the user the branch name and how to review. Two options:
228
-
229
- - **Local review:** open the pikku console — the changes view diffs the
230
- current branch against `main` with pikku-aware structure (added functions,
231
- new wires, migrations).
232
- - **PR review:** ask before pushing. Once they confirm, `git push -u origin
233
- feature/<slug>` and surface the PR-create URL.
234
-
235
- Do not push without explicit confirmation. Do not merge.
236
-
237
- ## Hard constraints
238
-
239
- The skill's `allowed-tools` does **not** permit:
240
-
241
- - `yarn add` / `npm install` / dependency changes (ask the user first)
242
- - `yarn dbmigrate` (never run migrations against the real DB during planning)
243
- - `pikku deploy apply` (never deploy)
244
- - secret writes
245
- - network calls beyond what the implementation requires
246
-
247
- If the feature genuinely needs any of these, **stop and ask** with a clear
248
- explanation of why and what would change.
249
-
250
- ## Output discipline
251
-
252
- - Stage 2 (intent statement) is plain English, one paragraph.
253
- - Between stages, give one-line updates: "Discovered 30 functions, http+queue
254
- in use. Drafting intent..." → "Branch `feature/todos` created, implementing..."
255
- → "`pikku all` clean, `tsc` clean, committed. Review via console or run
256
- `git diff main`."
257
- - Don't narrate file-by-file. Only surface what's interesting (new patterns,
258
- judgment calls, things you suppressed).