MCPcopy
hub / github.com/vercel/next.js / main

Function main

run-evals.js:107–191  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105}
106
107function main() {
108 const argv = require('yargs/yargs')(process.argv.slice(2))
109 .command(
110 '$0 [eval-name]',
111 'Run an eval (baseline + agents-md variants)',
112 (y) =>
113 y.positional('eval-name', {
114 type: 'string',
115 describe: 'Fixture directory name',
116 })
117 )
118 .boolean('all')
119 .describe('all', 'Run every eval (slow — normally only CI does this)')
120 .boolean('dry')
121 .describe('dry', 'Preview without executing')
122 .conflicts('all', 'eval-name')
123 .check((argv) => {
124 if (!argv.all && !argv.evalName) {
125 throw new Error(
126 `Missing <eval-name>.\n\nAvailable evals:\n${listEvals()
127 .map((n) => ` ${n}`)
128 .join('\n')}`
129 )
130 }
131 if (
132 argv.evalName &&
133 !fs.existsSync(path.join(FIXTURES_DIR, argv.evalName))
134 ) {
135 throw new Error(
136 `Unknown eval: ${argv.evalName}\n(looked in ${FIXTURES_DIR})`
137 )
138 }
139 return true
140 })
141 .strict()
142 .help().argv
143
144 /** @type {string | null} */
145 const evalName = argv.all ? null : /** @type {string} */ (argv.evalName)
146 // Flags not consumed here are forwarded to agent-eval.
147 const forward = argv.dry ? ['--dry'] : []
148
149 if (!fs.existsSync(path.join(ROOT, 'packages/next/dist'))) {
150 console.error(
151 'packages/next/dist not found. Run `pnpm --filter=next build` first.'
152 )
153 process.exit(1)
154 }
155
156 if (process.env.NEXT_SKIP_PACK && fs.existsSync(TARBALL)) {
157 console.log('> Reusing existing tarball (NEXT_SKIP_PACK=1)')
158 } else {
159 console.log('> Packing next...')
160 pack()
161 const mb = (fs.statSync(TARBALL).size / 1024 / 1024).toFixed(1)
162 console.log(` ${TARBALL} (${mb} MB)`)
163 }
164

Callers 1

run-evals.jsFile · 0.70

Calls 15

listEvalsFunction · 0.85
packFunction · 0.85
writeExperimentsFunction · 0.85
spawnSyncFunction · 0.85
helpMethod · 0.80
conflictsMethod · 0.80
describeMethod · 0.80
commandMethod · 0.80
errorMethod · 0.65
requireFunction · 0.50
strictMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…