style: apply repo formatter to the security-fix files (no behavior change)

This commit is contained in:
Affaan Mustafa
2026-06-18 20:03:24 -04:00
parent bd9083ca1e
commit ed251f958a
3 changed files with 209 additions and 295 deletions
+20 -28
View File
@@ -25,7 +25,7 @@ function parseArgs(argv) {
repoRoot: null,
dryRun: false,
json: false,
help: false,
help: false
};
for (let index = 0; index < args.length; index += 1) {
@@ -63,9 +63,7 @@ function deriveRepoRootFromState(state) {
continue;
}
const relativeParts = operation.sourceRelativePath
.split(/[\\/]+/)
.filter(Boolean);
const relativeParts = operation.sourceRelativePath.split(/[\\/]+/).filter(Boolean);
if (relativeParts.length === 0) {
continue;
@@ -149,9 +147,7 @@ function validateRepoRoot(repoRoot) {
throw new Error(`Invalid ECC repo root: unreadable package.json at ${packageJsonPath}`);
}
if (!ECC_PACKAGE_NAMES.has(pkgName)) {
throw new Error(
`Refusing to run install from untrusted repo root ${normalized}: package.json name '${pkgName}' is not an official ECC package.`
);
throw new Error(`Refusing to run install from untrusted repo root ${normalized}: package.json name '${pkgName}' is not an official ECC package.`);
}
return normalized;
@@ -162,7 +158,7 @@ function runExternalCommand(command, args, options = {}) {
cwd: options.cwd,
env: options.env || process.env,
encoding: 'utf8',
maxBuffer: 10 * 1024 * 1024,
maxBuffer: 10 * 1024 * 1024
});
if (result.error) {
@@ -186,7 +182,7 @@ function runAutoUpdate(options = {}, dependencies = {}) {
const records = discover({
homeDir,
projectRoot,
targets: options.targets,
targets: options.targets
}).filter(record => record.exists);
const results = [];
@@ -198,8 +194,8 @@ function runAutoUpdate(options = {}, dependencies = {}) {
summary: {
checkedCount: 0,
updatedCount: 0,
errorCount: 0,
},
errorCount: 0
}
};
}
@@ -211,7 +207,7 @@ function runAutoUpdate(options = {}, dependencies = {}) {
adapter: record.adapter,
installStatePath: record.installStatePath,
status: 'error',
error: record.error || 'No valid install-state available',
error: record.error || 'No valid install-state available'
});
continue;
}
@@ -220,7 +216,7 @@ function runAutoUpdate(options = {}, dependencies = {}) {
inferredRepoRoots.push(recordRepoRoot);
validRecords.push({
record,
repoRoot: recordRepoRoot,
repoRoot: recordRepoRoot
});
}
@@ -240,15 +236,15 @@ function runAutoUpdate(options = {}, dependencies = {}) {
summary: {
checkedCount: results.length,
updatedCount: 0,
errorCount: results.length,
},
errorCount: results.length
}
};
}
const env = {
...process.env,
HOME: homeDir,
USERPROFILE: homeDir,
USERPROFILE: homeDir
};
if (!options.dryRun) {
@@ -258,11 +254,7 @@ function runAutoUpdate(options = {}, dependencies = {}) {
for (const entry of validRecords) {
const installArgs = buildInstallApplyArgs(entry.record);
const args = [
path.join(repoRoot, 'scripts', 'install-apply.js'),
...installArgs,
'--json',
];
const args = [path.join(repoRoot, 'scripts', 'install-apply.js'), ...installArgs, '--json'];
if (options.dryRun) {
args.push('--dry-run');
@@ -271,7 +263,7 @@ function runAutoUpdate(options = {}, dependencies = {}) {
try {
const commandResult = execute(process.execPath, args, {
cwd: determineInstallCwd(entry.record, repoRoot),
env,
env
});
let payload = null;
@@ -286,7 +278,7 @@ function runAutoUpdate(options = {}, dependencies = {}) {
cwd: determineInstallCwd(entry.record, repoRoot),
installArgs,
status: options.dryRun ? 'planned' : 'updated',
payload,
payload
});
} catch (error) {
results.push({
@@ -295,7 +287,7 @@ function runAutoUpdate(options = {}, dependencies = {}) {
repoRoot,
installArgs,
status: 'error',
error: error.message,
error: error.message
});
}
}
@@ -307,8 +299,8 @@ function runAutoUpdate(options = {}, dependencies = {}) {
summary: {
checkedCount: results.length,
updatedCount: results.filter(result => result.status === 'updated' || result.status === 'planned').length,
errorCount: results.filter(result => result.status === 'error').length,
},
errorCount: results.filter(result => result.status === 'error').length
}
};
}
@@ -350,7 +342,7 @@ function main() {
projectRoot: process.cwd(),
targets: options.targets,
repoRoot: options.repoRoot,
dryRun: options.dryRun,
dryRun: options.dryRun
});
if (options.json) {
@@ -375,5 +367,5 @@ module.exports = {
deriveRepoRootFromState,
buildInstallApplyArgs,
determineInstallCwd,
runAutoUpdate,
runAutoUpdate
};