mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-11 03:13:12 +00:00
fix(cliproxy): gate binary download log, fix pool message prefix and routing affinity help
Only log 'Binary not found, downloading...' when a download will actually happen (after the allowInstall guard). Stop double-prefixing pool enable/disable messages that already carry [OK]/[!]. Route 'cliproxy routing affinity --help' to affinity help instead of the generic cliproxy help.
This commit is contained in:
1 parent
8cfd13ba96
commit
9d5b33382b
3 files changed
+16
-8
No files matched your search
@@ -132,9 +132,7 @@ export async function ensureBinary(config: BinaryManagerConfig): Promise<string>
|
|||||||
return binaryPath;
|
return binaryPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Binary missing - download
|
// Binary missing
|
||||||
log('Binary not found, downloading...', verbose);
|
|
||||||
|
|
||||||
if (!config.allowInstall) {
|
if (!config.allowInstall) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${getBackendLabel(backend)} binary is not installed locally. ` +
|
`${getBackendLabel(backend)} binary is not installed locally. ` +
|
||||||
@@ -142,6 +140,9 @@ export async function ensureBinary(config: BinaryManagerConfig): Promise<string>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only log download intent when a download will actually happen
|
||||||
|
log('Binary not found, downloading...', verbose);
|
||||||
|
|
||||||
if (!config.forceVersion) {
|
if (!config.forceVersion) {
|
||||||
try {
|
try {
|
||||||
const latestVersion = await fetchLatestVersion(verbose, backend);
|
const latestVersion = await fetchLatestVersion(verbose, backend);
|
||||||
|
|||||||
@@ -146,9 +146,14 @@ export async function handleCliproxyCommand(args: string[]): Promise<void> {
|
|||||||
const verbose = hasAnyFlag(remainingArgs, ['--verbose', '-v']);
|
const verbose = hasAnyFlag(remainingArgs, ['--verbose', '-v']);
|
||||||
const command = remainingArgs[0];
|
const command = remainingArgs[0];
|
||||||
|
|
||||||
if (hasAnyFlag(remainingArgs, ['--help', '-h'])) {
|
// Show global cliproxy help only when --help/-h is the top-level intent (no
|
||||||
await showHelp();
|
// subcommand, or the flag is the first arg). Subcommands that accept --help
|
||||||
return;
|
// (e.g. routing affinity --help) handle it themselves after dispatch.
|
||||||
|
if (!command || command === '--help' || command === '-h') {
|
||||||
|
if (hasAnyFlag(remainingArgs, ['--help', '-h'])) {
|
||||||
|
await showHelp();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Catalog commands
|
// Catalog commands
|
||||||
|
|||||||
@@ -79,7 +79,8 @@ export async function handlePoolSubcommand(args: string[]): Promise<void> {
|
|||||||
console.log(warn(result.message));
|
console.log(warn(result.message));
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} else if (result.changed) {
|
} else if (result.changed) {
|
||||||
console.log(ok(result.message));
|
// message already carries the correct [OK]/[!] prefix from routing-strategy
|
||||||
|
console.log(result.message);
|
||||||
} else {
|
} else {
|
||||||
console.log(info(result.message));
|
console.log(info(result.message));
|
||||||
}
|
}
|
||||||
@@ -93,7 +94,8 @@ export async function handlePoolSubcommand(args: string[]): Promise<void> {
|
|||||||
console.log(warn(result.message));
|
console.log(warn(result.message));
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} else if (result.changed) {
|
} else if (result.changed) {
|
||||||
console.log(ok(result.message));
|
// message already carries the correct [OK]/[!] prefix from routing-strategy
|
||||||
|
console.log(result.message);
|
||||||
} else {
|
} else {
|
||||||
console.log(info(result.message));
|
console.log(info(result.message));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user