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;
|
||||
}
|
||||
|
||||
// Binary missing - download
|
||||
log('Binary not found, downloading...', verbose);
|
||||
|
||||
// Binary missing
|
||||
if (!config.allowInstall) {
|
||||
throw new Error(
|
||||
`${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) {
|
||||
try {
|
||||
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 command = remainingArgs[0];
|
||||
|
||||
if (hasAnyFlag(remainingArgs, ['--help', '-h'])) {
|
||||
await showHelp();
|
||||
return;
|
||||
// Show global cliproxy help only when --help/-h is the top-level intent (no
|
||||
// subcommand, or the flag is the first arg). Subcommands that accept --help
|
||||
// (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
|
||||
|
||||
@@ -79,7 +79,8 @@ export async function handlePoolSubcommand(args: string[]): Promise<void> {
|
||||
console.log(warn(result.message));
|
||||
process.exitCode = 1;
|
||||
} else if (result.changed) {
|
||||
console.log(ok(result.message));
|
||||
// message already carries the correct [OK]/[!] prefix from routing-strategy
|
||||
console.log(result.message);
|
||||
} else {
|
||||
console.log(info(result.message));
|
||||
}
|
||||
@@ -93,7 +94,8 @@ export async function handlePoolSubcommand(args: string[]): Promise<void> {
|
||||
console.log(warn(result.message));
|
||||
process.exitCode = 1;
|
||||
} else if (result.changed) {
|
||||
console.log(ok(result.message));
|
||||
// message already carries the correct [OK]/[!] prefix from routing-strategy
|
||||
console.log(result.message);
|
||||
} else {
|
||||
console.log(info(result.message));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user