{"version":3,"file":"exercodeProblem.cjs","names":["runSingleHarness","checkAllProblems"],"sources":["../../src/cli/exercodeProblem.ts"],"sourcesContent":["import { checkAllProblems } from './checkAllProblems.js';\nimport { runSingleHarness } from './runSingleHarness.js';\n\nconst usage = `Usage: exercode-problem [rootDir] [--only <substring>]... [--skip <substring>]... [--concurrency <n>]\n       exercode-problem judge <answerDir> [paramsJson]\n       exercode-problem debug <answerDir> [paramsJson]\n\nWithout a subcommand, judge all model answers of all problems under rootDir\n(default: the current directory). Use \\`judge\\` or \\`debug\\` in a problem\ndirectory to run one answer directory, e.g.:\n  exercode-problem debug model_answers/python '{ \"stdin\": \"1 2\" }'`;\n\n// oxlint-disable-next-line unicorn/prefer-top-level-await -- the CJS build output does not support top-level await\nvoid main();\n\nasync function main(): Promise<void> {\n  const args = process.argv.slice(2);\n  if (args[0] === '--help' || args[0] === '-h') {\n    // console.log would be stripped from the built CLI, so print the usage with console.info.\n    console.info(usage);\n    return;\n  }\n  try {\n    if (args[0] === 'judge' || args[0] === 'debug') {\n      if (args.length < 2) {\n        console.error(usage);\n        process.exitCode = 1;\n        return;\n      }\n      // Harness scripts and presets read the answer directory and params from fixed positions in\n      // `process.argv`, so drop the subcommand to restore those positions.\n      process.argv.splice(2, 1);\n      process.exitCode = await runSingleHarness(args[0]);\n    } else {\n      process.exitCode = await checkAllProblems(args);\n    }\n  } catch (error) {\n    // Print the whole error: harness failures need their stack and `cause`, not just the message.\n    console.error(error);\n    process.exitCode = 1;\n  }\n}\n"],"mappings":"2FAGM,EAAQ;;;;;;;oEAUT,EAAK,EAEV,eAAe,GAAsB,CACnC,IAAM,EAAO,QAAQ,KAAK,MAAM,CAAC,EACjC,GAAI,EAAK,KAAO,UAAY,EAAK,KAAO,KAAM,CAE5C,QAAQ,KAAK,CAAK,EAClB,MACF,CACA,GAAI,CACF,GAAI,EAAK,KAAO,SAAW,EAAK,KAAO,QAAS,CAC9C,GAAI,EAAK,OAAS,EAAG,CACnB,QAAQ,MAAM,CAAK,EACnB,QAAQ,SAAW,EACnB,MACF,CAGA,QAAQ,KAAK,OAAO,EAAG,CAAC,EACxB,QAAQ,SAAW,MAAMA,EAAAA,iBAAiB,EAAK,EAAE,CACnD,KACE,SAAQ,SAAW,MAAMC,EAAAA,iBAAiB,CAAI,CAElD,OAAS,EAAO,CAEd,QAAQ,MAAM,CAAK,EACnB,QAAQ,SAAW,CACrB,CACF"}