MCPcopy Index your code
hub / github.com/simstudioai/sim / resolveFiles

Function resolveFiles

scripts/check-migrations-safety.ts:431–448  ·  view source on GitHub ↗
(argv: string[])

Source from the content-addressed store, hash-verified

429}
430
431async function resolveFiles(argv: string[]): Promise<string[] | null> {
432 if (argv.includes('--all')) {
433 return (await listSqlFiles(path.join(ROOT, MIGRATIONS_DIR))).map((f) => path.relative(ROOT, f))
434 }
435 const dirIdx = argv.indexOf('--dir')
436 if (dirIdx !== -1) {
437 const dir = argv[dirIdx + 1]
438 if (!dir) throw new Error('--dir requires a path')
439 return (await listSqlFiles(path.resolve(dir))).map((f) => path.relative(ROOT, f))
440 }
441 const baseRef = argv.find((a) => !a.startsWith('--')) ?? 'origin/staging'
442 const files = changedMigrationFiles(baseRef)
443 if (files.length === 0 && git(['rev-parse', 'HEAD']) === null) {
444 console.warn('⚠ git unavailable — skipping migration safety check.')
445 return null
446 }
447 return files
448}
449
450async function main() {
451 const files = await resolveFiles(process.argv.slice(2))

Callers 1

mainFunction · 0.85

Calls 6

listSqlFilesFunction · 0.85
changedMigrationFilesFunction · 0.85
gitFunction · 0.85
joinMethod · 0.80
resolveMethod · 0.65
warnMethod · 0.65

Tested by

no test coverage detected