@bleedingdev/modern-js-sandpack-react 3.2.0-ultramodern.105 → 3.2.0-ultramodern.106

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.
@@ -50,15 +50,15 @@ const MWAFiles = {
50
50
  "tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"target\": \"ESNext\",\n \"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n \"module\": \"preserve\",\n \"moduleResolution\": \"Bundler\",\n \"moduleDetection\": \"force\",\n \"isolatedModules\": true,\n \"verbatimModuleSyntax\": true,\n \"noEmit\": true,\n \"allowJs\": true,\n \"allowImportingTsExtensions\": true,\n \"resolveJsonModule\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true,\n \"strict\": true,\n \"noUncheckedIndexedAccess\": true,\n \"exactOptionalPropertyTypes\": true,\n \"noImplicitOverride\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@api/*\": [\"./api/*\"],\n \"@shared/*\": [\"./shared/*\"]\n },\n \"rootDir\": \".\",\n \"plugins\": [\n {\n \"name\": \"@effect/language-service\",\n \"diagnostics\": true,\n \"includeSuggestionsInTsc\": true,\n \"ignoreEffectSuggestionsInTscExitCode\": false,\n \"ignoreEffectWarningsInTscExitCode\": false,\n \"ignoreEffectErrorsInTscExitCode\": false,\n \"skipDisabledOptimization\": true,\n \"diagnosticSeverity\": {\n \"anyUnknownInErrorContext\": \"error\",\n \"classSelfMismatch\": \"error\",\n \"duplicatePackage\": \"error\",\n \"effectFnImplicitAny\": \"error\",\n \"floatingEffect\": \"error\",\n \"genericEffectServices\": \"error\",\n \"missingEffectContext\": \"error\",\n \"missingEffectError\": \"error\",\n \"missingLayerContext\": \"error\",\n \"missingReturnYieldStar\": \"error\",\n \"missingStarInYieldEffectGen\": \"error\",\n \"nonObjectEffectServiceType\": \"error\",\n \"outdatedApi\": \"error\",\n \"overriddenSchemaConstructor\": \"error\",\n \"catchUnfailableEffect\": \"error\",\n \"effectFnIife\": \"error\",\n \"effectGenUsesAdapter\": \"error\",\n \"effectInFailure\": \"error\",\n \"effectInVoidSuccess\": \"error\",\n \"globalErrorInEffectCatch\": \"error\",\n \"globalErrorInEffectFailure\": \"error\",\n \"layerMergeAllWithDependencies\": \"error\",\n \"lazyPromiseInEffectSync\": \"error\",\n \"leakingRequirements\": \"error\",\n \"multipleEffectProvide\": \"error\",\n \"returnEffectInGen\": \"error\",\n \"runEffectInsideEffect\": \"error\",\n \"schemaSyncInEffect\": \"error\",\n \"scopeInLayerEffect\": \"error\",\n \"strictEffectProvide\": \"error\",\n \"tryCatchInEffectGen\": \"error\",\n \"unknownInEffectCatch\": \"error\",\n \"asyncFunction\": \"error\",\n \"cryptoRandomUUID\": \"error\",\n \"cryptoRandomUUIDInEffect\": \"error\",\n \"extendsNativeError\": \"error\",\n \"globalConsole\": \"error\",\n \"globalConsoleInEffect\": \"error\",\n \"globalDate\": \"error\",\n \"globalDateInEffect\": \"error\",\n \"globalFetch\": \"error\",\n \"globalFetchInEffect\": \"error\",\n \"globalRandom\": \"error\",\n \"globalRandomInEffect\": \"error\",\n \"globalTimers\": \"error\",\n \"globalTimersInEffect\": \"error\",\n \"instanceOfSchema\": \"error\",\n \"newPromise\": \"error\",\n \"nodeBuiltinImport\": \"error\",\n \"preferSchemaOverJson\": \"error\",\n \"processEnv\": \"error\",\n \"processEnvInEffect\": \"error\",\n \"unsafeEffectTypeAssertion\": \"error\",\n \"catchAllToMapError\": \"error\",\n \"deterministicKeys\": \"error\",\n \"effectDoNotation\": \"error\",\n \"effectFnOpportunity\": \"error\",\n \"effectMapFlatten\": \"error\",\n \"effectMapVoid\": \"error\",\n \"effectSucceedWithVoid\": \"error\",\n \"missedPipeableOpportunity\": \"error\",\n \"missingEffectServiceDependency\": \"error\",\n \"nestedEffectGenYield\": \"error\",\n \"redundantSchemaTagIdentifier\": \"error\",\n \"schemaStructWithTag\": \"error\",\n \"schemaUnionOfLiterals\": \"error\",\n \"serviceNotAsClass\": \"error\",\n \"strictBooleanExpressions\": \"error\",\n \"unnecessaryArrowBlock\": \"error\",\n \"unnecessaryEffectGen\": \"error\",\n \"unnecessaryFailYieldableError\": \"error\",\n \"unnecessaryPipe\": \"error\",\n \"unnecessaryPipeChain\": \"error\"\n }\n }\n ]\n },\n \"include\": [\"src\", \"api\", \"shared\", \"config\", \"modern.config.ts\", \"server\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
51
51
  ".agents/skills-lock.json": "{\n \"schemaVersion\": 2,\n \"installDir\": \".agents/skills\",\n \"sources\": [\n {\n \"id\": \"techsiocz-private\",\n \"visibility\": \"private\",\n \"repository\": \"https://github.com/TechsioCZ/skills\",\n \"install\": \"clone-if-authorized\",\n \"baseline\": [\n {\n \"name\": \"plan-graph\",\n \"reason\": \"Build and validate DAGs from .plan.md files\"\n },\n {\n \"name\": \"dag\",\n \"reason\": \"Inspect current plan frontiers and blocked lanes\"\n },\n {\n \"name\": \"subagent-graph\",\n \"reason\": \"Design dependency-aware multi-agent launch graphs\"\n },\n {\n \"name\": \"helm\",\n \"reason\": \"Steer already-running multi-agent work\"\n },\n {\n \"name\": \"debugger-mode\",\n \"reason\": \"Run hypothesis-driven debugging with runtime evidence\"\n }\n ]\n }\n ]\n}\n",
52
52
  ".codex/hooks.json": "{\n \"Stop\": [\n {\n \"command\": \"pnpm format && pnpm lint:fix && pnpm ultramodern:check\",\n \"timeout\": 600000,\n \"statusMessage\": \"Running UltraModern quality gates\"\n }\n ],\n \"SubagentStop\": [\n {\n \"command\": \"pnpm format && pnpm lint:fix && pnpm ultramodern:check\",\n \"timeout\": 600000,\n \"statusMessage\": \"Running UltraModern quality gates\"\n }\n ]\n}\n",
53
- "scripts/bootstrap-agent-skills.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst lockPath = path.join(root, '.agents/skills-lock.json');\nconst checkOnly = process.argv.includes('--check');\nconst force = process.argv.includes('--force');\n\nconst readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8'));\n\nconst run = (command, args, options = {}) =>\n execFileSync(command, args, {\n cwd: options.cwd ?? root,\n encoding: 'utf-8',\n stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],\n });\n\nconst commandExists = (command) => {\n try {\n run(command, ['--version'], { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n};\n\nconst runShell = (script) =>\n run('sh', ['-lc', script], {\n stdio: 'inherit',\n });\n\nconst installGit = () => {\n if (commandExists('git')) {\n return;\n }\n\n if (commandExists('brew')) {\n run('brew', ['install', 'git'], { stdio: 'inherit' });\n } else if (process.platform === 'linux' && commandExists('apt-get')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}apt-get update && ${sudo}apt-get install -y git`);\n } else if (process.platform === 'linux' && commandExists('dnf')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}dnf install -y git`);\n } else if (process.platform === 'linux' && commandExists('yum')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}yum install -y git`);\n } else if (process.platform === 'linux' && commandExists('apk')) {\n runShell('apk add --no-cache git');\n }\n\n if (!commandExists('git')) {\n throw new Error(\n 'Git is required for UltraModern setup. Install git and run pnpm skills:install again.',\n );\n }\n};\n\nconst isInsideGitWorkTree = () => {\n try {\n return run('git', ['rev-parse', '--is-inside-work-tree']).trim() === 'true';\n } catch {\n return false;\n }\n};\n\nconst initializeGitRepository = () => {\n if (isInsideGitWorkTree()) {\n return;\n }\n\n try {\n run('git', ['init', '-b', 'main'], { stdio: 'inherit' });\n } catch {\n run('git', ['init'], { stdio: 'inherit' });\n run('git', ['branch', '-M', 'main'], { stdio: 'inherit' });\n }\n};\n\nconst installLefthook = () => {\n try {\n run('lefthook', ['install'], { stdio: 'inherit' });\n } catch (error) {\n console.warn(`Unable to install lefthook hooks: ${error.message}`);\n }\n};\n\nconst removeTree = (dir) =>\n fs.rmSync(dir, {\n force: true,\n maxRetries: 5,\n recursive: true,\n retryDelay: 100,\n });\n\nconst cloneSource = (source, targetDir) => {\n if (source.commit) {\n run('git', ['init', targetDir]);\n run('git', ['remote', 'add', 'origin', source.repository], {\n cwd: targetDir,\n });\n run('git', ['fetch', '--depth', '1', '--quiet', 'origin', source.commit], {\n cwd: targetDir,\n });\n run(\n 'git',\n [\n '-c',\n 'advice.detachedHead=false',\n 'checkout',\n '--detach',\n '--quiet',\n 'FETCH_HEAD',\n ],\n { cwd: targetDir },\n );\n return;\n }\n\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1', '--quiet']);\n } catch {\n run('git', ['clone', '--depth', '1', '--quiet', source.repository, targetDir]);\n }\n};\n\nconst resolveSkillDir = (sourceRoot, skillName) => {\n const candidates = [\n path.join(sourceRoot, skillName),\n path.join(sourceRoot, 'skills', skillName),\n path.join(sourceRoot, 'skills', 'engineering', skillName),\n path.join(sourceRoot, 'skills', 'productivity', skillName),\n ];\n return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'SKILL.md')));\n};\n\nif (!fs.existsSync(lockPath)) {\n console.error('Missing .agents/skills-lock.json');\n process.exit(1);\n}\n\nconst lock = readJson(lockPath);\nconst installDir = path.join(root, lock.installDir ?? '.agents/skills');\nconst sources = lock.sources ?? [];\nconst requiredCloneSources = sources.filter((source) => source.install === 'clone');\nconst optionalCloneSources = sources.filter(\n (source) => source.install === 'clone-if-authorized',\n);\nconst requiredSkills = [\n ...(lock.baseline ?? []),\n ...requiredCloneSources.flatMap((source) => source.baseline ?? []),\n].filter(\n (skill, index, skills) =>\n skills.findIndex((candidate) => candidate.name === skill.name) === index,\n);\n\nif (checkOnly) {\n const missingRequired = requiredSkills\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md')));\n const missingOptional = optionalCloneSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n\n if (missingRequired.length > 0) {\n console.error(\n `Required agent skills not installed: ${missingRequired.join(', ')}. Run pnpm skills:install.`,\n );\n process.exit(1);\n }\n\n if (missingOptional.length > 0) {\n console.warn(\n `Private skills not installed: ${missingOptional.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Required and private agent skills are installed.');\n process.exit(0);\n }\n console.log('Required agent skills are installed.');\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\ninstallGit();\n\nfor (const source of [...requiredCloneSources, ...optionalCloneSources]) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n try {\n cloneSource(source, tempDir);\n } catch (error) {\n if (source.install === 'clone-if-authorized') {\n console.warn(\n `Skipping ${source.repository}; current developer may not have access.`,\n );\n continue;\n }\n throw error;\n }\n for (const skill of source.baseline ?? []) {\n const sourceSkillDir = resolveSkillDir(tempDir, skill.name);\n if (!sourceSkillDir) {\n throw new Error(`Skill ${skill.name} not found in ${source.repository}`);\n }\n const targetSkillDir = path.join(installDir, skill.name);\n if (fs.existsSync(targetSkillDir)) {\n if (!force) {\n console.log(`Skipping existing ${skill.name}`);\n continue;\n }\n removeTree(targetSkillDir);\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n removeTree(tempDir);\n }\n}\n\ninitializeGitRepository();\ninstallLefthook();\n",
54
53
  "scripts/check-i18n-strings.mjs": "import fs from 'node:fs';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst scanRoots = ['src'].map((scanRoot) => path.join(root, scanRoot));\nconst ignoredDirectories = new Set(['.modern', '.modernjs', 'dist', 'node_modules']);\nconst visibleAttributePattern =\n /\\s(?:aria-label|alt|placeholder|title)=[\"']([^\"']*[A-Za-z][^\"']*)[\"']/gu;\nconst jsxTextPattern = />([^<>{}]*[A-Za-z][^<>{}]*)</gu;\nconst jsxIntrinsicTags = new Set([\n 'a',\n 'abbr',\n 'address',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'mark',\n 'menu',\n 'meta',\n 'meter',\n 'nav',\n 'ol',\n 'option',\n 'p',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n 'strong',\n 'style',\n 'summary',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'u',\n 'ul',\n 'video',\n]);\n\nconst collectFiles = (directory) => {\n if (!fs.existsSync(directory)) {\n return [];\n }\n\n const files = [];\n for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {\n if (entry.isDirectory()) {\n if (!ignoredDirectories.has(entry.name)) {\n files.push(...collectFiles(path.join(directory, entry.name)));\n }\n continue;\n }\n\n if (entry.isFile() && /\\.(jsx|tsx)$/u.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n files.push(path.join(directory, entry.name));\n }\n }\n return files;\n};\n\nconst lineNumberForIndex = (content, index) => content.slice(0, index).split('\\n').length;\nconst isCodeElementText = (content, index) => {\n const tagStart = content.lastIndexOf('<', index);\n if (tagStart === -1) {\n return false;\n }\n return /^<code(?:\\s|>)/u.test(content.slice(tagStart, index));\n};\nconst isJsxTagEnd = (content, index) => {\n const tagStart = content.lastIndexOf('<', index);\n if (tagStart === -1 || content.slice(tagStart + 1, index).includes('<')) {\n return false;\n }\n const match = content\n .slice(tagStart, index + 1)\n .match(/^<\\/?\\s*([A-Za-z][\\w:.-]*)\\b[^<>]*>$/u);\n if (!match) {\n return false;\n }\n const [, tagName] = match;\n return (\n /^[A-Z]/u.test(tagName) ||\n tagName.includes('-') ||\n jsxIntrinsicTags.has(tagName)\n );\n};\nconst isIgnoredLine = (content, index) => {\n const lineStart = content.lastIndexOf('\\n', index) + 1;\n const lineEnd = content.indexOf('\\n', index);\n const currentLineEnd = lineEnd === -1 ? content.length : lineEnd;\n const previousLineStart = content.lastIndexOf('\\n', Math.max(0, lineStart - 2)) + 1;\n const nextLineEnd = content.indexOf('\\n', currentLineEnd + 1);\n const context = content.slice(\n previousLineStart,\n nextLineEnd === -1 ? content.length : nextLineEnd,\n );\n return /i18n-ignore/u.test(context);\n};\n\nconst violations = [];\nfor (const filePath of scanRoots.flatMap(collectFiles)) {\n const content = fs.readFileSync(filePath, 'utf-8');\n for (const match of content.matchAll(visibleAttributePattern)) {\n const [, visibleText] = match;\n if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: visibleText.trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const [, jsxText] = match;\n const text = jsxText.replaceAll(/\\s+/gu, ' ').trim();\n if (\n text &&\n !isIgnoredLine(content, match.index ?? 0) &&\n isJsxTagEnd(content, match.index ?? 0) &&\n !isCodeElementText(content, match.index ?? 0)\n ) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text,\n });\n }\n }\n}\n\nif (violations.length > 0) {\n console.error('Hardcoded user-visible JSX strings found. Move copy to locale JSON files.');\n for (const violation of violations) {\n console.error(\n `${path.relative(root, violation.filePath)}:${violation.line} ${JSON.stringify(\n violation.text,\n )}`,\n );\n }\n process.exit(1);\n}\n\nconsole.log('No hardcoded user-visible JSX strings found.');\n",
54
+ "scripts/bootstrap-agent-skills.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst lockPath = path.join(root, '.agents/skills-lock.json');\nconst checkOnly = process.argv.includes('--check');\nconst force = process.argv.includes('--force');\n\nconst readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8'));\n\nconst run = (command, args, options = {}) =>\n execFileSync(command, args, {\n cwd: options.cwd ?? root,\n encoding: 'utf-8',\n stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],\n });\n\nconst commandExists = (command) => {\n try {\n run(command, ['--version'], { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n};\n\nconst runShell = (script) =>\n run('sh', ['-lc', script], {\n stdio: 'inherit',\n });\n\nconst installGit = () => {\n if (commandExists('git')) {\n return;\n }\n\n if (commandExists('brew')) {\n run('brew', ['install', 'git'], { stdio: 'inherit' });\n } else if (process.platform === 'linux' && commandExists('apt-get')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}apt-get update && ${sudo}apt-get install -y git`);\n } else if (process.platform === 'linux' && commandExists('dnf')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}dnf install -y git`);\n } else if (process.platform === 'linux' && commandExists('yum')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}yum install -y git`);\n } else if (process.platform === 'linux' && commandExists('apk')) {\n runShell('apk add --no-cache git');\n }\n\n if (!commandExists('git')) {\n throw new Error(\n 'Git is required for UltraModern setup. Install git and run pnpm skills:install again.',\n );\n }\n};\n\nconst isInsideGitWorkTree = () => {\n try {\n return run('git', ['rev-parse', '--is-inside-work-tree']).trim() === 'true';\n } catch {\n return false;\n }\n};\n\nconst initializeGitRepository = () => {\n if (isInsideGitWorkTree()) {\n return;\n }\n\n try {\n run('git', ['init', '-b', 'main'], { stdio: 'inherit' });\n } catch {\n run('git', ['init'], { stdio: 'inherit' });\n run('git', ['branch', '-M', 'main'], { stdio: 'inherit' });\n }\n};\n\nconst installLefthook = () => {\n try {\n run('lefthook', ['install'], { stdio: 'inherit' });\n } catch (error) {\n console.warn(`Unable to install lefthook hooks: ${error.message}`);\n }\n};\n\nconst removeTree = (dir) =>\n fs.rmSync(dir, {\n force: true,\n maxRetries: 5,\n recursive: true,\n retryDelay: 100,\n });\n\nconst cloneSource = (source, targetDir) => {\n if (source.commit) {\n run('git', ['init', targetDir]);\n run('git', ['remote', 'add', 'origin', source.repository], {\n cwd: targetDir,\n });\n run('git', ['fetch', '--depth', '1', '--quiet', 'origin', source.commit], {\n cwd: targetDir,\n });\n run(\n 'git',\n [\n '-c',\n 'advice.detachedHead=false',\n 'checkout',\n '--detach',\n '--quiet',\n 'FETCH_HEAD',\n ],\n { cwd: targetDir },\n );\n return;\n }\n\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1', '--quiet']);\n } catch {\n run('git', ['clone', '--depth', '1', '--quiet', source.repository, targetDir]);\n }\n};\n\nconst resolveSkillDir = (sourceRoot, skillName) => {\n const candidates = [\n path.join(sourceRoot, skillName),\n path.join(sourceRoot, 'skills', skillName),\n path.join(sourceRoot, 'skills', 'engineering', skillName),\n path.join(sourceRoot, 'skills', 'productivity', skillName),\n ];\n return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'SKILL.md')));\n};\n\nif (!fs.existsSync(lockPath)) {\n console.error('Missing .agents/skills-lock.json');\n process.exit(1);\n}\n\nconst lock = readJson(lockPath);\nconst installDir = path.join(root, lock.installDir ?? '.agents/skills');\nconst sources = lock.sources ?? [];\nconst requiredCloneSources = sources.filter((source) => source.install === 'clone');\nconst optionalCloneSources = sources.filter(\n (source) => source.install === 'clone-if-authorized',\n);\nconst requiredSkills = [\n ...(lock.baseline ?? []),\n ...requiredCloneSources.flatMap((source) => source.baseline ?? []),\n].filter(\n (skill, index, skills) =>\n skills.findIndex((candidate) => candidate.name === skill.name) === index,\n);\n\nif (checkOnly) {\n const missingRequired = requiredSkills\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md')));\n const missingOptional = optionalCloneSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n\n if (missingRequired.length > 0) {\n console.error(\n `Required agent skills not installed: ${missingRequired.join(', ')}. Run pnpm skills:install.`,\n );\n process.exit(1);\n }\n\n if (missingOptional.length > 0) {\n console.warn(\n `Private skills not installed: ${missingOptional.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Required and private agent skills are installed.');\n process.exit(0);\n }\n console.log('Required agent skills are installed.');\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\ninstallGit();\n\nfor (const source of [...requiredCloneSources, ...optionalCloneSources]) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n try {\n cloneSource(source, tempDir);\n } catch (error) {\n if (source.install === 'clone-if-authorized') {\n console.warn(\n `Skipping ${source.repository}; current developer may not have access.`,\n );\n continue;\n }\n throw error;\n }\n for (const skill of source.baseline ?? []) {\n const sourceSkillDir = resolveSkillDir(tempDir, skill.name);\n if (!sourceSkillDir) {\n throw new Error(`Skill ${skill.name} not found in ${source.repository}`);\n }\n const targetSkillDir = path.join(installDir, skill.name);\n if (fs.existsSync(targetSkillDir)) {\n if (!force) {\n console.log(`Skipping existing ${skill.name}`);\n continue;\n }\n removeTree(targetSkillDir);\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n removeTree(tempDir);\n }\n}\n\ninitializeGitRepository();\ninstallLefthook();\n",
55
55
  "scripts/validate-ultramodern.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst configPath = path.resolve(process.cwd(), 'modern.config.ts');\nconst templateManifestPath = path.resolve(process.cwd(), '.modernjs/mv-template-manifest.json');\nconst packageSourcePath = path.resolve(\n process.cwd(),\n '.modernjs/ultramodern-package-source.json',\n);\nconst readText = (relativePath) =>\n fs.readFileSync(path.resolve(process.cwd(), relativePath), 'utf-8');\nconst readJson = (relativePath) => JSON.parse(readText(relativePath));\nconst readPnpmConfig = (key) => {\n const env = Object.fromEntries(\n Object.entries(process.env).filter(\n ([envKey]) => !/^(?:npm|pnpm)_config_/iu.test(envKey),\n ),\n );\n const output = execFileSync('pnpm', ['config', 'get', key, '--json'], {\n cwd: process.cwd(),\n encoding: 'utf-8',\n env,\n stdio: ['ignore', 'pipe', 'pipe'],\n }).trim();\n return output ? JSON.parse(output) : undefined;\n};\nconst enableTailwind = true;\nconst expectedPnpmVersion = '11.5.0';\nconst activePnpmVersion = execFileSync('pnpm', ['--version'], {\n cwd: process.cwd(),\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'pipe'],\n}).trim();\n\nif (activePnpmVersion !== expectedPnpmVersion) {\n console.error(\n `Generated app requires pnpm ${expectedPnpmVersion}; active pnpm is ${activePnpmVersion}. Run mise install, then rerun pnpm from the activated shell`,\n );\n process.exit(1);\n}\n\nif (!fs.existsSync(configPath)) {\n console.error('modern.config.ts not found');\n process.exit(1);\n}\n\nconst content = fs.readFileSync(configPath, 'utf-8');\nconst requiredTokens = [\n 'presetUltramodern(',\n 'appTools()',\n 'enableModuleFederationSSR',\n 'enableBffRequestId',\n 'enableTelemetryExporters',\n 'i18nPlugin(',\n 'localePathRedirect: true',\n 'ULTRAMODERN_SITE_URL',\n 'MODERN_PUBLIC_SITE_URL must be set for production builds',\n 'globalVars',\n];\nconst missing = requiredTokens.filter((token) => !content.includes(token));\n\nif (missing.length > 0) {\n console.error(`Ultramodern contract check failed. Missing tokens: ${missing.join(', ')}`);\n process.exit(1);\n}\n\nif (!fs.existsSync(templateManifestPath)) {\n console.error('.modernjs/mv-template-manifest.json not found');\n process.exit(1);\n}\n\nconst templateManifest = JSON.parse(fs.readFileSync(templateManifestPath, 'utf-8'));\nconst requiredDeniedPaths = [\n '.git/**',\n '.npmrc',\n '.yarnrc',\n '.env',\n '.env.*',\n 'node_modules/**',\n 'dist/**',\n];\nconst requiredPostMaterialization = [\n 'ultramodern-contract-check',\n 'agent-skill-postinstall-allowed',\n 'github-workflow-security-enforced',\n 'package-source-retained',\n 'pnpm-11-policy-enforced',\n 'rstest-smoke-tests',\n 'template-manifest-retained',\n];\nconst requiredPaths = [\n\n 'AGENTS.md',\n '.agents/skills-lock.json',\n '.codex/hooks.json',\n '.github/renovate.json',\n '.github/workflows/ultramodern-gates.yml',\n 'lefthook.yml',\n 'oxlint.config.ts',\n 'oxfmt.config.ts',\n 'scripts/bootstrap-agent-skills.mjs',\n\n '.mise.toml',\n '.modernjs/ultramodern-package-source.json',\n 'pnpm-workspace.yaml',\n 'rstest.config.mts',\n 'scripts/check-i18n-strings.mjs',\n\n 'postcss.config.mjs',\n 'tailwind.config.ts',\n\n 'config/public/locales/en/translation.json',\n 'config/public/locales/cs/translation.json',\n 'config/favicon.svg',\n 'config/public/assets/ultramodern-logo.svg',\n 'src/modern-app-env.d.ts',\n 'src/routes/index.css',\n 'src/routes/layout.tsx',\n 'src/routes/[lang]/page.tsx',\n 'tests/ultramodern.contract.test.ts',\n];\nconst manifestErrors = [];\n\nfor (const requiredPath of requiredPaths) {\n if (!fs.existsSync(path.resolve(process.cwd(), requiredPath))) {\n console.error(`${requiredPath} not found`);\n process.exit(1);\n }\n}\n\nif (fs.existsSync(path.resolve(process.cwd(), 'src/routes/page.tsx'))) {\n console.error('src/routes/page.tsx must move under src/routes/[lang]/page.tsx');\n process.exit(1);\n}\n\nif (\n !enableTailwind &&\n (fs.existsSync(path.resolve(process.cwd(), 'postcss.config.mjs')) ||\n fs.existsSync(path.resolve(process.cwd(), 'tailwind.config.ts')))\n) {\n console.error('Tailwind config files must not be written when Tailwind is disabled');\n process.exit(1);\n}\n\n\nconst workflowContent = fs.readFileSync(\n path.resolve(process.cwd(), '.github/workflows/ultramodern-gates.yml'),\n 'utf-8',\n);\nconst renovateConfig = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.github/renovate.json'), 'utf-8'),\n);\nfor (const requiredSnippet of [\n 'permissions:\\n contents: read',\n 'pull_request:',\n 'persist-credentials: false',\n 'jdx/mise-action',\n 'pnpm install --frozen-lockfile',\n 'pnpm run ultramodern:check',\n 'pnpm run build',\n 'MODERN_PUBLIC_SITE_URL: http://localhost:8080',\n 'timeout-minutes:',\n 'egress-policy: audit',\n]) {\n if (!workflowContent.includes(requiredSnippet)) {\n console.error(`Generated workflow must retain ${requiredSnippet.split('\\n')[0]}`);\n process.exit(1);\n }\n}\nif (workflowContent.includes('pull_request_target')) {\n console.error('Generated workflow must not use pull_request_target');\n process.exit(1);\n}\nfor (const match of workflowContent.matchAll(/^\\s*uses:\\s*([^@\\s]+)@([^\\s#]+)/gmu)) {\n const [, actionName, actionRef] = match;\n if (!/^[a-f0-9]{40}$/u.test(actionRef)) {\n console.error(`Generated workflow must pin ${actionName}@${actionRef} to a commit SHA`);\n process.exit(1);\n }\n}\nif (\n renovateConfig.dependencyDashboard !== true ||\n renovateConfig.minimumReleaseAge !== '1 day' ||\n !renovateConfig.extends?.includes('helpers:pinGitHubActionDigests') ||\n !renovateConfig.packageRules?.some(\n (rule) =>\n rule.dependencyDashboardApproval === true && rule.matchUpdateTypes?.includes('major'),\n )\n) {\n console.error('Generated Renovate config must retain dashboard, release-age, action pinning, and major-approval policy');\n process.exit(1);\n}\n\n\nif (templateManifest.schemaVersion !== 1) {\n manifestErrors.push('schemaVersion');\n}\n\nif (templateManifest.source?.type !== 'builtin') {\n manifestErrors.push('source.type');\n}\n\nif (\n !Array.isArray(templateManifest.integrity?.checksums) ||\n !templateManifest.integrity.checksums.some(\n (checksum) =>\n checksum.algorithm === 'sha256' &&\n checksum.scope === 'source-tree' &&\n /^[0-9a-f]{64}$/u.test(checksum.value),\n )\n) {\n manifestErrors.push('integrity.checksums[source-tree]');\n}\n\nfor (const deniedPath of requiredDeniedPaths) {\n if (!templateManifest.materialization?.deniedPaths?.includes(deniedPath)) {\n manifestErrors.push(`materialization.deniedPaths:${deniedPath}`);\n }\n}\n\nif (templateManifest.lifecyclePolicy?.denyByDefault !== true) {\n manifestErrors.push('lifecyclePolicy.denyByDefault');\n}\nif (\n JSON.stringify(templateManifest.lifecyclePolicy?.allowedScripts) !==\n JSON.stringify(['postinstall'])\n) {\n manifestErrors.push('lifecyclePolicy.allowedScripts');\n}\n\nfor (const token of requiredPostMaterialization) {\n if (!templateManifest.validation?.postMaterializationValidation?.includes(token)) {\n manifestErrors.push(`validation.postMaterializationValidation:${token}`);\n }\n}\n\nif (manifestErrors.length > 0) {\n console.error(\n `Ultramodern template manifest check failed. Invalid fields: ${manifestErrors.join(', ')}`,\n );\n process.exit(1);\n}\n\nconst packageJson = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), 'package.json'), 'utf-8'),\n);\nconst packageSource = JSON.parse(fs.readFileSync(packageSourcePath, 'utf-8'));\nconst routePage = readText('src/routes/[lang]/page.tsx');\nconst routeCss = readText('src/routes/index.css');\nconst modernConfig = readText('modern.config.ts');\nconst enLocale = readJson('config/public/locales/en/translation.json');\nconst csLocale = readJson('config/public/locales/cs/translation.json');\nconst unresolvedTemplateMarker = String.fromCodePoint(123, 123);\nif (JSON.stringify(packageJson).includes(unresolvedTemplateMarker)) {\n console.error('package.json contains unresolved template markers');\n process.exit(1);\n}\nif (JSON.stringify(packageSource).includes(unresolvedTemplateMarker)) {\n console.error('package source metadata contains unresolved template markers');\n process.exit(1);\n}\n\nfor (const [fileName, text] of [\n ['src/routes/[lang]/page.tsx', routePage],\n ['src/routes/index.css', routeCss],\n ['modern.config.ts', modernConfig],\n]) {\n if (text.includes('lf3-static.bytednsdoc.com')) {\n console.error(`${fileName} must not depend on remote starter assets`);\n process.exit(1);\n }\n}\n\nfor (const requiredSnippet of [\n '<Helmet',\n 'htmlAttributes={{',\n 'dir: languageDirections[currentLanguage]',\n 'lang: currentLanguage',\n '<title>{pageTitle}</title>',\n '<meta name=\"description\" content={pageDescription} />',\n '<main id=\"starter-main\" className=\"starter-main\">',\n '<h1 id=\"starter-heading\" className=\"title\">',\n 'src=\"/assets/ultramodern-logo.svg\"',\n 'height={96}',\n 'width={96}',\n '<span aria-hidden=\"true\" className=\"arrow-right\" />',\n]) {\n if (!routePage.includes(requiredSnippet)) {\n console.error(`Generated route page must retain starter correctness snippet: ${requiredSnippet}`);\n process.exit(1);\n }\n}\n\nfor (const forbiddenSnippet of ['src=\"https://', '<div className=\"title\">']) {\n if (routePage.includes(forbiddenSnippet)) {\n console.error(`Generated route page must not contain ${forbiddenSnippet}`);\n process.exit(1);\n }\n}\n\nfor (const requiredSnippet of [\n 'width=device-width, initial-scale=1.0, viewport-fit=cover',\n \"title: 'UltraModern.js Starter'\",\n]) {\n if (!modernConfig.includes(requiredSnippet)) {\n console.error(`modern.config.ts must retain ${requiredSnippet}`);\n process.exit(1);\n }\n}\nif (modernConfig.includes('user-scalable=no') || modernConfig.includes('maximum-scale')) {\n console.error('modern.config.ts must not disable user zoom');\n process.exit(1);\n}\n\nfor (const requiredSnippet of [\n 'min-block-size: 100dvh',\n 'grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr))',\n ':focus-visible',\n '@media (prefers-reduced-motion: reduce)',\n '.skip-link',\n]) {\n if (!routeCss.includes(requiredSnippet)) {\n console.error(`Starter CSS must retain ${requiredSnippet}`);\n process.exit(1);\n }\n}\nif (routeCss.includes('width: 1100px') || /\\.card:focus(?!-visible)/u.test(routeCss)) {\n console.error('Starter CSS must not reintroduce fixed grid width or focus transform styling');\n process.exit(1);\n}\n\nfor (const [localeName, locale] of [\n ['en', enLocale],\n ['cs', csLocale],\n]) {\n if (\n typeof locale.home?.meta?.title !== 'string' ||\n typeof locale.home?.meta?.description !== 'string' ||\n typeof locale.home?.skipLink !== 'string'\n ) {\n console.error(`${localeName} locale must include starter metadata and skip-link copy`);\n process.exit(1);\n }\n}\n\nconst skillsLock = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.agents/skills-lock.json'), 'utf-8'),\n);\n\nconst requiredScripts = {\n\n format: 'oxfmt .',\n 'format:check': 'oxfmt --check .',\n\n 'i18n:check': 'node ./scripts/check-i18n-strings.mjs',\n\n lint: 'oxlint .',\n 'lint:fix': 'oxlint . --fix',\n postinstall: 'oxfmt . && node ./scripts/bootstrap-agent-skills.mjs',\n 'skills:check': 'node ./scripts/bootstrap-agent-skills.mjs --check',\n 'skills:install': 'node ./scripts/bootstrap-agent-skills.mjs',\n\n test: 'rstest run',\n};\n\nfor (const [scriptName, scriptCommand] of Object.entries(requiredScripts)) {\n if (packageJson.scripts?.[scriptName] !== scriptCommand) {\n console.error(`Missing or invalid package script: ${scriptName}`);\n process.exit(1);\n }\n}\n\nif (\n !packageJson.scripts?.typecheck?.includes('effect-tsgo') ||\n !packageJson.scripts.typecheck.includes('get-exe-path')\n) {\n console.error('typecheck must use effect-tsgo as the TypeScript checker');\n process.exit(1);\n}\n\nif (!packageJson.scripts?.['ultramodern:check']?.includes('pnpm test')) {\n console.error('ultramodern:check must run the generated Rstest suite');\n process.exit(1);\n}\n\nif (packageJson.private !== true) {\n console.error('Generated app package must be private by default');\n process.exit(1);\n}\n\nconst miseConfig = fs.readFileSync(path.resolve(process.cwd(), '.mise.toml'), 'utf-8');\nif (!miseConfig.includes(`pnpm = \"${expectedPnpmVersion}\"`)) {\n console.error(`Generated app must pin pnpm ${expectedPnpmVersion} in .mise.toml`);\n process.exit(1);\n}\n\nif (packageJson.packageManager !== `pnpm@${expectedPnpmVersion}`) {\n console.error(`Generated app package must pin pnpm@${expectedPnpmVersion}`);\n process.exit(1);\n}\n\nif (packageJson.engines?.pnpm !== `>=${expectedPnpmVersion} <11.6.0`) {\n console.error(`Generated app package must require pnpm >=${expectedPnpmVersion} <11.6.0`);\n process.exit(1);\n}\n\nif (packageJson.pnpm !== undefined) {\n console.error('Generated app must keep pnpm policy in pnpm-workspace.yaml, not package.json');\n process.exit(1);\n}\n\nif (readPnpmConfig('minimumReleaseAge') !== 1440) {\n console.error('pnpm minimumReleaseAge must be 1440');\n process.exit(1);\n}\nif (readPnpmConfig('minimumReleaseAgeStrict') !== true) {\n console.error('pnpm minimumReleaseAgeStrict must be true');\n process.exit(1);\n}\nif (readPnpmConfig('minimumReleaseAgeIgnoreMissingTime') !== false) {\n console.error('pnpm minimumReleaseAgeIgnoreMissingTime must be false');\n process.exit(1);\n}\nconst expectedMinimumReleaseAgeExcludes = [\n '@bleedingdev/modern-js-*',\n '@tanstack/react-router',\n '@tanstack/router-core',\n '@typescript/native-preview',\n '@typescript/native-preview-*',\n '@types/react',\n];\nif (\n JSON.stringify(readPnpmConfig('minimumReleaseAgeExclude')) !==\n JSON.stringify(expectedMinimumReleaseAgeExcludes)\n) {\n console.error('pnpm minimumReleaseAgeExclude must allow only approved latest-lane package cohorts');\n process.exit(1);\n}\nif (readPnpmConfig('trustPolicy') !== 'no-downgrade') {\n console.error('pnpm trustPolicy must be no-downgrade');\n process.exit(1);\n}\nfor (const [key, expected] of [\n ['trustPolicyIgnoreAfter', 1440],\n ['blockExoticSubdeps', true],\n ['engineStrict', true],\n ['pmOnFail', 'error'],\n ['verifyDepsBeforeRun', 'error'],\n ['strictDepBuilds', true],\n]) {\n if (readPnpmConfig(key) !== expected) {\n console.error(`pnpm ${key} must be ${String(expected)}`);\n process.exit(1);\n }\n}\nif (\n JSON.stringify(readPnpmConfig('allowBuilds')) !==\n JSON.stringify({\n '@swc/core': true,\n 'core-js': true,\n esbuild: true,\n lefthook: true,\n 'msgpackr-extract': true,\n sharp: true,\n workerd: true,\n })\n) {\n console.error('pnpm allowBuilds must approve only the generated app build dependencies');\n process.exit(1);\n}\nif (\n JSON.stringify(readPnpmConfig('onlyBuiltDependencies')) !==\n JSON.stringify(['@swc/core', 'core-js', 'esbuild', 'lefthook', 'msgpackr-extract', 'sharp', 'workerd'])\n) {\n console.error('pnpm onlyBuiltDependencies must approve only the generated app build dependencies');\n process.exit(1);\n}\n\nif (packageJson.modernjs?.preset !== 'presetUltramodern') {\n console.error('package.json must declare presetUltramodern metadata');\n process.exit(1);\n}\n\nif (\n packageJson.modernjs?.packageSource?.config !== './.modernjs/ultramodern-package-source.json'\n) {\n console.error('package.json must retain package source metadata location');\n process.exit(1);\n}\n\nif (packageJson.modernjs?.packageSource?.strategy !== packageSource.strategy) {\n console.error('package.json package source strategy must match package source metadata');\n process.exit(1);\n}\n\nif (packageSource.schemaVersion !== 1) {\n console.error('Package source metadata must use schemaVersion 1');\n process.exit(1);\n}\n\nif (packageSource.preset !== 'presetUltramodern') {\n console.error('Package source metadata must declare presetUltramodern');\n process.exit(1);\n}\n\nif (packageSource.strategy !== 'workspace' && packageSource.strategy !== 'install') {\n console.error('Package source strategy must be workspace or install');\n process.exit(1);\n}\n\nconst declaredModernPackages = packageSource.modernPackages?.packages;\nif (!Array.isArray(declaredModernPackages) || declaredModernPackages.length === 0) {\n console.error('Package source metadata must declare the generated Modern package cohort');\n process.exit(1);\n}\n\nconst invalidModernPackages = declaredModernPackages.filter(\n (packageName) => typeof packageName !== 'string' || !packageName.startsWith('@modern-js/'),\n);\nif (invalidModernPackages.length > 0) {\n console.error(`Package source metadata contains invalid Modern packages: ${invalidModernPackages.join(', ')}`);\n process.exit(1);\n}\n\nconst packageJsonModernDependencies = [\n ...new Set(\n ['dependencies', 'devDependencies']\n .flatMap((section) => Object.keys(packageJson[section] ?? {}))\n .filter((packageName) => packageName.startsWith('@modern-js/')),\n ),\n];\nconst missingMetadataPackages = packageJsonModernDependencies.filter(\n (packageName) => !declaredModernPackages.includes(packageName),\n);\nif (missingMetadataPackages.length > 0) {\n console.error(`Package source metadata must include package.json Modern dependencies: ${missingMetadataPackages.join(', ')}`);\n process.exit(1);\n}\n\nconst expectedModernSpecifier = packageSource.modernPackages?.specifier;\nif (typeof expectedModernSpecifier !== 'string' || expectedModernSpecifier.length === 0) {\n console.error('Package source metadata must provide a Modern package specifier');\n process.exit(1);\n}\nif (\n packageSource.strategy === 'install' &&\n expectedModernSpecifier !== templateManifest.template?.version\n) {\n console.error(\n `Package source Modern specifier ${expectedModernSpecifier} must match template version ${templateManifest.template?.version}`,\n );\n process.exit(1);\n}\n\nconst expectedModernDependency = (packageName) => {\n const alias = packageSource.modernPackages?.aliases?.[packageName];\n return typeof alias === 'string'\n ? `npm:${alias}@${expectedModernSpecifier}`\n : expectedModernSpecifier;\n};\n\nfor (const section of ['dependencies', 'devDependencies']) {\n for (const packageName of declaredModernPackages) {\n if (\n packageJson[section]?.[packageName] &&\n packageJson[section][packageName] !== expectedModernDependency(packageName)\n ) {\n console.error(`${section}.${packageName} must match package source metadata`);\n process.exit(1);\n }\n }\n}\n\nfor (const dependency of ['@modern-js/plugin-i18n', 'i18next', 'react-i18next']) {\n if (!packageJson.dependencies?.[dependency]) {\n console.error(`Missing dependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nfor (const dependency of [\n '@effect/tsgo',\n '@modern-js/adapter-rstest',\n '@rstest/core',\n '@typescript/native-preview',\n 'happy-dom',\n\n '@tailwindcss/postcss',\n 'postcss',\n 'tailwindcss',\n\n\n 'lefthook',\n 'oxlint',\n 'oxfmt',\n 'ultracite',\n\n]) {\n if (!packageJson.devDependencies?.[dependency]) {\n console.error(`Missing devDependency: ${dependency}`);\n process.exit(1);\n }\n}\n\n\nif (\n packageJson.devDependencies?.tailwindcss !== '^4.3.0' ||\n packageJson.devDependencies?.['@tailwindcss/postcss'] !== '^4.3.0'\n) {\n console.error('Tailwind CSS dependencies must use the UltraModern default baseline');\n process.exit(1);\n}\n\n\n\n\nconst privateSource = skillsLock.sources?.find(\n (source) => source.repository === 'https://github.com/TechsioCZ/skills',\n);\nconst privateSkills = new Set(privateSource?.baseline?.map((skill) => skill.name));\nfor (const skillName of ['plan-graph', 'dag', 'subagent-graph', 'helm', 'debugger-mode']) {\n if (!privateSkills.has(skillName)) {\n console.error(`Missing private skill allowlist entry: ${skillName}`);\n process.exit(1);\n }\n}\n\n\nconsole.log('Ultramodern contract check passed.');\n",
56
56
  "tests/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"types\": [\"@rstest/core/globals\"]\n },\n \"include\": [\"./\"]\n}\n",
57
57
  "tests/ultramodern.contract.test.ts": "import fs from 'node:fs';\nimport path from 'node:path';\nimport { describe, expect, test } from '@rstest/core';\n\nconst root = process.cwd();\nconst readText = (relativePath: string) =>\n fs.readFileSync(path.join(root, relativePath), 'utf-8');\nconst readJson = <T>(relativePath: string): T =>\n JSON.parse(readText(relativePath)) as T;\n\ndescribe('generated UltraModern contract', () => {\n test('keeps localized route metadata and Rstest wiring', () => {\n expect(fs.existsSync(path.join(root, 'src/routes/[lang]/page.tsx'))).toBe(\n true,\n );\n expect(fs.existsSync(path.join(root, 'src/routes/page.tsx'))).toBe(false);\n expect(fs.existsSync(path.join(root, 'src/routes/layout.tsx'))).toBe(true);\n\n expect(fs.existsSync(path.join(root, 'postcss.config.mjs'))).toBe(true);\n expect(fs.existsSync(path.join(root, 'tailwind.config.ts'))).toBe(true);\n\n\n });\n\n test('keeps UltraModern starter web correctness defaults', () => {\n const routePage = readText('src/routes/[lang]/page.tsx');\n const routeCss = readText('src/routes/index.css');\n const modernConfig = readText('modern.config.ts');\n const enLocale = readJson<{\n home?: {\n meta?: {\n description?: string;\n title?: string;\n };\n skipLink?: string;\n };\n }>('config/public/locales/en/translation.json');\n\n expect(fs.existsSync(path.join(root, 'config/favicon.svg'))).toBe(true);\n expect(\n fs.existsSync(\n path.join(root, 'config/public/assets/ultramodern-logo.svg'),\n ),\n ).toBe(true);\n expect(routePage).not.toContain('lf3-static.bytednsdoc.com');\n expect(routePage).toContain('<Helmet');\n expect(routePage).toContain('htmlAttributes={{');\n expect(routePage).toContain('dir: languageDirections[currentLanguage]');\n expect(routePage).toContain('lang: currentLanguage');\n expect(routePage).toContain('<title>{pageTitle}</title>');\n expect(routePage).toContain(\n '<meta name=\"description\" content={pageDescription} />',\n );\n expect(routePage).toContain(\n '<main id=\"starter-main\" className=\"starter-main\">',\n );\n expect(routePage).toContain('<h1 id=\"starter-heading\" className=\"title\">');\n expect(routePage).toContain('src=\"/assets/ultramodern-logo.svg\"');\n expect(routePage).toContain('height={96}');\n expect(routePage).toContain('width={96}');\n expect(routePage).toContain(\n '<span aria-hidden=\"true\" className=\"arrow-right\" />',\n );\n expect(routePage).not.toContain('<div className=\"title\">');\n expect(modernConfig).toContain(\n 'width=device-width, initial-scale=1.0, viewport-fit=cover',\n );\n expect(modernConfig).not.toContain('user-scalable=no');\n expect(modernConfig).not.toContain('maximum-scale');\n expect(routeCss).toContain('min-block-size: 100dvh');\n expect(routeCss).toContain(\n 'grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr))',\n );\n expect(routeCss).toContain(':focus-visible');\n expect(routeCss).toContain('@media (prefers-reduced-motion: reduce)');\n expect(routeCss).not.toContain('width: 1100px');\n expect(enLocale.home?.meta?.title).toBe('UltraModern.js Starter');\n expect(enLocale.home?.meta?.description).toBeTruthy();\n expect(enLocale.home?.skipLink).toBeTruthy();\n });\n\n test('retains package-source metadata for generated Modern.js packages', () => {\n const packageJson = readJson<{\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n modernjs?: {\n packageSource?: {\n config?: string;\n strategy?: string;\n };\n preset?: string;\n };\n }>('package.json');\n const packageSource = readJson<{\n modernPackages?: {\n packages?: string[];\n specifier?: string;\n };\n strategy?: string;\n }>('.modernjs/ultramodern-package-source.json');\n\n expect(packageJson.modernjs?.preset).toBe('presetUltramodern');\n expect(packageJson.modernjs?.packageSource?.config).toBe(\n './.modernjs/ultramodern-package-source.json',\n );\n expect(packageJson.modernjs?.packageSource?.strategy).toBe(\n packageSource.strategy,\n );\n expect(packageSource.strategy).toMatch(/^(workspace|install)$/u);\n const generatedModernDependencies = [\n ...new Set(\n (['dependencies', 'devDependencies'] as const).flatMap(section =>\n Object.keys(packageJson[section] ?? {}),\n ),\n ),\n ].filter(packageName => packageName.startsWith('@modern-js/'));\n expect(packageSource.modernPackages?.packages?.length).toBeGreaterThan(0);\n expect(packageSource.modernPackages?.packages).toEqual(\n expect.arrayContaining(generatedModernDependencies),\n );\n expect(packageSource.modernPackages?.specifier).toBeTruthy();\n expect(\n packageJson.devDependencies?.['@modern-js/adapter-rstest'],\n ).toBeTruthy();\n\n expect(packageJson.devDependencies?.tailwindcss).toBe('^4.3.0');\n expect(packageJson.devDependencies?.['@tailwindcss/postcss']).toBe(\n '^4.3.0',\n );\n\n\n });\n});\n",
58
58
  ".github/renovate.json": "{\n \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n \"extends\": [\n \"config:recommended\",\n \"helpers:pinGitHubActionDigests\"\n ],\n \"dependencyDashboard\": true,\n \"minimumReleaseAge\": \"1 day\",\n \"prConcurrentLimit\": 5,\n \"prHourlyLimit\": 2,\n \"rangeStrategy\": \"bump\",\n \"schedule\": [\n \"before 5am on monday\"\n ],\n \"timezone\": \"Etc/UTC\",\n \"packageRules\": [\n {\n \"matchManagers\": [\n \"github-actions\"\n ],\n \"groupName\": \"github-actions\",\n \"labels\": [\n \"dependencies\",\n \"github-actions\",\n \"security\"\n ]\n },\n {\n \"matchManagers\": [\n \"npm\"\n ],\n \"matchUpdateTypes\": [\n \"patch\",\n \"minor\"\n ],\n \"groupName\": \"npm minor and patch updates\",\n \"labels\": [\n \"dependencies\",\n \"npm\"\n ]\n },\n {\n \"matchUpdateTypes\": [\n \"major\"\n ],\n \"dependencyDashboardApproval\": true,\n \"labels\": [\n \"dependencies\",\n \"major\"\n ]\n }\n ]\n}\n",
59
59
  ".github/workflows/ultramodern-gates.yml": "name: Ultramodern Gates\n\non:\n push:\n pull_request:\n\npermissions:\n contents: read\n\ndefaults:\n run:\n shell: bash\n\nenv:\n FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true\n\nconcurrency:\n group: ultramodern-gates-${{ github.workflow }}-${{ github.ref }}\n cancel-in-progress: true\n\njobs:\n ultramodern-gates:\n runs-on: ubuntu-latest\n timeout-minutes: 20\n steps:\n - name: Harden Runner\n uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2\n with:\n egress-policy: audit\n\n - name: Checkout\n uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2\n with:\n fetch-depth: 1\n persist-credentials: false\n\n - name: Setup Node.js\n uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0\n with:\n node-version: 24\n\n - name: Setup mise\n uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0\n\n - name: Install Dependencies\n run: mise exec -- pnpm install --frozen-lockfile\n\n - name: Validate Ultramodern Contract\n run: mise exec -- pnpm run ultramodern:check\n\n - name: Build\n env:\n MODERN_PUBLIC_SITE_URL: http://localhost:8080\n run: mise exec -- pnpm run build\n",
60
- "api/effect/index.ts": "import {\n Effect,\n HttpApiBuilder,\n Layer,\n defineEffectBff,\n} from '@modern-js/plugin-bff/effect-server';\nimport type { HttpApi, HttpApiGroup } from '@modern-js/plugin-bff/effect-server';\nimport { bffEffectApi } from '../../shared/effect/api.ts';\n\ntype ApiGroups<TApi> = TApi extends HttpApi.HttpApi<string, infer TGroups> ? TGroups : never;\ntype GreetingsHandlers = HttpApiBuilder.Handlers.FromGroup<\n HttpApiGroup.WithName<ApiGroups<typeof bffEffectApi>, 'greetings'>\n>;\n\nconst greetingsLayer = HttpApiBuilder.group(\n bffEffectApi,\n 'greetings',\n (handlers: GreetingsHandlers) =>\n handlers.handle('hello', () =>\n Effect.succeed({\n message: 'Hello from Effect HttpApi',\n runtime: 'effect' as const,\n }),\n ),\n);\n\nconst layer = HttpApiBuilder.layer(bffEffectApi).pipe(\n Layer.provide(greetingsLayer),\n);\n\nexport default defineEffectBff({\n api: bffEffectApi,\n layer,\n});\n",
61
60
  "api/lambda/hello.ts": "\n",
61
+ "api/effect/index.ts": "import {\n Effect,\n HttpApiBuilder,\n Layer,\n defineEffectBff,\n} from '@modern-js/plugin-bff/effect-server';\nimport type { HttpApi, HttpApiGroup } from '@modern-js/plugin-bff/effect-server';\nimport { bffEffectApi } from '../../shared/effect/api.ts';\n\ntype ApiGroups<TApi> = TApi extends HttpApi.HttpApi<string, infer TGroups> ? TGroups : never;\ntype GreetingsHandlers = HttpApiBuilder.Handlers.FromGroup<\n HttpApiGroup.WithName<ApiGroups<typeof bffEffectApi>, 'greetings'>\n>;\n\nconst greetingsLayer = HttpApiBuilder.group(\n bffEffectApi,\n 'greetings',\n (handlers: GreetingsHandlers) =>\n handlers.handle('hello', () =>\n Effect.succeed({\n message: 'Hello from Effect HttpApi',\n runtime: 'effect' as const,\n }),\n ),\n);\n\nconst layer = HttpApiBuilder.layer(bffEffectApi).pipe(\n Layer.provide(greetingsLayer),\n);\n\nexport default defineEffectBff({\n api: bffEffectApi,\n layer,\n});\n",
62
62
  "shared/effect/api.ts": "import {\n HttpApi,\n HttpApiEndpoint,\n HttpApiGroup,\n Schema,\n} from '@modern-js/plugin-bff/effect-client';\n\nexport const bffEffectApi = HttpApi.make('BffApi').add(\n HttpApiGroup.make('greetings').add(\n HttpApiEndpoint.get('hello', '/effect/hello', {\n success: Schema.Struct({\n message: Schema.String,\n runtime: Schema.Literal('effect'),\n }),\n }),\n ),\n);\n",
63
63
  "src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n\ndeclare const ULTRAMODERN_SITE_URL: string;\n",
64
64
  "src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\nimport { createInstance } from 'i18next';\n\nconst i18nInstance = createInstance();\n\nexport default defineRuntimeConfig({\n i18n: {\n i18nInstance,\n initOptions: {\n defaultNS: 'translation',\n fallbackLng: 'en',\n interpolation: {\n escapeValue: false,\n },\n ns: ['translation'],\n supportedLngs: ['en', 'cs'],\n },\n },\n router: {\n framework: 'tanstack',\n },\n});\n",
@@ -18,15 +18,15 @@ const MWAFiles = {
18
18
  "tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"target\": \"ESNext\",\n \"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n \"module\": \"preserve\",\n \"moduleResolution\": \"Bundler\",\n \"moduleDetection\": \"force\",\n \"isolatedModules\": true,\n \"verbatimModuleSyntax\": true,\n \"noEmit\": true,\n \"allowJs\": true,\n \"allowImportingTsExtensions\": true,\n \"resolveJsonModule\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true,\n \"strict\": true,\n \"noUncheckedIndexedAccess\": true,\n \"exactOptionalPropertyTypes\": true,\n \"noImplicitOverride\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@api/*\": [\"./api/*\"],\n \"@shared/*\": [\"./shared/*\"]\n },\n \"rootDir\": \".\",\n \"plugins\": [\n {\n \"name\": \"@effect/language-service\",\n \"diagnostics\": true,\n \"includeSuggestionsInTsc\": true,\n \"ignoreEffectSuggestionsInTscExitCode\": false,\n \"ignoreEffectWarningsInTscExitCode\": false,\n \"ignoreEffectErrorsInTscExitCode\": false,\n \"skipDisabledOptimization\": true,\n \"diagnosticSeverity\": {\n \"anyUnknownInErrorContext\": \"error\",\n \"classSelfMismatch\": \"error\",\n \"duplicatePackage\": \"error\",\n \"effectFnImplicitAny\": \"error\",\n \"floatingEffect\": \"error\",\n \"genericEffectServices\": \"error\",\n \"missingEffectContext\": \"error\",\n \"missingEffectError\": \"error\",\n \"missingLayerContext\": \"error\",\n \"missingReturnYieldStar\": \"error\",\n \"missingStarInYieldEffectGen\": \"error\",\n \"nonObjectEffectServiceType\": \"error\",\n \"outdatedApi\": \"error\",\n \"overriddenSchemaConstructor\": \"error\",\n \"catchUnfailableEffect\": \"error\",\n \"effectFnIife\": \"error\",\n \"effectGenUsesAdapter\": \"error\",\n \"effectInFailure\": \"error\",\n \"effectInVoidSuccess\": \"error\",\n \"globalErrorInEffectCatch\": \"error\",\n \"globalErrorInEffectFailure\": \"error\",\n \"layerMergeAllWithDependencies\": \"error\",\n \"lazyPromiseInEffectSync\": \"error\",\n \"leakingRequirements\": \"error\",\n \"multipleEffectProvide\": \"error\",\n \"returnEffectInGen\": \"error\",\n \"runEffectInsideEffect\": \"error\",\n \"schemaSyncInEffect\": \"error\",\n \"scopeInLayerEffect\": \"error\",\n \"strictEffectProvide\": \"error\",\n \"tryCatchInEffectGen\": \"error\",\n \"unknownInEffectCatch\": \"error\",\n \"asyncFunction\": \"error\",\n \"cryptoRandomUUID\": \"error\",\n \"cryptoRandomUUIDInEffect\": \"error\",\n \"extendsNativeError\": \"error\",\n \"globalConsole\": \"error\",\n \"globalConsoleInEffect\": \"error\",\n \"globalDate\": \"error\",\n \"globalDateInEffect\": \"error\",\n \"globalFetch\": \"error\",\n \"globalFetchInEffect\": \"error\",\n \"globalRandom\": \"error\",\n \"globalRandomInEffect\": \"error\",\n \"globalTimers\": \"error\",\n \"globalTimersInEffect\": \"error\",\n \"instanceOfSchema\": \"error\",\n \"newPromise\": \"error\",\n \"nodeBuiltinImport\": \"error\",\n \"preferSchemaOverJson\": \"error\",\n \"processEnv\": \"error\",\n \"processEnvInEffect\": \"error\",\n \"unsafeEffectTypeAssertion\": \"error\",\n \"catchAllToMapError\": \"error\",\n \"deterministicKeys\": \"error\",\n \"effectDoNotation\": \"error\",\n \"effectFnOpportunity\": \"error\",\n \"effectMapFlatten\": \"error\",\n \"effectMapVoid\": \"error\",\n \"effectSucceedWithVoid\": \"error\",\n \"missedPipeableOpportunity\": \"error\",\n \"missingEffectServiceDependency\": \"error\",\n \"nestedEffectGenYield\": \"error\",\n \"redundantSchemaTagIdentifier\": \"error\",\n \"schemaStructWithTag\": \"error\",\n \"schemaUnionOfLiterals\": \"error\",\n \"serviceNotAsClass\": \"error\",\n \"strictBooleanExpressions\": \"error\",\n \"unnecessaryArrowBlock\": \"error\",\n \"unnecessaryEffectGen\": \"error\",\n \"unnecessaryFailYieldableError\": \"error\",\n \"unnecessaryPipe\": \"error\",\n \"unnecessaryPipeChain\": \"error\"\n }\n }\n ]\n },\n \"include\": [\"src\", \"api\", \"shared\", \"config\", \"modern.config.ts\", \"server\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
19
19
  ".agents/skills-lock.json": "{\n \"schemaVersion\": 2,\n \"installDir\": \".agents/skills\",\n \"sources\": [\n {\n \"id\": \"techsiocz-private\",\n \"visibility\": \"private\",\n \"repository\": \"https://github.com/TechsioCZ/skills\",\n \"install\": \"clone-if-authorized\",\n \"baseline\": [\n {\n \"name\": \"plan-graph\",\n \"reason\": \"Build and validate DAGs from .plan.md files\"\n },\n {\n \"name\": \"dag\",\n \"reason\": \"Inspect current plan frontiers and blocked lanes\"\n },\n {\n \"name\": \"subagent-graph\",\n \"reason\": \"Design dependency-aware multi-agent launch graphs\"\n },\n {\n \"name\": \"helm\",\n \"reason\": \"Steer already-running multi-agent work\"\n },\n {\n \"name\": \"debugger-mode\",\n \"reason\": \"Run hypothesis-driven debugging with runtime evidence\"\n }\n ]\n }\n ]\n}\n",
20
20
  ".codex/hooks.json": "{\n \"Stop\": [\n {\n \"command\": \"pnpm format && pnpm lint:fix && pnpm ultramodern:check\",\n \"timeout\": 600000,\n \"statusMessage\": \"Running UltraModern quality gates\"\n }\n ],\n \"SubagentStop\": [\n {\n \"command\": \"pnpm format && pnpm lint:fix && pnpm ultramodern:check\",\n \"timeout\": 600000,\n \"statusMessage\": \"Running UltraModern quality gates\"\n }\n ]\n}\n",
21
- "scripts/bootstrap-agent-skills.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst lockPath = path.join(root, '.agents/skills-lock.json');\nconst checkOnly = process.argv.includes('--check');\nconst force = process.argv.includes('--force');\n\nconst readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8'));\n\nconst run = (command, args, options = {}) =>\n execFileSync(command, args, {\n cwd: options.cwd ?? root,\n encoding: 'utf-8',\n stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],\n });\n\nconst commandExists = (command) => {\n try {\n run(command, ['--version'], { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n};\n\nconst runShell = (script) =>\n run('sh', ['-lc', script], {\n stdio: 'inherit',\n });\n\nconst installGit = () => {\n if (commandExists('git')) {\n return;\n }\n\n if (commandExists('brew')) {\n run('brew', ['install', 'git'], { stdio: 'inherit' });\n } else if (process.platform === 'linux' && commandExists('apt-get')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}apt-get update && ${sudo}apt-get install -y git`);\n } else if (process.platform === 'linux' && commandExists('dnf')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}dnf install -y git`);\n } else if (process.platform === 'linux' && commandExists('yum')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}yum install -y git`);\n } else if (process.platform === 'linux' && commandExists('apk')) {\n runShell('apk add --no-cache git');\n }\n\n if (!commandExists('git')) {\n throw new Error(\n 'Git is required for UltraModern setup. Install git and run pnpm skills:install again.',\n );\n }\n};\n\nconst isInsideGitWorkTree = () => {\n try {\n return run('git', ['rev-parse', '--is-inside-work-tree']).trim() === 'true';\n } catch {\n return false;\n }\n};\n\nconst initializeGitRepository = () => {\n if (isInsideGitWorkTree()) {\n return;\n }\n\n try {\n run('git', ['init', '-b', 'main'], { stdio: 'inherit' });\n } catch {\n run('git', ['init'], { stdio: 'inherit' });\n run('git', ['branch', '-M', 'main'], { stdio: 'inherit' });\n }\n};\n\nconst installLefthook = () => {\n try {\n run('lefthook', ['install'], { stdio: 'inherit' });\n } catch (error) {\n console.warn(`Unable to install lefthook hooks: ${error.message}`);\n }\n};\n\nconst removeTree = (dir) =>\n fs.rmSync(dir, {\n force: true,\n maxRetries: 5,\n recursive: true,\n retryDelay: 100,\n });\n\nconst cloneSource = (source, targetDir) => {\n if (source.commit) {\n run('git', ['init', targetDir]);\n run('git', ['remote', 'add', 'origin', source.repository], {\n cwd: targetDir,\n });\n run('git', ['fetch', '--depth', '1', '--quiet', 'origin', source.commit], {\n cwd: targetDir,\n });\n run(\n 'git',\n [\n '-c',\n 'advice.detachedHead=false',\n 'checkout',\n '--detach',\n '--quiet',\n 'FETCH_HEAD',\n ],\n { cwd: targetDir },\n );\n return;\n }\n\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1', '--quiet']);\n } catch {\n run('git', ['clone', '--depth', '1', '--quiet', source.repository, targetDir]);\n }\n};\n\nconst resolveSkillDir = (sourceRoot, skillName) => {\n const candidates = [\n path.join(sourceRoot, skillName),\n path.join(sourceRoot, 'skills', skillName),\n path.join(sourceRoot, 'skills', 'engineering', skillName),\n path.join(sourceRoot, 'skills', 'productivity', skillName),\n ];\n return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'SKILL.md')));\n};\n\nif (!fs.existsSync(lockPath)) {\n console.error('Missing .agents/skills-lock.json');\n process.exit(1);\n}\n\nconst lock = readJson(lockPath);\nconst installDir = path.join(root, lock.installDir ?? '.agents/skills');\nconst sources = lock.sources ?? [];\nconst requiredCloneSources = sources.filter((source) => source.install === 'clone');\nconst optionalCloneSources = sources.filter(\n (source) => source.install === 'clone-if-authorized',\n);\nconst requiredSkills = [\n ...(lock.baseline ?? []),\n ...requiredCloneSources.flatMap((source) => source.baseline ?? []),\n].filter(\n (skill, index, skills) =>\n skills.findIndex((candidate) => candidate.name === skill.name) === index,\n);\n\nif (checkOnly) {\n const missingRequired = requiredSkills\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md')));\n const missingOptional = optionalCloneSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n\n if (missingRequired.length > 0) {\n console.error(\n `Required agent skills not installed: ${missingRequired.join(', ')}. Run pnpm skills:install.`,\n );\n process.exit(1);\n }\n\n if (missingOptional.length > 0) {\n console.warn(\n `Private skills not installed: ${missingOptional.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Required and private agent skills are installed.');\n process.exit(0);\n }\n console.log('Required agent skills are installed.');\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\ninstallGit();\n\nfor (const source of [...requiredCloneSources, ...optionalCloneSources]) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n try {\n cloneSource(source, tempDir);\n } catch (error) {\n if (source.install === 'clone-if-authorized') {\n console.warn(\n `Skipping ${source.repository}; current developer may not have access.`,\n );\n continue;\n }\n throw error;\n }\n for (const skill of source.baseline ?? []) {\n const sourceSkillDir = resolveSkillDir(tempDir, skill.name);\n if (!sourceSkillDir) {\n throw new Error(`Skill ${skill.name} not found in ${source.repository}`);\n }\n const targetSkillDir = path.join(installDir, skill.name);\n if (fs.existsSync(targetSkillDir)) {\n if (!force) {\n console.log(`Skipping existing ${skill.name}`);\n continue;\n }\n removeTree(targetSkillDir);\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n removeTree(tempDir);\n }\n}\n\ninitializeGitRepository();\ninstallLefthook();\n",
22
21
  "scripts/check-i18n-strings.mjs": "import fs from 'node:fs';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst scanRoots = ['src'].map((scanRoot) => path.join(root, scanRoot));\nconst ignoredDirectories = new Set(['.modern', '.modernjs', 'dist', 'node_modules']);\nconst visibleAttributePattern =\n /\\s(?:aria-label|alt|placeholder|title)=[\"']([^\"']*[A-Za-z][^\"']*)[\"']/gu;\nconst jsxTextPattern = />([^<>{}]*[A-Za-z][^<>{}]*)</gu;\nconst jsxIntrinsicTags = new Set([\n 'a',\n 'abbr',\n 'address',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'mark',\n 'menu',\n 'meta',\n 'meter',\n 'nav',\n 'ol',\n 'option',\n 'p',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n 'strong',\n 'style',\n 'summary',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'u',\n 'ul',\n 'video',\n]);\n\nconst collectFiles = (directory) => {\n if (!fs.existsSync(directory)) {\n return [];\n }\n\n const files = [];\n for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {\n if (entry.isDirectory()) {\n if (!ignoredDirectories.has(entry.name)) {\n files.push(...collectFiles(path.join(directory, entry.name)));\n }\n continue;\n }\n\n if (entry.isFile() && /\\.(jsx|tsx)$/u.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n files.push(path.join(directory, entry.name));\n }\n }\n return files;\n};\n\nconst lineNumberForIndex = (content, index) => content.slice(0, index).split('\\n').length;\nconst isCodeElementText = (content, index) => {\n const tagStart = content.lastIndexOf('<', index);\n if (tagStart === -1) {\n return false;\n }\n return /^<code(?:\\s|>)/u.test(content.slice(tagStart, index));\n};\nconst isJsxTagEnd = (content, index) => {\n const tagStart = content.lastIndexOf('<', index);\n if (tagStart === -1 || content.slice(tagStart + 1, index).includes('<')) {\n return false;\n }\n const match = content\n .slice(tagStart, index + 1)\n .match(/^<\\/?\\s*([A-Za-z][\\w:.-]*)\\b[^<>]*>$/u);\n if (!match) {\n return false;\n }\n const [, tagName] = match;\n return (\n /^[A-Z]/u.test(tagName) ||\n tagName.includes('-') ||\n jsxIntrinsicTags.has(tagName)\n );\n};\nconst isIgnoredLine = (content, index) => {\n const lineStart = content.lastIndexOf('\\n', index) + 1;\n const lineEnd = content.indexOf('\\n', index);\n const currentLineEnd = lineEnd === -1 ? content.length : lineEnd;\n const previousLineStart = content.lastIndexOf('\\n', Math.max(0, lineStart - 2)) + 1;\n const nextLineEnd = content.indexOf('\\n', currentLineEnd + 1);\n const context = content.slice(\n previousLineStart,\n nextLineEnd === -1 ? content.length : nextLineEnd,\n );\n return /i18n-ignore/u.test(context);\n};\n\nconst violations = [];\nfor (const filePath of scanRoots.flatMap(collectFiles)) {\n const content = fs.readFileSync(filePath, 'utf-8');\n for (const match of content.matchAll(visibleAttributePattern)) {\n const [, visibleText] = match;\n if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: visibleText.trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const [, jsxText] = match;\n const text = jsxText.replaceAll(/\\s+/gu, ' ').trim();\n if (\n text &&\n !isIgnoredLine(content, match.index ?? 0) &&\n isJsxTagEnd(content, match.index ?? 0) &&\n !isCodeElementText(content, match.index ?? 0)\n ) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text,\n });\n }\n }\n}\n\nif (violations.length > 0) {\n console.error('Hardcoded user-visible JSX strings found. Move copy to locale JSON files.');\n for (const violation of violations) {\n console.error(\n `${path.relative(root, violation.filePath)}:${violation.line} ${JSON.stringify(\n violation.text,\n )}`,\n );\n }\n process.exit(1);\n}\n\nconsole.log('No hardcoded user-visible JSX strings found.');\n",
22
+ "scripts/bootstrap-agent-skills.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst lockPath = path.join(root, '.agents/skills-lock.json');\nconst checkOnly = process.argv.includes('--check');\nconst force = process.argv.includes('--force');\n\nconst readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8'));\n\nconst run = (command, args, options = {}) =>\n execFileSync(command, args, {\n cwd: options.cwd ?? root,\n encoding: 'utf-8',\n stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],\n });\n\nconst commandExists = (command) => {\n try {\n run(command, ['--version'], { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n};\n\nconst runShell = (script) =>\n run('sh', ['-lc', script], {\n stdio: 'inherit',\n });\n\nconst installGit = () => {\n if (commandExists('git')) {\n return;\n }\n\n if (commandExists('brew')) {\n run('brew', ['install', 'git'], { stdio: 'inherit' });\n } else if (process.platform === 'linux' && commandExists('apt-get')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}apt-get update && ${sudo}apt-get install -y git`);\n } else if (process.platform === 'linux' && commandExists('dnf')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}dnf install -y git`);\n } else if (process.platform === 'linux' && commandExists('yum')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}yum install -y git`);\n } else if (process.platform === 'linux' && commandExists('apk')) {\n runShell('apk add --no-cache git');\n }\n\n if (!commandExists('git')) {\n throw new Error(\n 'Git is required for UltraModern setup. Install git and run pnpm skills:install again.',\n );\n }\n};\n\nconst isInsideGitWorkTree = () => {\n try {\n return run('git', ['rev-parse', '--is-inside-work-tree']).trim() === 'true';\n } catch {\n return false;\n }\n};\n\nconst initializeGitRepository = () => {\n if (isInsideGitWorkTree()) {\n return;\n }\n\n try {\n run('git', ['init', '-b', 'main'], { stdio: 'inherit' });\n } catch {\n run('git', ['init'], { stdio: 'inherit' });\n run('git', ['branch', '-M', 'main'], { stdio: 'inherit' });\n }\n};\n\nconst installLefthook = () => {\n try {\n run('lefthook', ['install'], { stdio: 'inherit' });\n } catch (error) {\n console.warn(`Unable to install lefthook hooks: ${error.message}`);\n }\n};\n\nconst removeTree = (dir) =>\n fs.rmSync(dir, {\n force: true,\n maxRetries: 5,\n recursive: true,\n retryDelay: 100,\n });\n\nconst cloneSource = (source, targetDir) => {\n if (source.commit) {\n run('git', ['init', targetDir]);\n run('git', ['remote', 'add', 'origin', source.repository], {\n cwd: targetDir,\n });\n run('git', ['fetch', '--depth', '1', '--quiet', 'origin', source.commit], {\n cwd: targetDir,\n });\n run(\n 'git',\n [\n '-c',\n 'advice.detachedHead=false',\n 'checkout',\n '--detach',\n '--quiet',\n 'FETCH_HEAD',\n ],\n { cwd: targetDir },\n );\n return;\n }\n\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1', '--quiet']);\n } catch {\n run('git', ['clone', '--depth', '1', '--quiet', source.repository, targetDir]);\n }\n};\n\nconst resolveSkillDir = (sourceRoot, skillName) => {\n const candidates = [\n path.join(sourceRoot, skillName),\n path.join(sourceRoot, 'skills', skillName),\n path.join(sourceRoot, 'skills', 'engineering', skillName),\n path.join(sourceRoot, 'skills', 'productivity', skillName),\n ];\n return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'SKILL.md')));\n};\n\nif (!fs.existsSync(lockPath)) {\n console.error('Missing .agents/skills-lock.json');\n process.exit(1);\n}\n\nconst lock = readJson(lockPath);\nconst installDir = path.join(root, lock.installDir ?? '.agents/skills');\nconst sources = lock.sources ?? [];\nconst requiredCloneSources = sources.filter((source) => source.install === 'clone');\nconst optionalCloneSources = sources.filter(\n (source) => source.install === 'clone-if-authorized',\n);\nconst requiredSkills = [\n ...(lock.baseline ?? []),\n ...requiredCloneSources.flatMap((source) => source.baseline ?? []),\n].filter(\n (skill, index, skills) =>\n skills.findIndex((candidate) => candidate.name === skill.name) === index,\n);\n\nif (checkOnly) {\n const missingRequired = requiredSkills\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md')));\n const missingOptional = optionalCloneSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n\n if (missingRequired.length > 0) {\n console.error(\n `Required agent skills not installed: ${missingRequired.join(', ')}. Run pnpm skills:install.`,\n );\n process.exit(1);\n }\n\n if (missingOptional.length > 0) {\n console.warn(\n `Private skills not installed: ${missingOptional.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Required and private agent skills are installed.');\n process.exit(0);\n }\n console.log('Required agent skills are installed.');\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\ninstallGit();\n\nfor (const source of [...requiredCloneSources, ...optionalCloneSources]) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n try {\n cloneSource(source, tempDir);\n } catch (error) {\n if (source.install === 'clone-if-authorized') {\n console.warn(\n `Skipping ${source.repository}; current developer may not have access.`,\n );\n continue;\n }\n throw error;\n }\n for (const skill of source.baseline ?? []) {\n const sourceSkillDir = resolveSkillDir(tempDir, skill.name);\n if (!sourceSkillDir) {\n throw new Error(`Skill ${skill.name} not found in ${source.repository}`);\n }\n const targetSkillDir = path.join(installDir, skill.name);\n if (fs.existsSync(targetSkillDir)) {\n if (!force) {\n console.log(`Skipping existing ${skill.name}`);\n continue;\n }\n removeTree(targetSkillDir);\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n removeTree(tempDir);\n }\n}\n\ninitializeGitRepository();\ninstallLefthook();\n",
23
23
  "scripts/validate-ultramodern.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst configPath = path.resolve(process.cwd(), 'modern.config.ts');\nconst templateManifestPath = path.resolve(process.cwd(), '.modernjs/mv-template-manifest.json');\nconst packageSourcePath = path.resolve(\n process.cwd(),\n '.modernjs/ultramodern-package-source.json',\n);\nconst readText = (relativePath) =>\n fs.readFileSync(path.resolve(process.cwd(), relativePath), 'utf-8');\nconst readJson = (relativePath) => JSON.parse(readText(relativePath));\nconst readPnpmConfig = (key) => {\n const env = Object.fromEntries(\n Object.entries(process.env).filter(\n ([envKey]) => !/^(?:npm|pnpm)_config_/iu.test(envKey),\n ),\n );\n const output = execFileSync('pnpm', ['config', 'get', key, '--json'], {\n cwd: process.cwd(),\n encoding: 'utf-8',\n env,\n stdio: ['ignore', 'pipe', 'pipe'],\n }).trim();\n return output ? JSON.parse(output) : undefined;\n};\nconst enableTailwind = true;\nconst expectedPnpmVersion = '11.5.0';\nconst activePnpmVersion = execFileSync('pnpm', ['--version'], {\n cwd: process.cwd(),\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'pipe'],\n}).trim();\n\nif (activePnpmVersion !== expectedPnpmVersion) {\n console.error(\n `Generated app requires pnpm ${expectedPnpmVersion}; active pnpm is ${activePnpmVersion}. Run mise install, then rerun pnpm from the activated shell`,\n );\n process.exit(1);\n}\n\nif (!fs.existsSync(configPath)) {\n console.error('modern.config.ts not found');\n process.exit(1);\n}\n\nconst content = fs.readFileSync(configPath, 'utf-8');\nconst requiredTokens = [\n 'presetUltramodern(',\n 'appTools()',\n 'enableModuleFederationSSR',\n 'enableBffRequestId',\n 'enableTelemetryExporters',\n 'i18nPlugin(',\n 'localePathRedirect: true',\n 'ULTRAMODERN_SITE_URL',\n 'MODERN_PUBLIC_SITE_URL must be set for production builds',\n 'globalVars',\n];\nconst missing = requiredTokens.filter((token) => !content.includes(token));\n\nif (missing.length > 0) {\n console.error(`Ultramodern contract check failed. Missing tokens: ${missing.join(', ')}`);\n process.exit(1);\n}\n\nif (!fs.existsSync(templateManifestPath)) {\n console.error('.modernjs/mv-template-manifest.json not found');\n process.exit(1);\n}\n\nconst templateManifest = JSON.parse(fs.readFileSync(templateManifestPath, 'utf-8'));\nconst requiredDeniedPaths = [\n '.git/**',\n '.npmrc',\n '.yarnrc',\n '.env',\n '.env.*',\n 'node_modules/**',\n 'dist/**',\n];\nconst requiredPostMaterialization = [\n 'ultramodern-contract-check',\n 'agent-skill-postinstall-allowed',\n 'github-workflow-security-enforced',\n 'package-source-retained',\n 'pnpm-11-policy-enforced',\n 'rstest-smoke-tests',\n 'template-manifest-retained',\n];\nconst requiredPaths = [\n\n 'AGENTS.md',\n '.agents/skills-lock.json',\n '.codex/hooks.json',\n '.github/renovate.json',\n '.github/workflows/ultramodern-gates.yml',\n 'lefthook.yml',\n 'oxlint.config.ts',\n 'oxfmt.config.ts',\n 'scripts/bootstrap-agent-skills.mjs',\n\n '.mise.toml',\n '.modernjs/ultramodern-package-source.json',\n 'pnpm-workspace.yaml',\n 'rstest.config.mts',\n 'scripts/check-i18n-strings.mjs',\n\n 'postcss.config.mjs',\n 'tailwind.config.ts',\n\n 'config/public/locales/en/translation.json',\n 'config/public/locales/cs/translation.json',\n 'config/favicon.svg',\n 'config/public/assets/ultramodern-logo.svg',\n 'src/modern-app-env.d.ts',\n 'src/routes/index.css',\n 'src/routes/layout.tsx',\n 'src/routes/[lang]/page.tsx',\n 'tests/ultramodern.contract.test.ts',\n];\nconst manifestErrors = [];\n\nfor (const requiredPath of requiredPaths) {\n if (!fs.existsSync(path.resolve(process.cwd(), requiredPath))) {\n console.error(`${requiredPath} not found`);\n process.exit(1);\n }\n}\n\nif (fs.existsSync(path.resolve(process.cwd(), 'src/routes/page.tsx'))) {\n console.error('src/routes/page.tsx must move under src/routes/[lang]/page.tsx');\n process.exit(1);\n}\n\nif (\n !enableTailwind &&\n (fs.existsSync(path.resolve(process.cwd(), 'postcss.config.mjs')) ||\n fs.existsSync(path.resolve(process.cwd(), 'tailwind.config.ts')))\n) {\n console.error('Tailwind config files must not be written when Tailwind is disabled');\n process.exit(1);\n}\n\n\nconst workflowContent = fs.readFileSync(\n path.resolve(process.cwd(), '.github/workflows/ultramodern-gates.yml'),\n 'utf-8',\n);\nconst renovateConfig = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.github/renovate.json'), 'utf-8'),\n);\nfor (const requiredSnippet of [\n 'permissions:\\n contents: read',\n 'pull_request:',\n 'persist-credentials: false',\n 'jdx/mise-action',\n 'pnpm install --frozen-lockfile',\n 'pnpm run ultramodern:check',\n 'pnpm run build',\n 'MODERN_PUBLIC_SITE_URL: http://localhost:8080',\n 'timeout-minutes:',\n 'egress-policy: audit',\n]) {\n if (!workflowContent.includes(requiredSnippet)) {\n console.error(`Generated workflow must retain ${requiredSnippet.split('\\n')[0]}`);\n process.exit(1);\n }\n}\nif (workflowContent.includes('pull_request_target')) {\n console.error('Generated workflow must not use pull_request_target');\n process.exit(1);\n}\nfor (const match of workflowContent.matchAll(/^\\s*uses:\\s*([^@\\s]+)@([^\\s#]+)/gmu)) {\n const [, actionName, actionRef] = match;\n if (!/^[a-f0-9]{40}$/u.test(actionRef)) {\n console.error(`Generated workflow must pin ${actionName}@${actionRef} to a commit SHA`);\n process.exit(1);\n }\n}\nif (\n renovateConfig.dependencyDashboard !== true ||\n renovateConfig.minimumReleaseAge !== '1 day' ||\n !renovateConfig.extends?.includes('helpers:pinGitHubActionDigests') ||\n !renovateConfig.packageRules?.some(\n (rule) =>\n rule.dependencyDashboardApproval === true && rule.matchUpdateTypes?.includes('major'),\n )\n) {\n console.error('Generated Renovate config must retain dashboard, release-age, action pinning, and major-approval policy');\n process.exit(1);\n}\n\n\nif (templateManifest.schemaVersion !== 1) {\n manifestErrors.push('schemaVersion');\n}\n\nif (templateManifest.source?.type !== 'builtin') {\n manifestErrors.push('source.type');\n}\n\nif (\n !Array.isArray(templateManifest.integrity?.checksums) ||\n !templateManifest.integrity.checksums.some(\n (checksum) =>\n checksum.algorithm === 'sha256' &&\n checksum.scope === 'source-tree' &&\n /^[0-9a-f]{64}$/u.test(checksum.value),\n )\n) {\n manifestErrors.push('integrity.checksums[source-tree]');\n}\n\nfor (const deniedPath of requiredDeniedPaths) {\n if (!templateManifest.materialization?.deniedPaths?.includes(deniedPath)) {\n manifestErrors.push(`materialization.deniedPaths:${deniedPath}`);\n }\n}\n\nif (templateManifest.lifecyclePolicy?.denyByDefault !== true) {\n manifestErrors.push('lifecyclePolicy.denyByDefault');\n}\nif (\n JSON.stringify(templateManifest.lifecyclePolicy?.allowedScripts) !==\n JSON.stringify(['postinstall'])\n) {\n manifestErrors.push('lifecyclePolicy.allowedScripts');\n}\n\nfor (const token of requiredPostMaterialization) {\n if (!templateManifest.validation?.postMaterializationValidation?.includes(token)) {\n manifestErrors.push(`validation.postMaterializationValidation:${token}`);\n }\n}\n\nif (manifestErrors.length > 0) {\n console.error(\n `Ultramodern template manifest check failed. Invalid fields: ${manifestErrors.join(', ')}`,\n );\n process.exit(1);\n}\n\nconst packageJson = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), 'package.json'), 'utf-8'),\n);\nconst packageSource = JSON.parse(fs.readFileSync(packageSourcePath, 'utf-8'));\nconst routePage = readText('src/routes/[lang]/page.tsx');\nconst routeCss = readText('src/routes/index.css');\nconst modernConfig = readText('modern.config.ts');\nconst enLocale = readJson('config/public/locales/en/translation.json');\nconst csLocale = readJson('config/public/locales/cs/translation.json');\nconst unresolvedTemplateMarker = String.fromCodePoint(123, 123);\nif (JSON.stringify(packageJson).includes(unresolvedTemplateMarker)) {\n console.error('package.json contains unresolved template markers');\n process.exit(1);\n}\nif (JSON.stringify(packageSource).includes(unresolvedTemplateMarker)) {\n console.error('package source metadata contains unresolved template markers');\n process.exit(1);\n}\n\nfor (const [fileName, text] of [\n ['src/routes/[lang]/page.tsx', routePage],\n ['src/routes/index.css', routeCss],\n ['modern.config.ts', modernConfig],\n]) {\n if (text.includes('lf3-static.bytednsdoc.com')) {\n console.error(`${fileName} must not depend on remote starter assets`);\n process.exit(1);\n }\n}\n\nfor (const requiredSnippet of [\n '<Helmet',\n 'htmlAttributes={{',\n 'dir: languageDirections[currentLanguage]',\n 'lang: currentLanguage',\n '<title>{pageTitle}</title>',\n '<meta name=\"description\" content={pageDescription} />',\n '<main id=\"starter-main\" className=\"starter-main\">',\n '<h1 id=\"starter-heading\" className=\"title\">',\n 'src=\"/assets/ultramodern-logo.svg\"',\n 'height={96}',\n 'width={96}',\n '<span aria-hidden=\"true\" className=\"arrow-right\" />',\n]) {\n if (!routePage.includes(requiredSnippet)) {\n console.error(`Generated route page must retain starter correctness snippet: ${requiredSnippet}`);\n process.exit(1);\n }\n}\n\nfor (const forbiddenSnippet of ['src=\"https://', '<div className=\"title\">']) {\n if (routePage.includes(forbiddenSnippet)) {\n console.error(`Generated route page must not contain ${forbiddenSnippet}`);\n process.exit(1);\n }\n}\n\nfor (const requiredSnippet of [\n 'width=device-width, initial-scale=1.0, viewport-fit=cover',\n \"title: 'UltraModern.js Starter'\",\n]) {\n if (!modernConfig.includes(requiredSnippet)) {\n console.error(`modern.config.ts must retain ${requiredSnippet}`);\n process.exit(1);\n }\n}\nif (modernConfig.includes('user-scalable=no') || modernConfig.includes('maximum-scale')) {\n console.error('modern.config.ts must not disable user zoom');\n process.exit(1);\n}\n\nfor (const requiredSnippet of [\n 'min-block-size: 100dvh',\n 'grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr))',\n ':focus-visible',\n '@media (prefers-reduced-motion: reduce)',\n '.skip-link',\n]) {\n if (!routeCss.includes(requiredSnippet)) {\n console.error(`Starter CSS must retain ${requiredSnippet}`);\n process.exit(1);\n }\n}\nif (routeCss.includes('width: 1100px') || /\\.card:focus(?!-visible)/u.test(routeCss)) {\n console.error('Starter CSS must not reintroduce fixed grid width or focus transform styling');\n process.exit(1);\n}\n\nfor (const [localeName, locale] of [\n ['en', enLocale],\n ['cs', csLocale],\n]) {\n if (\n typeof locale.home?.meta?.title !== 'string' ||\n typeof locale.home?.meta?.description !== 'string' ||\n typeof locale.home?.skipLink !== 'string'\n ) {\n console.error(`${localeName} locale must include starter metadata and skip-link copy`);\n process.exit(1);\n }\n}\n\nconst skillsLock = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.agents/skills-lock.json'), 'utf-8'),\n);\n\nconst requiredScripts = {\n\n format: 'oxfmt .',\n 'format:check': 'oxfmt --check .',\n\n 'i18n:check': 'node ./scripts/check-i18n-strings.mjs',\n\n lint: 'oxlint .',\n 'lint:fix': 'oxlint . --fix',\n postinstall: 'oxfmt . && node ./scripts/bootstrap-agent-skills.mjs',\n 'skills:check': 'node ./scripts/bootstrap-agent-skills.mjs --check',\n 'skills:install': 'node ./scripts/bootstrap-agent-skills.mjs',\n\n test: 'rstest run',\n};\n\nfor (const [scriptName, scriptCommand] of Object.entries(requiredScripts)) {\n if (packageJson.scripts?.[scriptName] !== scriptCommand) {\n console.error(`Missing or invalid package script: ${scriptName}`);\n process.exit(1);\n }\n}\n\nif (\n !packageJson.scripts?.typecheck?.includes('effect-tsgo') ||\n !packageJson.scripts.typecheck.includes('get-exe-path')\n) {\n console.error('typecheck must use effect-tsgo as the TypeScript checker');\n process.exit(1);\n}\n\nif (!packageJson.scripts?.['ultramodern:check']?.includes('pnpm test')) {\n console.error('ultramodern:check must run the generated Rstest suite');\n process.exit(1);\n}\n\nif (packageJson.private !== true) {\n console.error('Generated app package must be private by default');\n process.exit(1);\n}\n\nconst miseConfig = fs.readFileSync(path.resolve(process.cwd(), '.mise.toml'), 'utf-8');\nif (!miseConfig.includes(`pnpm = \"${expectedPnpmVersion}\"`)) {\n console.error(`Generated app must pin pnpm ${expectedPnpmVersion} in .mise.toml`);\n process.exit(1);\n}\n\nif (packageJson.packageManager !== `pnpm@${expectedPnpmVersion}`) {\n console.error(`Generated app package must pin pnpm@${expectedPnpmVersion}`);\n process.exit(1);\n}\n\nif (packageJson.engines?.pnpm !== `>=${expectedPnpmVersion} <11.6.0`) {\n console.error(`Generated app package must require pnpm >=${expectedPnpmVersion} <11.6.0`);\n process.exit(1);\n}\n\nif (packageJson.pnpm !== undefined) {\n console.error('Generated app must keep pnpm policy in pnpm-workspace.yaml, not package.json');\n process.exit(1);\n}\n\nif (readPnpmConfig('minimumReleaseAge') !== 1440) {\n console.error('pnpm minimumReleaseAge must be 1440');\n process.exit(1);\n}\nif (readPnpmConfig('minimumReleaseAgeStrict') !== true) {\n console.error('pnpm minimumReleaseAgeStrict must be true');\n process.exit(1);\n}\nif (readPnpmConfig('minimumReleaseAgeIgnoreMissingTime') !== false) {\n console.error('pnpm minimumReleaseAgeIgnoreMissingTime must be false');\n process.exit(1);\n}\nconst expectedMinimumReleaseAgeExcludes = [\n '@bleedingdev/modern-js-*',\n '@tanstack/react-router',\n '@tanstack/router-core',\n '@typescript/native-preview',\n '@typescript/native-preview-*',\n '@types/react',\n];\nif (\n JSON.stringify(readPnpmConfig('minimumReleaseAgeExclude')) !==\n JSON.stringify(expectedMinimumReleaseAgeExcludes)\n) {\n console.error('pnpm minimumReleaseAgeExclude must allow only approved latest-lane package cohorts');\n process.exit(1);\n}\nif (readPnpmConfig('trustPolicy') !== 'no-downgrade') {\n console.error('pnpm trustPolicy must be no-downgrade');\n process.exit(1);\n}\nfor (const [key, expected] of [\n ['trustPolicyIgnoreAfter', 1440],\n ['blockExoticSubdeps', true],\n ['engineStrict', true],\n ['pmOnFail', 'error'],\n ['verifyDepsBeforeRun', 'error'],\n ['strictDepBuilds', true],\n]) {\n if (readPnpmConfig(key) !== expected) {\n console.error(`pnpm ${key} must be ${String(expected)}`);\n process.exit(1);\n }\n}\nif (\n JSON.stringify(readPnpmConfig('allowBuilds')) !==\n JSON.stringify({\n '@swc/core': true,\n 'core-js': true,\n esbuild: true,\n lefthook: true,\n 'msgpackr-extract': true,\n sharp: true,\n workerd: true,\n })\n) {\n console.error('pnpm allowBuilds must approve only the generated app build dependencies');\n process.exit(1);\n}\nif (\n JSON.stringify(readPnpmConfig('onlyBuiltDependencies')) !==\n JSON.stringify(['@swc/core', 'core-js', 'esbuild', 'lefthook', 'msgpackr-extract', 'sharp', 'workerd'])\n) {\n console.error('pnpm onlyBuiltDependencies must approve only the generated app build dependencies');\n process.exit(1);\n}\n\nif (packageJson.modernjs?.preset !== 'presetUltramodern') {\n console.error('package.json must declare presetUltramodern metadata');\n process.exit(1);\n}\n\nif (\n packageJson.modernjs?.packageSource?.config !== './.modernjs/ultramodern-package-source.json'\n) {\n console.error('package.json must retain package source metadata location');\n process.exit(1);\n}\n\nif (packageJson.modernjs?.packageSource?.strategy !== packageSource.strategy) {\n console.error('package.json package source strategy must match package source metadata');\n process.exit(1);\n}\n\nif (packageSource.schemaVersion !== 1) {\n console.error('Package source metadata must use schemaVersion 1');\n process.exit(1);\n}\n\nif (packageSource.preset !== 'presetUltramodern') {\n console.error('Package source metadata must declare presetUltramodern');\n process.exit(1);\n}\n\nif (packageSource.strategy !== 'workspace' && packageSource.strategy !== 'install') {\n console.error('Package source strategy must be workspace or install');\n process.exit(1);\n}\n\nconst declaredModernPackages = packageSource.modernPackages?.packages;\nif (!Array.isArray(declaredModernPackages) || declaredModernPackages.length === 0) {\n console.error('Package source metadata must declare the generated Modern package cohort');\n process.exit(1);\n}\n\nconst invalidModernPackages = declaredModernPackages.filter(\n (packageName) => typeof packageName !== 'string' || !packageName.startsWith('@modern-js/'),\n);\nif (invalidModernPackages.length > 0) {\n console.error(`Package source metadata contains invalid Modern packages: ${invalidModernPackages.join(', ')}`);\n process.exit(1);\n}\n\nconst packageJsonModernDependencies = [\n ...new Set(\n ['dependencies', 'devDependencies']\n .flatMap((section) => Object.keys(packageJson[section] ?? {}))\n .filter((packageName) => packageName.startsWith('@modern-js/')),\n ),\n];\nconst missingMetadataPackages = packageJsonModernDependencies.filter(\n (packageName) => !declaredModernPackages.includes(packageName),\n);\nif (missingMetadataPackages.length > 0) {\n console.error(`Package source metadata must include package.json Modern dependencies: ${missingMetadataPackages.join(', ')}`);\n process.exit(1);\n}\n\nconst expectedModernSpecifier = packageSource.modernPackages?.specifier;\nif (typeof expectedModernSpecifier !== 'string' || expectedModernSpecifier.length === 0) {\n console.error('Package source metadata must provide a Modern package specifier');\n process.exit(1);\n}\nif (\n packageSource.strategy === 'install' &&\n expectedModernSpecifier !== templateManifest.template?.version\n) {\n console.error(\n `Package source Modern specifier ${expectedModernSpecifier} must match template version ${templateManifest.template?.version}`,\n );\n process.exit(1);\n}\n\nconst expectedModernDependency = (packageName) => {\n const alias = packageSource.modernPackages?.aliases?.[packageName];\n return typeof alias === 'string'\n ? `npm:${alias}@${expectedModernSpecifier}`\n : expectedModernSpecifier;\n};\n\nfor (const section of ['dependencies', 'devDependencies']) {\n for (const packageName of declaredModernPackages) {\n if (\n packageJson[section]?.[packageName] &&\n packageJson[section][packageName] !== expectedModernDependency(packageName)\n ) {\n console.error(`${section}.${packageName} must match package source metadata`);\n process.exit(1);\n }\n }\n}\n\nfor (const dependency of ['@modern-js/plugin-i18n', 'i18next', 'react-i18next']) {\n if (!packageJson.dependencies?.[dependency]) {\n console.error(`Missing dependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nfor (const dependency of [\n '@effect/tsgo',\n '@modern-js/adapter-rstest',\n '@rstest/core',\n '@typescript/native-preview',\n 'happy-dom',\n\n '@tailwindcss/postcss',\n 'postcss',\n 'tailwindcss',\n\n\n 'lefthook',\n 'oxlint',\n 'oxfmt',\n 'ultracite',\n\n]) {\n if (!packageJson.devDependencies?.[dependency]) {\n console.error(`Missing devDependency: ${dependency}`);\n process.exit(1);\n }\n}\n\n\nif (\n packageJson.devDependencies?.tailwindcss !== '^4.3.0' ||\n packageJson.devDependencies?.['@tailwindcss/postcss'] !== '^4.3.0'\n) {\n console.error('Tailwind CSS dependencies must use the UltraModern default baseline');\n process.exit(1);\n}\n\n\n\n\nconst privateSource = skillsLock.sources?.find(\n (source) => source.repository === 'https://github.com/TechsioCZ/skills',\n);\nconst privateSkills = new Set(privateSource?.baseline?.map((skill) => skill.name));\nfor (const skillName of ['plan-graph', 'dag', 'subagent-graph', 'helm', 'debugger-mode']) {\n if (!privateSkills.has(skillName)) {\n console.error(`Missing private skill allowlist entry: ${skillName}`);\n process.exit(1);\n }\n}\n\n\nconsole.log('Ultramodern contract check passed.');\n",
24
24
  "tests/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"types\": [\"@rstest/core/globals\"]\n },\n \"include\": [\"./\"]\n}\n",
25
25
  "tests/ultramodern.contract.test.ts": "import fs from 'node:fs';\nimport path from 'node:path';\nimport { describe, expect, test } from '@rstest/core';\n\nconst root = process.cwd();\nconst readText = (relativePath: string) =>\n fs.readFileSync(path.join(root, relativePath), 'utf-8');\nconst readJson = <T>(relativePath: string): T =>\n JSON.parse(readText(relativePath)) as T;\n\ndescribe('generated UltraModern contract', () => {\n test('keeps localized route metadata and Rstest wiring', () => {\n expect(fs.existsSync(path.join(root, 'src/routes/[lang]/page.tsx'))).toBe(\n true,\n );\n expect(fs.existsSync(path.join(root, 'src/routes/page.tsx'))).toBe(false);\n expect(fs.existsSync(path.join(root, 'src/routes/layout.tsx'))).toBe(true);\n\n expect(fs.existsSync(path.join(root, 'postcss.config.mjs'))).toBe(true);\n expect(fs.existsSync(path.join(root, 'tailwind.config.ts'))).toBe(true);\n\n\n });\n\n test('keeps UltraModern starter web correctness defaults', () => {\n const routePage = readText('src/routes/[lang]/page.tsx');\n const routeCss = readText('src/routes/index.css');\n const modernConfig = readText('modern.config.ts');\n const enLocale = readJson<{\n home?: {\n meta?: {\n description?: string;\n title?: string;\n };\n skipLink?: string;\n };\n }>('config/public/locales/en/translation.json');\n\n expect(fs.existsSync(path.join(root, 'config/favicon.svg'))).toBe(true);\n expect(\n fs.existsSync(\n path.join(root, 'config/public/assets/ultramodern-logo.svg'),\n ),\n ).toBe(true);\n expect(routePage).not.toContain('lf3-static.bytednsdoc.com');\n expect(routePage).toContain('<Helmet');\n expect(routePage).toContain('htmlAttributes={{');\n expect(routePage).toContain('dir: languageDirections[currentLanguage]');\n expect(routePage).toContain('lang: currentLanguage');\n expect(routePage).toContain('<title>{pageTitle}</title>');\n expect(routePage).toContain(\n '<meta name=\"description\" content={pageDescription} />',\n );\n expect(routePage).toContain(\n '<main id=\"starter-main\" className=\"starter-main\">',\n );\n expect(routePage).toContain('<h1 id=\"starter-heading\" className=\"title\">');\n expect(routePage).toContain('src=\"/assets/ultramodern-logo.svg\"');\n expect(routePage).toContain('height={96}');\n expect(routePage).toContain('width={96}');\n expect(routePage).toContain(\n '<span aria-hidden=\"true\" className=\"arrow-right\" />',\n );\n expect(routePage).not.toContain('<div className=\"title\">');\n expect(modernConfig).toContain(\n 'width=device-width, initial-scale=1.0, viewport-fit=cover',\n );\n expect(modernConfig).not.toContain('user-scalable=no');\n expect(modernConfig).not.toContain('maximum-scale');\n expect(routeCss).toContain('min-block-size: 100dvh');\n expect(routeCss).toContain(\n 'grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr))',\n );\n expect(routeCss).toContain(':focus-visible');\n expect(routeCss).toContain('@media (prefers-reduced-motion: reduce)');\n expect(routeCss).not.toContain('width: 1100px');\n expect(enLocale.home?.meta?.title).toBe('UltraModern.js Starter');\n expect(enLocale.home?.meta?.description).toBeTruthy();\n expect(enLocale.home?.skipLink).toBeTruthy();\n });\n\n test('retains package-source metadata for generated Modern.js packages', () => {\n const packageJson = readJson<{\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n modernjs?: {\n packageSource?: {\n config?: string;\n strategy?: string;\n };\n preset?: string;\n };\n }>('package.json');\n const packageSource = readJson<{\n modernPackages?: {\n packages?: string[];\n specifier?: string;\n };\n strategy?: string;\n }>('.modernjs/ultramodern-package-source.json');\n\n expect(packageJson.modernjs?.preset).toBe('presetUltramodern');\n expect(packageJson.modernjs?.packageSource?.config).toBe(\n './.modernjs/ultramodern-package-source.json',\n );\n expect(packageJson.modernjs?.packageSource?.strategy).toBe(\n packageSource.strategy,\n );\n expect(packageSource.strategy).toMatch(/^(workspace|install)$/u);\n const generatedModernDependencies = [\n ...new Set(\n (['dependencies', 'devDependencies'] as const).flatMap(section =>\n Object.keys(packageJson[section] ?? {}),\n ),\n ),\n ].filter(packageName => packageName.startsWith('@modern-js/'));\n expect(packageSource.modernPackages?.packages?.length).toBeGreaterThan(0);\n expect(packageSource.modernPackages?.packages).toEqual(\n expect.arrayContaining(generatedModernDependencies),\n );\n expect(packageSource.modernPackages?.specifier).toBeTruthy();\n expect(\n packageJson.devDependencies?.['@modern-js/adapter-rstest'],\n ).toBeTruthy();\n\n expect(packageJson.devDependencies?.tailwindcss).toBe('^4.3.0');\n expect(packageJson.devDependencies?.['@tailwindcss/postcss']).toBe(\n '^4.3.0',\n );\n\n\n });\n});\n",
26
26
  ".github/renovate.json": "{\n \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n \"extends\": [\n \"config:recommended\",\n \"helpers:pinGitHubActionDigests\"\n ],\n \"dependencyDashboard\": true,\n \"minimumReleaseAge\": \"1 day\",\n \"prConcurrentLimit\": 5,\n \"prHourlyLimit\": 2,\n \"rangeStrategy\": \"bump\",\n \"schedule\": [\n \"before 5am on monday\"\n ],\n \"timezone\": \"Etc/UTC\",\n \"packageRules\": [\n {\n \"matchManagers\": [\n \"github-actions\"\n ],\n \"groupName\": \"github-actions\",\n \"labels\": [\n \"dependencies\",\n \"github-actions\",\n \"security\"\n ]\n },\n {\n \"matchManagers\": [\n \"npm\"\n ],\n \"matchUpdateTypes\": [\n \"patch\",\n \"minor\"\n ],\n \"groupName\": \"npm minor and patch updates\",\n \"labels\": [\n \"dependencies\",\n \"npm\"\n ]\n },\n {\n \"matchUpdateTypes\": [\n \"major\"\n ],\n \"dependencyDashboardApproval\": true,\n \"labels\": [\n \"dependencies\",\n \"major\"\n ]\n }\n ]\n}\n",
27
27
  ".github/workflows/ultramodern-gates.yml": "name: Ultramodern Gates\n\non:\n push:\n pull_request:\n\npermissions:\n contents: read\n\ndefaults:\n run:\n shell: bash\n\nenv:\n FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true\n\nconcurrency:\n group: ultramodern-gates-${{ github.workflow }}-${{ github.ref }}\n cancel-in-progress: true\n\njobs:\n ultramodern-gates:\n runs-on: ubuntu-latest\n timeout-minutes: 20\n steps:\n - name: Harden Runner\n uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2\n with:\n egress-policy: audit\n\n - name: Checkout\n uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2\n with:\n fetch-depth: 1\n persist-credentials: false\n\n - name: Setup Node.js\n uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0\n with:\n node-version: 24\n\n - name: Setup mise\n uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0\n\n - name: Install Dependencies\n run: mise exec -- pnpm install --frozen-lockfile\n\n - name: Validate Ultramodern Contract\n run: mise exec -- pnpm run ultramodern:check\n\n - name: Build\n env:\n MODERN_PUBLIC_SITE_URL: http://localhost:8080\n run: mise exec -- pnpm run build\n",
28
- "api/effect/index.ts": "import {\n Effect,\n HttpApiBuilder,\n Layer,\n defineEffectBff,\n} from '@modern-js/plugin-bff/effect-server';\nimport type { HttpApi, HttpApiGroup } from '@modern-js/plugin-bff/effect-server';\nimport { bffEffectApi } from '../../shared/effect/api.ts';\n\ntype ApiGroups<TApi> = TApi extends HttpApi.HttpApi<string, infer TGroups> ? TGroups : never;\ntype GreetingsHandlers = HttpApiBuilder.Handlers.FromGroup<\n HttpApiGroup.WithName<ApiGroups<typeof bffEffectApi>, 'greetings'>\n>;\n\nconst greetingsLayer = HttpApiBuilder.group(\n bffEffectApi,\n 'greetings',\n (handlers: GreetingsHandlers) =>\n handlers.handle('hello', () =>\n Effect.succeed({\n message: 'Hello from Effect HttpApi',\n runtime: 'effect' as const,\n }),\n ),\n);\n\nconst layer = HttpApiBuilder.layer(bffEffectApi).pipe(\n Layer.provide(greetingsLayer),\n);\n\nexport default defineEffectBff({\n api: bffEffectApi,\n layer,\n});\n",
29
28
  "api/lambda/hello.ts": "\n",
29
+ "api/effect/index.ts": "import {\n Effect,\n HttpApiBuilder,\n Layer,\n defineEffectBff,\n} from '@modern-js/plugin-bff/effect-server';\nimport type { HttpApi, HttpApiGroup } from '@modern-js/plugin-bff/effect-server';\nimport { bffEffectApi } from '../../shared/effect/api.ts';\n\ntype ApiGroups<TApi> = TApi extends HttpApi.HttpApi<string, infer TGroups> ? TGroups : never;\ntype GreetingsHandlers = HttpApiBuilder.Handlers.FromGroup<\n HttpApiGroup.WithName<ApiGroups<typeof bffEffectApi>, 'greetings'>\n>;\n\nconst greetingsLayer = HttpApiBuilder.group(\n bffEffectApi,\n 'greetings',\n (handlers: GreetingsHandlers) =>\n handlers.handle('hello', () =>\n Effect.succeed({\n message: 'Hello from Effect HttpApi',\n runtime: 'effect' as const,\n }),\n ),\n);\n\nconst layer = HttpApiBuilder.layer(bffEffectApi).pipe(\n Layer.provide(greetingsLayer),\n);\n\nexport default defineEffectBff({\n api: bffEffectApi,\n layer,\n});\n",
30
30
  "shared/effect/api.ts": "import {\n HttpApi,\n HttpApiEndpoint,\n HttpApiGroup,\n Schema,\n} from '@modern-js/plugin-bff/effect-client';\n\nexport const bffEffectApi = HttpApi.make('BffApi').add(\n HttpApiGroup.make('greetings').add(\n HttpApiEndpoint.get('hello', '/effect/hello', {\n success: Schema.Struct({\n message: Schema.String,\n runtime: Schema.Literal('effect'),\n }),\n }),\n ),\n);\n",
31
31
  "src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n\ndeclare const ULTRAMODERN_SITE_URL: string;\n",
32
32
  "src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\nimport { createInstance } from 'i18next';\n\nconst i18nInstance = createInstance();\n\nexport default defineRuntimeConfig({\n i18n: {\n i18nInstance,\n initOptions: {\n defaultNS: 'translation',\n fallbackLng: 'en',\n interpolation: {\n escapeValue: false,\n },\n ns: ['translation'],\n supportedLngs: ['en', 'cs'],\n },\n },\n router: {\n framework: 'tanstack',\n },\n});\n",
@@ -19,15 +19,15 @@ const MWAFiles = {
19
19
  "tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"target\": \"ESNext\",\n \"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n \"module\": \"preserve\",\n \"moduleResolution\": \"Bundler\",\n \"moduleDetection\": \"force\",\n \"isolatedModules\": true,\n \"verbatimModuleSyntax\": true,\n \"noEmit\": true,\n \"allowJs\": true,\n \"allowImportingTsExtensions\": true,\n \"resolveJsonModule\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true,\n \"strict\": true,\n \"noUncheckedIndexedAccess\": true,\n \"exactOptionalPropertyTypes\": true,\n \"noImplicitOverride\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@api/*\": [\"./api/*\"],\n \"@shared/*\": [\"./shared/*\"]\n },\n \"rootDir\": \".\",\n \"plugins\": [\n {\n \"name\": \"@effect/language-service\",\n \"diagnostics\": true,\n \"includeSuggestionsInTsc\": true,\n \"ignoreEffectSuggestionsInTscExitCode\": false,\n \"ignoreEffectWarningsInTscExitCode\": false,\n \"ignoreEffectErrorsInTscExitCode\": false,\n \"skipDisabledOptimization\": true,\n \"diagnosticSeverity\": {\n \"anyUnknownInErrorContext\": \"error\",\n \"classSelfMismatch\": \"error\",\n \"duplicatePackage\": \"error\",\n \"effectFnImplicitAny\": \"error\",\n \"floatingEffect\": \"error\",\n \"genericEffectServices\": \"error\",\n \"missingEffectContext\": \"error\",\n \"missingEffectError\": \"error\",\n \"missingLayerContext\": \"error\",\n \"missingReturnYieldStar\": \"error\",\n \"missingStarInYieldEffectGen\": \"error\",\n \"nonObjectEffectServiceType\": \"error\",\n \"outdatedApi\": \"error\",\n \"overriddenSchemaConstructor\": \"error\",\n \"catchUnfailableEffect\": \"error\",\n \"effectFnIife\": \"error\",\n \"effectGenUsesAdapter\": \"error\",\n \"effectInFailure\": \"error\",\n \"effectInVoidSuccess\": \"error\",\n \"globalErrorInEffectCatch\": \"error\",\n \"globalErrorInEffectFailure\": \"error\",\n \"layerMergeAllWithDependencies\": \"error\",\n \"lazyPromiseInEffectSync\": \"error\",\n \"leakingRequirements\": \"error\",\n \"multipleEffectProvide\": \"error\",\n \"returnEffectInGen\": \"error\",\n \"runEffectInsideEffect\": \"error\",\n \"schemaSyncInEffect\": \"error\",\n \"scopeInLayerEffect\": \"error\",\n \"strictEffectProvide\": \"error\",\n \"tryCatchInEffectGen\": \"error\",\n \"unknownInEffectCatch\": \"error\",\n \"asyncFunction\": \"error\",\n \"cryptoRandomUUID\": \"error\",\n \"cryptoRandomUUIDInEffect\": \"error\",\n \"extendsNativeError\": \"error\",\n \"globalConsole\": \"error\",\n \"globalConsoleInEffect\": \"error\",\n \"globalDate\": \"error\",\n \"globalDateInEffect\": \"error\",\n \"globalFetch\": \"error\",\n \"globalFetchInEffect\": \"error\",\n \"globalRandom\": \"error\",\n \"globalRandomInEffect\": \"error\",\n \"globalTimers\": \"error\",\n \"globalTimersInEffect\": \"error\",\n \"instanceOfSchema\": \"error\",\n \"newPromise\": \"error\",\n \"nodeBuiltinImport\": \"error\",\n \"preferSchemaOverJson\": \"error\",\n \"processEnv\": \"error\",\n \"processEnvInEffect\": \"error\",\n \"unsafeEffectTypeAssertion\": \"error\",\n \"catchAllToMapError\": \"error\",\n \"deterministicKeys\": \"error\",\n \"effectDoNotation\": \"error\",\n \"effectFnOpportunity\": \"error\",\n \"effectMapFlatten\": \"error\",\n \"effectMapVoid\": \"error\",\n \"effectSucceedWithVoid\": \"error\",\n \"missedPipeableOpportunity\": \"error\",\n \"missingEffectServiceDependency\": \"error\",\n \"nestedEffectGenYield\": \"error\",\n \"redundantSchemaTagIdentifier\": \"error\",\n \"schemaStructWithTag\": \"error\",\n \"schemaUnionOfLiterals\": \"error\",\n \"serviceNotAsClass\": \"error\",\n \"strictBooleanExpressions\": \"error\",\n \"unnecessaryArrowBlock\": \"error\",\n \"unnecessaryEffectGen\": \"error\",\n \"unnecessaryFailYieldableError\": \"error\",\n \"unnecessaryPipe\": \"error\",\n \"unnecessaryPipeChain\": \"error\"\n }\n }\n ]\n },\n \"include\": [\"src\", \"api\", \"shared\", \"config\", \"modern.config.ts\", \"server\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
20
20
  ".agents/skills-lock.json": "{\n \"schemaVersion\": 2,\n \"installDir\": \".agents/skills\",\n \"sources\": [\n {\n \"id\": \"techsiocz-private\",\n \"visibility\": \"private\",\n \"repository\": \"https://github.com/TechsioCZ/skills\",\n \"install\": \"clone-if-authorized\",\n \"baseline\": [\n {\n \"name\": \"plan-graph\",\n \"reason\": \"Build and validate DAGs from .plan.md files\"\n },\n {\n \"name\": \"dag\",\n \"reason\": \"Inspect current plan frontiers and blocked lanes\"\n },\n {\n \"name\": \"subagent-graph\",\n \"reason\": \"Design dependency-aware multi-agent launch graphs\"\n },\n {\n \"name\": \"helm\",\n \"reason\": \"Steer already-running multi-agent work\"\n },\n {\n \"name\": \"debugger-mode\",\n \"reason\": \"Run hypothesis-driven debugging with runtime evidence\"\n }\n ]\n }\n ]\n}\n",
21
21
  ".codex/hooks.json": "{\n \"Stop\": [\n {\n \"command\": \"pnpm format && pnpm lint:fix && pnpm ultramodern:check\",\n \"timeout\": 600000,\n \"statusMessage\": \"Running UltraModern quality gates\"\n }\n ],\n \"SubagentStop\": [\n {\n \"command\": \"pnpm format && pnpm lint:fix && pnpm ultramodern:check\",\n \"timeout\": 600000,\n \"statusMessage\": \"Running UltraModern quality gates\"\n }\n ]\n}\n",
22
- "scripts/bootstrap-agent-skills.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst lockPath = path.join(root, '.agents/skills-lock.json');\nconst checkOnly = process.argv.includes('--check');\nconst force = process.argv.includes('--force');\n\nconst readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8'));\n\nconst run = (command, args, options = {}) =>\n execFileSync(command, args, {\n cwd: options.cwd ?? root,\n encoding: 'utf-8',\n stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],\n });\n\nconst commandExists = (command) => {\n try {\n run(command, ['--version'], { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n};\n\nconst runShell = (script) =>\n run('sh', ['-lc', script], {\n stdio: 'inherit',\n });\n\nconst installGit = () => {\n if (commandExists('git')) {\n return;\n }\n\n if (commandExists('brew')) {\n run('brew', ['install', 'git'], { stdio: 'inherit' });\n } else if (process.platform === 'linux' && commandExists('apt-get')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}apt-get update && ${sudo}apt-get install -y git`);\n } else if (process.platform === 'linux' && commandExists('dnf')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}dnf install -y git`);\n } else if (process.platform === 'linux' && commandExists('yum')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}yum install -y git`);\n } else if (process.platform === 'linux' && commandExists('apk')) {\n runShell('apk add --no-cache git');\n }\n\n if (!commandExists('git')) {\n throw new Error(\n 'Git is required for UltraModern setup. Install git and run pnpm skills:install again.',\n );\n }\n};\n\nconst isInsideGitWorkTree = () => {\n try {\n return run('git', ['rev-parse', '--is-inside-work-tree']).trim() === 'true';\n } catch {\n return false;\n }\n};\n\nconst initializeGitRepository = () => {\n if (isInsideGitWorkTree()) {\n return;\n }\n\n try {\n run('git', ['init', '-b', 'main'], { stdio: 'inherit' });\n } catch {\n run('git', ['init'], { stdio: 'inherit' });\n run('git', ['branch', '-M', 'main'], { stdio: 'inherit' });\n }\n};\n\nconst installLefthook = () => {\n try {\n run('lefthook', ['install'], { stdio: 'inherit' });\n } catch (error) {\n console.warn(`Unable to install lefthook hooks: ${error.message}`);\n }\n};\n\nconst removeTree = (dir) =>\n fs.rmSync(dir, {\n force: true,\n maxRetries: 5,\n recursive: true,\n retryDelay: 100,\n });\n\nconst cloneSource = (source, targetDir) => {\n if (source.commit) {\n run('git', ['init', targetDir]);\n run('git', ['remote', 'add', 'origin', source.repository], {\n cwd: targetDir,\n });\n run('git', ['fetch', '--depth', '1', '--quiet', 'origin', source.commit], {\n cwd: targetDir,\n });\n run(\n 'git',\n [\n '-c',\n 'advice.detachedHead=false',\n 'checkout',\n '--detach',\n '--quiet',\n 'FETCH_HEAD',\n ],\n { cwd: targetDir },\n );\n return;\n }\n\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1', '--quiet']);\n } catch {\n run('git', ['clone', '--depth', '1', '--quiet', source.repository, targetDir]);\n }\n};\n\nconst resolveSkillDir = (sourceRoot, skillName) => {\n const candidates = [\n path.join(sourceRoot, skillName),\n path.join(sourceRoot, 'skills', skillName),\n path.join(sourceRoot, 'skills', 'engineering', skillName),\n path.join(sourceRoot, 'skills', 'productivity', skillName),\n ];\n return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'SKILL.md')));\n};\n\nif (!fs.existsSync(lockPath)) {\n console.error('Missing .agents/skills-lock.json');\n process.exit(1);\n}\n\nconst lock = readJson(lockPath);\nconst installDir = path.join(root, lock.installDir ?? '.agents/skills');\nconst sources = lock.sources ?? [];\nconst requiredCloneSources = sources.filter((source) => source.install === 'clone');\nconst optionalCloneSources = sources.filter(\n (source) => source.install === 'clone-if-authorized',\n);\nconst requiredSkills = [\n ...(lock.baseline ?? []),\n ...requiredCloneSources.flatMap((source) => source.baseline ?? []),\n].filter(\n (skill, index, skills) =>\n skills.findIndex((candidate) => candidate.name === skill.name) === index,\n);\n\nif (checkOnly) {\n const missingRequired = requiredSkills\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md')));\n const missingOptional = optionalCloneSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n\n if (missingRequired.length > 0) {\n console.error(\n `Required agent skills not installed: ${missingRequired.join(', ')}. Run pnpm skills:install.`,\n );\n process.exit(1);\n }\n\n if (missingOptional.length > 0) {\n console.warn(\n `Private skills not installed: ${missingOptional.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Required and private agent skills are installed.');\n process.exit(0);\n }\n console.log('Required agent skills are installed.');\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\ninstallGit();\n\nfor (const source of [...requiredCloneSources, ...optionalCloneSources]) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n try {\n cloneSource(source, tempDir);\n } catch (error) {\n if (source.install === 'clone-if-authorized') {\n console.warn(\n `Skipping ${source.repository}; current developer may not have access.`,\n );\n continue;\n }\n throw error;\n }\n for (const skill of source.baseline ?? []) {\n const sourceSkillDir = resolveSkillDir(tempDir, skill.name);\n if (!sourceSkillDir) {\n throw new Error(`Skill ${skill.name} not found in ${source.repository}`);\n }\n const targetSkillDir = path.join(installDir, skill.name);\n if (fs.existsSync(targetSkillDir)) {\n if (!force) {\n console.log(`Skipping existing ${skill.name}`);\n continue;\n }\n removeTree(targetSkillDir);\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n removeTree(tempDir);\n }\n}\n\ninitializeGitRepository();\ninstallLefthook();\n",
23
22
  "scripts/check-i18n-strings.mjs": "import fs from 'node:fs';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst scanRoots = ['src'].map((scanRoot) => path.join(root, scanRoot));\nconst ignoredDirectories = new Set(['.modern', '.modernjs', 'dist', 'node_modules']);\nconst visibleAttributePattern =\n /\\s(?:aria-label|alt|placeholder|title)=[\"']([^\"']*[A-Za-z][^\"']*)[\"']/gu;\nconst jsxTextPattern = />([^<>{}]*[A-Za-z][^<>{}]*)</gu;\nconst jsxIntrinsicTags = new Set([\n 'a',\n 'abbr',\n 'address',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'mark',\n 'menu',\n 'meta',\n 'meter',\n 'nav',\n 'ol',\n 'option',\n 'p',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n 'strong',\n 'style',\n 'summary',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'u',\n 'ul',\n 'video',\n]);\n\nconst collectFiles = (directory) => {\n if (!fs.existsSync(directory)) {\n return [];\n }\n\n const files = [];\n for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {\n if (entry.isDirectory()) {\n if (!ignoredDirectories.has(entry.name)) {\n files.push(...collectFiles(path.join(directory, entry.name)));\n }\n continue;\n }\n\n if (entry.isFile() && /\\.(jsx|tsx)$/u.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n files.push(path.join(directory, entry.name));\n }\n }\n return files;\n};\n\nconst lineNumberForIndex = (content, index) => content.slice(0, index).split('\\n').length;\nconst isCodeElementText = (content, index) => {\n const tagStart = content.lastIndexOf('<', index);\n if (tagStart === -1) {\n return false;\n }\n return /^<code(?:\\s|>)/u.test(content.slice(tagStart, index));\n};\nconst isJsxTagEnd = (content, index) => {\n const tagStart = content.lastIndexOf('<', index);\n if (tagStart === -1 || content.slice(tagStart + 1, index).includes('<')) {\n return false;\n }\n const match = content\n .slice(tagStart, index + 1)\n .match(/^<\\/?\\s*([A-Za-z][\\w:.-]*)\\b[^<>]*>$/u);\n if (!match) {\n return false;\n }\n const [, tagName] = match;\n return (\n /^[A-Z]/u.test(tagName) ||\n tagName.includes('-') ||\n jsxIntrinsicTags.has(tagName)\n );\n};\nconst isIgnoredLine = (content, index) => {\n const lineStart = content.lastIndexOf('\\n', index) + 1;\n const lineEnd = content.indexOf('\\n', index);\n const currentLineEnd = lineEnd === -1 ? content.length : lineEnd;\n const previousLineStart = content.lastIndexOf('\\n', Math.max(0, lineStart - 2)) + 1;\n const nextLineEnd = content.indexOf('\\n', currentLineEnd + 1);\n const context = content.slice(\n previousLineStart,\n nextLineEnd === -1 ? content.length : nextLineEnd,\n );\n return /i18n-ignore/u.test(context);\n};\n\nconst violations = [];\nfor (const filePath of scanRoots.flatMap(collectFiles)) {\n const content = fs.readFileSync(filePath, 'utf-8');\n for (const match of content.matchAll(visibleAttributePattern)) {\n const [, visibleText] = match;\n if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: visibleText.trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const [, jsxText] = match;\n const text = jsxText.replaceAll(/\\s+/gu, ' ').trim();\n if (\n text &&\n !isIgnoredLine(content, match.index ?? 0) &&\n isJsxTagEnd(content, match.index ?? 0) &&\n !isCodeElementText(content, match.index ?? 0)\n ) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text,\n });\n }\n }\n}\n\nif (violations.length > 0) {\n console.error('Hardcoded user-visible JSX strings found. Move copy to locale JSON files.');\n for (const violation of violations) {\n console.error(\n `${path.relative(root, violation.filePath)}:${violation.line} ${JSON.stringify(\n violation.text,\n )}`,\n );\n }\n process.exit(1);\n}\n\nconsole.log('No hardcoded user-visible JSX strings found.');\n",
23
+ "scripts/bootstrap-agent-skills.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst lockPath = path.join(root, '.agents/skills-lock.json');\nconst checkOnly = process.argv.includes('--check');\nconst force = process.argv.includes('--force');\n\nconst readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8'));\n\nconst run = (command, args, options = {}) =>\n execFileSync(command, args, {\n cwd: options.cwd ?? root,\n encoding: 'utf-8',\n stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],\n });\n\nconst commandExists = (command) => {\n try {\n run(command, ['--version'], { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n};\n\nconst runShell = (script) =>\n run('sh', ['-lc', script], {\n stdio: 'inherit',\n });\n\nconst installGit = () => {\n if (commandExists('git')) {\n return;\n }\n\n if (commandExists('brew')) {\n run('brew', ['install', 'git'], { stdio: 'inherit' });\n } else if (process.platform === 'linux' && commandExists('apt-get')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}apt-get update && ${sudo}apt-get install -y git`);\n } else if (process.platform === 'linux' && commandExists('dnf')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}dnf install -y git`);\n } else if (process.platform === 'linux' && commandExists('yum')) {\n const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';\n runShell(`${sudo}yum install -y git`);\n } else if (process.platform === 'linux' && commandExists('apk')) {\n runShell('apk add --no-cache git');\n }\n\n if (!commandExists('git')) {\n throw new Error(\n 'Git is required for UltraModern setup. Install git and run pnpm skills:install again.',\n );\n }\n};\n\nconst isInsideGitWorkTree = () => {\n try {\n return run('git', ['rev-parse', '--is-inside-work-tree']).trim() === 'true';\n } catch {\n return false;\n }\n};\n\nconst initializeGitRepository = () => {\n if (isInsideGitWorkTree()) {\n return;\n }\n\n try {\n run('git', ['init', '-b', 'main'], { stdio: 'inherit' });\n } catch {\n run('git', ['init'], { stdio: 'inherit' });\n run('git', ['branch', '-M', 'main'], { stdio: 'inherit' });\n }\n};\n\nconst installLefthook = () => {\n try {\n run('lefthook', ['install'], { stdio: 'inherit' });\n } catch (error) {\n console.warn(`Unable to install lefthook hooks: ${error.message}`);\n }\n};\n\nconst removeTree = (dir) =>\n fs.rmSync(dir, {\n force: true,\n maxRetries: 5,\n recursive: true,\n retryDelay: 100,\n });\n\nconst cloneSource = (source, targetDir) => {\n if (source.commit) {\n run('git', ['init', targetDir]);\n run('git', ['remote', 'add', 'origin', source.repository], {\n cwd: targetDir,\n });\n run('git', ['fetch', '--depth', '1', '--quiet', 'origin', source.commit], {\n cwd: targetDir,\n });\n run(\n 'git',\n [\n '-c',\n 'advice.detachedHead=false',\n 'checkout',\n '--detach',\n '--quiet',\n 'FETCH_HEAD',\n ],\n { cwd: targetDir },\n );\n return;\n }\n\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1', '--quiet']);\n } catch {\n run('git', ['clone', '--depth', '1', '--quiet', source.repository, targetDir]);\n }\n};\n\nconst resolveSkillDir = (sourceRoot, skillName) => {\n const candidates = [\n path.join(sourceRoot, skillName),\n path.join(sourceRoot, 'skills', skillName),\n path.join(sourceRoot, 'skills', 'engineering', skillName),\n path.join(sourceRoot, 'skills', 'productivity', skillName),\n ];\n return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'SKILL.md')));\n};\n\nif (!fs.existsSync(lockPath)) {\n console.error('Missing .agents/skills-lock.json');\n process.exit(1);\n}\n\nconst lock = readJson(lockPath);\nconst installDir = path.join(root, lock.installDir ?? '.agents/skills');\nconst sources = lock.sources ?? [];\nconst requiredCloneSources = sources.filter((source) => source.install === 'clone');\nconst optionalCloneSources = sources.filter(\n (source) => source.install === 'clone-if-authorized',\n);\nconst requiredSkills = [\n ...(lock.baseline ?? []),\n ...requiredCloneSources.flatMap((source) => source.baseline ?? []),\n].filter(\n (skill, index, skills) =>\n skills.findIndex((candidate) => candidate.name === skill.name) === index,\n);\n\nif (checkOnly) {\n const missingRequired = requiredSkills\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md')));\n const missingOptional = optionalCloneSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n\n if (missingRequired.length > 0) {\n console.error(\n `Required agent skills not installed: ${missingRequired.join(', ')}. Run pnpm skills:install.`,\n );\n process.exit(1);\n }\n\n if (missingOptional.length > 0) {\n console.warn(\n `Private skills not installed: ${missingOptional.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Required and private agent skills are installed.');\n process.exit(0);\n }\n console.log('Required agent skills are installed.');\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\ninstallGit();\n\nfor (const source of [...requiredCloneSources, ...optionalCloneSources]) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n try {\n cloneSource(source, tempDir);\n } catch (error) {\n if (source.install === 'clone-if-authorized') {\n console.warn(\n `Skipping ${source.repository}; current developer may not have access.`,\n );\n continue;\n }\n throw error;\n }\n for (const skill of source.baseline ?? []) {\n const sourceSkillDir = resolveSkillDir(tempDir, skill.name);\n if (!sourceSkillDir) {\n throw new Error(`Skill ${skill.name} not found in ${source.repository}`);\n }\n const targetSkillDir = path.join(installDir, skill.name);\n if (fs.existsSync(targetSkillDir)) {\n if (!force) {\n console.log(`Skipping existing ${skill.name}`);\n continue;\n }\n removeTree(targetSkillDir);\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n removeTree(tempDir);\n }\n}\n\ninitializeGitRepository();\ninstallLefthook();\n",
24
24
  "scripts/validate-ultramodern.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst configPath = path.resolve(process.cwd(), 'modern.config.ts');\nconst templateManifestPath = path.resolve(process.cwd(), '.modernjs/mv-template-manifest.json');\nconst packageSourcePath = path.resolve(\n process.cwd(),\n '.modernjs/ultramodern-package-source.json',\n);\nconst readText = (relativePath) =>\n fs.readFileSync(path.resolve(process.cwd(), relativePath), 'utf-8');\nconst readJson = (relativePath) => JSON.parse(readText(relativePath));\nconst readPnpmConfig = (key) => {\n const env = Object.fromEntries(\n Object.entries(process.env).filter(\n ([envKey]) => !/^(?:npm|pnpm)_config_/iu.test(envKey),\n ),\n );\n const output = execFileSync('pnpm', ['config', 'get', key, '--json'], {\n cwd: process.cwd(),\n encoding: 'utf-8',\n env,\n stdio: ['ignore', 'pipe', 'pipe'],\n }).trim();\n return output ? JSON.parse(output) : undefined;\n};\nconst enableTailwind = true;\nconst expectedPnpmVersion = '11.5.0';\nconst activePnpmVersion = execFileSync('pnpm', ['--version'], {\n cwd: process.cwd(),\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'pipe'],\n}).trim();\n\nif (activePnpmVersion !== expectedPnpmVersion) {\n console.error(\n `Generated app requires pnpm ${expectedPnpmVersion}; active pnpm is ${activePnpmVersion}. Run mise install, then rerun pnpm from the activated shell`,\n );\n process.exit(1);\n}\n\nif (!fs.existsSync(configPath)) {\n console.error('modern.config.ts not found');\n process.exit(1);\n}\n\nconst content = fs.readFileSync(configPath, 'utf-8');\nconst requiredTokens = [\n 'presetUltramodern(',\n 'appTools()',\n 'enableModuleFederationSSR',\n 'enableBffRequestId',\n 'enableTelemetryExporters',\n 'i18nPlugin(',\n 'localePathRedirect: true',\n 'ULTRAMODERN_SITE_URL',\n 'MODERN_PUBLIC_SITE_URL must be set for production builds',\n 'globalVars',\n];\nconst missing = requiredTokens.filter((token) => !content.includes(token));\n\nif (missing.length > 0) {\n console.error(`Ultramodern contract check failed. Missing tokens: ${missing.join(', ')}`);\n process.exit(1);\n}\n\nif (!fs.existsSync(templateManifestPath)) {\n console.error('.modernjs/mv-template-manifest.json not found');\n process.exit(1);\n}\n\nconst templateManifest = JSON.parse(fs.readFileSync(templateManifestPath, 'utf-8'));\nconst requiredDeniedPaths = [\n '.git/**',\n '.npmrc',\n '.yarnrc',\n '.env',\n '.env.*',\n 'node_modules/**',\n 'dist/**',\n];\nconst requiredPostMaterialization = [\n 'ultramodern-contract-check',\n 'agent-skill-postinstall-allowed',\n 'github-workflow-security-enforced',\n 'package-source-retained',\n 'pnpm-11-policy-enforced',\n 'rstest-smoke-tests',\n 'template-manifest-retained',\n];\nconst requiredPaths = [\n\n 'AGENTS.md',\n '.agents/skills-lock.json',\n '.codex/hooks.json',\n '.github/renovate.json',\n '.github/workflows/ultramodern-gates.yml',\n 'lefthook.yml',\n 'oxlint.config.ts',\n 'oxfmt.config.ts',\n 'scripts/bootstrap-agent-skills.mjs',\n\n '.mise.toml',\n '.modernjs/ultramodern-package-source.json',\n 'pnpm-workspace.yaml',\n 'rstest.config.mts',\n 'scripts/check-i18n-strings.mjs',\n\n 'postcss.config.mjs',\n 'tailwind.config.ts',\n\n 'config/public/locales/en/translation.json',\n 'config/public/locales/cs/translation.json',\n 'config/favicon.svg',\n 'config/public/assets/ultramodern-logo.svg',\n 'src/modern-app-env.d.ts',\n 'src/routes/index.css',\n 'src/routes/layout.tsx',\n 'src/routes/[lang]/page.tsx',\n 'tests/ultramodern.contract.test.ts',\n];\nconst manifestErrors = [];\n\nfor (const requiredPath of requiredPaths) {\n if (!fs.existsSync(path.resolve(process.cwd(), requiredPath))) {\n console.error(`${requiredPath} not found`);\n process.exit(1);\n }\n}\n\nif (fs.existsSync(path.resolve(process.cwd(), 'src/routes/page.tsx'))) {\n console.error('src/routes/page.tsx must move under src/routes/[lang]/page.tsx');\n process.exit(1);\n}\n\nif (\n !enableTailwind &&\n (fs.existsSync(path.resolve(process.cwd(), 'postcss.config.mjs')) ||\n fs.existsSync(path.resolve(process.cwd(), 'tailwind.config.ts')))\n) {\n console.error('Tailwind config files must not be written when Tailwind is disabled');\n process.exit(1);\n}\n\n\nconst workflowContent = fs.readFileSync(\n path.resolve(process.cwd(), '.github/workflows/ultramodern-gates.yml'),\n 'utf-8',\n);\nconst renovateConfig = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.github/renovate.json'), 'utf-8'),\n);\nfor (const requiredSnippet of [\n 'permissions:\\n contents: read',\n 'pull_request:',\n 'persist-credentials: false',\n 'jdx/mise-action',\n 'pnpm install --frozen-lockfile',\n 'pnpm run ultramodern:check',\n 'pnpm run build',\n 'MODERN_PUBLIC_SITE_URL: http://localhost:8080',\n 'timeout-minutes:',\n 'egress-policy: audit',\n]) {\n if (!workflowContent.includes(requiredSnippet)) {\n console.error(`Generated workflow must retain ${requiredSnippet.split('\\n')[0]}`);\n process.exit(1);\n }\n}\nif (workflowContent.includes('pull_request_target')) {\n console.error('Generated workflow must not use pull_request_target');\n process.exit(1);\n}\nfor (const match of workflowContent.matchAll(/^\\s*uses:\\s*([^@\\s]+)@([^\\s#]+)/gmu)) {\n const [, actionName, actionRef] = match;\n if (!/^[a-f0-9]{40}$/u.test(actionRef)) {\n console.error(`Generated workflow must pin ${actionName}@${actionRef} to a commit SHA`);\n process.exit(1);\n }\n}\nif (\n renovateConfig.dependencyDashboard !== true ||\n renovateConfig.minimumReleaseAge !== '1 day' ||\n !renovateConfig.extends?.includes('helpers:pinGitHubActionDigests') ||\n !renovateConfig.packageRules?.some(\n (rule) =>\n rule.dependencyDashboardApproval === true && rule.matchUpdateTypes?.includes('major'),\n )\n) {\n console.error('Generated Renovate config must retain dashboard, release-age, action pinning, and major-approval policy');\n process.exit(1);\n}\n\n\nif (templateManifest.schemaVersion !== 1) {\n manifestErrors.push('schemaVersion');\n}\n\nif (templateManifest.source?.type !== 'builtin') {\n manifestErrors.push('source.type');\n}\n\nif (\n !Array.isArray(templateManifest.integrity?.checksums) ||\n !templateManifest.integrity.checksums.some(\n (checksum) =>\n checksum.algorithm === 'sha256' &&\n checksum.scope === 'source-tree' &&\n /^[0-9a-f]{64}$/u.test(checksum.value),\n )\n) {\n manifestErrors.push('integrity.checksums[source-tree]');\n}\n\nfor (const deniedPath of requiredDeniedPaths) {\n if (!templateManifest.materialization?.deniedPaths?.includes(deniedPath)) {\n manifestErrors.push(`materialization.deniedPaths:${deniedPath}`);\n }\n}\n\nif (templateManifest.lifecyclePolicy?.denyByDefault !== true) {\n manifestErrors.push('lifecyclePolicy.denyByDefault');\n}\nif (\n JSON.stringify(templateManifest.lifecyclePolicy?.allowedScripts) !==\n JSON.stringify(['postinstall'])\n) {\n manifestErrors.push('lifecyclePolicy.allowedScripts');\n}\n\nfor (const token of requiredPostMaterialization) {\n if (!templateManifest.validation?.postMaterializationValidation?.includes(token)) {\n manifestErrors.push(`validation.postMaterializationValidation:${token}`);\n }\n}\n\nif (manifestErrors.length > 0) {\n console.error(\n `Ultramodern template manifest check failed. Invalid fields: ${manifestErrors.join(', ')}`,\n );\n process.exit(1);\n}\n\nconst packageJson = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), 'package.json'), 'utf-8'),\n);\nconst packageSource = JSON.parse(fs.readFileSync(packageSourcePath, 'utf-8'));\nconst routePage = readText('src/routes/[lang]/page.tsx');\nconst routeCss = readText('src/routes/index.css');\nconst modernConfig = readText('modern.config.ts');\nconst enLocale = readJson('config/public/locales/en/translation.json');\nconst csLocale = readJson('config/public/locales/cs/translation.json');\nconst unresolvedTemplateMarker = String.fromCodePoint(123, 123);\nif (JSON.stringify(packageJson).includes(unresolvedTemplateMarker)) {\n console.error('package.json contains unresolved template markers');\n process.exit(1);\n}\nif (JSON.stringify(packageSource).includes(unresolvedTemplateMarker)) {\n console.error('package source metadata contains unresolved template markers');\n process.exit(1);\n}\n\nfor (const [fileName, text] of [\n ['src/routes/[lang]/page.tsx', routePage],\n ['src/routes/index.css', routeCss],\n ['modern.config.ts', modernConfig],\n]) {\n if (text.includes('lf3-static.bytednsdoc.com')) {\n console.error(`${fileName} must not depend on remote starter assets`);\n process.exit(1);\n }\n}\n\nfor (const requiredSnippet of [\n '<Helmet',\n 'htmlAttributes={{',\n 'dir: languageDirections[currentLanguage]',\n 'lang: currentLanguage',\n '<title>{pageTitle}</title>',\n '<meta name=\"description\" content={pageDescription} />',\n '<main id=\"starter-main\" className=\"starter-main\">',\n '<h1 id=\"starter-heading\" className=\"title\">',\n 'src=\"/assets/ultramodern-logo.svg\"',\n 'height={96}',\n 'width={96}',\n '<span aria-hidden=\"true\" className=\"arrow-right\" />',\n]) {\n if (!routePage.includes(requiredSnippet)) {\n console.error(`Generated route page must retain starter correctness snippet: ${requiredSnippet}`);\n process.exit(1);\n }\n}\n\nfor (const forbiddenSnippet of ['src=\"https://', '<div className=\"title\">']) {\n if (routePage.includes(forbiddenSnippet)) {\n console.error(`Generated route page must not contain ${forbiddenSnippet}`);\n process.exit(1);\n }\n}\n\nfor (const requiredSnippet of [\n 'width=device-width, initial-scale=1.0, viewport-fit=cover',\n \"title: 'UltraModern.js Starter'\",\n]) {\n if (!modernConfig.includes(requiredSnippet)) {\n console.error(`modern.config.ts must retain ${requiredSnippet}`);\n process.exit(1);\n }\n}\nif (modernConfig.includes('user-scalable=no') || modernConfig.includes('maximum-scale')) {\n console.error('modern.config.ts must not disable user zoom');\n process.exit(1);\n}\n\nfor (const requiredSnippet of [\n 'min-block-size: 100dvh',\n 'grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr))',\n ':focus-visible',\n '@media (prefers-reduced-motion: reduce)',\n '.skip-link',\n]) {\n if (!routeCss.includes(requiredSnippet)) {\n console.error(`Starter CSS must retain ${requiredSnippet}`);\n process.exit(1);\n }\n}\nif (routeCss.includes('width: 1100px') || /\\.card:focus(?!-visible)/u.test(routeCss)) {\n console.error('Starter CSS must not reintroduce fixed grid width or focus transform styling');\n process.exit(1);\n}\n\nfor (const [localeName, locale] of [\n ['en', enLocale],\n ['cs', csLocale],\n]) {\n if (\n typeof locale.home?.meta?.title !== 'string' ||\n typeof locale.home?.meta?.description !== 'string' ||\n typeof locale.home?.skipLink !== 'string'\n ) {\n console.error(`${localeName} locale must include starter metadata and skip-link copy`);\n process.exit(1);\n }\n}\n\nconst skillsLock = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.agents/skills-lock.json'), 'utf-8'),\n);\n\nconst requiredScripts = {\n\n format: 'oxfmt .',\n 'format:check': 'oxfmt --check .',\n\n 'i18n:check': 'node ./scripts/check-i18n-strings.mjs',\n\n lint: 'oxlint .',\n 'lint:fix': 'oxlint . --fix',\n postinstall: 'oxfmt . && node ./scripts/bootstrap-agent-skills.mjs',\n 'skills:check': 'node ./scripts/bootstrap-agent-skills.mjs --check',\n 'skills:install': 'node ./scripts/bootstrap-agent-skills.mjs',\n\n test: 'rstest run',\n};\n\nfor (const [scriptName, scriptCommand] of Object.entries(requiredScripts)) {\n if (packageJson.scripts?.[scriptName] !== scriptCommand) {\n console.error(`Missing or invalid package script: ${scriptName}`);\n process.exit(1);\n }\n}\n\nif (\n !packageJson.scripts?.typecheck?.includes('effect-tsgo') ||\n !packageJson.scripts.typecheck.includes('get-exe-path')\n) {\n console.error('typecheck must use effect-tsgo as the TypeScript checker');\n process.exit(1);\n}\n\nif (!packageJson.scripts?.['ultramodern:check']?.includes('pnpm test')) {\n console.error('ultramodern:check must run the generated Rstest suite');\n process.exit(1);\n}\n\nif (packageJson.private !== true) {\n console.error('Generated app package must be private by default');\n process.exit(1);\n}\n\nconst miseConfig = fs.readFileSync(path.resolve(process.cwd(), '.mise.toml'), 'utf-8');\nif (!miseConfig.includes(`pnpm = \"${expectedPnpmVersion}\"`)) {\n console.error(`Generated app must pin pnpm ${expectedPnpmVersion} in .mise.toml`);\n process.exit(1);\n}\n\nif (packageJson.packageManager !== `pnpm@${expectedPnpmVersion}`) {\n console.error(`Generated app package must pin pnpm@${expectedPnpmVersion}`);\n process.exit(1);\n}\n\nif (packageJson.engines?.pnpm !== `>=${expectedPnpmVersion} <11.6.0`) {\n console.error(`Generated app package must require pnpm >=${expectedPnpmVersion} <11.6.0`);\n process.exit(1);\n}\n\nif (packageJson.pnpm !== undefined) {\n console.error('Generated app must keep pnpm policy in pnpm-workspace.yaml, not package.json');\n process.exit(1);\n}\n\nif (readPnpmConfig('minimumReleaseAge') !== 1440) {\n console.error('pnpm minimumReleaseAge must be 1440');\n process.exit(1);\n}\nif (readPnpmConfig('minimumReleaseAgeStrict') !== true) {\n console.error('pnpm minimumReleaseAgeStrict must be true');\n process.exit(1);\n}\nif (readPnpmConfig('minimumReleaseAgeIgnoreMissingTime') !== false) {\n console.error('pnpm minimumReleaseAgeIgnoreMissingTime must be false');\n process.exit(1);\n}\nconst expectedMinimumReleaseAgeExcludes = [\n '@bleedingdev/modern-js-*',\n '@tanstack/react-router',\n '@tanstack/router-core',\n '@typescript/native-preview',\n '@typescript/native-preview-*',\n '@types/react',\n];\nif (\n JSON.stringify(readPnpmConfig('minimumReleaseAgeExclude')) !==\n JSON.stringify(expectedMinimumReleaseAgeExcludes)\n) {\n console.error('pnpm minimumReleaseAgeExclude must allow only approved latest-lane package cohorts');\n process.exit(1);\n}\nif (readPnpmConfig('trustPolicy') !== 'no-downgrade') {\n console.error('pnpm trustPolicy must be no-downgrade');\n process.exit(1);\n}\nfor (const [key, expected] of [\n ['trustPolicyIgnoreAfter', 1440],\n ['blockExoticSubdeps', true],\n ['engineStrict', true],\n ['pmOnFail', 'error'],\n ['verifyDepsBeforeRun', 'error'],\n ['strictDepBuilds', true],\n]) {\n if (readPnpmConfig(key) !== expected) {\n console.error(`pnpm ${key} must be ${String(expected)}`);\n process.exit(1);\n }\n}\nif (\n JSON.stringify(readPnpmConfig('allowBuilds')) !==\n JSON.stringify({\n '@swc/core': true,\n 'core-js': true,\n esbuild: true,\n lefthook: true,\n 'msgpackr-extract': true,\n sharp: true,\n workerd: true,\n })\n) {\n console.error('pnpm allowBuilds must approve only the generated app build dependencies');\n process.exit(1);\n}\nif (\n JSON.stringify(readPnpmConfig('onlyBuiltDependencies')) !==\n JSON.stringify(['@swc/core', 'core-js', 'esbuild', 'lefthook', 'msgpackr-extract', 'sharp', 'workerd'])\n) {\n console.error('pnpm onlyBuiltDependencies must approve only the generated app build dependencies');\n process.exit(1);\n}\n\nif (packageJson.modernjs?.preset !== 'presetUltramodern') {\n console.error('package.json must declare presetUltramodern metadata');\n process.exit(1);\n}\n\nif (\n packageJson.modernjs?.packageSource?.config !== './.modernjs/ultramodern-package-source.json'\n) {\n console.error('package.json must retain package source metadata location');\n process.exit(1);\n}\n\nif (packageJson.modernjs?.packageSource?.strategy !== packageSource.strategy) {\n console.error('package.json package source strategy must match package source metadata');\n process.exit(1);\n}\n\nif (packageSource.schemaVersion !== 1) {\n console.error('Package source metadata must use schemaVersion 1');\n process.exit(1);\n}\n\nif (packageSource.preset !== 'presetUltramodern') {\n console.error('Package source metadata must declare presetUltramodern');\n process.exit(1);\n}\n\nif (packageSource.strategy !== 'workspace' && packageSource.strategy !== 'install') {\n console.error('Package source strategy must be workspace or install');\n process.exit(1);\n}\n\nconst declaredModernPackages = packageSource.modernPackages?.packages;\nif (!Array.isArray(declaredModernPackages) || declaredModernPackages.length === 0) {\n console.error('Package source metadata must declare the generated Modern package cohort');\n process.exit(1);\n}\n\nconst invalidModernPackages = declaredModernPackages.filter(\n (packageName) => typeof packageName !== 'string' || !packageName.startsWith('@modern-js/'),\n);\nif (invalidModernPackages.length > 0) {\n console.error(`Package source metadata contains invalid Modern packages: ${invalidModernPackages.join(', ')}`);\n process.exit(1);\n}\n\nconst packageJsonModernDependencies = [\n ...new Set(\n ['dependencies', 'devDependencies']\n .flatMap((section) => Object.keys(packageJson[section] ?? {}))\n .filter((packageName) => packageName.startsWith('@modern-js/')),\n ),\n];\nconst missingMetadataPackages = packageJsonModernDependencies.filter(\n (packageName) => !declaredModernPackages.includes(packageName),\n);\nif (missingMetadataPackages.length > 0) {\n console.error(`Package source metadata must include package.json Modern dependencies: ${missingMetadataPackages.join(', ')}`);\n process.exit(1);\n}\n\nconst expectedModernSpecifier = packageSource.modernPackages?.specifier;\nif (typeof expectedModernSpecifier !== 'string' || expectedModernSpecifier.length === 0) {\n console.error('Package source metadata must provide a Modern package specifier');\n process.exit(1);\n}\nif (\n packageSource.strategy === 'install' &&\n expectedModernSpecifier !== templateManifest.template?.version\n) {\n console.error(\n `Package source Modern specifier ${expectedModernSpecifier} must match template version ${templateManifest.template?.version}`,\n );\n process.exit(1);\n}\n\nconst expectedModernDependency = (packageName) => {\n const alias = packageSource.modernPackages?.aliases?.[packageName];\n return typeof alias === 'string'\n ? `npm:${alias}@${expectedModernSpecifier}`\n : expectedModernSpecifier;\n};\n\nfor (const section of ['dependencies', 'devDependencies']) {\n for (const packageName of declaredModernPackages) {\n if (\n packageJson[section]?.[packageName] &&\n packageJson[section][packageName] !== expectedModernDependency(packageName)\n ) {\n console.error(`${section}.${packageName} must match package source metadata`);\n process.exit(1);\n }\n }\n}\n\nfor (const dependency of ['@modern-js/plugin-i18n', 'i18next', 'react-i18next']) {\n if (!packageJson.dependencies?.[dependency]) {\n console.error(`Missing dependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nfor (const dependency of [\n '@effect/tsgo',\n '@modern-js/adapter-rstest',\n '@rstest/core',\n '@typescript/native-preview',\n 'happy-dom',\n\n '@tailwindcss/postcss',\n 'postcss',\n 'tailwindcss',\n\n\n 'lefthook',\n 'oxlint',\n 'oxfmt',\n 'ultracite',\n\n]) {\n if (!packageJson.devDependencies?.[dependency]) {\n console.error(`Missing devDependency: ${dependency}`);\n process.exit(1);\n }\n}\n\n\nif (\n packageJson.devDependencies?.tailwindcss !== '^4.3.0' ||\n packageJson.devDependencies?.['@tailwindcss/postcss'] !== '^4.3.0'\n) {\n console.error('Tailwind CSS dependencies must use the UltraModern default baseline');\n process.exit(1);\n}\n\n\n\n\nconst privateSource = skillsLock.sources?.find(\n (source) => source.repository === 'https://github.com/TechsioCZ/skills',\n);\nconst privateSkills = new Set(privateSource?.baseline?.map((skill) => skill.name));\nfor (const skillName of ['plan-graph', 'dag', 'subagent-graph', 'helm', 'debugger-mode']) {\n if (!privateSkills.has(skillName)) {\n console.error(`Missing private skill allowlist entry: ${skillName}`);\n process.exit(1);\n }\n}\n\n\nconsole.log('Ultramodern contract check passed.');\n",
25
25
  "tests/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"types\": [\"@rstest/core/globals\"]\n },\n \"include\": [\"./\"]\n}\n",
26
26
  "tests/ultramodern.contract.test.ts": "import fs from 'node:fs';\nimport path from 'node:path';\nimport { describe, expect, test } from '@rstest/core';\n\nconst root = process.cwd();\nconst readText = (relativePath: string) =>\n fs.readFileSync(path.join(root, relativePath), 'utf-8');\nconst readJson = <T>(relativePath: string): T =>\n JSON.parse(readText(relativePath)) as T;\n\ndescribe('generated UltraModern contract', () => {\n test('keeps localized route metadata and Rstest wiring', () => {\n expect(fs.existsSync(path.join(root, 'src/routes/[lang]/page.tsx'))).toBe(\n true,\n );\n expect(fs.existsSync(path.join(root, 'src/routes/page.tsx'))).toBe(false);\n expect(fs.existsSync(path.join(root, 'src/routes/layout.tsx'))).toBe(true);\n\n expect(fs.existsSync(path.join(root, 'postcss.config.mjs'))).toBe(true);\n expect(fs.existsSync(path.join(root, 'tailwind.config.ts'))).toBe(true);\n\n\n });\n\n test('keeps UltraModern starter web correctness defaults', () => {\n const routePage = readText('src/routes/[lang]/page.tsx');\n const routeCss = readText('src/routes/index.css');\n const modernConfig = readText('modern.config.ts');\n const enLocale = readJson<{\n home?: {\n meta?: {\n description?: string;\n title?: string;\n };\n skipLink?: string;\n };\n }>('config/public/locales/en/translation.json');\n\n expect(fs.existsSync(path.join(root, 'config/favicon.svg'))).toBe(true);\n expect(\n fs.existsSync(\n path.join(root, 'config/public/assets/ultramodern-logo.svg'),\n ),\n ).toBe(true);\n expect(routePage).not.toContain('lf3-static.bytednsdoc.com');\n expect(routePage).toContain('<Helmet');\n expect(routePage).toContain('htmlAttributes={{');\n expect(routePage).toContain('dir: languageDirections[currentLanguage]');\n expect(routePage).toContain('lang: currentLanguage');\n expect(routePage).toContain('<title>{pageTitle}</title>');\n expect(routePage).toContain(\n '<meta name=\"description\" content={pageDescription} />',\n );\n expect(routePage).toContain(\n '<main id=\"starter-main\" className=\"starter-main\">',\n );\n expect(routePage).toContain('<h1 id=\"starter-heading\" className=\"title\">');\n expect(routePage).toContain('src=\"/assets/ultramodern-logo.svg\"');\n expect(routePage).toContain('height={96}');\n expect(routePage).toContain('width={96}');\n expect(routePage).toContain(\n '<span aria-hidden=\"true\" className=\"arrow-right\" />',\n );\n expect(routePage).not.toContain('<div className=\"title\">');\n expect(modernConfig).toContain(\n 'width=device-width, initial-scale=1.0, viewport-fit=cover',\n );\n expect(modernConfig).not.toContain('user-scalable=no');\n expect(modernConfig).not.toContain('maximum-scale');\n expect(routeCss).toContain('min-block-size: 100dvh');\n expect(routeCss).toContain(\n 'grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr))',\n );\n expect(routeCss).toContain(':focus-visible');\n expect(routeCss).toContain('@media (prefers-reduced-motion: reduce)');\n expect(routeCss).not.toContain('width: 1100px');\n expect(enLocale.home?.meta?.title).toBe('UltraModern.js Starter');\n expect(enLocale.home?.meta?.description).toBeTruthy();\n expect(enLocale.home?.skipLink).toBeTruthy();\n });\n\n test('retains package-source metadata for generated Modern.js packages', () => {\n const packageJson = readJson<{\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n modernjs?: {\n packageSource?: {\n config?: string;\n strategy?: string;\n };\n preset?: string;\n };\n }>('package.json');\n const packageSource = readJson<{\n modernPackages?: {\n packages?: string[];\n specifier?: string;\n };\n strategy?: string;\n }>('.modernjs/ultramodern-package-source.json');\n\n expect(packageJson.modernjs?.preset).toBe('presetUltramodern');\n expect(packageJson.modernjs?.packageSource?.config).toBe(\n './.modernjs/ultramodern-package-source.json',\n );\n expect(packageJson.modernjs?.packageSource?.strategy).toBe(\n packageSource.strategy,\n );\n expect(packageSource.strategy).toMatch(/^(workspace|install)$/u);\n const generatedModernDependencies = [\n ...new Set(\n (['dependencies', 'devDependencies'] as const).flatMap(section =>\n Object.keys(packageJson[section] ?? {}),\n ),\n ),\n ].filter(packageName => packageName.startsWith('@modern-js/'));\n expect(packageSource.modernPackages?.packages?.length).toBeGreaterThan(0);\n expect(packageSource.modernPackages?.packages).toEqual(\n expect.arrayContaining(generatedModernDependencies),\n );\n expect(packageSource.modernPackages?.specifier).toBeTruthy();\n expect(\n packageJson.devDependencies?.['@modern-js/adapter-rstest'],\n ).toBeTruthy();\n\n expect(packageJson.devDependencies?.tailwindcss).toBe('^4.3.0');\n expect(packageJson.devDependencies?.['@tailwindcss/postcss']).toBe(\n '^4.3.0',\n );\n\n\n });\n});\n",
27
27
  ".github/renovate.json": "{\n \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n \"extends\": [\n \"config:recommended\",\n \"helpers:pinGitHubActionDigests\"\n ],\n \"dependencyDashboard\": true,\n \"minimumReleaseAge\": \"1 day\",\n \"prConcurrentLimit\": 5,\n \"prHourlyLimit\": 2,\n \"rangeStrategy\": \"bump\",\n \"schedule\": [\n \"before 5am on monday\"\n ],\n \"timezone\": \"Etc/UTC\",\n \"packageRules\": [\n {\n \"matchManagers\": [\n \"github-actions\"\n ],\n \"groupName\": \"github-actions\",\n \"labels\": [\n \"dependencies\",\n \"github-actions\",\n \"security\"\n ]\n },\n {\n \"matchManagers\": [\n \"npm\"\n ],\n \"matchUpdateTypes\": [\n \"patch\",\n \"minor\"\n ],\n \"groupName\": \"npm minor and patch updates\",\n \"labels\": [\n \"dependencies\",\n \"npm\"\n ]\n },\n {\n \"matchUpdateTypes\": [\n \"major\"\n ],\n \"dependencyDashboardApproval\": true,\n \"labels\": [\n \"dependencies\",\n \"major\"\n ]\n }\n ]\n}\n",
28
28
  ".github/workflows/ultramodern-gates.yml": "name: Ultramodern Gates\n\non:\n push:\n pull_request:\n\npermissions:\n contents: read\n\ndefaults:\n run:\n shell: bash\n\nenv:\n FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true\n\nconcurrency:\n group: ultramodern-gates-${{ github.workflow }}-${{ github.ref }}\n cancel-in-progress: true\n\njobs:\n ultramodern-gates:\n runs-on: ubuntu-latest\n timeout-minutes: 20\n steps:\n - name: Harden Runner\n uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2\n with:\n egress-policy: audit\n\n - name: Checkout\n uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2\n with:\n fetch-depth: 1\n persist-credentials: false\n\n - name: Setup Node.js\n uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0\n with:\n node-version: 24\n\n - name: Setup mise\n uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0\n\n - name: Install Dependencies\n run: mise exec -- pnpm install --frozen-lockfile\n\n - name: Validate Ultramodern Contract\n run: mise exec -- pnpm run ultramodern:check\n\n - name: Build\n env:\n MODERN_PUBLIC_SITE_URL: http://localhost:8080\n run: mise exec -- pnpm run build\n",
29
- "api/effect/index.ts": "import {\n Effect,\n HttpApiBuilder,\n Layer,\n defineEffectBff,\n} from '@modern-js/plugin-bff/effect-server';\nimport type { HttpApi, HttpApiGroup } from '@modern-js/plugin-bff/effect-server';\nimport { bffEffectApi } from '../../shared/effect/api.ts';\n\ntype ApiGroups<TApi> = TApi extends HttpApi.HttpApi<string, infer TGroups> ? TGroups : never;\ntype GreetingsHandlers = HttpApiBuilder.Handlers.FromGroup<\n HttpApiGroup.WithName<ApiGroups<typeof bffEffectApi>, 'greetings'>\n>;\n\nconst greetingsLayer = HttpApiBuilder.group(\n bffEffectApi,\n 'greetings',\n (handlers: GreetingsHandlers) =>\n handlers.handle('hello', () =>\n Effect.succeed({\n message: 'Hello from Effect HttpApi',\n runtime: 'effect' as const,\n }),\n ),\n);\n\nconst layer = HttpApiBuilder.layer(bffEffectApi).pipe(\n Layer.provide(greetingsLayer),\n);\n\nexport default defineEffectBff({\n api: bffEffectApi,\n layer,\n});\n",
30
29
  "api/lambda/hello.ts": "\n",
30
+ "api/effect/index.ts": "import {\n Effect,\n HttpApiBuilder,\n Layer,\n defineEffectBff,\n} from '@modern-js/plugin-bff/effect-server';\nimport type { HttpApi, HttpApiGroup } from '@modern-js/plugin-bff/effect-server';\nimport { bffEffectApi } from '../../shared/effect/api.ts';\n\ntype ApiGroups<TApi> = TApi extends HttpApi.HttpApi<string, infer TGroups> ? TGroups : never;\ntype GreetingsHandlers = HttpApiBuilder.Handlers.FromGroup<\n HttpApiGroup.WithName<ApiGroups<typeof bffEffectApi>, 'greetings'>\n>;\n\nconst greetingsLayer = HttpApiBuilder.group(\n bffEffectApi,\n 'greetings',\n (handlers: GreetingsHandlers) =>\n handlers.handle('hello', () =>\n Effect.succeed({\n message: 'Hello from Effect HttpApi',\n runtime: 'effect' as const,\n }),\n ),\n);\n\nconst layer = HttpApiBuilder.layer(bffEffectApi).pipe(\n Layer.provide(greetingsLayer),\n);\n\nexport default defineEffectBff({\n api: bffEffectApi,\n layer,\n});\n",
31
31
  "shared/effect/api.ts": "import {\n HttpApi,\n HttpApiEndpoint,\n HttpApiGroup,\n Schema,\n} from '@modern-js/plugin-bff/effect-client';\n\nexport const bffEffectApi = HttpApi.make('BffApi').add(\n HttpApiGroup.make('greetings').add(\n HttpApiEndpoint.get('hello', '/effect/hello', {\n success: Schema.Struct({\n message: Schema.String,\n runtime: Schema.Literal('effect'),\n }),\n }),\n ),\n);\n",
32
32
  "src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n\ndeclare const ULTRAMODERN_SITE_URL: string;\n",
33
33
  "src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\nimport { createInstance } from 'i18next';\n\nconst i18nInstance = createInstance();\n\nexport default defineRuntimeConfig({\n i18n: {\n i18nInstance,\n initOptions: {\n defaultNS: 'translation',\n fallbackLng: 'en',\n interpolation: {\n escapeValue: false,\n },\n ns: ['translation'],\n supportedLngs: ['en', 'cs'],\n },\n },\n router: {\n framework: 'tanstack',\n },\n});\n",
@@ -18,15 +18,15 @@ export declare const MWAFiles: {
18
18
  "tsconfig.json": string;
19
19
  ".agents/skills-lock.json": string;
20
20
  ".codex/hooks.json": string;
21
- "scripts/bootstrap-agent-skills.mjs": string;
22
21
  "scripts/check-i18n-strings.mjs": string;
22
+ "scripts/bootstrap-agent-skills.mjs": string;
23
23
  "scripts/validate-ultramodern.mjs": string;
24
24
  "tests/tsconfig.json": string;
25
25
  "tests/ultramodern.contract.test.ts": string;
26
26
  ".github/renovate.json": string;
27
27
  ".github/workflows/ultramodern-gates.yml": string;
28
- "api/effect/index.ts": string;
29
28
  "api/lambda/hello.ts": string;
29
+ "api/effect/index.ts": string;
30
30
  "shared/effect/api.ts": string;
31
31
  "src/modern-app-env.d.ts": string;
32
32
  "src/modern.runtime.ts": string;
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.2.0-ultramodern.105",
20
+ "version": "3.2.0-ultramodern.106",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "module": "./dist/esm/index.mjs",
@@ -48,7 +48,7 @@
48
48
  "@types/recursive-readdir": "^2.2.4",
49
49
  "@typescript/native-preview": "7.0.0-dev.20260606.1",
50
50
  "recursive-readdir": "^2.2.3",
51
- "@modern-js/create": "npm:@bleedingdev/modern-js-create@3.2.0-ultramodern.105"
51
+ "@modern-js/create": "npm:@bleedingdev/modern-js-create@3.2.0-ultramodern.106"
52
52
  },
53
53
  "sideEffects": false,
54
54
  "publishConfig": {