@pikku/cli 0.12.42 → 0.12.44

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 (113) hide show
  1. package/cli.schema.json +1 -1
  2. package/console-app/assets/index-CRLT8CXr.js +254 -0
  3. package/console-app/assets/index-DwyRdRuZ.css +1 -0
  4. package/console-app/index.html +2 -2
  5. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  6. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  7. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  8. package/dist/.pikku/cli/pikku-cli-channel.js +11 -1
  9. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +10 -0
  10. package/dist/.pikku/cli/pikku-cli-client.gen.js +73 -0
  11. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  12. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  13. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  14. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +56 -26
  15. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  16. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  17. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  18. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  19. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  20. package/dist/.pikku/function/pikku-function-types.gen.d.ts +2 -2
  21. package/dist/.pikku/function/pikku-function-types.gen.js +3 -2
  22. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  23. package/dist/.pikku/function/pikku-functions-meta.gen.json +134 -96
  24. package/dist/.pikku/function/pikku-functions.gen.js +1 -1
  25. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  26. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  27. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
  28. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
  29. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
  30. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  31. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  32. package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
  33. package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
  34. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  35. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  36. package/dist/.pikku/pikku-services.gen.d.ts +2 -2
  37. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  38. package/dist/.pikku/pikku-types.gen.js +1 -1
  39. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  40. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  41. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
  42. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  43. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  44. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  45. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +4 -2
  46. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  47. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  48. package/dist/.pikku/schemas/register.gen.js +13 -5
  49. package/dist/.pikku/schemas/schemas/DeployApplyInput.schema.json +1 -1
  50. package/dist/.pikku/schemas/schemas/DeployPlanInput.schema.json +1 -1
  51. package/dist/.pikku/schemas/schemas/FabricAddInput.schema.json +1 -0
  52. package/dist/.pikku/schemas/schemas/FabricAddOutput.schema.json +1 -0
  53. package/dist/.pikku/schemas/schemas/FabricPublishInput.schema.json +1 -0
  54. package/dist/.pikku/schemas/schemas/FabricPublishOutput.schema.json +1 -0
  55. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  56. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  57. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  58. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  59. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  60. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  61. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  62. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  63. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  64. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  65. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  66. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
  67. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  68. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  69. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  70. package/dist/bin/pikku-bin.mjs +2 -2
  71. package/dist/src/cli.wiring.js +12 -0
  72. package/dist/src/deploy/build-pipeline.d.ts +2 -0
  73. package/dist/src/deploy/build-pipeline.js +7 -1
  74. package/dist/src/deploy/bundler/bundler.d.ts +2 -0
  75. package/dist/src/deploy/bundler/bundler.js +8 -5
  76. package/dist/src/fabric/fabric-commands.d.ts +61 -3
  77. package/dist/src/fabric/fabric-commands.js +27 -1
  78. package/dist/src/fabric/functions/add.function.d.ts +50 -0
  79. package/dist/src/fabric/functions/add.function.js +144 -0
  80. package/dist/src/fabric/functions/publish.function.d.ts +45 -0
  81. package/dist/src/fabric/functions/publish.function.js +85 -0
  82. package/dist/src/fabric/functions/validate-core.d.ts +1 -1
  83. package/dist/src/fabric/functions/validate.function.d.ts +4 -4
  84. package/dist/src/fabric/functions/validate.function.js +119 -0
  85. package/dist/src/functions/commands/deploy-apply.d.ts +3 -0
  86. package/dist/src/functions/commands/deploy-apply.js +1 -0
  87. package/dist/src/functions/commands/deploy-plan.d.ts +3 -0
  88. package/dist/src/functions/commands/deploy-plan.js +1 -0
  89. package/dist/src/functions/commands/pikku-command-summary.js +3 -2
  90. package/dist/src/functions/commands/versions-update.js +10 -4
  91. package/dist/src/functions/commands/workspace-validate.d.ts +3 -3
  92. package/dist/src/functions/db/better-auth-schema.js +15 -2
  93. package/dist/src/functions/db/sqlite/sqlite-kysely.js +11 -3
  94. package/dist/src/functions/validate/workspace-validate.d.ts +2 -2
  95. package/dist/src/functions/validate/workspace-validate.js +4 -0
  96. package/dist/src/functions/wirings/auth/pikku-command-auth.js +6 -1
  97. package/dist/src/functions/wirings/auth/serialize-auth-gen.d.ts +4 -1
  98. package/dist/src/functions/wirings/auth/serialize-auth-gen.js +36 -12
  99. package/dist/src/functions/wirings/emails/pikku-command-emails.js +48 -19
  100. package/dist/src/functions/wirings/functions/pikku-command-services.js +5 -4
  101. package/dist/src/functions/wirings/functions/serialize-function-types.js +3 -2
  102. package/dist/src/scaffold/rpc-remote.gen.js +1 -1
  103. package/dist/src/services/cli-logger-forwarder.service.d.ts +4 -1
  104. package/dist/src/services/cli-logger-forwarder.service.js +20 -2
  105. package/dist/src/services/cli-logger.service.d.ts +16 -2
  106. package/dist/src/services/cli-logger.service.js +33 -5
  107. package/dist/src/services.d.ts +6 -1
  108. package/dist/src/services.js +13 -12
  109. package/dist/tsconfig.tsbuildinfo +1 -1
  110. package/package.json +4 -4
  111. package/skills/pikku-emails/SKILL.md +157 -0
  112. package/console-app/assets/index-D9Z9rySK.js +0 -233
  113. package/console-app/assets/index-DwUzVI5k.css +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/cli",
3
- "version": "0.12.42",
3
+ "version": "0.12.44",
4
4
  "author": "yasser.fadl@gmail.com",
5
5
  "license": "BUSL-1.1",
6
6
  "imports": {
@@ -27,11 +27,11 @@
27
27
  "dependencies": {
28
28
  "@electric-sql/pglite": "^0.5.1",
29
29
  "@openapi-contrib/json-schema-to-openapi-schema": "^4.3.1",
30
- "@pikku/better-auth": "^0.12.7",
31
- "@pikku/core": "^0.12.34",
30
+ "@pikku/better-auth": "^0.12.9",
31
+ "@pikku/core": "^0.12.35",
32
32
  "@pikku/deploy-cloudflare": "^0.12.3",
33
33
  "@pikku/fetch": "^0.12.3",
34
- "@pikku/inspector": "^0.12.20",
34
+ "@pikku/inspector": "^0.12.22",
35
35
  "@pikku/kysely": "^0.12.16",
36
36
  "@pikku/kysely-node-sqlite": "^0.12.2",
37
37
  "@pikku/node-http-server": "^0.12.2",
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: pikku-emails
3
+ description: "Use when working with Pikku's file-based email templates: authoring HTML/subject/text templates, locales, partials and theme, running `pikku emails generate`, and rendering/sending them through an EmailService.
4
+ TRIGGER when: code uses renderEmailTemplate, EmailTemplateName, EmailService, SendTemplateEmailInput, LocalEmailService, or imports from .pikku/email/pikku-emails.gen.
5
+ TRIGGER when: the project has an emails/ directory (templates/, locales/, partials/, theme.json) or emailTemplatesDir in pikku.config.json.
6
+ TRIGGER when: user asks to add/edit a transactional email (verification, password reset, invitation, receipt), wire email sending, or translate an email.
7
+ DO NOT TRIGGER when: user asks about i18n for the app UI (use pikku-i18n) or auth flows in general (use pikku-better-auth)."
8
+ ---
9
+
10
+ # Pikku Emails
11
+
12
+ Pikku compiles a directory of plain template files into a typed, dependency-free
13
+ renderer. `pikku emails generate` reads `emailTemplatesDir` and writes
14
+ `.pikku/email/pikku-emails.gen.ts` (the `renderEmailTemplate` function + per-template
15
+ types) and `pikku-emails-meta.gen.json`. Templates are authored as files; the
16
+ generated output is never edited by hand.
17
+
18
+ ## Agent Operating Procedure
19
+
20
+ 1. Edit source files under `emailTemplatesDir` only. Never edit `.pikku/email/*`.
21
+ 2. After any change run `pikku emails generate` (it is also part of `prebuild`, usually
22
+ `pikku bootstrap; pikku all; pikku emails generate`).
23
+ 3. Validate by importing `renderEmailTemplate` and rendering with sample data, or run the
24
+ project's typecheck — the generated `data` type will flag missing/wrong variables.
25
+ 4. Fix the source cause; do not patch generated files or update hashes by hand.
26
+
27
+ ## Config
28
+
29
+ ```jsonc
30
+ // pikku.config.json
31
+ {
32
+ "emailTemplatesDir": "emails", // relative to rootDir; omit to disable emails
33
+ "outDir": ".pikku" // gen lands in <outDir>/email/
34
+ }
35
+ ```
36
+
37
+ If `emailTemplatesDir` is unset the command is a no-op.
38
+
39
+ ## Directory layout
40
+
41
+ ```text
42
+ emails/
43
+ theme.json # brand tokens: appName, fonts, colors
44
+ locales/
45
+ en.json # translation strings, nested namespaces
46
+ de.json # one file per locale (filename = locale key)
47
+ partials/
48
+ layout.html # outer wrapper; must include {{content}}
49
+ footer.html # reusable fragment, included with {{> footer}}
50
+ templates/
51
+ verify-email.html # body (required)
52
+ verify-email.subject.txt # subject line (required)
53
+ verify-email.text.txt # plain-text alternative (optional)
54
+ ```
55
+
56
+ A template's **name** is its filename without the `.html` / `.subject.txt` / `.text.txt`
57
+ suffix (`verify-email` above). `html` and `subject` are required; `text` is optional and,
58
+ when present, becomes the plain-text MIME part.
59
+
60
+ ## Templating syntax
61
+
62
+ Placeholders are `{{ ... }}`. Resolution order inside a template:
63
+
64
+ - `{{appName}}` — from `data.appName`, falling back to `theme.appName`.
65
+ - `{{theme.colors.accent}}`, `{{theme.fonts.body}}` — values from `theme.json`.
66
+ - `{{t.verifyEmail.heading}}` — string from the active locale file (`locales/<locale>.json`).
67
+ - `{{verifyUrl}}` — any other key is a **runtime variable**, supplied via `data`.
68
+ - `{{> footer}}` — include a partial from `partials/`.
69
+ - `{{content}}` / `{{subject}}` — only meaningful inside `partials/layout.html`
70
+ (the rendered body and subject). `layout.html` wraps every template if present.
71
+
72
+ Locale strings may themselves contain variables and partial-free placeholders, e.g.
73
+ `"subject": "{{inviterName}} invited you to join {{organizationName}}"`. These are
74
+ resolved in the same pass, so a subject of `{{t.invitation.subject}}` expands fully.
75
+
76
+ ## Typed variables (per template)
77
+
78
+ The generator extracts the runtime variables each template references and emits a typed
79
+ `data` shape. Extraction is **scoped to the template**: it walks the template's
80
+ html/subject/text, the partials it includes, and only the locale keys it actually
81
+ references (transitively) — variables from unrelated locale entries do not leak in.
82
+
83
+ ```ts
84
+ import {
85
+ renderEmailTemplate,
86
+ type EmailTemplateName,
87
+ type EmailTemplateVariables,
88
+ } from './.pikku/email/pikku-emails.gen.js'
89
+
90
+ // EmailTemplateVariables<'organization-invitation'> =
91
+ // { appName?: ...; inviteUrl?: ...; inviterName?: ...; organizationName?: ... }
92
+ ```
93
+
94
+ To make a variable required-and-typed, reference it directly in the template body (not
95
+ only in a locale string), so it shows up as that template's variable.
96
+
97
+ ## Rendering
98
+
99
+ ```ts
100
+ const rendered = renderEmailTemplate({
101
+ name: 'verify-email', // EmailTemplateName (autocompleted)
102
+ locale: 'en', // optional, defaults to 'en'
103
+ data: { verifyUrl: url }, // EmailTemplateVariables<'verify-email'>
104
+ })
105
+ // rendered: { name, locale, subject, html, text?, variables, hash }
106
+ ```
107
+
108
+ `hash` is a stable content hash (useful as an idempotency / dedupe key on outgoing mail).
109
+
110
+ ## Sending through an EmailService
111
+
112
+ `@pikku/core/services` defines `EmailService.send(input)` where `input` is one of
113
+ `SendTextEmailInput`, `SendHTMLEmailInput`, or `SendTemplateEmailInput`:
114
+
115
+ ```ts
116
+ import type { EmailService } from '@pikku/core/services'
117
+
118
+ await email.send({
119
+ to: user.email,
120
+ template: { name: 'verify-email', locale: user.locale, data: { verifyUrl } },
121
+ })
122
+ ```
123
+
124
+ `LocalEmailService` (dev/test) captures the payload as-is. To actually render templates
125
+ before sending, wrap a delegate service: when `input.template` is present, call
126
+ `renderEmailTemplate` and forward `subject` / `html` / `text` to the delegate (e.g. a
127
+ Resend/SES/SMTP service). This wrapper is project-owned because `renderEmailTemplate`
128
+ is generated per project; wire it in `services.ts` and inject it into functions.
129
+
130
+ ```ts
131
+ async send(input: SendEmailInput) {
132
+ if (!('template' in input) || !input.template) return this.delegate.send(input)
133
+ const r = renderEmailTemplate(input.template as RenderEmailInput<EmailTemplateName>)
134
+ return this.delegate.send({
135
+ to: input.to, from: input.from, subject: r.subject, html: r.html,
136
+ ...(r.text ? { text: r.text } : {}),
137
+ })
138
+ }
139
+ ```
140
+
141
+ ## Generated artifacts
142
+
143
+ - `.pikku/email/pikku-emails.gen.ts` — `renderEmailTemplate`, `EmailTemplateName`,
144
+ `EmailLocale`, `EmailTemplateVariables<T>`, inlined templates/locales/partials/theme.
145
+ - `.pikku/email/pikku-emails-meta.gen.json` — per-template `variables`, `hasHtml/Subject/Text`,
146
+ and per-locale content hashes. Both are regenerated; keep them out of hand edits and
147
+ (typically) git-ignored.
148
+
149
+ ## Gotchas
150
+
151
+ - New template not appearing → you added `.html` but forgot `.subject.txt` (subject is
152
+ required), or didn't rerun `pikku emails generate`.
153
+ - Variable typed `unknown`/missing → it's only in a locale string for a different template;
154
+ reference it in this template to scope it in.
155
+ - Editing a locale string changes that template's content hash — expected; the hash covers
156
+ the strings the template uses.
157
+ - `layout.html` must contain `{{content}}` or the body is dropped.