includio-cms 0.7.1 → 0.7.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to includio-cms are documented here.
4
4
  Generated from `src/lib/updates/` — do not edit manually.
5
5
 
6
+ ## 0.7.2 — 2026-03-16
7
+
8
+ CLI create-user command
9
+
10
+ ### Added
11
+ - CLI `create-user` command — interactive user creation with email, password (auto-generate option), name, and role via better-auth
12
+
6
13
  ## 0.7.1 — 2026-03-13
7
14
 
8
15
  Custom fields plugin system, pathTemplate, admin public API
package/ROADMAP.md CHANGED
@@ -163,6 +163,10 @@
163
163
  - [x] `[feature]` `[P2]` resolveMediaWithStyles utility & core svelte export
164
164
  - [x] `[fix]` `[P1]` Schema serialization type cast (stricter TS compatibility)
165
165
 
166
+ ## 0.7.2 — CLI create-user
167
+
168
+ - [x] `[feature]` `[P1]` CLI `create-user` command — interactive user creation with role assignment <!-- files: src/lib/cli/create-user.ts, src/lib/cli/index.ts -->
169
+
166
170
  ## 0.8.0 — SEO module
167
171
 
168
172
  - [ ] `[feature]` `[P1]` SERP preview + character limits for title/description <!-- files: src/lib/admin/components/fields/seo-field.svelte -->
@@ -0,0 +1,2 @@
1
+ import 'dotenv/config';
2
+ export declare function createUser(): Promise<void>;
@@ -0,0 +1,81 @@
1
+ import 'dotenv/config';
2
+ import crypto from 'node:crypto';
3
+ import readline from 'readline';
4
+ import z from 'zod';
5
+ import { drizzle } from 'drizzle-orm/postgres-js';
6
+ import postgres from 'postgres';
7
+ import { betterAuth } from 'better-auth';
8
+ import { drizzleAdapter } from 'better-auth/adapters/drizzle';
9
+ import { admin } from 'better-auth/plugins';
10
+ import * as authSchema from '../server/db/schema/auth-schema.js';
11
+ const emailSchema = z.string().email();
12
+ const passwordSchema = z.string().min(6).max(255, 'Invalid password (min 6, max 255 characters)');
13
+ const nameSchema = z.string().min(1);
14
+ const roleSchema = z.enum(['admin', 'user']);
15
+ function generatePassword(length = 24) {
16
+ return crypto.randomBytes(length).toString('base64url').slice(0, length);
17
+ }
18
+ export async function createUser() {
19
+ const DATABASE_URL = process.env.DATABASE_URL;
20
+ if (!DATABASE_URL) {
21
+ console.error('DATABASE_URL is not set. Check your .env file.');
22
+ process.exit(1);
23
+ }
24
+ const client = postgres(DATABASE_URL);
25
+ const db = drizzle(client);
26
+ const auth = betterAuth({
27
+ database: drizzleAdapter(db, { provider: 'pg', schema: authSchema }),
28
+ emailAndPassword: { enabled: true },
29
+ plugins: [admin()]
30
+ });
31
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
32
+ function ask(q) {
33
+ return new Promise((resolve) => rl.question(q, resolve));
34
+ }
35
+ console.log('Please provide the following information to create a new user:');
36
+ const name = await ask('Name: ');
37
+ const parsedName = nameSchema.safeParse(name);
38
+ if (!parsedName.success) {
39
+ console.error(parsedName.error.flatten());
40
+ process.exit(1);
41
+ }
42
+ const email = await ask('E-mail: ');
43
+ const parsedEmail = emailSchema.safeParse(email);
44
+ if (!parsedEmail.success) {
45
+ console.error(parsedEmail.error.flatten());
46
+ process.exit(1);
47
+ }
48
+ const passwordInput = await ask('Password (leave empty to generate): ');
49
+ const password = passwordInput.trim() || generatePassword();
50
+ const wasGenerated = !passwordInput.trim();
51
+ const parsedPassword = passwordSchema.safeParse(password);
52
+ if (!parsedPassword.success) {
53
+ console.error(parsedPassword.error.flatten());
54
+ process.exit(1);
55
+ }
56
+ const roleInput = await ask('Role (admin/user) [admin]: ');
57
+ const role = roleInput.trim() || 'admin';
58
+ const parsedRole = roleSchema.safeParse(role);
59
+ if (!parsedRole.success) {
60
+ console.error('Invalid role. Must be "admin" or "user".');
61
+ process.exit(1);
62
+ }
63
+ rl.close();
64
+ const response = await auth.api.createUser({
65
+ body: {
66
+ email: parsedEmail.data,
67
+ name: parsedName.data,
68
+ password: parsedPassword.data,
69
+ role: parsedRole.data
70
+ }
71
+ });
72
+ const user = response.user;
73
+ console.log(`\nUser created successfully:
74
+ ID: ${user.id}
75
+ Email: ${user.email}
76
+ Name: ${user.name}
77
+ Role: ${parsedRole.data}
78
+ Password: ${parsedPassword.data}${wasGenerated ? ' (generated)' : ''}
79
+ Please store the password securely, as it is not retrievable later.`);
80
+ await client.end();
81
+ }
package/dist/cli/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { scaffoldAdmin } from './scaffold/admin.js';
3
3
  import { installPeers } from './install-peers.js';
4
+ import { createUser } from './create-user.js';
4
5
  import path from 'node:path';
5
6
  const args = process.argv.slice(2);
6
7
  const command = args[0];
@@ -11,6 +12,7 @@ function printUsage() {
11
12
  Commands:
12
13
  scaffold admin Generate admin route files
13
14
  install-peers Install missing peer dependencies
15
+ create-user Create a new admin/user account
14
16
 
15
17
  Options:
16
18
  --force Overwrite existing files
@@ -29,6 +31,9 @@ else if (command === 'install-peers') {
29
31
  const dryRun = args.includes('--dry-run');
30
32
  installPeers({ dryRun });
31
33
  }
34
+ else if (command === 'create-user') {
35
+ createUser();
36
+ }
32
37
  else {
33
38
  printUsage();
34
39
  process.exit(command ? 1 : 0);
@@ -1,36 +1,3 @@
1
- export function hello_world(inputs: {
2
- name: NonNullable<unknown>;
3
- }, options?: {
4
- locale?: "en" | "pl";
5
- }): string;
6
- /**
7
- * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
8
- *
9
- * - Changing this function will be over-written by the next build.
10
- *
11
- * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
12
- * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
13
- *
14
- * @param {{}} inputs
15
- * @param {{ locale?: "en" | "pl" }} options
16
- * @returns {string}
17
- */
18
- declare function login_hello(inputs?: {}, options?: {
19
- locale?: "en" | "pl";
20
- }): string;
21
- /**
22
- * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
23
- *
24
- * - Changing this function will be over-written by the next build.
25
- *
26
- * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
27
- * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
28
- *
29
- * @param {{}} inputs
30
- * @param {{ locale?: "en" | "pl" }} options
31
- * @returns {string}
32
- */
33
- declare function login_please_login(inputs?: {}, options?: {
34
- locale?: "en" | "pl";
35
- }): string;
36
- export { login_hello as login.hello, login_please_login as login.please_login };
1
+ export * from "./hello_world.js";
2
+ export * from "./login_hello.js";
3
+ export * from "./login_please_login.js";
@@ -1,72 +1,4 @@
1
1
  /* eslint-disable */
2
- import { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from "../runtime.js"
3
- import * as en from "./en.js"
4
- import * as pl from "./pl.js"
5
- /**
6
- * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
7
- *
8
- * - Changing this function will be over-written by the next build.
9
- *
10
- * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
11
- * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
12
- *
13
- * @param {{ name: NonNullable<unknown> }} inputs
14
- * @param {{ locale?: "en" | "pl" }} options
15
- * @returns {string}
16
- */
17
- /* @__NO_SIDE_EFFECTS__ */
18
- export const hello_world = (inputs, options = {}) => {
19
- if (experimentalMiddlewareLocaleSplitting && isServer === false) {
20
- return /** @type {any} */ (globalThis).__paraglide_ssr.hello_world(inputs)
21
- }
22
- const locale = options.locale ?? getLocale()
23
- trackMessageCall("hello_world", locale)
24
- if (locale === "en") return en.hello_world(inputs)
25
- return pl.hello_world(inputs)
26
- };
27
- /**
28
- * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
29
- *
30
- * - Changing this function will be over-written by the next build.
31
- *
32
- * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
33
- * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
34
- *
35
- * @param {{}} inputs
36
- * @param {{ locale?: "en" | "pl" }} options
37
- * @returns {string}
38
- */
39
- /* @__NO_SIDE_EFFECTS__ */
40
- const login_hello = (inputs = {}, options = {}) => {
41
- if (experimentalMiddlewareLocaleSplitting && isServer === false) {
42
- return /** @type {any} */ (globalThis).__paraglide_ssr.login_hello(inputs)
43
- }
44
- const locale = options.locale ?? getLocale()
45
- trackMessageCall("login_hello", locale)
46
- if (locale === "en") return en.login_hello(inputs)
47
- return pl.login_hello(inputs)
48
- };
49
- export { login_hello as "login.hello" }
50
- /**
51
- * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
52
- *
53
- * - Changing this function will be over-written by the next build.
54
- *
55
- * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
56
- * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
57
- *
58
- * @param {{}} inputs
59
- * @param {{ locale?: "en" | "pl" }} options
60
- * @returns {string}
61
- */
62
- /* @__NO_SIDE_EFFECTS__ */
63
- const login_please_login = (inputs = {}, options = {}) => {
64
- if (experimentalMiddlewareLocaleSplitting && isServer === false) {
65
- return /** @type {any} */ (globalThis).__paraglide_ssr.login_please_login(inputs)
66
- }
67
- const locale = options.locale ?? getLocale()
68
- trackMessageCall("login_please_login", locale)
69
- if (locale === "en") return en.login_please_login(inputs)
70
- return pl.login_please_login(inputs)
71
- };
72
- export { login_please_login as "login.please_login" }
2
+ export * from './hello_world.js'
3
+ export * from './login_hello.js'
4
+ export * from './login_please_login.js'
@@ -0,0 +1,5 @@
1
+ export function hello_world(inputs: {
2
+ name: NonNullable<unknown>;
3
+ }, options?: {
4
+ locale?: "en" | "pl";
5
+ }): string;
@@ -0,0 +1,33 @@
1
+ /* eslint-disable */
2
+ import { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';
3
+
4
+ const en_hello_world = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {
5
+ return `Hello, ${i.name} from en!`
6
+ };
7
+
8
+ const pl_hello_world = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {
9
+ return `Hello, ${i.name} from pl!`
10
+ };
11
+
12
+ /**
13
+ * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
14
+ *
15
+ * - Changing this function will be over-written by the next build.
16
+ *
17
+ * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
18
+ * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
19
+ *
20
+ * @param {{ name: NonNullable<unknown> }} inputs
21
+ * @param {{ locale?: "en" | "pl" }} options
22
+ * @returns {string}
23
+ */
24
+ /* @__NO_SIDE_EFFECTS__ */
25
+ export const hello_world = (inputs, options = {}) => {
26
+ if (experimentalMiddlewareLocaleSplitting && isServer === false) {
27
+ return /** @type {any} */ (globalThis).__paraglide_ssr.hello_world(inputs)
28
+ }
29
+ const locale = options.locale ?? getLocale()
30
+ trackMessageCall("hello_world", locale)
31
+ if (locale === "en") return en_hello_world(inputs)
32
+ return pl_hello_world(inputs)
33
+ };
@@ -0,0 +1,16 @@
1
+ export { login_hello as login.hello };
2
+ /**
3
+ * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
4
+ *
5
+ * - Changing this function will be over-written by the next build.
6
+ *
7
+ * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
8
+ * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
9
+ *
10
+ * @param {{}} inputs
11
+ * @param {{ locale?: "en" | "pl" }} options
12
+ * @returns {string}
13
+ */
14
+ declare function login_hello(inputs?: {}, options?: {
15
+ locale?: "en" | "pl";
16
+ }): string;
@@ -0,0 +1,34 @@
1
+ /* eslint-disable */
2
+ import { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';
3
+
4
+ const en_login_hello = /** @type {(inputs: {}) => string} */ () => {
5
+ return `Welcome back`
6
+ };
7
+
8
+ const pl_login_hello = /** @type {(inputs: {}) => string} */ () => {
9
+ return `Witaj ponownie`
10
+ };
11
+
12
+ /**
13
+ * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
14
+ *
15
+ * - Changing this function will be over-written by the next build.
16
+ *
17
+ * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
18
+ * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
19
+ *
20
+ * @param {{}} inputs
21
+ * @param {{ locale?: "en" | "pl" }} options
22
+ * @returns {string}
23
+ */
24
+ /* @__NO_SIDE_EFFECTS__ */
25
+ const login_hello = (inputs = {}, options = {}) => {
26
+ if (experimentalMiddlewareLocaleSplitting && isServer === false) {
27
+ return /** @type {any} */ (globalThis).__paraglide_ssr.login_hello(inputs)
28
+ }
29
+ const locale = options.locale ?? getLocale()
30
+ trackMessageCall("login_hello", locale)
31
+ if (locale === "en") return en_login_hello(inputs)
32
+ return pl_login_hello(inputs)
33
+ };
34
+ export { login_hello as "login.hello" }
@@ -0,0 +1,16 @@
1
+ export { login_please_login as login.please_login };
2
+ /**
3
+ * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
4
+ *
5
+ * - Changing this function will be over-written by the next build.
6
+ *
7
+ * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
8
+ * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
9
+ *
10
+ * @param {{}} inputs
11
+ * @param {{ locale?: "en" | "pl" }} options
12
+ * @returns {string}
13
+ */
14
+ declare function login_please_login(inputs?: {}, options?: {
15
+ locale?: "en" | "pl";
16
+ }): string;
@@ -0,0 +1,34 @@
1
+ /* eslint-disable */
2
+ import { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';
3
+
4
+ const en_login_please_login = /** @type {(inputs: {}) => string} */ () => {
5
+ return `Login to your account`
6
+ };
7
+
8
+ const pl_login_please_login = /** @type {(inputs: {}) => string} */ () => {
9
+ return `Zaloguj się na swoje konto`
10
+ };
11
+
12
+ /**
13
+ * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
14
+ *
15
+ * - Changing this function will be over-written by the next build.
16
+ *
17
+ * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
18
+ * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
19
+ *
20
+ * @param {{}} inputs
21
+ * @param {{ locale?: "en" | "pl" }} options
22
+ * @returns {string}
23
+ */
24
+ /* @__NO_SIDE_EFFECTS__ */
25
+ const login_please_login = (inputs = {}, options = {}) => {
26
+ if (experimentalMiddlewareLocaleSplitting && isServer === false) {
27
+ return /** @type {any} */ (globalThis).__paraglide_ssr.login_please_login(inputs)
28
+ }
29
+ const locale = options.locale ?? getLocale()
30
+ trackMessageCall("login_please_login", locale)
31
+ if (locale === "en") return en_login_please_login(inputs)
32
+ return pl_login_please_login(inputs)
33
+ };
34
+ export { login_please_login as "login.please_login" }
@@ -0,0 +1,2 @@
1
+ import type { CmsUpdate } from '../index.js';
2
+ export declare const update: CmsUpdate;
@@ -0,0 +1,10 @@
1
+ export const update = {
2
+ version: '0.7.2',
3
+ date: '2026-03-16',
4
+ description: 'CLI create-user command',
5
+ features: [
6
+ 'CLI `create-user` command — interactive user creation with email, password (auto-generate option), name, and role via better-auth'
7
+ ],
8
+ fixes: [],
9
+ breakingChanges: []
10
+ };
@@ -25,7 +25,8 @@ import { update as update061 } from './0.6.1/index.js';
25
25
  import { update as update062 } from './0.6.2/index.js';
26
26
  import { update as update070 } from './0.7.0/index.js';
27
27
  import { update as update071 } from './0.7.1/index.js';
28
- export const updates = [update0065, update0066, update0067, update0068, update0069, update010, update011, update012, update013, update014, update015, update020, update022, update050, update051, update052, update053, update054, update055, update056, update057, update058, update060, update061, update062, update070, update071];
28
+ import { update as update072 } from './0.7.2/index.js';
29
+ export const updates = [update0065, update0066, update0067, update0068, update0069, update010, update011, update012, update013, update014, update015, update020, update022, update050, update051, update052, update053, update054, update055, update056, update057, update058, update060, update061, update062, update070, update071, update072];
29
30
  export const getUpdatesFrom = (fromVersion) => {
30
31
  const fromParts = fromVersion.split('.').map(Number);
31
32
  return updates.filter((update) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "includio-cms",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -1,5 +0,0 @@
1
- export const hello_world: (inputs: {
2
- name: NonNullable<unknown>;
3
- }) => string;
4
- export const login_hello: (inputs: {}) => string;
5
- export const login_please_login: (inputs: {}) => string;
@@ -1,14 +0,0 @@
1
- /* eslint-disable */
2
-
3
-
4
- export const hello_world = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {
5
- return `Hello, ${i.name} from en!`
6
- };
7
-
8
- export const login_hello = /** @type {(inputs: {}) => string} */ () => {
9
- return `Welcome back`
10
- };
11
-
12
- export const login_please_login = /** @type {(inputs: {}) => string} */ () => {
13
- return `Login to your account`
14
- };
@@ -1,5 +0,0 @@
1
- export const hello_world: (inputs: {
2
- name: NonNullable<unknown>;
3
- }) => string;
4
- export const login_hello: (inputs: {}) => string;
5
- export const login_please_login: (inputs: {}) => string;
@@ -1,14 +0,0 @@
1
- /* eslint-disable */
2
-
3
-
4
- export const hello_world = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {
5
- return `Hello, ${i.name} from pl!`
6
- };
7
-
8
- export const login_hello = /** @type {(inputs: {}) => string} */ () => {
9
- return `Witaj ponownie`
10
- };
11
-
12
- export const login_please_login = /** @type {(inputs: {}) => string} */ () => {
13
- return `Zaloguj się na swoje konto`
14
- };