mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
This reverts commit e61b75f007.
This commit is contained in:
@@ -56,7 +56,7 @@ export function buildProfileSettings(modelId, baseUrl, cfg) {
|
||||
* behaviorally identical. Writes `<claudeHome>/profiles/<name>/settings.json`
|
||||
* (directory-per-profile); never touches the active/default Claude config.
|
||||
* @param {Array} models
|
||||
* @param {{claudeHome?:string, baseUrl:string, dryRun?:boolean, only?:string, log?:(line:string)=>void}} opts
|
||||
* @param {{claudeHome?:string, baseUrl:string, dryRun?:boolean, only?:string}} opts
|
||||
* @returns {Promise<{written:number, skipped:number, profiles:Array<{name:string, model:string, filePath:string}>}>}
|
||||
*/
|
||||
export async function syncClaudeProfilesFromModels(models, opts = {}) {
|
||||
@@ -64,12 +64,6 @@ export async function syncClaudeProfilesFromModels(models, opts = {}) {
|
||||
const profilesRoot = join(claudeHome, "profiles");
|
||||
const baseUrl = opts.baseUrl;
|
||||
const dryRun = Boolean(opts.dryRun);
|
||||
// Injectable dry-run printer (#5959): under the node:test runner, a child
|
||||
// process writing multi-byte UTF-8 (the "──" box-drawing heading) to stdout
|
||||
// corrupts the runner's V8-serialized event stream ~50% of the time
|
||||
// ("Unable to deserialize cloned data due to invalid or unsupported
|
||||
// version"). Tests inject a collector; the CLI default stays console.log.
|
||||
const log = opts.log ?? console.log;
|
||||
const onlyFilter = opts.only ? opts.only.split(",").map((s) => s.trim()) : null;
|
||||
|
||||
if (!dryRun && !existsSync(profilesRoot)) {
|
||||
@@ -102,8 +96,8 @@ export async function syncClaudeProfilesFromModels(models, opts = {}) {
|
||||
const content = buildProfileSettings(id, baseUrl, cfg);
|
||||
|
||||
if (dryRun) {
|
||||
log(`\n── [dry-run] ${filePath} ──`);
|
||||
log(content);
|
||||
console.log(`\n── [dry-run] ${filePath} ──`);
|
||||
console.log(content);
|
||||
} else {
|
||||
mkdirSync(dir, { recursive: true });
|
||||
writeFileSync(filePath, content, "utf8");
|
||||
|
||||
Reference in New Issue
Block a user