Initial import of LogDarioSeq baseline

Establishes version control for the personal Logseq DB fork before
starting the server-client architecture migration and domain features
described in docs/agent-guide and the approved implementation plan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Sonnet 5 committed 2026-08-25 15:32:15 +02:00
commit 40631362b3
2016 files changed
+543898

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
import fs from 'node:fs'
import path from 'node:path'
const unsupportedFontFilePattern = /\.(?:woff2|woff)$/
const unsupportedCssFontPattern = /\.woff2?["')]|\bformat\(["']woff2?["']\)/
const walk = (dir) => {
const entries = fs.readdirSync(dir, { withFileTypes: true })
return entries.flatMap((entry) => {
const fullPath = path.join(dir, entry.name)
return entry.isDirectory() ? walk(fullPath) : fullPath
})
}
const relativePath = (repoRoot, filePath) =>
path.relative(repoRoot, filePath).split(path.sep).join('/')
export const existingAssetRoots = (assetRoots) =>
assetRoots.filter((root) => fs.existsSync(root))
export const findUnsupportedIOSFontAssets = ({ repoRoot, assetRoots }) => {
const roots = existingAssetRoots(assetRoots)
const files = roots.flatMap(walk)
return {
fontFiles: files
.filter((filePath) => unsupportedFontFilePattern.test(filePath))
.map((filePath) => relativePath(repoRoot, filePath))
.sort(),
cssFiles: files
.filter((filePath) => filePath.endsWith('.css'))
.flatMap((filePath) => {
const css = fs.readFileSync(filePath, 'utf8')
return unsupportedCssFontPattern.test(css)
? [relativePath(repoRoot, filePath)]
: []
})
.sort(),
roots,
}
}
+109
View File
@@ -0,0 +1,109 @@
'use strict';
const OPERATION_ORDER = Object.freeze([
'add',
'copyPaste',
'copyPasteTreeToEmptyTarget',
'move',
'indent',
'outdent',
'delete',
'undo',
'redo',
]);
function buildOperationPlan(totalOps) {
if (!Number.isInteger(totalOps) || totalOps <= 0) {
throw new Error('totalOps must be a positive integer');
}
const plan = [];
for (let i = 0; i < totalOps; i += 1) {
plan.push(OPERATION_ORDER[i % OPERATION_ORDER.length]);
}
return plan;
}
function chooseRunnableOperation(requestedOperation, managedCount) {
switch (requestedOperation) {
case 'copyPaste':
case 'copyPasteTreeToEmptyTarget':
return managedCount >= 1 ? requestedOperation : 'add';
case 'move':
case 'indent':
case 'delete':
return managedCount >= 2 ? requestedOperation : 'add';
case 'outdent':
case 'add':
case 'undo':
case 'redo':
return requestedOperation;
default:
throw new Error(`Unsupported operation kind: ${requestedOperation}`);
}
}
function parsePositiveInteger(value, flagName) {
const parsed = Number.parseInt(value, 10);
if (!Number.isInteger(parsed) || parsed <= 0) {
throw new Error(`${flagName} must be a positive integer`);
}
return parsed;
}
function parseNonNegativeInteger(value, flagName) {
const parsed = Number.parseInt(value, 10);
if (!Number.isInteger(parsed) || parsed < 0) {
throw new Error(`${flagName} must be a non-negative integer`);
}
return parsed;
}
function parseArgs(argv) {
const result = {
ops: 200,
port: 9333,
undoRedoDelayMs: 350,
};
for (let i = 0; i < argv.length; i += 1) {
const arg = argv[i];
if (arg === '--help' || arg === '-h') {
return { ...result, help: true };
}
const next = argv[i + 1];
if (arg === '--ops') {
result.ops = parsePositiveInteger(next, '--ops');
i += 1;
continue;
}
if (arg === '--port') {
result.port = parsePositiveInteger(next, '--port');
i += 1;
continue;
}
if (arg === '--undo-redo-delay-ms') {
result.undoRedoDelayMs = parseNonNegativeInteger(next, '--undo-redo-delay-ms');
i += 1;
continue;
}
throw new Error(`Unknown argument: ${arg}`);
}
if (result.ops < 200) {
throw new Error('--ops must be at least 200');
}
return result;
}
module.exports = {
OPERATION_ORDER,
buildOperationPlan,
chooseRunnableOperation,
parseArgs,
};
@@ -0,0 +1,44 @@
const unsupportedIOSWebFontSourcePattern =
/\.woff2?(?:[?#][^"')\s]*)?(?:["')\s]|$)|format\(["']woff2?["']\)/i
const stripUnsupportedIOSWebFontValue = (value) => {
const sources = value.split(/,(?=\s*(?:url|local)\()/)
const supportedSources = sources.filter((source) =>
!unsupportedIOSWebFontSourcePattern.test(source))
return supportedSources.length === 0 ? null : supportedSources.join(',')
}
const stripUnsupportedIOSWebFontSources = (css) =>
css.replace(/@font-face\s*{[^{}]*}/g, (fontFace) => {
let hasSupportedSrc = true
const nextFontFace = fontFace.replace(/src:([^;}]+)([;}])/g, (_match, value, delimiter) => {
const nextValue = stripUnsupportedIOSWebFontValue(value)
hasSupportedSrc = nextValue !== null
return nextValue === null ? '' : `src:${nextValue}${delimiter}`
})
return hasSupportedSrc ? nextFontFace : ''
})
const stripIOSWebFontSourcesPlugin = () => ({
postcssPlugin: 'strip-ios-web-font-sources',
Declaration (decl) {
if (decl.prop.toLowerCase() === 'src') {
const nextValue = stripUnsupportedIOSWebFontValue(decl.value)
if (nextValue === null) {
if (decl.parent?.type === 'atrule' && decl.parent.name === 'font-face') {
decl.parent.remove()
} else {
decl.remove()
}
} else {
decl.value = nextValue
}
}
},
})
module.exports = {
stripIOSWebFontSourcesPlugin,
stripUnsupportedIOSWebFontSources,
}