mirror of
https://github.com/stablyai/orca.git
synced 2026-11-13 17:37:40 +00:00
* refactor(tooling): organize test runtime and maintenance owners * test(tooling): preserve relocated runtime fixture dependency edges * refactor(tooling): preserve xterm routing owner checks * ci(tooling): include routing owner in sparse checkout * test(tooling): preserve copied workflow dependency closures * fix(tooling): normalize hashed JSON assets in release parity * fix(tooling): distinguish asset aliases from literal references * fix(tooling): frame normalized asset reference payloads * fix(tooling): normalize decoded JSON asset references * refactor(tooling): organize build, CI and release owners * fix(tooling): align moved generator and workflow path contracts * fix(tooling): update generated plugin bundle owner banners * test(tooling): create relocated mobile verifier fixture directories * test(tooling): copy headless detector dependency closure * test(tooling): align native batch policy fixtures with owner path * fix(tooling): link moved reliability command to historical evidence * fix(tooling): preserve nested sandbox owners and canonical guide source * fix(tooling): target release version owners in checkout fixture
44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
JavaScript
const WATCH_ARGS = new Set(['-w', '--watch'])
|
|
|
|
/** The `--changed` ref of a one-shot run: true for the bare flag, undefined when absent or ambiguous. */
|
|
export function parseChangedArg(args) {
|
|
if (args[0] !== 'run' || args.some((arg) => WATCH_ARGS.has(arg.split('=')[0]))) {
|
|
return undefined
|
|
}
|
|
const index = args.findIndex((arg) => arg === '--changed' || arg.startsWith('--changed='))
|
|
if (index === -1) {
|
|
return undefined
|
|
}
|
|
const arg = args[index]
|
|
if (arg !== '--changed') {
|
|
return arg.slice('--changed='.length) || undefined
|
|
}
|
|
// Vitest would read a following positional as the ref; leave that form to Vitest.
|
|
const next = args[index + 1]
|
|
return next === undefined || next.startsWith('-') ? true : undefined
|
|
}
|
|
|
|
// Skip empty --changed runs only when Git proves no changes; uncertainty still starts Vitest.
|
|
export async function hasNoChangedFiles(args, root, runProcess) {
|
|
const changed = parseChangedArg(args)
|
|
if (changed === undefined) {
|
|
return false
|
|
}
|
|
const queries = [
|
|
// Covers Vitest's staged, modified, and untracked queries. Unlike `ls-files --modified`, it
|
|
// refreshes stale index stat data instead of rehashing files on every run.
|
|
['status', '--porcelain', '-z', '--untracked-files=all', '--ignore-submodules=none'],
|
|
...(typeof changed === 'string' ? [['diff', '--name-only', '-z', `${changed}...HEAD`]] : [])
|
|
]
|
|
try {
|
|
const results = await Promise.all(
|
|
queries.map((args) =>
|
|
runProcess({ program: 'git', args, cwd: root, timeoutMs: 30_000, maxOutputBytes: 4096 })
|
|
)
|
|
)
|
|
return results.every((result) => result.code === 0 && result.stdout === '')
|
|
} catch {
|
|
return false
|
|
}
|
|
}
|