@bleedingdev/modern-js-sandpack-react 3.2.0-ultramodern.36 → 3.2.0-ultramodern.38

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.
@@ -44,8 +44,8 @@ const MWAFiles = {
44
44
  "tailwind.config.ts": "",
45
45
  "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 \"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\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
46
46
  ".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",
47
- "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;\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 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 if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: match[1].trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const text = match[1].replaceAll(/\\s+/gu, ' ').trim();\n if (text && !isIgnoredLine(content, match.index ?? 0)) {\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",
48
47
  "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 cloneSource = (source, targetDir) => {\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1'], {\n stdio: 'inherit',\n });\n } catch {\n run('git', ['clone', '--depth', '1', source.repository, targetDir], {\n stdio: 'inherit',\n });\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 privateSources = (lock.sources ?? []).filter(\n (source) => source.install === 'clone-if-authorized',\n);\n\nif (checkOnly) {\n const missing = privateSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n if (missing.length > 0) {\n console.warn(\n `Private skills not installed: ${missing.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Agent skills are installed.');\n }\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\n\nfor (const source of privateSources) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n cloneSource(source, tempDir);\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 fs.rmSync(targetSkillDir, { force: true, recursive: true });\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n fs.rmSync(tempDir, { force: true, recursive: true });\n }\n}\n",
48
+ "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;\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 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 if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: match[1].trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const text = match[1].replaceAll(/\\s+/gu, ' ').trim();\n if (text && !isIgnoredLine(content, match.index ?? 0)) {\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",
49
49
  "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 readPnpmConfig = (key) => {\n const env = { ...process.env };\n for (const envKey of Object.keys(env)) {\n if (/^(?:npm|pnpm)_config_/i.test(envKey)) {\n delete env[envKey];\n }\n }\n const output = execFileSync('pnpm', ['config', 'get', key, '--json'], {\n cwd: process.cwd(),\n env,\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'pipe'],\n }).trim();\n return output ? JSON.parse(output) : undefined;\n};\nconst isSubproject = ;\nconst enableTailwind = ;\nconst expectedPnpmVersion = '';\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 through mise exec -- pnpm ...`,\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 'dependency-install-with-lifecycle-deny',\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 'AGENTS.md',\n '.agents/skills-lock.json',\n '.github/renovate.json',\n '.github/workflows/ultramodern-gates.yml',\n 'oxlint.config.ts',\n 'oxfmt.config.ts',\n 'scripts/bootstrap-agent-skills.mjs',\n '.mise.toml',\n '.modernjs/ultramodern-package-source.json',\n 'pnpm-workspace.yaml',\n 'rstest.config.mts',\n 'scripts/check-i18n-strings.mjs',\n 'config/public/locales/en/translation.json',\n 'config/public/locales/cs/translation.json',\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 (!enableTailwind) {\n if (\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 'mise exec -- pnpm install --frozen-lockfile',\n 'mise exec -- pnpm run ultramodern:check',\n 'mise exec -- 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\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}\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 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}\nconst skillsLock = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.agents/skills-lock.json'), 'utf-8'),\n);\nconst requiredScripts = {\n 'i18n:check': 'node ./scripts/check-i18n-strings.mjs',\n test: 'rstest run',\n format: 'oxfmt .',\n 'format:check': 'oxfmt --check .',\n lint: 'oxlint .',\n 'lint:fix': 'oxlint . --fix',\n 'skills:check': 'node ./scripts/bootstrap-agent-skills.mjs --check',\n 'skills:install': 'node ./scripts/bootstrap-agent-skills.mjs',\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.5.0`) {\n console.error(`Generated app package must require pnpm >=${expectedPnpmVersion} <11.5.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}\nif (\n JSON.stringify(readPnpmConfig('minimumReleaseAgeExclude')) !==\n JSON.stringify([\n '@modern-js/*',\n '@bleedingdev/*',\n '@effect/tsgo',\n '@effect/tsgo-*',\n '@typescript/native-preview',\n '@typescript/native-preview-*',\n ])\n) {\n console.error('pnpm minimumReleaseAgeExclude must retain framework exceptions');\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 'msgpackr-extract': true,\n sharp: true,\n 'simple-git-hooks': 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 (readPnpmConfig('onlyBuiltDependencies') !== undefined) {\n console.error('pnpm onlyBuiltDependencies must not be set');\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 (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 expectedModernPackages = [\n '@modern-js/runtime',\n '@modern-js/app-tools',\n '@modern-js/tsconfig',\n '@modern-js/plugin-i18n',\n '@modern-js/plugin-tanstack',\n '@modern-js/plugin-bff',\n '@modern-js/adapter-rstest',\n];\n\nfor (const packageName of expectedModernPackages) {\n if (!packageSource.modernPackages?.packages?.includes(packageName)) {\n console.error(`Package source metadata must include ${packageName}`);\n process.exit(1);\n }\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}\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 packageName of [\n '@modern-js/runtime',\n '@modern-js/plugin-i18n',\n '@modern-js/plugin-tanstack',\n]) {\n if (\n packageJson.dependencies?.[packageName] &&\n packageJson.dependencies[packageName] !== expectedModernDependency(packageName)\n ) {\n console.error(`Dependency ${packageName} must match package source metadata`);\n process.exit(1);\n }\n}\n\nfor (const packageName of [\n '@modern-js/app-tools',\n '@modern-js/adapter-rstest',\n '@modern-js/tsconfig',\n '@modern-js/plugin-bff',\n]) {\n if (\n packageJson.devDependencies?.[packageName] &&\n packageJson.devDependencies[packageName] !== expectedModernDependency(packageName)\n ) {\n console.error(`Dev dependency ${packageName} must match package source metadata`);\n process.exit(1);\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 'oxlint',\n 'oxfmt',\n 'ultracite',\n]) {\n if (!packageJson.devDependencies?.[dependency]) {\n console.error(`Missing devDependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nif (\n packageJson.devDependencies?.tailwindcss ||\n packageJson.devDependencies?.['@tailwindcss/postcss'] ||\n packageJson.devDependencies?.postcss\n) {\n console.error('Tailwind CSS dependencies must be absent when Tailwind is disabled');\n process.exit(1);\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\nconsole.log('Ultramodern contract check passed.');\n",
50
50
  "tests/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"types\": [\"@rstest/core/globals\"]\n },\n \"include\": [\"./\"]\n}\n",
51
51
  "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 expect(fs.existsSync(path.join(root, 'postcss.config.mjs'))).toBe(false);\n expect(fs.existsSync(path.join(root, 'tailwind.config.ts'))).toBe(false);\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 };\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(packageSource.strategy).toMatch(/^(workspace|install)$/u);\n expect(packageSource.modernPackages?.packages).toContain(\n '@modern-js/runtime',\n );\n expect(packageSource.modernPackages?.packages).toContain(\n '@modern-js/app-tools',\n );\n expect(packageSource.modernPackages?.packages).toContain(\n '@modern-js/adapter-rstest',\n );\n expect(packageSource.modernPackages?.specifier).toBeTruthy();\n expect(\n packageJson.devDependencies?.['@modern-js/adapter-rstest'],\n ).toBeTruthy();\n expect(packageJson.devDependencies?.tailwindcss).toBeUndefined();\n expect(\n packageJson.devDependencies?.['@tailwindcss/postcss'],\n ).toBeUndefined();\n });\n});\n",
@@ -16,8 +16,8 @@ const MWAFiles = {
16
16
  "tailwind.config.ts": "",
17
17
  "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 \"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\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
18
18
  ".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",
19
- "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;\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 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 if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: match[1].trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const text = match[1].replaceAll(/\\s+/gu, ' ').trim();\n if (text && !isIgnoredLine(content, match.index ?? 0)) {\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",
20
19
  "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 cloneSource = (source, targetDir) => {\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1'], {\n stdio: 'inherit',\n });\n } catch {\n run('git', ['clone', '--depth', '1', source.repository, targetDir], {\n stdio: 'inherit',\n });\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 privateSources = (lock.sources ?? []).filter(\n (source) => source.install === 'clone-if-authorized',\n);\n\nif (checkOnly) {\n const missing = privateSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n if (missing.length > 0) {\n console.warn(\n `Private skills not installed: ${missing.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Agent skills are installed.');\n }\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\n\nfor (const source of privateSources) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n cloneSource(source, tempDir);\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 fs.rmSync(targetSkillDir, { force: true, recursive: true });\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n fs.rmSync(tempDir, { force: true, recursive: true });\n }\n}\n",
20
+ "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;\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 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 if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: match[1].trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const text = match[1].replaceAll(/\\s+/gu, ' ').trim();\n if (text && !isIgnoredLine(content, match.index ?? 0)) {\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",
21
21
  "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 readPnpmConfig = (key) => {\n const env = { ...process.env };\n for (const envKey of Object.keys(env)) {\n if (/^(?:npm|pnpm)_config_/i.test(envKey)) {\n delete env[envKey];\n }\n }\n const output = execFileSync('pnpm', ['config', 'get', key, '--json'], {\n cwd: process.cwd(),\n env,\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'pipe'],\n }).trim();\n return output ? JSON.parse(output) : undefined;\n};\nconst isSubproject = ;\nconst enableTailwind = ;\nconst expectedPnpmVersion = '';\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 through mise exec -- pnpm ...`,\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 'dependency-install-with-lifecycle-deny',\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 'AGENTS.md',\n '.agents/skills-lock.json',\n '.github/renovate.json',\n '.github/workflows/ultramodern-gates.yml',\n 'oxlint.config.ts',\n 'oxfmt.config.ts',\n 'scripts/bootstrap-agent-skills.mjs',\n '.mise.toml',\n '.modernjs/ultramodern-package-source.json',\n 'pnpm-workspace.yaml',\n 'rstest.config.mts',\n 'scripts/check-i18n-strings.mjs',\n 'config/public/locales/en/translation.json',\n 'config/public/locales/cs/translation.json',\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 (!enableTailwind) {\n if (\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 'mise exec -- pnpm install --frozen-lockfile',\n 'mise exec -- pnpm run ultramodern:check',\n 'mise exec -- 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\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}\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 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}\nconst skillsLock = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.agents/skills-lock.json'), 'utf-8'),\n);\nconst requiredScripts = {\n 'i18n:check': 'node ./scripts/check-i18n-strings.mjs',\n test: 'rstest run',\n format: 'oxfmt .',\n 'format:check': 'oxfmt --check .',\n lint: 'oxlint .',\n 'lint:fix': 'oxlint . --fix',\n 'skills:check': 'node ./scripts/bootstrap-agent-skills.mjs --check',\n 'skills:install': 'node ./scripts/bootstrap-agent-skills.mjs',\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.5.0`) {\n console.error(`Generated app package must require pnpm >=${expectedPnpmVersion} <11.5.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}\nif (\n JSON.stringify(readPnpmConfig('minimumReleaseAgeExclude')) !==\n JSON.stringify([\n '@modern-js/*',\n '@bleedingdev/*',\n '@effect/tsgo',\n '@effect/tsgo-*',\n '@typescript/native-preview',\n '@typescript/native-preview-*',\n ])\n) {\n console.error('pnpm minimumReleaseAgeExclude must retain framework exceptions');\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 'msgpackr-extract': true,\n sharp: true,\n 'simple-git-hooks': 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 (readPnpmConfig('onlyBuiltDependencies') !== undefined) {\n console.error('pnpm onlyBuiltDependencies must not be set');\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 (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 expectedModernPackages = [\n '@modern-js/runtime',\n '@modern-js/app-tools',\n '@modern-js/tsconfig',\n '@modern-js/plugin-i18n',\n '@modern-js/plugin-tanstack',\n '@modern-js/plugin-bff',\n '@modern-js/adapter-rstest',\n];\n\nfor (const packageName of expectedModernPackages) {\n if (!packageSource.modernPackages?.packages?.includes(packageName)) {\n console.error(`Package source metadata must include ${packageName}`);\n process.exit(1);\n }\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}\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 packageName of [\n '@modern-js/runtime',\n '@modern-js/plugin-i18n',\n '@modern-js/plugin-tanstack',\n]) {\n if (\n packageJson.dependencies?.[packageName] &&\n packageJson.dependencies[packageName] !== expectedModernDependency(packageName)\n ) {\n console.error(`Dependency ${packageName} must match package source metadata`);\n process.exit(1);\n }\n}\n\nfor (const packageName of [\n '@modern-js/app-tools',\n '@modern-js/adapter-rstest',\n '@modern-js/tsconfig',\n '@modern-js/plugin-bff',\n]) {\n if (\n packageJson.devDependencies?.[packageName] &&\n packageJson.devDependencies[packageName] !== expectedModernDependency(packageName)\n ) {\n console.error(`Dev dependency ${packageName} must match package source metadata`);\n process.exit(1);\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 'oxlint',\n 'oxfmt',\n 'ultracite',\n]) {\n if (!packageJson.devDependencies?.[dependency]) {\n console.error(`Missing devDependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nif (\n packageJson.devDependencies?.tailwindcss ||\n packageJson.devDependencies?.['@tailwindcss/postcss'] ||\n packageJson.devDependencies?.postcss\n) {\n console.error('Tailwind CSS dependencies must be absent when Tailwind is disabled');\n process.exit(1);\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\nconsole.log('Ultramodern contract check passed.');\n",
22
22
  "tests/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"types\": [\"@rstest/core/globals\"]\n },\n \"include\": [\"./\"]\n}\n",
23
23
  "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 expect(fs.existsSync(path.join(root, 'postcss.config.mjs'))).toBe(false);\n expect(fs.existsSync(path.join(root, 'tailwind.config.ts'))).toBe(false);\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 };\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(packageSource.strategy).toMatch(/^(workspace|install)$/u);\n expect(packageSource.modernPackages?.packages).toContain(\n '@modern-js/runtime',\n );\n expect(packageSource.modernPackages?.packages).toContain(\n '@modern-js/app-tools',\n );\n expect(packageSource.modernPackages?.packages).toContain(\n '@modern-js/adapter-rstest',\n );\n expect(packageSource.modernPackages?.specifier).toBeTruthy();\n expect(\n packageJson.devDependencies?.['@modern-js/adapter-rstest'],\n ).toBeTruthy();\n expect(packageJson.devDependencies?.tailwindcss).toBeUndefined();\n expect(\n packageJson.devDependencies?.['@tailwindcss/postcss'],\n ).toBeUndefined();\n });\n});\n",
@@ -17,8 +17,8 @@ const MWAFiles = {
17
17
  "tailwind.config.ts": "",
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 \"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\"],\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
- "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;\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 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 if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: match[1].trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const text = match[1].replaceAll(/\\s+/gu, ' ').trim();\n if (text && !isIgnoredLine(content, match.index ?? 0)) {\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",
21
20
  "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 cloneSource = (source, targetDir) => {\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1'], {\n stdio: 'inherit',\n });\n } catch {\n run('git', ['clone', '--depth', '1', source.repository, targetDir], {\n stdio: 'inherit',\n });\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 privateSources = (lock.sources ?? []).filter(\n (source) => source.install === 'clone-if-authorized',\n);\n\nif (checkOnly) {\n const missing = privateSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n if (missing.length > 0) {\n console.warn(\n `Private skills not installed: ${missing.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Agent skills are installed.');\n }\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\n\nfor (const source of privateSources) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n cloneSource(source, tempDir);\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 fs.rmSync(targetSkillDir, { force: true, recursive: true });\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n fs.rmSync(tempDir, { force: true, recursive: true });\n }\n}\n",
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;\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 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 if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: match[1].trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const text = match[1].replaceAll(/\\s+/gu, ' ').trim();\n if (text && !isIgnoredLine(content, match.index ?? 0)) {\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
22
  "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 readPnpmConfig = (key) => {\n const env = { ...process.env };\n for (const envKey of Object.keys(env)) {\n if (/^(?:npm|pnpm)_config_/i.test(envKey)) {\n delete env[envKey];\n }\n }\n const output = execFileSync('pnpm', ['config', 'get', key, '--json'], {\n cwd: process.cwd(),\n env,\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'pipe'],\n }).trim();\n return output ? JSON.parse(output) : undefined;\n};\nconst isSubproject = ;\nconst enableTailwind = ;\nconst expectedPnpmVersion = '';\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 through mise exec -- pnpm ...`,\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 'dependency-install-with-lifecycle-deny',\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 'AGENTS.md',\n '.agents/skills-lock.json',\n '.github/renovate.json',\n '.github/workflows/ultramodern-gates.yml',\n 'oxlint.config.ts',\n 'oxfmt.config.ts',\n 'scripts/bootstrap-agent-skills.mjs',\n '.mise.toml',\n '.modernjs/ultramodern-package-source.json',\n 'pnpm-workspace.yaml',\n 'rstest.config.mts',\n 'scripts/check-i18n-strings.mjs',\n 'config/public/locales/en/translation.json',\n 'config/public/locales/cs/translation.json',\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 (!enableTailwind) {\n if (\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 'mise exec -- pnpm install --frozen-lockfile',\n 'mise exec -- pnpm run ultramodern:check',\n 'mise exec -- 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\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}\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 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}\nconst skillsLock = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.agents/skills-lock.json'), 'utf-8'),\n);\nconst requiredScripts = {\n 'i18n:check': 'node ./scripts/check-i18n-strings.mjs',\n test: 'rstest run',\n format: 'oxfmt .',\n 'format:check': 'oxfmt --check .',\n lint: 'oxlint .',\n 'lint:fix': 'oxlint . --fix',\n 'skills:check': 'node ./scripts/bootstrap-agent-skills.mjs --check',\n 'skills:install': 'node ./scripts/bootstrap-agent-skills.mjs',\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.5.0`) {\n console.error(`Generated app package must require pnpm >=${expectedPnpmVersion} <11.5.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}\nif (\n JSON.stringify(readPnpmConfig('minimumReleaseAgeExclude')) !==\n JSON.stringify([\n '@modern-js/*',\n '@bleedingdev/*',\n '@effect/tsgo',\n '@effect/tsgo-*',\n '@typescript/native-preview',\n '@typescript/native-preview-*',\n ])\n) {\n console.error('pnpm minimumReleaseAgeExclude must retain framework exceptions');\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 'msgpackr-extract': true,\n sharp: true,\n 'simple-git-hooks': 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 (readPnpmConfig('onlyBuiltDependencies') !== undefined) {\n console.error('pnpm onlyBuiltDependencies must not be set');\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 (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 expectedModernPackages = [\n '@modern-js/runtime',\n '@modern-js/app-tools',\n '@modern-js/tsconfig',\n '@modern-js/plugin-i18n',\n '@modern-js/plugin-tanstack',\n '@modern-js/plugin-bff',\n '@modern-js/adapter-rstest',\n];\n\nfor (const packageName of expectedModernPackages) {\n if (!packageSource.modernPackages?.packages?.includes(packageName)) {\n console.error(`Package source metadata must include ${packageName}`);\n process.exit(1);\n }\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}\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 packageName of [\n '@modern-js/runtime',\n '@modern-js/plugin-i18n',\n '@modern-js/plugin-tanstack',\n]) {\n if (\n packageJson.dependencies?.[packageName] &&\n packageJson.dependencies[packageName] !== expectedModernDependency(packageName)\n ) {\n console.error(`Dependency ${packageName} must match package source metadata`);\n process.exit(1);\n }\n}\n\nfor (const packageName of [\n '@modern-js/app-tools',\n '@modern-js/adapter-rstest',\n '@modern-js/tsconfig',\n '@modern-js/plugin-bff',\n]) {\n if (\n packageJson.devDependencies?.[packageName] &&\n packageJson.devDependencies[packageName] !== expectedModernDependency(packageName)\n ) {\n console.error(`Dev dependency ${packageName} must match package source metadata`);\n process.exit(1);\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 'oxlint',\n 'oxfmt',\n 'ultracite',\n]) {\n if (!packageJson.devDependencies?.[dependency]) {\n console.error(`Missing devDependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nif (\n packageJson.devDependencies?.tailwindcss ||\n packageJson.devDependencies?.['@tailwindcss/postcss'] ||\n packageJson.devDependencies?.postcss\n) {\n console.error('Tailwind CSS dependencies must be absent when Tailwind is disabled');\n process.exit(1);\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\nconsole.log('Ultramodern contract check passed.');\n",
23
23
  "tests/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"types\": [\"@rstest/core/globals\"]\n },\n \"include\": [\"./\"]\n}\n",
24
24
  "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 expect(fs.existsSync(path.join(root, 'postcss.config.mjs'))).toBe(false);\n expect(fs.existsSync(path.join(root, 'tailwind.config.ts'))).toBe(false);\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 };\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(packageSource.strategy).toMatch(/^(workspace|install)$/u);\n expect(packageSource.modernPackages?.packages).toContain(\n '@modern-js/runtime',\n );\n expect(packageSource.modernPackages?.packages).toContain(\n '@modern-js/app-tools',\n );\n expect(packageSource.modernPackages?.packages).toContain(\n '@modern-js/adapter-rstest',\n );\n expect(packageSource.modernPackages?.specifier).toBeTruthy();\n expect(\n packageJson.devDependencies?.['@modern-js/adapter-rstest'],\n ).toBeTruthy();\n expect(packageJson.devDependencies?.tailwindcss).toBeUndefined();\n expect(\n packageJson.devDependencies?.['@tailwindcss/postcss'],\n ).toBeUndefined();\n });\n});\n",
@@ -16,8 +16,8 @@ export declare const MWAFiles: {
16
16
  "tailwind.config.ts": string;
17
17
  "tsconfig.json": string;
18
18
  ".agents/skills-lock.json": string;
19
- "scripts/check-i18n-strings.mjs": string;
20
19
  "scripts/bootstrap-agent-skills.mjs": string;
20
+ "scripts/check-i18n-strings.mjs": string;
21
21
  "scripts/validate-ultramodern.mjs": string;
22
22
  "tests/tsconfig.json": string;
23
23
  "tests/ultramodern.contract.test.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.36",
20
+ "version": "3.2.0-ultramodern.38",
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.20260527.2",
50
50
  "recursive-readdir": "^2.2.3",
51
- "@modern-js/create": "npm:@bleedingdev/modern-js-create@3.2.0-ultramodern.36"
51
+ "@modern-js/create": "npm:@bleedingdev/modern-js-create@3.2.0-ultramodern.38"
52
52
  },
53
53
  "sideEffects": false,
54
54
  "publishConfig": {