mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-01 01:05:00 +00:00
code: validate,tools,stream (2 files)
This commit is contained in:
24
packages/stream_cast/seed/scripts/audience_pulse.lua
Normal file
24
packages/stream_cast/seed/scripts/audience_pulse.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local M = {}
|
||||
|
||||
function M.score(metrics)
|
||||
local messages = metrics.messagesPerMinute or 0
|
||||
local reactions = metrics.reactionsPerMinute or 0
|
||||
local viewers = metrics.viewers or 1
|
||||
|
||||
local raw = (messages * 0.6) + (reactions * 0.4)
|
||||
local score = (raw / viewers) * 100
|
||||
|
||||
local tier = "steady"
|
||||
if score >= 80 then
|
||||
tier = "surging"
|
||||
elseif score <= 30 then
|
||||
tier = "cooling"
|
||||
end
|
||||
|
||||
return {
|
||||
score = score,
|
||||
tier = tier
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
49
tools/validate-codegen-export.ts
Normal file
49
tools/validate-codegen-export.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env tsx
|
||||
|
||||
import { mkdir, writeFile } from 'node:fs/promises'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
import JSZip from 'jszip'
|
||||
|
||||
import { generateCodegenZip } from '../frontends/nextjs/src/lib/codegen/generate-codegen-zip'
|
||||
|
||||
const spec = {
|
||||
projectName: 'neon-arcade-export',
|
||||
packageId: 'arcade_lobby',
|
||||
runtime: 'desktop',
|
||||
tone: 'neon',
|
||||
brief: 'Validates the Codegen Studio bundle outputs.',
|
||||
}
|
||||
|
||||
const rootDir = spec.projectName.replace(/[^a-z0-9-]/gi, '-').toLowerCase()
|
||||
const outputDir = fileURLToPath(new URL('../.tmp', import.meta.url))
|
||||
const outputFile = `${outputDir}/${spec.projectName}.zip`
|
||||
|
||||
const assertZipContains = async (zipBuffer: Buffer) => {
|
||||
const zip = await JSZip.loadAsync(zipBuffer)
|
||||
const paths = [
|
||||
`${rootDir}/README.md`,
|
||||
`${rootDir}/src/app/page.tsx`,
|
||||
`${rootDir}/cli/main.cpp`,
|
||||
`${rootDir}/spec.json`,
|
||||
]
|
||||
|
||||
for (const entry of paths) {
|
||||
if (!zip.file(entry)) {
|
||||
throw new Error(`Missing expected entry ${entry}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const run = async () => {
|
||||
await mkdir(outputDir, { recursive: true })
|
||||
const { zipBuffer } = await generateCodegenZip(spec)
|
||||
await assertZipContains(zipBuffer)
|
||||
await writeFile(outputFile, zipBuffer)
|
||||
console.log('Codegen export validated at', outputFile)
|
||||
}
|
||||
|
||||
run().catch((error) => {
|
||||
console.error('Codegen export validation failed:', error)
|
||||
process.exit(1)
|
||||
})
|
||||
Reference in New Issue
Block a user