@pikku/cli 0.12.37 → 0.12.39
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/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 +1 -1
- 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.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 +1 -1
- 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 +164 -164
- package/dist/.pikku/function/pikku-functions.gen.js +1 -1
- 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/http/pikku-http-wirings-meta.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-wirings.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.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/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 +7 -7
- 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/pikku-workflow-types.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -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/fabric/functions/validate-core.js +7 -7
- package/dist/src/fabric/functions/validate.function.js +36 -28
- package/dist/src/fabric/lib/config.d.ts +4 -4
- package/dist/src/fabric/lib/config.js +2 -2
- package/dist/src/functions/db/better-auth-schema.js +33 -11
- package/dist/src/functions/db/db-codegen.js +9 -5
- package/dist/src/functions/db/local-db.d.ts +2 -2
- package/dist/src/functions/db/local-db.js +123 -6
- package/dist/src/functions/db/sqlite/sqlite-runtime-node.js +2 -1
- package/dist/src/scaffold/rpc-remote.gen.js +1 -1
- package/package.json +1 -1
|
@@ -124,12 +124,12 @@
|
|
|
124
124
|
"pikkuVariableDefinitionTypes": "pikkuVariableDefinitionTypes",
|
|
125
125
|
"pikkuPackage": "pikkuPackage",
|
|
126
126
|
"pikkuPermissions": "pikkuPermissions",
|
|
127
|
+
"pikkuEventsScaffold": "pikkuEventsScaffold",
|
|
127
128
|
"pikkuCommandQueueMap": "pikkuCommandQueueMap",
|
|
128
129
|
"pikkuQueueTypes": "pikkuQueueTypes",
|
|
129
130
|
"pikkuCommandQueue": "pikkuCommandQueue",
|
|
130
131
|
"pikkuQueueMap": "pikkuQueueMap",
|
|
131
132
|
"pikkuQueue": "pikkuQueue",
|
|
132
|
-
"pikkuEventsScaffold": "pikkuEventsScaffold",
|
|
133
133
|
"pikkuPublicRPC": "pikkuPublicRPC",
|
|
134
134
|
"pikkuRemoteRPC": "pikkuRemoteRPC",
|
|
135
135
|
"pikkuRPCInternalMap": "pikkuRPCInternalMap",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.39
|
|
3
3
|
*/
|
|
4
4
|
import { addSchema } from '@pikku/core/schema';
|
|
5
5
|
import * as PikkuSchemasOutput from './schemas/PikkuSchemasOutput.schema.json' with { type: 'json' };
|
|
@@ -180,12 +180,12 @@ import * as PikkuMetaClientsInput from './schemas/PikkuMetaClientsInput.schema.j
|
|
|
180
180
|
addSchema('PikkuMetaClientsInput', PikkuMetaClientsInput);
|
|
181
181
|
import * as RemoteRPCHandlerInput from './schemas/RemoteRPCHandlerInput.schema.json' with { type: 'json' };
|
|
182
182
|
addSchema('RemoteRPCHandlerInput', RemoteRPCHandlerInput);
|
|
183
|
+
import * as PikkuCommandChannelsOutput from './schemas/PikkuCommandChannelsOutput.schema.json' with { type: 'json' };
|
|
184
|
+
addSchema('PikkuCommandChannelsOutput', PikkuCommandChannelsOutput);
|
|
183
185
|
import * as PikkuAIAgentOutput from './schemas/PikkuAIAgentOutput.schema.json' with { type: 'json' };
|
|
184
186
|
addSchema('PikkuAIAgentOutput', PikkuAIAgentOutput);
|
|
185
187
|
import * as PikkuPublicAgentOutput from './schemas/PikkuPublicAgentOutput.schema.json' with { type: 'json' };
|
|
186
188
|
addSchema('PikkuPublicAgentOutput', PikkuPublicAgentOutput);
|
|
187
|
-
import * as PikkuCommandChannelsOutput from './schemas/PikkuCommandChannelsOutput.schema.json' with { type: 'json' };
|
|
188
|
-
addSchema('PikkuCommandChannelsOutput', PikkuCommandChannelsOutput);
|
|
189
189
|
import * as PikkuCLIEntryOutput from './schemas/PikkuCLIEntryOutput.schema.json' with { type: 'json' };
|
|
190
190
|
addSchema('PikkuCLIEntryOutput', PikkuCLIEntryOutput);
|
|
191
191
|
import * as PikkuCLIOutput from './schemas/PikkuCLIOutput.schema.json' with { type: 'json' };
|
|
@@ -200,8 +200,6 @@ import * as PikkuFunctionTypesInput from './schemas/PikkuFunctionTypesInput.sche
|
|
|
200
200
|
addSchema('PikkuFunctionTypesInput', PikkuFunctionTypesInput);
|
|
201
201
|
import * as PikkuFunctionsOutput from './schemas/PikkuFunctionsOutput.schema.json' with { type: 'json' };
|
|
202
202
|
addSchema('PikkuFunctionsOutput', PikkuFunctionsOutput);
|
|
203
|
-
import * as PikkuGatewayOutput from './schemas/PikkuGatewayOutput.schema.json' with { type: 'json' };
|
|
204
|
-
addSchema('PikkuGatewayOutput', PikkuGatewayOutput);
|
|
205
203
|
import * as PikkuCommandHTTPOutput from './schemas/PikkuCommandHTTPOutput.schema.json' with { type: 'json' };
|
|
206
204
|
addSchema('PikkuCommandHTTPOutput', PikkuCommandHTTPOutput);
|
|
207
205
|
import * as PikkuHTTPOutput from './schemas/PikkuHTTPOutput.schema.json' with { type: 'json' };
|
|
@@ -212,6 +210,8 @@ import * as PikkuMiddlewareOutput from './schemas/PikkuMiddlewareOutput.schema.j
|
|
|
212
210
|
addSchema('PikkuMiddlewareOutput', PikkuMiddlewareOutput);
|
|
213
211
|
import * as PikkuPackageOutput from './schemas/PikkuPackageOutput.schema.json' with { type: 'json' };
|
|
214
212
|
addSchema('PikkuPackageOutput', PikkuPackageOutput);
|
|
213
|
+
import * as PikkuGatewayOutput from './schemas/PikkuGatewayOutput.schema.json' with { type: 'json' };
|
|
214
|
+
addSchema('PikkuGatewayOutput', PikkuGatewayOutput);
|
|
215
215
|
import * as PikkuPermissionsOutput from './schemas/PikkuPermissionsOutput.schema.json' with { type: 'json' };
|
|
216
216
|
addSchema('PikkuPermissionsOutput', PikkuPermissionsOutput);
|
|
217
217
|
import * as PikkuCommandQueueOutput from './schemas/PikkuCommandQueueOutput.schema.json' with { type: 'json' };
|
|
@@ -220,14 +220,14 @@ import * as PikkuQueueOutput from './schemas/PikkuQueueOutput.schema.json' with
|
|
|
220
220
|
addSchema('PikkuQueueOutput', PikkuQueueOutput);
|
|
221
221
|
import * as PikkuEventsScaffoldOutput from './schemas/PikkuEventsScaffoldOutput.schema.json' with { type: 'json' };
|
|
222
222
|
addSchema('PikkuEventsScaffoldOutput', PikkuEventsScaffoldOutput);
|
|
223
|
+
import * as PikkuSchedulerOutput from './schemas/PikkuSchedulerOutput.schema.json' with { type: 'json' };
|
|
224
|
+
addSchema('PikkuSchedulerOutput', PikkuSchedulerOutput);
|
|
223
225
|
import * as PikkuPublicRPCOutput from './schemas/PikkuPublicRPCOutput.schema.json' with { type: 'json' };
|
|
224
226
|
addSchema('PikkuPublicRPCOutput', PikkuPublicRPCOutput);
|
|
225
227
|
import * as PikkuRemoteRPCOutput from './schemas/PikkuRemoteRPCOutput.schema.json' with { type: 'json' };
|
|
226
228
|
addSchema('PikkuRemoteRPCOutput', PikkuRemoteRPCOutput);
|
|
227
229
|
import * as PikkuRPCOutput from './schemas/PikkuRPCOutput.schema.json' with { type: 'json' };
|
|
228
230
|
addSchema('PikkuRPCOutput', PikkuRPCOutput);
|
|
229
|
-
import * as PikkuSchedulerOutput from './schemas/PikkuSchedulerOutput.schema.json' with { type: 'json' };
|
|
230
|
-
addSchema('PikkuSchedulerOutput', PikkuSchedulerOutput);
|
|
231
231
|
import * as PikkuTriggerTypesInput from './schemas/PikkuTriggerTypesInput.schema.json' with { type: 'json' };
|
|
232
232
|
addSchema('PikkuTriggerTypesInput', PikkuTriggerTypesInput);
|
|
233
233
|
import * as PikkuTriggerOutput from './schemas/PikkuTriggerOutput.schema.json' with { type: 'json' };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.39
|
|
3
3
|
*/
|
|
4
4
|
export { wireVariable } from '@pikku/core/variable';
|
|
5
5
|
export type { CoreVariable, VariableDefinitionMeta, VariableDefinitionsMeta } from '@pikku/core/variable';
|
package/dist/bin/pikku-bin.mjs
CHANGED
|
@@ -11,8 +11,8 @@ async function checkForUpdate() {
|
|
|
11
11
|
})
|
|
12
12
|
if (!res.ok) return
|
|
13
13
|
const { version: latest } = await res.json()
|
|
14
|
-
if (latest !== '0.12.
|
|
15
|
-
process.stderr.write(`\n Update available 0.12.
|
|
14
|
+
if (latest !== '0.12.39') {
|
|
15
|
+
process.stderr.write(`\n Update available 0.12.39 → ${latest}\n brew upgrade pikku or npm install -g @pikku/cli\n\n`)
|
|
16
16
|
}
|
|
17
17
|
} catch {}
|
|
18
18
|
}
|
|
@@ -79,16 +79,16 @@ export async function runFabricValidate(startDir = process.cwd()) {
|
|
|
79
79
|
catch {
|
|
80
80
|
w('gitignore-missing', '.gitignore not found at project root — generated artifacts (.pikku, .pikku-runtime, .opencode) may be committed accidentally', gitignorePath, 'Create .gitignore and add ".pikku", ".pikku-runtime", and ".opencode" to it');
|
|
81
81
|
}
|
|
82
|
-
const fabricConfigPath = join(root, '
|
|
82
|
+
const fabricConfigPath = join(root, 'pikkufabric.config.json');
|
|
83
83
|
const fabricConfig = await readJsonSafe(fabricConfigPath);
|
|
84
84
|
if (!fabricConfig) {
|
|
85
|
-
info('fabric-config-missing', '
|
|
85
|
+
info('fabric-config-missing', 'pikkufabric.config.json not found — project has not been linked to fabric yet', fabricConfigPath, 'Run `pikku fabric link` to create it, or create manually: {"projectId": "__PROJECT_ID__"}');
|
|
86
86
|
}
|
|
87
87
|
else if (!fabricConfig.projectId) {
|
|
88
|
-
info('fabric-config-no-project-id', '
|
|
88
|
+
info('fabric-config-no-project-id', 'pikkufabric.config.json is missing "projectId"', fabricConfigPath, 'Add "projectId": "<your-project-id>" to pikkufabric.config.json, or run `pikku fabric link`');
|
|
89
89
|
}
|
|
90
90
|
else if (fabricConfig.projectId === '__PROJECT_ID__') {
|
|
91
|
-
info('fabric-config-placeholder-project-id', '
|
|
91
|
+
info('fabric-config-placeholder-project-id', 'pikkufabric.config.json has a placeholder projectId ("__PROJECT_ID__") — project is not linked', fabricConfigPath, 'Run `pikku fabric link` to replace the placeholder with a real project ID');
|
|
92
92
|
}
|
|
93
93
|
const rootPkgPath = join(root, 'package.json');
|
|
94
94
|
const rootPkg = await readJsonSafe(rootPkgPath);
|
|
@@ -103,7 +103,7 @@ export async function runFabricValidate(startDir = process.cwd()) {
|
|
|
103
103
|
}
|
|
104
104
|
const fnDir = join(root, 'packages', 'functions');
|
|
105
105
|
const functionsSdkPkgName = (await readJsonSafe(join(root, 'packages', 'functions-sdk', 'package.json')))?.name;
|
|
106
|
-
const themePkgName = (await readJsonSafe(join(root, 'packages', 'theme', 'package.json')))?.name;
|
|
106
|
+
const themePkgName = (await readJsonSafe(join(root, 'packages', 'mantine-theme', 'package.json')))?.name;
|
|
107
107
|
const componentsPkgName = (await readJsonSafe(join(root, 'packages', 'components', 'package.json')))?.name;
|
|
108
108
|
if (existsSync(fnDir)) {
|
|
109
109
|
const fnPkgPath = join(fnDir, 'package.json');
|
|
@@ -241,8 +241,8 @@ export async function runFabricValidate(startDir = process.cwd()) {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
const designDocUrl = 'https://pikkufabric.dev/docs/design';
|
|
244
|
-
if (!existsSync(join(root, 'packages', 'theme'))) {
|
|
245
|
-
info('theme-missing', 'packages/theme/ not found — Fabric design features require a theme package', join(root, 'packages', 'theme'), `Create packages/theme/ with your Mantine theme tokens. See ${designDocUrl}`);
|
|
244
|
+
if (!existsSync(join(root, 'packages', 'mantine-theme'))) {
|
|
245
|
+
info('theme-missing', 'packages/mantine-theme/ not found — Fabric design features require a theme package', join(root, 'packages', 'mantine-theme'), `Create packages/mantine-theme/ with your Mantine theme tokens. See ${designDocUrl}`);
|
|
246
246
|
}
|
|
247
247
|
if (!existsSync(join(root, 'packages', 'components'))) {
|
|
248
248
|
info('components-missing', 'packages/components/ not found — Fabric design features require a components package', join(root, 'packages', 'components'), `Create packages/components/ with your shared UI components. See ${designDocUrl}`);
|
|
@@ -20,8 +20,9 @@ export const FabricValidateOutput = z.object({
|
|
|
20
20
|
async function findProjectRoot(startDir) {
|
|
21
21
|
let dir = startDir;
|
|
22
22
|
while (true) {
|
|
23
|
-
if (existsSync(join(dir, '
|
|
23
|
+
if (existsSync(join(dir, 'pikkufabric.config.json'))) {
|
|
24
24
|
return dir;
|
|
25
|
+
}
|
|
25
26
|
if (existsSync(join(dir, 'package.json'))) {
|
|
26
27
|
try {
|
|
27
28
|
const pkg = JSON.parse(await readFile(join(dir, 'package.json'), 'utf8'));
|
|
@@ -83,19 +84,19 @@ export async function runValidate(startDir = process.cwd()) {
|
|
|
83
84
|
const info = (id, message, path, fixHint) => {
|
|
84
85
|
findings.push({ id, severity: 'info', message, path, fixHint });
|
|
85
86
|
};
|
|
86
|
-
// ──
|
|
87
|
+
// ── pikkufabric.config.json ────────────────────────────────────────────
|
|
87
88
|
// Not required to run validate — downgraded to info so any pikku project
|
|
88
89
|
// can be checked for compatibility before it is linked to a fabric account.
|
|
89
|
-
const fabricConfigPath = join(root, '
|
|
90
|
+
const fabricConfigPath = join(root, 'pikkufabric.config.json');
|
|
90
91
|
const fabricConfig = await readJsonSafe(fabricConfigPath);
|
|
91
92
|
if (!fabricConfig) {
|
|
92
|
-
info('fabric-config-missing', '
|
|
93
|
+
info('fabric-config-missing', 'pikkufabric.config.json not found — project has not been linked to fabric yet', fabricConfigPath, 'Run `pikku fabric link` to create it, or create manually: {"projectId": "__PROJECT_ID__"}');
|
|
93
94
|
}
|
|
94
95
|
else if (!fabricConfig.projectId) {
|
|
95
|
-
info('fabric-config-no-project-id', '
|
|
96
|
+
info('fabric-config-no-project-id', 'pikkufabric.config.json is missing "projectId"', fabricConfigPath, 'Add "projectId": "<your-project-id>" to pikkufabric.config.json, or run `pikku fabric link`');
|
|
96
97
|
}
|
|
97
98
|
else if (fabricConfig.projectId === '__PROJECT_ID__') {
|
|
98
|
-
info('fabric-config-placeholder-project-id', '
|
|
99
|
+
info('fabric-config-placeholder-project-id', 'pikkufabric.config.json has a placeholder projectId ("__PROJECT_ID__") — project is not linked', fabricConfigPath, 'Run `pikku fabric link` to replace the placeholder with a real project ID');
|
|
99
100
|
}
|
|
100
101
|
// ── root pikku.config.json ─────────────────────────────────────────────
|
|
101
102
|
const pikkuConfigPath = join(root, 'pikku.config.json');
|
|
@@ -114,6 +115,7 @@ export async function runValidate(startDir = process.cwd()) {
|
|
|
114
115
|
info('pikku-config-no-client-files', 'pikku.config.json missing "clientFiles" — no generated SDK or React Query hooks', pikkuConfigPath, 'Add clientFiles.rpcMapDeclarationFile and clientFiles.reactQueryFile pointing to packages/functions-sdk/src/pikku/');
|
|
115
116
|
}
|
|
116
117
|
}
|
|
118
|
+
const dbEngine = pikkuConfig?.db?.engine ?? 'sqlite';
|
|
117
119
|
const rootPkgPath = join(root, 'package.json');
|
|
118
120
|
const rootPkg = await readJsonSafe(rootPkgPath);
|
|
119
121
|
if (!rootPkg) {
|
|
@@ -149,7 +151,7 @@ export async function runValidate(startDir = process.cwd()) {
|
|
|
149
151
|
// ── packages/functions/ ────────────────────────────────────────────────
|
|
150
152
|
const fnDir = join(root, 'packages', 'functions');
|
|
151
153
|
const functionsSdkPkgName = (await readJsonSafe(join(root, 'packages', 'functions-sdk', 'package.json')))?.name;
|
|
152
|
-
const themePkgName = (await readJsonSafe(join(root, 'packages', 'theme', 'package.json')))?.name;
|
|
154
|
+
const themePkgName = (await readJsonSafe(join(root, 'packages', 'mantine-theme', 'package.json')))?.name;
|
|
153
155
|
const componentsPkgName = (await readJsonSafe(join(root, 'packages', 'components', 'package.json')))?.name;
|
|
154
156
|
if (!existsSync(fnDir)) {
|
|
155
157
|
e('functions-pkg-missing', 'packages/functions/ directory not found', fnDir, 'Create packages/functions/ as a yarn workspace containing pikku.config.json, src/, and db/sqlite/');
|
|
@@ -170,7 +172,7 @@ export async function runValidate(startDir = process.cwd()) {
|
|
|
170
172
|
...fnPkg.devDependencies,
|
|
171
173
|
...fnPkg.peerDependencies,
|
|
172
174
|
};
|
|
173
|
-
if (fnAllDeps['@pikku/kysely-postgres']) {
|
|
175
|
+
if (dbEngine !== 'postgres' && fnAllDeps['@pikku/kysely-postgres']) {
|
|
174
176
|
e('fn-pkg-postgres-dep', '@pikku/kysely-postgres is in packages/functions dependencies — Fabric uses SQLite/libSQL (Turso), not PostgreSQL', fnPkgPath, 'Remove @pikku/kysely-postgres and use @pikku/kysely-sqlite with LibsqlWebDialect instead');
|
|
175
177
|
}
|
|
176
178
|
}
|
|
@@ -185,25 +187,26 @@ export async function runValidate(startDir = process.cwd()) {
|
|
|
185
187
|
const usesLibsql = servicesText.includes('@pikku/kysely-sqlite') ||
|
|
186
188
|
servicesText.includes('LibsqlWebDialect');
|
|
187
189
|
const usesProcessEnv = /\bprocess\.env\.[A-Z_]/.test(servicesText);
|
|
188
|
-
if (usesKysely && !usesLibsql) {
|
|
190
|
+
if (dbEngine !== 'postgres' && usesKysely && !usesLibsql) {
|
|
189
191
|
e('services-wrong-db-adapter', 'services.ts uses Kysely but not LibsqlWebDialect — Fabric injects a Turso/libSQL DATABASE_URL at runtime, not a PostgreSQL URL', servicesPath, 'Import LibsqlWebDialect from @pikku/kysely-sqlite and replace the dialect: new Kysely({ dialect: new LibsqlWebDialect({ url: databaseUrl }) })');
|
|
190
192
|
}
|
|
191
193
|
if (usesProcessEnv) {
|
|
192
194
|
info('services-process-env', 'services.ts reads process.env directly — prefer variables.get() for portable secret/variable access', servicesPath, 'Replace process.env.SOME_VAR with await variables.get("SOME_VAR") — declare the binding with wireVariable/wireSecret; process.env is fine for optional/non-secret config');
|
|
193
195
|
}
|
|
194
|
-
if (
|
|
196
|
+
if (dbEngine !== 'postgres' &&
|
|
197
|
+
usesLibsql &&
|
|
195
198
|
rootPkg &&
|
|
196
199
|
!rootPkg.dependencies?.['@pikku/kysely-sqlite'] &&
|
|
197
200
|
!rootPkg.devDependencies?.['@pikku/kysely-sqlite']) {
|
|
198
201
|
e('missing-kysely-sqlite', 'services.ts imports @pikku/kysely-sqlite but it is not in root package.json', rootPkgPath, 'Add "@pikku/kysely-sqlite": "file:./vendor/pikku-kysely-sqlite.tgz" to dependencies');
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
|
-
//
|
|
202
|
-
|
|
203
|
-
// db/sqlite (SQLite/libSQL) or db/postgres (PostgreSQL).
|
|
204
|
-
const migrationsDir = join(root, 'db', 'sqlite');
|
|
204
|
+
// Database layout is declared by pikku.config.json db.engine.
|
|
205
|
+
const migrationsDir = join(root, 'db', dbEngine === 'postgres' ? 'postgres' : 'sqlite');
|
|
205
206
|
if (!existsSync(migrationsDir)) {
|
|
206
|
-
e('migrations-dir-missing',
|
|
207
|
+
e('migrations-dir-missing', `db/${dbEngine === 'postgres' ? 'postgres' : 'sqlite'}/ not found`, migrationsDir, dbEngine === 'postgres'
|
|
208
|
+
? 'Create db/postgres/ and add numbered .sql files (e.g. 0001-init.sql) using PostgreSQL-compatible syntax'
|
|
209
|
+
: 'Create db/sqlite/ and add numbered .sql files (e.g. 0001-init.sql) using SQLite-compatible syntax');
|
|
207
210
|
}
|
|
208
211
|
else {
|
|
209
212
|
try {
|
|
@@ -223,14 +226,16 @@ export async function runValidate(startDir = process.cwd()) {
|
|
|
223
226
|
break;
|
|
224
227
|
}
|
|
225
228
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
if (dbEngine !== 'postgres') {
|
|
230
|
+
// Check for PostgreSQL-specific syntax — Fabric uses Turso (SQLite/libSQL)
|
|
231
|
+
for (const f of files) {
|
|
232
|
+
const sql = await readTextSafe(join(migrationsDir, f));
|
|
233
|
+
if (!sql)
|
|
234
|
+
continue;
|
|
235
|
+
const hits = POSTGRES_SQL_PATTERNS.filter(({ re }) => re.test(sql)).map(({ label }) => label);
|
|
236
|
+
if (hits.length > 0) {
|
|
237
|
+
e(`migration-postgres-sql-${f.replace(/[^a-z0-9]/gi, '-')}`, `${f} contains PostgreSQL syntax (${hits.join(', ')}) — Fabric uses SQLite/libSQL (Turso)`, join(migrationsDir, f), "Rewrite the migration using SQLite-compatible syntax: TEXT instead of JSONB, INTEGER PRIMARY KEY for auto-increment, datetime('now') instead of NOW(), no :: casts");
|
|
238
|
+
}
|
|
234
239
|
}
|
|
235
240
|
}
|
|
236
241
|
}
|
|
@@ -238,10 +243,13 @@ export async function runValidate(startDir = process.cwd()) {
|
|
|
238
243
|
// readdir failure — skip
|
|
239
244
|
}
|
|
240
245
|
}
|
|
241
|
-
|
|
242
|
-
const seedPath = join(root, 'db', 'sqlite-seed.sql');
|
|
246
|
+
const seedPath = join(root, 'db', dbEngine === 'postgres' ? 'postgres-seed.sql' : 'sqlite-seed.sql');
|
|
243
247
|
if (!existsSync(seedPath)) {
|
|
244
|
-
e('seed-sql-missing',
|
|
248
|
+
e('seed-sql-missing', dbEngine === 'postgres'
|
|
249
|
+
? 'db/postgres-seed.sql not found'
|
|
250
|
+
: 'db/sqlite-seed.sql not found', seedPath, dbEngine === 'postgres'
|
|
251
|
+
? 'Create db/postgres-seed.sql with idempotent seed data for local/test data'
|
|
252
|
+
: 'Create db/sqlite-seed.sql with idempotent INSERT OR IGNORE statements for demo/test data');
|
|
245
253
|
}
|
|
246
254
|
// audit table — info if not present (optional feature)
|
|
247
255
|
if (existsSync(migrationsDir)) {
|
|
@@ -328,8 +336,8 @@ export async function runValidate(startDir = process.cwd()) {
|
|
|
328
336
|
}
|
|
329
337
|
// ── packages/theme + packages/components ──────────────────────────────
|
|
330
338
|
const designDocUrl = 'https://pikkufabric.dev/docs/design';
|
|
331
|
-
if (!existsSync(join(root, 'packages', 'theme'))) {
|
|
332
|
-
info('theme-missing', 'packages/theme/ not found — Fabric design features require a theme package', join(root, 'packages', 'theme'), `Create packages/theme/ with your Mantine theme tokens. See ${designDocUrl}`);
|
|
339
|
+
if (!existsSync(join(root, 'packages', 'mantine-theme'))) {
|
|
340
|
+
info('theme-missing', 'packages/mantine-theme/ not found — Fabric design features require a theme package', join(root, 'packages', 'mantine-theme'), `Create packages/mantine-theme/ with your Mantine theme tokens. See ${designDocUrl}`);
|
|
333
341
|
}
|
|
334
342
|
if (!existsSync(join(root, 'packages', 'components'))) {
|
|
335
343
|
info('components-missing', 'packages/components/ not found — Fabric design features require a components package', join(root, 'packages', 'components'), `Create packages/components/ with your shared UI components. See ${designDocUrl}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `
|
|
3
|
-
* Pins the project link (id, default api url) and declares deployable
|
|
4
|
-
* + production domain. Discovered by walking up from cwd until found.
|
|
2
|
+
* `pikkufabric.config.json` lives next to `pikku.config.json` in the project
|
|
3
|
+
* root. Pins the project link (id, default api url) and declares deployable
|
|
4
|
+
* apps + production domain. Discovered by walking up from cwd until found.
|
|
5
5
|
*/
|
|
6
6
|
export interface ProjectConfig {
|
|
7
7
|
projectId: string;
|
|
@@ -53,7 +53,7 @@ export interface ResolvedApiContext {
|
|
|
53
53
|
/**
|
|
54
54
|
* Stitch together the api-url + auth token from the standard sources:
|
|
55
55
|
* 1. explicit override (e.g. --api-url flag)
|
|
56
|
-
* 2.
|
|
56
|
+
* 2. pikkufabric.config.json apiUrl
|
|
57
57
|
* 3. FABRIC_API_URL env var
|
|
58
58
|
* 4. hardcoded default
|
|
59
59
|
*
|
|
@@ -3,7 +3,7 @@ import { existsSync } from 'node:fs';
|
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
const DEFAULT_API_URL = 'http://localhost:7103';
|
|
6
|
-
const projectConfigName = '
|
|
6
|
+
const projectConfigName = 'pikkufabric.config.json';
|
|
7
7
|
const authFilePath = join(homedir(), '.fabric', 'auth.json');
|
|
8
8
|
export async function findProjectConfig(startDir = process.cwd()) {
|
|
9
9
|
let dir = startDir;
|
|
@@ -41,7 +41,7 @@ export async function writeAuthFile(file) {
|
|
|
41
41
|
/**
|
|
42
42
|
* Stitch together the api-url + auth token from the standard sources:
|
|
43
43
|
* 1. explicit override (e.g. --api-url flag)
|
|
44
|
-
* 2.
|
|
44
|
+
* 2. pikkufabric.config.json apiUrl
|
|
45
45
|
* 3. FABRIC_API_URL env var
|
|
46
46
|
* 4. hardcoded default
|
|
47
47
|
*
|