@percepta/create 4.1.4 → 4.1.6

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 (44) hide show
  1. package/dist/index.js +13 -10
  2. package/dist/index.js.map +1 -1
  3. package/dist/{init-COp0nGdk.js → init-BD3EyyLO.js} +12 -4
  4. package/dist/init-BD3EyyLO.js.map +1 -0
  5. package/dist/{manifest-CqIDnbgs.js → manifest-By1SgOjC.js} +3 -2
  6. package/dist/manifest-By1SgOjC.js.map +1 -0
  7. package/dist/{register-app-Ctv1Grnr.js → register-app-DZg-Pmtd.js} +66 -42
  8. package/dist/register-app-DZg-Pmtd.js.map +1 -0
  9. package/dist/{status-BXYaQ4a2.js → status-K6raTwwu.js} +2 -2
  10. package/dist/{status-BXYaQ4a2.js.map → status-K6raTwwu.js.map} +1 -1
  11. package/dist/{sync-BayU4w1j.js → sync-Bi958-2W.js} +2 -2
  12. package/dist/{sync-BayU4w1j.js.map → sync-Bi958-2W.js.map} +1 -1
  13. package/dist/{upstream-CZEzLrS4.js → upstream-CAraZeSS.js} +2 -2
  14. package/dist/{upstream-CZEzLrS4.js.map → upstream-CAraZeSS.js.map} +1 -1
  15. package/package.json +1 -1
  16. package/templates/infra/os.blueprint.yaml.template +30 -25
  17. package/templates/library/package.json.template +1 -1
  18. package/templates/monorepo/.envrc.example +1 -0
  19. package/templates/monorepo/.github/workflows/access-control.yml +0 -3
  20. package/templates/monorepo/.node-version +1 -1
  21. package/templates/monorepo/.vscode/extensions.json +3 -0
  22. package/templates/monorepo/.vscode/settings.json +26 -0
  23. package/templates/monorepo/auth/README.md +2 -2
  24. package/templates/monorepo/auth/package.json +2 -1
  25. package/templates/monorepo/auth/src/drizzle/db.ts +6 -1
  26. package/templates/monorepo/gitignore.template +1 -1
  27. package/templates/monorepo/pnpm-workspace.yaml +0 -8
  28. package/templates/webapp/.github/workflows/__APP_NAME__-ryvn-release.yaml +3 -2
  29. package/templates/webapp/AGENTS.md +1 -1
  30. package/templates/webapp/Dockerfile +20 -19
  31. package/templates/webapp/README.md +1 -1
  32. package/templates/webapp/agent-skills/access-control.md +3 -3
  33. package/templates/webapp/agent-skills/database.md +1 -1
  34. package/templates/webapp/next.config.ts +1 -1
  35. package/templates/webapp/package.json.template +2 -2
  36. package/templates/webapp/scripts/seed.ts +3 -3
  37. package/templates/webapp/src/app/(settings)/settings/page.tsx +3 -2
  38. package/templates/webapp/src/drizzle/schema/index.ts +1 -1
  39. package/templates/webapp/src/lib/auth/index.ts +2 -2
  40. package/templates/webapp/src/startup-checks.ts +1 -1
  41. package/dist/init-COp0nGdk.js.map +0 -1
  42. package/dist/manifest-CqIDnbgs.js.map +0 -1
  43. package/dist/register-app-Ctv1Grnr.js.map +0 -1
  44. package/templates/webapp/.node-version +0 -1
@@ -0,0 +1,26 @@
1
+ {
2
+ "editor.codeActionsOnSave": {
3
+ "source.fixAll": "explicit"
4
+ },
5
+ "editor.defaultFormatter": "oxc.oxc-vscode",
6
+ "editor.formatOnSave": true,
7
+ "typescript.tsdk": "node_modules/typescript/lib",
8
+ "[javascript]": {
9
+ "editor.defaultFormatter": "oxc.oxc-vscode"
10
+ },
11
+ "[javascriptreact]": {
12
+ "editor.defaultFormatter": "oxc.oxc-vscode"
13
+ },
14
+ "[typescript]": {
15
+ "editor.defaultFormatter": "oxc.oxc-vscode"
16
+ },
17
+ "[typescriptreact]": {
18
+ "editor.defaultFormatter": "oxc.oxc-vscode"
19
+ },
20
+ "[json]": {
21
+ "editor.defaultFormatter": "oxc.oxc-vscode"
22
+ },
23
+ "[jsonc]": {
24
+ "editor.defaultFormatter": "oxc.oxc-vscode"
25
+ }
26
+ }
@@ -5,8 +5,8 @@ This workspace wires the customer-global Better Auth database schema from
5
5
  session validation and user / group table references instead of creating
6
6
  app-local auth tables.
7
7
 
8
- Import auth as `@__APP_NAME__/auth`, the database handle as
9
- `@__APP_NAME__/auth/db`, and table definitions as `@__APP_NAME__/auth/schema`
8
+ Import auth as `@__CUSTOMER_SLUG__/auth`, the database handle as
9
+ `@__CUSTOMER_SLUG__/auth/db`, and table definitions as `@__CUSTOMER_SLUG__/auth/schema`
10
10
  from app packages.
11
11
 
12
12
  The important identity invariant is:
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "@__APP_NAME__/auth",
2
+ "name": "@__CUSTOMER_SLUG__/auth",
3
3
  "version": "0.0.1",
4
4
  "private": true,
5
5
  "description": "Shared customer identity package.",
@@ -22,6 +22,7 @@
22
22
  "devDependencies": {
23
23
  "@percepta/build": "^1.0.0",
24
24
  "@types/node": "^24.1.0",
25
+ "@types/pg": "^8.15.4",
25
26
  "drizzle-kit": "^0.31.4",
26
27
  "tsx": "^4.20.3"
27
28
  }
@@ -1,8 +1,13 @@
1
1
  import { createAuthDatabase } from "@percepta/auth/drizzle";
2
+ import type { NodePgDatabase } from "drizzle-orm/node-postgres";
3
+ import type { Pool } from "pg";
2
4
  import { getAuthDatabaseConnectionString } from "../config/database";
3
5
  import * as schema from "./schema";
4
6
 
5
- export const { client, db } = createAuthDatabase({
7
+ export const {
8
+ client,
9
+ db,
10
+ }: { client: Pool; db: NodePgDatabase<typeof schema> } = createAuthDatabase({
6
11
  connectionString: getAuthDatabaseConnectionString(),
7
12
  schema,
8
13
  });
@@ -10,7 +10,6 @@ build/
10
10
 
11
11
  # IDE
12
12
  .idea/
13
- .vscode/
14
13
  *.swp
15
14
  *.swo
16
15
 
@@ -19,6 +18,7 @@ build/
19
18
  Thumbs.db
20
19
 
21
20
  # Env files
21
+ .envrc
22
22
  .env
23
23
  .env.local
24
24
  .env.*.local
@@ -6,14 +6,6 @@ packages:
6
6
  # user's pnpm config enforces minimumReleaseAge.
7
7
  minimumReleaseAgeExclude:
8
8
  - "@percepta/*"
9
- - "better-auth"
10
- - "@better-auth/*"
11
- - "oxfmt"
12
- - "@oxfmt/*"
13
- - "oxlint"
14
- - "@oxlint/*"
15
- - "oxlint-tsgolint"
16
- - "@oxlint-tsgolint/*"
17
9
 
18
10
  overrides:
19
11
  fast-xml-parser@<=5.5.6: 5.5.6
@@ -54,12 +54,13 @@ jobs:
54
54
  echo "isPreview=$isPreview" >> $GITHUB_OUTPUT
55
55
 
56
56
  - name: Build and Push
57
- uses: ryvn-technologies/ryvn-build-action@v1.2.0
57
+ uses: ryvn-technologies/ryvn-build-action@v2
58
58
  with:
59
59
  service_name: ${{ env.SERVICE_NAME }}
60
60
  version: ${{ steps.generate-tag.outputs.version }}
61
61
  build_only: ${{ !(github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || steps.generate-tag.outputs.isPreview == 'true') }}
62
- build_args: NPM_TOKEN=${{ secrets.NPM_TOKEN }}
62
+ build_secrets: |
63
+ NPM_TOKEN=${{ secrets.NPM_TOKEN }}
63
64
  ryvn_client_id: ${{ secrets.RYVN_CLIENT_ID }}
64
65
  ryvn_client_secret: ${{ secrets.RYVN_CLIENT_SECRET }}
65
66
 
@@ -219,7 +219,7 @@ Client-side usage via `src/lib/trpc.ts`.
219
219
 
220
220
  ### Authentication
221
221
 
222
- Better Auth is configured in the customer monorepo's shared `@__REPO_NAME__/auth` package. The app imports it through `src/lib/auth/` for local session validation. `DATABASE_URL` is this app's database only; deployed auth should use `AUTH_DATABASE_URL` from the monorepo auth Secret.
222
+ Better Auth is configured in the customer monorepo's shared `@__CUSTOMER_SLUG__/auth` package. The app imports it through `src/lib/auth/` for local session validation. `DATABASE_URL` is this app's database only; deployed auth should use `AUTH_DATABASE_URL` from the monorepo auth Secret.
223
223
 
224
224
  - **Server-side**: `auth.api.getSession({ headers: await headers() })` — get session in server components or tRPC context
225
225
  - **Client-side**: `authClient.useSession()` — React hook from `src/lib/auth-client.ts`
@@ -1,34 +1,35 @@
1
1
  # Base image with PNPM:
2
- ARG NODE_VERSION=24.4.1
2
+ ARG NODE_VERSION=24.16.0
3
3
  FROM node:${NODE_VERSION}-slim AS base
4
- WORKDIR /app
5
- RUN npm install -g pnpm
4
+ WORKDIR /repo
5
+ ARG PNPM_VERSION=10.6.4
6
+ RUN npm install -g pnpm@${PNPM_VERSION}
6
7
 
7
8
  # Build stage:
8
9
  FROM base AS builder
9
- WORKDIR /repo
10
10
  ENV CI=true
11
11
 
12
- COPY . .
12
+ COPY .npmrc pnpm-lock.yaml pnpm-workspace.yaml ./
13
+ RUN --mount=type=secret,id=NPM_TOKEN \
14
+ NPM_TOKEN=$(cat /run/secrets/NPM_TOKEN 2>/dev/null || true) \
15
+ pnpm fetch
13
16
 
14
- # Create .npmrc with build-time token for private packages:
15
- ARG NPM_TOKEN
16
- RUN echo "@percepta:registry=https://registry.npmjs.org/" > .npmrc && \
17
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
17
+ COPY . .
18
+ RUN --mount=type=secret,id=NPM_TOKEN \
19
+ NPM_TOKEN=$(cat /run/secrets/NPM_TOKEN 2>/dev/null || true) \
20
+ pnpm install --frozen-lockfile --offline
18
21
 
19
- # Add BASE_PATH as a build argument
22
+ # Build service and its workspace dependencies in topological order:
20
23
  ARG BASE_PATH
21
24
  ENV BASE_PATH=${BASE_PATH}
22
-
23
- RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
24
-
25
- RUN NODE_ENV=production NODE_OPTIONS="--max-old-space-size=4096" pnpm --filter ./packages/__APP_NAME__ build
26
-
27
- # Remove .npmrc for security (contains auth token):
28
- RUN rm -f .npmrc
25
+ RUN --mount=type=secret,id=TURBO_TOKEN,env=TURBO_TOKEN,required=false \
26
+ --mount=type=secret,id=TURBO_TEAM,env=TURBO_TEAM,required=false \
27
+ NODE_ENV=production NODE_OPTIONS="--max-old-space-size=4096" \
28
+ pnpm turbo run build --filter=./packages/__APP_NAME__
29
29
 
30
30
  # Production stage - create the final image:
31
31
  FROM base AS production
32
+ WORKDIR /app
32
33
 
33
34
  # Install PostgreSQL client:
34
35
  USER root
@@ -41,7 +42,8 @@ RUN apt-get update \
41
42
  ENV NODE_ENV=production
42
43
  ENV NEXT_TELEMETRY_DISABLED=1
43
44
 
44
- # Copy BASE_PATH from the builder stage
45
+ # Carry BASE_PATH through to the runtime image:
46
+ ARG BASE_PATH
45
47
  ENV BASE_PATH=${BASE_PATH}
46
48
 
47
49
  # Copy built app from builder stage
@@ -59,7 +61,6 @@ COPY --from=builder /repo/packages/__APP_NAME__/node_modules ./packages/__APP_NA
59
61
  COPY --from=builder /repo/packages/__APP_NAME__/scripts ./packages/__APP_NAME__/scripts
60
62
  COPY --from=builder /repo/packages/__APP_NAME__/src ./packages/__APP_NAME__/src
61
63
 
62
-
63
64
  # Expose the port:
64
65
  EXPOSE 3000
65
66
 
@@ -149,7 +149,7 @@ logger.error(
149
149
 
150
150
  ## Authentication
151
151
 
152
- This app consumes the customer monorepo's shared [Better Auth](https://better-auth.com) package, `@__REPO_NAME__/auth`. The app still serves local development auth routes, but the users, sessions, accounts, groups, and group memberships live in the shared customer auth database. Deployed apps should receive that shared database through `AUTH_DATABASE_URL` from the monorepo auth Secret; `DATABASE_URL` is reserved for this app's own database.
152
+ This app consumes the customer monorepo's shared [Better Auth](https://better-auth.com) package, `@__CUSTOMER_SLUG__/auth`. The app still serves local development auth routes, but the users, sessions, accounts, groups, and group memberships live in the shared customer auth database. Deployed apps should receive that shared database through `AUTH_DATABASE_URL` from the monorepo auth Secret; `DATABASE_URL` is reserved for this app's own database.
153
153
 
154
154
  Required auth environment variables:
155
155
 
@@ -256,13 +256,13 @@ await getAccessControl().app.assignAppRole(
256
256
 
257
257
  ## Shared Auth Boundary
258
258
 
259
- This app imports Better Auth from `@__REPO_NAME__/auth` via `src/lib/auth/index.ts`. The app does not own `users`, `groups`, `group_members`, sessions, accounts, or verification tables.
259
+ This app imports Better Auth from `@__CUSTOMER_SLUG__/auth` via `src/lib/auth/index.ts`. The app does not own `users`, `groups`, `group_members`, sessions, accounts, or verification tables.
260
260
 
261
261
  When app code needs users for display, import from the shared auth package:
262
262
 
263
263
  ```ts
264
- import { db as authDb } from "@__REPO_NAME__/auth/db";
265
- import { users } from "@__REPO_NAME__/auth/schema";
264
+ import { db as authDb } from "@__CUSTOMER_SLUG__/auth/db";
265
+ import { users } from "@__CUSTOMER_SLUG__/auth/schema";
266
266
  ```
267
267
 
268
268
  Use `users.id` in SpiceDB refs. `users.external_id`, email, and group external IDs are ingestion lookup keys only.
@@ -10,7 +10,7 @@ Create a new schema file alongside the existing ones:
10
10
 
11
11
  ```typescript
12
12
  import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
13
- import { users } from "@__REPO_NAME__/auth/schema";
13
+ import { users } from "@__CUSTOMER_SLUG__/auth/schema";
14
14
 
15
15
  export const documents = pgTable("documents", {
16
16
  id: uuid("id").defaultRandom().primaryKey(),
@@ -9,7 +9,7 @@ const nextConfig: NextConfig = {
9
9
  // Enable standalone output for Docker:
10
10
  output: "standalone",
11
11
  outputFileTracingRoot: monorepoRoot,
12
- transpilePackages: ["@__REPO_NAME__/auth"],
12
+ transpilePackages: ["@__CUSTOMER_SLUG__/auth"],
13
13
  turbopack: {
14
14
  root: monorepoRoot,
15
15
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "__APP_NAME__",
2
+ "name": "@__CUSTOMER_SLUG__/__APP_NAME__",
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "type": "module",
@@ -46,7 +46,7 @@
46
46
  "@opentelemetry/auto-instrumentations-node": "^0.75.0",
47
47
  "@opentelemetry/exporter-trace-otlp-proto": "^0.217.0",
48
48
  "@opentelemetry/sdk-node": "^0.217.0",
49
- "@__REPO_NAME__/auth": "workspace:*",
49
+ "@__CUSTOMER_SLUG__/auth": "workspace:*",
50
50
  "@percepta/access-control": "^1.0.0",
51
51
  "@percepta/ai": "^0.1.0",
52
52
  "@percepta/database": "^0.1.2",
@@ -52,9 +52,9 @@ async function main(): Promise<void> {
52
52
  // oxlint-disable-next-line typescript/no-explicit-any
53
53
  (globalThis as any).AsyncLocalStorage = AsyncLocalStorage;
54
54
 
55
- const { auth } = await import("@__REPO_NAME__/auth");
56
- const { db: authDb } = await import("@__REPO_NAME__/auth/db");
57
- const { users } = await import("@__REPO_NAME__/auth/schema");
55
+ const { auth } = await import("@__CUSTOMER_SLUG__/auth");
56
+ const { db: authDb } = await import("@__CUSTOMER_SLUG__/auth/db");
57
+ const { users } = await import("@__CUSTOMER_SLUG__/auth/schema");
58
58
  const { getAccessControl, toUserSubject } =
59
59
  await import("../src/services/access/AppAccessControl");
60
60
  const { getEnvConfig } = await import("../src/config/getEnvConfig");
@@ -8,7 +8,7 @@ import {
8
8
  PrincipalMultiInput,
9
9
  type PrincipalOption,
10
10
  } from "@percepta/access-control/react";
11
- import { listPrincipals } from "@__REPO_NAME__/auth/principals";
11
+ import { listPrincipals } from "@__CUSTOMER_SLUG__/auth/principals";
12
12
  import {
13
13
  Badge,
14
14
  Table,
@@ -18,6 +18,7 @@ import {
18
18
  TableHeader,
19
19
  TableRow,
20
20
  } from "@percepta/design";
21
+ import { assertNever } from "@percepta/utils";
21
22
  import type { Metadata } from "next";
22
23
  import { revalidatePath } from "next/cache";
23
24
  import Link from "next/link";
@@ -540,7 +541,7 @@ function getApplicationAccessRoleDefinition(
540
541
  function getAppRoleDefinition(role: AccessAppRole): RoleDefinition {
541
542
  const definition = appRoleDefinitionMap.get(role);
542
543
  if (definition == null) {
543
- throw new Error(`Missing app role definition: ${role}`);
544
+ return assertNever(role);
544
545
  }
545
546
 
546
547
  return definition;
@@ -1,3 +1,3 @@
1
1
  // App-local resource tables are exported from this module.
2
- // Customer-global auth tables are exported by @__REPO_NAME__/auth/schema.
2
+ // Customer-global auth tables are exported by @__CUSTOMER_SLUG__/auth/schema.
3
3
  export {};
@@ -1,7 +1,7 @@
1
- import { auth } from "@__REPO_NAME__/auth";
1
+ import { auth } from "@__CUSTOMER_SLUG__/auth";
2
2
  import { headers } from "next/headers";
3
3
 
4
- export { auth, type BetterAuthSession } from "@__REPO_NAME__/auth";
4
+ export { auth, type BetterAuthSession } from "@__CUSTOMER_SLUG__/auth";
5
5
 
6
6
  export async function getServerSession() {
7
7
  return auth.api.getSession({
@@ -1,4 +1,4 @@
1
- import { client as authClient } from "@__REPO_NAME__/auth/db";
1
+ import { client as authClient } from "@__CUSTOMER_SLUG__/auth/db";
2
2
  import { getEnvConfig } from "./config/getEnvConfig";
3
3
  import { client } from "./drizzle/db";
4
4
  import { getLogger } from "./services/logger/AppLogger";
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-COp0nGdk.js","names":[],"sources":["../src/commands/init.ts"],"sourcesContent":["import path from \"node:path\";\nimport chalk from \"chalk\";\nimport fs from \"fs-extra\";\nimport inquirer from \"inquirer\";\nimport {\n writeManifest,\n manifestExists,\n derivePlaceholders,\n type MosaicManifest,\n} from \"../utils/manifest.js\";\nimport { isValidProjectType, VALID_PROJECT_TYPES } from \"../utils/prompts.js\";\nimport { getTemplateVersion } from \"../utils/template-versions.js\";\n\nexport interface InitOptions {\n type?: string;\n templateVersion?: string;\n}\n\nexport async function initCommand(options: InitOptions): Promise<void> {\n const cwd = process.cwd();\n\n if (await manifestExists(cwd)) {\n console.error(\n chalk.red(\".mosaic-template.json already exists in this directory.\"),\n );\n process.exit(1);\n }\n\n // Auto-detect app name from package.json\n const pkgPath = path.join(cwd, \"package.json\");\n let appName = path.basename(cwd);\n if (await fs.pathExists(pkgPath)) {\n const pkg = JSON.parse(await fs.readFile(pkgPath, \"utf-8\"));\n appName = pkg.name?.replace(/^@[^/]+\\//, \"\") || appName;\n }\n\n // Determine template type\n let templateType = options.type;\n if (templateType && !isValidProjectType(templateType)) {\n console.error(\n chalk.red(\n `Invalid template type \"${templateType}\". Valid types: ${VALID_PROJECT_TYPES.join(\", \")}`,\n ),\n );\n process.exit(1);\n }\n if (!templateType) {\n const answer = await inquirer.prompt([\n {\n type: \"list\",\n name: \"type\",\n message: \"Template type:\",\n choices: [\"webapp\", \"library\"],\n },\n ]);\n templateType = answer.type;\n }\n\n const templateVersion =\n options.templateVersion || getTemplateVersion(templateType!);\n\n // Derive placeholders from app name\n const appTitle = appName\n .split(\"-\")\n .map((w: string) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(\" \");\n\n const manifest: MosaicManifest = {\n templateType: templateType!,\n templateVersion,\n templateCommit: \"unknown\",\n createdAt: new Date().toISOString(),\n placeholders: derivePlaceholders(appName, appTitle),\n source: {\n templatePath: `packages/blueberry/templates/${templateType}`,\n },\n };\n\n await writeManifest(cwd, manifest);\n\n // Create mosaic-template-notes.md if it doesn't exist\n const notesPath = path.join(cwd, \"mosaic-template-notes.md\");\n if (!(await fs.pathExists(notesPath))) {\n await fs.writeFile(\n notesPath,\n `# Mosaic Divergence Notes\\n\\nDocument intentional differences from the ${templateType} template here.\\nClaude reads this file during sync to preserve your customizations.\\n\\n## Intentional Divergences\\n\\n`,\n );\n }\n\n console.log();\n console.log(\n chalk.green(\"\\u2714\"),\n chalk.bold(\"Initialized .mosaic-template.json\"),\n );\n console.log();\n console.log(chalk.dim(\" Template:\"), templateType);\n console.log(chalk.dim(\" Version:\"), templateVersion);\n console.log(chalk.dim(\" App name:\"), appName);\n console.log();\n console.log(\n chalk.dim(\n \"Review .mosaic-template.json and mosaic-template-notes.md, then commit them.\",\n ),\n );\n console.log();\n}\n"],"mappings":";;;;;;;;AAkBA,eAAsB,YAAY,SAAqC;CACrE,MAAM,MAAM,QAAQ,KAAK;AAEzB,KAAI,MAAM,eAAe,IAAI,EAAE;AAC7B,UAAQ,MACN,MAAM,IAAI,0DAA0D,CACrE;AACD,UAAQ,KAAK,EAAE;;CAIjB,MAAM,UAAU,KAAK,KAAK,KAAK,eAAe;CAC9C,IAAI,UAAU,KAAK,SAAS,IAAI;AAChC,KAAI,MAAM,GAAG,WAAW,QAAQ,CAE9B,WADY,KAAK,MAAM,MAAM,GAAG,SAAS,SAAS,QAAQ,CAC7C,CAAC,MAAM,QAAQ,aAAa,GAAG,IAAI;CAIlD,IAAI,eAAe,QAAQ;AAC3B,KAAI,gBAAgB,CAAC,mBAAmB,aAAa,EAAE;AACrD,UAAQ,MACN,MAAM,IACJ,0BAA0B,aAAa,kBAAkB,oBAAoB,KAAK,KAAK,GACxF,CACF;AACD,UAAQ,KAAK,EAAE;;AAEjB,KAAI,CAAC,aASH,iBAAe,MARM,SAAS,OAAO,CACnC;EACE,MAAM;EACN,MAAM;EACN,SAAS;EACT,SAAS,CAAC,UAAU,UAAU;EAC/B,CACF,CAAC,EACoB;CAGxB,MAAM,kBACJ,QAAQ,mBAAmB,mBAAmB,aAAc;CAG9D,MAAM,WAAW,QACd,MAAM,IAAI,CACV,KAAK,MAAc,EAAE,OAAO,EAAE,CAAC,aAAa,GAAG,EAAE,MAAM,EAAE,CAAC,CAC1D,KAAK,IAAI;AAaZ,OAAM,cAAc,KAAK;EAVT;EACd;EACA,gBAAgB;EAChB,4BAAW,IAAI,MAAM,EAAC,aAAa;EACnC,cAAc,mBAAmB,SAAS,SAAS;EACnD,QAAQ,EACN,cAAc,gCAAgC,gBAC/C;EAG8B,CAAC;CAGlC,MAAM,YAAY,KAAK,KAAK,KAAK,2BAA2B;AAC5D,KAAI,CAAE,MAAM,GAAG,WAAW,UAAU,CAClC,OAAM,GAAG,UACP,WACA,0EAA0E,aAAa,wHACxF;AAGH,SAAQ,KAAK;AACb,SAAQ,IACN,MAAM,MAAM,IAAS,EACrB,MAAM,KAAK,oCAAoC,CAChD;AACD,SAAQ,KAAK;AACb,SAAQ,IAAI,MAAM,IAAI,cAAc,EAAE,aAAa;AACnD,SAAQ,IAAI,MAAM,IAAI,aAAa,EAAE,gBAAgB;AACrD,SAAQ,IAAI,MAAM,IAAI,cAAc,EAAE,QAAQ;AAC9C,SAAQ,KAAK;AACb,SAAQ,IACN,MAAM,IACJ,+EACD,CACF;AACD,SAAQ,KAAK"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"manifest-CqIDnbgs.js","names":[],"sources":["../src/utils/design-theme.ts","../src/utils/manifest.ts"],"sourcesContent":["export const VALID_MOSAIC_DESIGN_THEMES = [\"paper\", \"modern\", \"dense\"] as const;\n\nexport type MosaicDesignTheme = (typeof VALID_MOSAIC_DESIGN_THEMES)[number];\n\nexport const DEFAULT_MOSAIC_DESIGN_THEME: MosaicDesignTheme = \"modern\";\n\nexport function isValidMosaicDesignTheme(\n value: unknown,\n): value is MosaicDesignTheme {\n return (\n typeof value === \"string\" &&\n VALID_MOSAIC_DESIGN_THEMES.includes(value as MosaicDesignTheme)\n );\n}\n","import path from \"node:path\";\nimport fs from \"fs-extra\";\nimport {\n DEFAULT_MOSAIC_DESIGN_THEME,\n type MosaicDesignTheme,\n} from \"./design-theme.js\";\n\nexport interface MosaicManifest {\n templateType: string;\n templateVersion: string;\n templateCommit: string;\n createdAt: string;\n lastSyncedAt?: string;\n placeholders: Record<string, string>;\n source: {\n templatePath: string;\n };\n}\n\nconst MANIFEST_FILENAME = \".mosaic-template.json\";\n\nexport function getManifestPath(dir: string): string {\n return path.join(dir, MANIFEST_FILENAME);\n}\n\nexport async function readManifest(dir: string): Promise<MosaicManifest> {\n const manifestPath = getManifestPath(dir);\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(\n `No ${MANIFEST_FILENAME} found in ${dir}. Run 'create init' to create one.`,\n );\n }\n const content = await fs.readFile(manifestPath, \"utf-8\");\n try {\n return JSON.parse(content) as MosaicManifest;\n } catch (error) {\n throw new Error(\n `Invalid JSON in ${MANIFEST_FILENAME}: ${(error as Error).message}`,\n );\n }\n}\n\nexport async function writeManifest(\n dir: string,\n manifest: MosaicManifest,\n): Promise<void> {\n const manifestPath = getManifestPath(dir);\n await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2) + \"\\n\");\n}\n\nexport async function manifestExists(dir: string): Promise<boolean> {\n return fs.pathExists(getManifestPath(dir));\n}\n\nexport function derivePlaceholders(\n appName: string,\n appTitle: string,\n repoName = appName,\n designTheme: MosaicDesignTheme = DEFAULT_MOSAIC_DESIGN_THEME,\n): Record<string, string> {\n const nameSnake = appName.replace(/-/g, \"_\");\n const repoNameSnake = repoName.replace(/-/g, \"_\");\n return {\n __APP_NAME__: appName,\n __APP_TITLE__: appTitle,\n __DB_NAME__: nameSnake + \"_db\",\n __APP_NAME_UPPER__: appName.toUpperCase(),\n __APP_NAME_SNAKE__: nameSnake,\n __REPO_NAME__: repoName,\n __REPO_NAME_SNAKE__: repoNameSnake,\n __MOSAIC_DESIGN_THEME__: designTheme,\n };\n}\n\nexport function resolveMosaicTemplatePath(options: {\n mosaicTemplatePath?: string;\n}): string {\n if (options.mosaicTemplatePath)\n return path.resolve(options.mosaicTemplatePath);\n if (process.env.MOSAIC_TEMPLATE_PATH)\n return path.resolve(process.env.MOSAIC_TEMPLATE_PATH);\n throw new Error(\n \"Mosaic repo path required. Use --mosaic-template-path or set MOSAIC_TEMPLATE_PATH.\",\n );\n}\n"],"mappings":";;;AAAA,MAAa,6BAA6B;CAAC;CAAS;CAAU;CAAQ;AAItE,MAAa,8BAAiD;AAE9D,SAAgB,yBACd,OAC4B;AAC5B,QACE,OAAO,UAAU,YACjB,2BAA2B,SAAS,MAA2B;;;;ACQnE,MAAM,oBAAoB;AAE1B,SAAgB,gBAAgB,KAAqB;AACnD,QAAO,KAAK,KAAK,KAAK,kBAAkB;;AAG1C,eAAsB,aAAa,KAAsC;CACvE,MAAM,eAAe,gBAAgB,IAAI;AACzC,KAAI,CAAE,MAAM,GAAG,WAAW,aAAa,CACrC,OAAM,IAAI,MACR,MAAM,kBAAkB,YAAY,IAAI,oCACzC;CAEH,MAAM,UAAU,MAAM,GAAG,SAAS,cAAc,QAAQ;AACxD,KAAI;AACF,SAAO,KAAK,MAAM,QAAQ;UACnB,OAAO;AACd,QAAM,IAAI,MACR,mBAAmB,kBAAkB,IAAK,MAAgB,UAC3D;;;AAIL,eAAsB,cACpB,KACA,UACe;CACf,MAAM,eAAe,gBAAgB,IAAI;AACzC,OAAM,GAAG,UAAU,cAAc,KAAK,UAAU,UAAU,MAAM,EAAE,GAAG,KAAK;;AAG5E,eAAsB,eAAe,KAA+B;AAClE,QAAO,GAAG,WAAW,gBAAgB,IAAI,CAAC;;AAG5C,SAAgB,mBACd,SACA,UACA,WAAW,SACX,cAAiC,6BACT;CACxB,MAAM,YAAY,QAAQ,QAAQ,MAAM,IAAI;CAC5C,MAAM,gBAAgB,SAAS,QAAQ,MAAM,IAAI;AACjD,QAAO;EACL,cAAc;EACd,eAAe;EACf,aAAa,YAAY;EACzB,oBAAoB,QAAQ,aAAa;EACzC,oBAAoB;EACpB,eAAe;EACf,qBAAqB;EACrB,yBAAyB;EAC1B;;AAGH,SAAgB,0BAA0B,SAE/B;AACT,KAAI,QAAQ,mBACV,QAAO,KAAK,QAAQ,QAAQ,mBAAmB;AACjD,KAAI,QAAQ,IAAI,qBACd,QAAO,KAAK,QAAQ,QAAQ,IAAI,qBAAqB;AACvD,OAAM,IAAI,MACR,qFACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-app-Ctv1Grnr.js","names":[],"sources":["../src/commands/infra/register-app.ts"],"sourcesContent":["import path from \"node:path\";\nimport chalk from \"chalk\";\nimport fs from \"fs-extra\";\nimport { isMap, isSeq, parseDocument } from \"yaml\";\nimport {\n toKebabCase,\n toSnakeCase,\n toTitleCase,\n} from \"../../utils/case-converters.js\";\nimport { detectMonorepo } from \"../../utils/detect-monorepo.js\";\nimport { validateProjectName } from \"../../utils/validate.js\";\nimport { readWorkspaceManifest } from \"../../utils/workspace-manifest.js\";\nimport {\n createInfraGitHubApi,\n createOrUpdateInfraPullRequestFiles,\n INFRA_BASE_BRANCH,\n INFRA_REPOSITORY,\n type InfraGitHubApi,\n type InfraPullRequestFile,\n resolveGitHubToken,\n} from \"./github.js\";\n\nconst OS_POSTGRESQL_TERRAFORM_ALIAS = \"os-postgresql-terraform\";\nconst OS_POSTGRESQL_TERRAFORM_SERVICES = new Set([\n \"os-postgresql-terraform-aws\",\n \"os-postgresql-terraform-azure\",\n]);\n\nexport interface RegisterAppResult {\n appName: string;\n blueprintName: string;\n blueprintPath: string;\n branchName: string;\n customerSlug: string;\n pullRequestUrl: string | null;\n repository: typeof INFRA_REPOSITORY;\n status: \"already_registered\" | \"created_pr\" | \"updated_pr\";\n servicePath: string;\n targetPath: string;\n}\n\nexport async function registerApp(\n appNameInput: string,\n args: {\n cwd?: string;\n github?: InfraGitHubApi;\n } = {},\n): Promise<RegisterAppResult> {\n const appName = normalizeAppName(appNameInput);\n const cwd = args.cwd ?? process.cwd();\n const monorepoContext = await detectMonorepo(cwd);\n if (!monorepoContext.found || !monorepoContext.rootDir) {\n throw new Error(\n \"Run this command from a Mosaic customer monorepo with a .mosaic-workspace.json file.\",\n );\n }\n\n const workspaceManifest = await readWorkspaceManifest(\n monorepoContext.rootDir,\n );\n const customerSlug = workspaceManifest?.customerSlug;\n if (!customerSlug) {\n throw new Error(\n \".mosaic-workspace.json is missing customerSlug. Recreate the monorepo with a current @percepta/create.\",\n );\n }\n\n const github = args.github ?? createInfraGitHubApi(resolveGitHubToken());\n const blueprintName = `${customerSlug}-os`;\n const branchName = `blueberry/register-${customerSlug}-${appName}`;\n const blueprintPath = [\n \"ryvn\",\n \"definitions\",\n customerSlug,\n \"blueprints\",\n `${blueprintName}.blueprint.yaml`,\n ].join(\"/\");\n const servicePath = [\n \"ryvn\",\n \"definitions\",\n customerSlug,\n \"services\",\n `${appName}.service.yaml`,\n ].join(\"/\");\n\n const mainBlueprintFile = await github.getFile(\n blueprintPath,\n INFRA_BASE_BRANCH,\n );\n if (!mainBlueprintFile) {\n throw new Error(\n `${blueprintPath} does not exist in ${INFRA_REPOSITORY}. Run \\`pnpm mosaic infra register-os-blueprint\\` and merge that infra PR first.`,\n );\n }\n\n const mainServiceFile = await github.getFile(servicePath, INFRA_BASE_BRANCH);\n const serviceContent =\n mainServiceFile == null\n ? await readLocalServiceDefinition(monorepoContext.rootDir, appName)\n : null;\n const blueprintContent = registerAppInBlueprint(\n mainBlueprintFile.content,\n appName,\n );\n\n const files: InfraPullRequestFile[] = [];\n if (blueprintContent !== mainBlueprintFile.content) {\n files.push({\n baseFileSha: mainBlueprintFile.sha,\n content: blueprintContent,\n message: `Register ${appName} in ${blueprintName}`,\n path: blueprintPath,\n });\n }\n if (serviceContent != null) {\n files.push({\n content: serviceContent,\n message: `Register ${appName} service`,\n path: servicePath,\n });\n }\n\n if (files.length === 0) {\n return {\n appName,\n blueprintName,\n blueprintPath,\n branchName,\n customerSlug,\n pullRequestUrl: null,\n repository: INFRA_REPOSITORY,\n status: \"already_registered\",\n servicePath,\n targetPath: blueprintPath,\n };\n }\n\n const pullRequest = await createOrUpdateInfraPullRequestFiles({\n branchName,\n github,\n files,\n title: `Register ${appName} app`,\n body: [\n `Registers the ${appName} service and deployment in ${blueprintName}.`,\n \"\",\n \"Generated by `mosaic infra register-app`.\",\n ].join(\"\\n\"),\n });\n\n return {\n appName,\n blueprintName,\n blueprintPath,\n branchName,\n customerSlug,\n pullRequestUrl: pullRequest.pullRequestUrl,\n repository: INFRA_REPOSITORY,\n status: pullRequest.status,\n servicePath,\n targetPath: blueprintPath,\n };\n}\n\nexport async function registerAppCommand(appName: string): Promise<void> {\n try {\n const result = await registerApp(appName);\n\n if (result.status === \"already_registered\") {\n console.log(\n chalk.green(\"✔\"),\n `${result.appName} is already registered in ${result.repository} at`,\n chalk.cyan(result.targetPath),\n );\n return;\n }\n\n const verb =\n result.status === \"created_pr\" ? \"Created\" : \"Updated existing\";\n console.log(\n chalk.green(\"✔\"),\n `${verb} infra PR for ${result.appName}:`,\n chalk.cyan(result.pullRequestUrl),\n );\n } catch (error) {\n console.error(chalk.red(\"Error:\"), (error as Error).message);\n process.exit(1);\n }\n}\n\nexport function addAppDatabaseToBlueprint(\n blueprintContent: string,\n appName: string,\n): string {\n return updateBlueprint(blueprintContent, appName, {\n appDatabase: true,\n appInstallation: false,\n appInputs: false,\n });\n}\n\nexport function registerAppInBlueprint(\n blueprintContent: string,\n appName: string,\n): string {\n return updateBlueprint(blueprintContent, appName, {\n appDatabase: true,\n appInstallation: true,\n appInputs: true,\n });\n}\n\nfunction updateBlueprint(\n blueprintContent: string,\n appName: string,\n options: {\n appDatabase: boolean;\n appInstallation: boolean;\n appInputs: boolean;\n },\n): string {\n const document = parseDocument(blueprintContent);\n if (document.errors.length > 0) {\n throw new Error(\n `Invalid OS blueprint YAML: ${document.errors.map((error) => error.message).join(\"; \")}`,\n );\n }\n\n const spec = document.get(\"spec\", true);\n if (!isMap(spec)) {\n throw new Error(\"OS blueprint must include a spec map.\");\n }\n\n let changed = false;\n const inputs = spec.get(\"inputs\", true);\n if (!isSeq(inputs)) {\n throw new Error(\"OS blueprint spec.inputs must be a sequence.\");\n }\n\n if (options.appInputs) {\n changed =\n addAppInput(document, inputs, renderIngressDomainInput()) || changed;\n changed =\n addAppInput(document, inputs, renderBetterAuthSecretInput(appName)) ||\n changed;\n changed =\n addAppInput(document, inputs, renderInngestEventKeyInput()) || changed;\n changed =\n addAppInput(document, inputs, renderInngestSigningKeyInput()) || changed;\n changed =\n addAppInput(document, inputs, renderLangfusePublicKeyInput()) || changed;\n changed =\n addAppInput(document, inputs, renderLangfuseSecretKeyInput()) || changed;\n }\n\n if (options.appDatabase) {\n changed = addAppDatabase(document, inputs, appName) || changed;\n }\n\n if (options.appInstallation) {\n const installations = spec.get(\"installations\", true);\n if (!isSeq(installations)) {\n throw new Error(\"OS blueprint spec.installations must be a sequence.\");\n }\n changed = ensureOsPostgresqlInstallationAlias(installations) || changed;\n changed = addAppInstallation(document, installations, appName) || changed;\n }\n\n return changed ? document.toString() : blueprintContent;\n}\n\nfunction ensureOsPostgresqlInstallationAlias(installations: {\n items: unknown[];\n}): boolean {\n let changed = false;\n\n for (const installation of installations.items) {\n if (!isMap(installation)) continue;\n\n const service = installation.get(\"service\");\n if (\n typeof service !== \"string\" ||\n !OS_POSTGRESQL_TERRAFORM_SERVICES.has(service)\n ) {\n continue;\n }\n\n if (installation.get(\"name\") === OS_POSTGRESQL_TERRAFORM_ALIAS) continue;\n\n installation.set(\"name\", OS_POSTGRESQL_TERRAFORM_ALIAS);\n changed = true;\n }\n\n return changed;\n}\n\nfunction addAppInput(\n document: ReturnType<typeof parseDocument>,\n inputs: { add(value: unknown): void; items: unknown[] },\n input: Record<string, unknown> & { name: string },\n): boolean {\n if (\n inputs.items.some((item) => isMap(item) && item.get(\"name\") === input.name)\n ) {\n return false;\n }\n\n inputs.add(document.createNode(input));\n return true;\n}\n\nfunction addAppDatabase(\n document: ReturnType<typeof parseDocument>,\n inputs: { items: unknown[] },\n appName: string,\n): boolean {\n const appDatabasesInput = inputs.items.find(\n (item) => isMap(item) && item.get(\"name\") === \"app_databases\",\n );\n if (!isMap(appDatabasesInput)) {\n throw new Error(\"OS blueprint must include an app_databases input.\");\n }\n\n const defaultValue = appDatabasesInput.get(\"default\", true);\n if (!isMap(defaultValue)) {\n throw new Error(\"OS blueprint app_databases default must be a map.\");\n }\n\n if (defaultValue.has(appName)) return false;\n\n defaultValue.flow = false;\n const appDatabaseValue = document.createNode({});\n if (isMap(appDatabaseValue)) appDatabaseValue.flow = true;\n defaultValue.set(appName, appDatabaseValue);\n return true;\n}\n\nfunction addAppInstallation(\n document: ReturnType<typeof parseDocument>,\n installations: { add(value: unknown): void; items: unknown[] },\n appName: string,\n): boolean {\n if (\n installations.items.some(\n (item) => isMap(item) && item.get(\"service\") === appName,\n )\n ) {\n return false;\n }\n\n installations.add(\n document.createNode({\n service: appName,\n env: renderAppInstallationEnv(appName),\n config: renderAppInstallationConfig(appName),\n }),\n );\n return true;\n}\n\nfunction renderIngressDomainInput(): Record<string, unknown> & {\n name: string;\n} {\n return {\n name: ingressDomainInputName(),\n type: \"string\",\n group: \"Applications\",\n displayName: \"Ingress Domain\",\n description: \"Shared ingress domain for generated OS webapps.\",\n default: '{{ default \"example.local\" .ryvn.env.state.public_domain.name }}',\n };\n}\n\nfunction renderBetterAuthSecretInput(\n appName: string,\n): Record<string, unknown> & { name: string } {\n return {\n name: betterAuthSecretInputName(appName),\n type: \"string\",\n isSecret: true,\n group: \"Applications\",\n displayName: `${toTitleCase(appName)} Better Auth Secret`,\n description: `Generated Better Auth signing secret for ${appName}.`,\n hidden: true,\n generated: {\n type: \"random-bytes\",\n length: 32,\n },\n };\n}\n\nfunction renderInngestEventKeyInput(): Record<string, unknown> & {\n name: string;\n} {\n return {\n name: inngestEventKeyInputName(),\n type: \"string\",\n isSecret: true,\n group: \"Applications\",\n displayName: \"Inngest Event Key\",\n description:\n \"Shared Inngest event key for generated OS webapps. Leave unset when the target Inngest installation does not require one.\",\n };\n}\n\nfunction renderInngestSigningKeyInput(): Record<string, unknown> & {\n name: string;\n} {\n return {\n name: inngestSigningKeyInputName(),\n type: \"string\",\n isSecret: true,\n group: \"Applications\",\n displayName: \"Inngest Signing Key\",\n description:\n \"Shared Inngest signing key for generated OS webapps. Leave unset when the target Inngest installation does not require one.\",\n };\n}\n\nfunction renderLangfusePublicKeyInput(): Record<string, unknown> & {\n name: string;\n} {\n return {\n name: langfusePublicKeyInputName(),\n type: \"string\",\n group: \"Applications\",\n displayName: \"Langfuse Public Key\",\n description:\n \"Shared Langfuse public key for generated OS webapps. Leave empty to disable Langfuse export.\",\n default: \"\",\n };\n}\n\nfunction renderLangfuseSecretKeyInput(): Record<string, unknown> & {\n name: string;\n} {\n return {\n name: langfuseSecretKeyInputName(),\n type: \"string\",\n isSecret: true,\n group: \"Applications\",\n displayName: \"Langfuse Secret Key\",\n description:\n \"Shared Langfuse secret key for generated OS webapps. Leave unset to disable Langfuse export.\",\n };\n}\n\nfunction renderAppInstallationEnv(\n appName: string,\n): Array<Record<string, unknown>> {\n const appHost = `${appName}.{{ input \"${ingressDomainInputName()}\" }}`;\n\n return [\n {\n key: \"DATABASE_URL\",\n isSecret: true,\n valueFromOutput: {\n serviceInstallation: \"os-postgresql-terraform\",\n name: `app_database_urls.${appName}`,\n },\n },\n {\n key: \"AUTH_DATABASE_URL\",\n isSecret: true,\n valueFromOutput: {\n serviceInstallation: \"os-postgresql-terraform\",\n name: \"auth_database_url\",\n },\n },\n {\n key: \"APP_BASE_URL\",\n value: `https://${appHost}`,\n },\n {\n key: \"DEPLOYMENT_ENVIRONMENT\",\n value: \"{{ EnvironmentName }}\",\n },\n {\n key: \"BETTER_AUTH_SECRET\",\n isSecret: true,\n valueFromInput: {\n name: betterAuthSecretInputName(appName),\n },\n },\n {\n key: \"INNGEST_BASE_URL\",\n value: '{{ (blueprintInstallation \"mosaic\").outputs.inngest_base_url }}',\n },\n {\n key: \"INNGEST_EVENT_KEY\",\n isSecret: true,\n valueFromInput: {\n name: inngestEventKeyInputName(),\n },\n },\n {\n key: \"INNGEST_SIGNING_KEY\",\n isSecret: true,\n valueFromInput: {\n name: inngestSigningKeyInputName(),\n },\n },\n {\n key: \"LANGFUSE_BASE_URL\",\n value: '{{ (blueprintInstallation \"mosaic\").outputs.langfuse_base_url }}',\n },\n {\n key: \"LANGFUSE_PUBLIC_KEY\",\n valueFromInput: {\n name: langfusePublicKeyInputName(),\n },\n },\n {\n key: \"LANGFUSE_SECRET_KEY\",\n isSecret: true,\n valueFromInput: {\n name: langfuseSecretKeyInputName(),\n },\n },\n {\n key: \"OTEL_EXPORTER_OTLP_ENDPOINT\",\n value:\n '{{ (blueprintInstallation \"mosaic\").outputs.otel_exporter_otlp_endpoint }}',\n },\n {\n key: \"SPICEDB_ENDPOINT\",\n value: '{{ (blueprintInstallation \"mosaic\").outputs.spicedb_endpoint }}',\n },\n {\n key: \"SPICEDB_PRESHARED_KEY\",\n isSecret: true,\n value:\n '{{ (blueprintInstallation \"mosaic\").outputs.spicedb_preshared_key }}',\n },\n {\n key: \"SPICEDB_INSECURE\",\n value: '{{ (blueprintInstallation \"mosaic\").outputs.spicedb_insecure }}',\n },\n ];\n}\n\nfunction renderAppInstallationConfig(appName: string): string {\n const appHost = `${appName}.{{ input \"${ingressDomainInputName()}\" }}`;\n\n return [\n \"replicaCount: 1\",\n \"\",\n \"service:\",\n \" port: 3000\",\n \"\",\n \"livenessEnabled: true\",\n \"readinessEnabled: true\",\n \"startupEnabled: true\",\n \"\",\n \"resources:\",\n \" requests:\",\n ' cpu: \"100m\"',\n \" memory: 256Mi\",\n \" limits:\",\n ' cpu: \"500m\"',\n \" memory: 512Mi\",\n \"\",\n \"ingress:\",\n \" enabled: true\",\n \" className: external-nginx\",\n \" annotations:\",\n \" cert-manager.io/cluster-issuer: external-issuer\",\n ' nginx.ingress.kubernetes.io/ssl-redirect: \"true\"',\n \" hosts:\",\n ` - host: '${appHost}'`,\n \" paths:\",\n \" - path: /\",\n \" pathType: Prefix\",\n \" tls:\",\n ` - secretName: ${appName}-tls`,\n \" hosts:\",\n ` - '${appHost}'`,\n \"\",\n ].join(\"\\n\");\n}\n\nasync function readLocalServiceDefinition(\n monorepoRoot: string,\n appName: string,\n): Promise<string> {\n const serviceDefinitionPath = path.join(\n monorepoRoot,\n \"packages\",\n appName,\n \"deploy\",\n \"ryvn\",\n `${appName}.service.yaml`,\n );\n if (!(await fs.pathExists(serviceDefinitionPath))) {\n throw new Error(\n `${serviceDefinitionPath} does not exist. Add the app's Ryvn service definition before registering it in infra.`,\n );\n }\n\n const content = await fs.readFile(serviceDefinitionPath, \"utf-8\");\n validateLocalServiceDefinition(content, appName, serviceDefinitionPath);\n return content.endsWith(\"\\n\") ? content : `${content}\\n`;\n}\n\nfunction validateLocalServiceDefinition(\n content: string,\n appName: string,\n serviceDefinitionPath: string,\n): void {\n const document = parseDocument(content);\n if (document.errors.length > 0) {\n throw new Error(\n `Invalid Ryvn service YAML at ${serviceDefinitionPath}: ${document.errors.map((error) => error.message).join(\"; \")}`,\n );\n }\n\n const service = document.toJS() as {\n kind?: unknown;\n metadata?: { name?: unknown };\n };\n if (service.kind !== \"Service\" || service.metadata?.name !== appName) {\n throw new Error(\n `${serviceDefinitionPath} must define kind: Service with metadata.name: ${appName}.`,\n );\n }\n}\n\nfunction ingressDomainInputName(): string {\n return \"ingress_domain\";\n}\n\nfunction betterAuthSecretInputName(appName: string): string {\n return `${toSnakeCase(appName)}_better_auth_secret`;\n}\n\nfunction inngestEventKeyInputName(): string {\n return \"inngest_event_key\";\n}\n\nfunction inngestSigningKeyInputName(): string {\n return \"inngest_signing_key\";\n}\n\nfunction langfusePublicKeyInputName(): string {\n return \"langfuse_public_key\";\n}\n\nfunction langfuseSecretKeyInputName(): string {\n return \"langfuse_secret_key\";\n}\n\nfunction normalizeAppName(appNameInput: string): string {\n const appName = toKebabCase(appNameInput);\n const validation = validateProjectName(appName);\n if (!validation.valid) {\n throw new Error(`Invalid app name: ${validation.error}`);\n }\n return appName;\n}\n"],"mappings":";;;;;;;;;AAsBA,MAAM,gCAAgC;AACtC,MAAM,mCAAmC,IAAI,IAAI,CAC/C,+BACA,gCACD,CAAC;AAeF,eAAsB,YACpB,cACA,OAGI,EAAE,EACsB;CAC5B,MAAM,UAAU,iBAAiB,aAAa;CAE9C,MAAM,kBAAkB,MAAM,eADlB,KAAK,OAAO,QAAQ,KAAK,CACY;AACjD,KAAI,CAAC,gBAAgB,SAAS,CAAC,gBAAgB,QAC7C,OAAM,IAAI,MACR,uFACD;CAMH,MAAM,gBAAe,MAHW,sBAC9B,gBAAgB,QACjB,GACuC;AACxC,KAAI,CAAC,aACH,OAAM,IAAI,MACR,yGACD;CAGH,MAAM,SAAS,KAAK,UAAU,qBAAqB,oBAAoB,CAAC;CACxE,MAAM,gBAAgB,GAAG,aAAa;CACtC,MAAM,aAAa,sBAAsB,aAAa,GAAG;CACzD,MAAM,gBAAgB;EACpB;EACA;EACA;EACA;EACA,GAAG,cAAc;EAClB,CAAC,KAAK,IAAI;CACX,MAAM,cAAc;EAClB;EACA;EACA;EACA;EACA,GAAG,QAAQ;EACZ,CAAC,KAAK,IAAI;CAEX,MAAM,oBAAoB,MAAM,OAAO,QACrC,eACA,kBACD;AACD,KAAI,CAAC,kBACH,OAAM,IAAI,MACR,GAAG,cAAc,qBAAqB,iBAAiB,kFACxD;CAIH,MAAM,iBACJ,MAF4B,OAAO,QAAQ,aAAA,OAA+B,IAEvD,OACf,MAAM,2BAA2B,gBAAgB,SAAS,QAAQ,GAClE;CACN,MAAM,mBAAmB,uBACvB,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