feat: local tier gateway with PGlite + Gitea-only publishing + repo linking

- Add PGlite (embedded Postgres) for local tier — gateway runs without
  external PG server. Same schema, same Drizzle API, zero module refactor.
- Install wizard now offers tier selection (local vs team).
  Local skips DATABASE_URL/VALKEY_URL, writes mosaic.config.json.
- Comment out npmjs publish step in CI (preserved for future use).
- Revert gateway publishConfig to Gitea registry, include in Gitea publish.
- Add repository field to all 23 publishable package.json files for
  Gitea package-to-repo linking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jarvis
2026-04-04 13:32:02 -05:00
parent 86d6c214fe
commit 6954e43bbb
29 changed files with 224 additions and 38 deletions

View File

@@ -1,6 +1,11 @@
{
"name": "@mosaic/gateway",
"version": "0.0.2",
"repository": {
"type": "git",
"url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git",
"directory": "apps/gateway"
},
"type": "module",
"main": "dist/main.js",
"bin": {
@@ -10,7 +15,7 @@
"dist"
],
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"registry": "https://git.mosaicstack.dev/api/packages/mosaic/npm/",
"access": "public"
},
"scripts": {

View File

@@ -1,5 +1,8 @@
import { mkdirSync } from 'node:fs';
import { homedir } from 'node:os';
import { join } from 'node:path';
import { Global, Inject, Module, type OnApplicationShutdown } from '@nestjs/common';
import { createDb, type Db, type DbHandle } from '@mosaic/db';
import { createDb, createPgliteDb, type Db, type DbHandle } from '@mosaic/db';
import { createStorageAdapter, type StorageAdapter } from '@mosaic/storage';
import type { MosaicConfig } from '@mosaic/config';
import { MOSAIC_CONFIG } from '../config/config.module.js';
@@ -13,8 +16,14 @@ export const STORAGE_ADAPTER = 'STORAGE_ADAPTER';
providers: [
{
provide: DB_HANDLE,
useFactory: (config: MosaicConfig): DbHandle =>
createDb(config.storage.type === 'postgres' ? config.storage.url : undefined),
useFactory: (config: MosaicConfig): DbHandle => {
if (config.tier === 'local') {
const dataDir = join(homedir(), '.config', 'mosaic', 'gateway', 'pglite');
mkdirSync(dataDir, { recursive: true });
return createPgliteDb(dataDir);
}
return createDb(config.storage.type === 'postgres' ? config.storage.url : undefined);
},
inject: [MOSAIC_CONFIG],
},
{