V2-Dev-Stand: Skala 1-10, Benefits/Concerns, DEV-Isolation und Gitea-Doku.
Bündelt die Neuentwicklung in AssigmentMonitorV2 (eigene Ports/DB), die Umstellung auf numerische Bewertungen, Meeting-Checklisten, KI-Tagging und die geplante Feedback-Kaskade — als Basis für Versionsverwaltung in Gitea. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
782678a1cf
commit
234f87d408
71 files changed
+7567
-705
No files matched your search
+43
-3
@@ -1,11 +1,51 @@
|
||||
import { DatabaseSync } from 'node:sqlite'
|
||||
import { mkdirSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { dirname, join, resolve, sep } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { TABLE_DEFINITIONS } from './db/tableRegistry'
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
const dbPath = join(__dirname, 'data', 'assignment-monitor.sqlite3')
|
||||
const projectRoot = resolve(join(__dirname, '..'))
|
||||
|
||||
/** V2-Defaults weichen bewusst von Produktiv (assignment-monitor.sqlite3) ab. */
|
||||
const sqliteFilename = process.env.SQLITE_FILENAME?.trim() || 'assignment-monitor-v2-dev.sqlite3'
|
||||
if (sqliteFilename.includes('/') || sqliteFilename.includes('\\') || sqliteFilename.includes('..')) {
|
||||
throw new Error(
|
||||
`[db] SAFETY: SQLITE_FILENAME darf nur ein Dateiname sein (kein Pfad): "${sqliteFilename}"`,
|
||||
)
|
||||
}
|
||||
|
||||
const dbPath = resolve(join(__dirname, 'data', sqliteFilename))
|
||||
|
||||
/**
|
||||
* Harte Absicherung: DB darf nur unter diesem V2-Projekt liegen und niemals unter
|
||||
* dem Produktiv-Ordner c:\dev\AssigmentMonitor (ohne V2-Suffix).
|
||||
*/
|
||||
function assertDevDbPath(resolvedDbPath: string): void {
|
||||
const dbNorm = resolvedDbPath.toLowerCase()
|
||||
const rootNorm = projectRoot.toLowerCase()
|
||||
const rootPrefix = rootNorm.endsWith(sep) ? rootNorm : rootNorm + sep
|
||||
|
||||
if (!dbNorm.startsWith(rootPrefix) && dbNorm !== rootNorm) {
|
||||
throw new Error(
|
||||
`[db] SAFETY: DB-Pfad liegt außerhalb von AssignmentMonitorV2.\n` +
|
||||
` DB: ${resolvedDbPath}\n` +
|
||||
` Root: ${projectRoot}`,
|
||||
)
|
||||
}
|
||||
|
||||
// Produktiv-Sibling: ...\AssigmentMonitor\server\data\... — V2-Pfad enthält "assigmentmonitorv2"
|
||||
const looksLikeProdData =
|
||||
/[/\\]assigmentmonitor[/\\]server[/\\]data[/\\]/.test(dbNorm) &&
|
||||
!/[/\\]assigmentmonitorv2[/\\]/.test(dbNorm)
|
||||
if (looksLikeProdData) {
|
||||
throw new Error(
|
||||
`[db] SAFETY: Versuch, die Produktiv-Datenbank zu öffnen wurde blockiert:\n ${resolvedDbPath}`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
assertDevDbPath(dbPath)
|
||||
mkdirSync(dirname(dbPath), { recursive: true })
|
||||
|
||||
export const db = new DatabaseSync(dbPath)
|
||||
@@ -31,4 +71,4 @@ for (const table of TABLE_DEFINITIONS) {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`[db] SQLite bereit unter ${dbPath}`)
|
||||
console.log(`[db] DEV-SQLite bereit unter ${dbPath}`)
|
||||
Reference in new issue
Block a user