mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-11 12:09:03 +00:00
fix(cliproxy): honor status --verbose and document --provider/diag in help
handleProxyStatus now respects --verbose (was parsed but ignored). Document the existing --provider option on default/pause/resume and the 'diag' alias for doctor in the cliproxy help text.
This commit is contained in:
1 parent
016c47ec9a
commit
a5feefe45a
3 files changed
+20
-7
No files matched your search
@@ -53,9 +53,9 @@ export async function showHelp(): Promise<void> {
|
|||||||
[
|
[
|
||||||
'Quota Management:',
|
'Quota Management:',
|
||||||
[
|
[
|
||||||
['default <account>', 'Set default account for rotation'],
|
['default <account> [--provider <name>]', 'Set default account for rotation'],
|
||||||
['pause <account>', 'Pause account (skip in rotation)'],
|
['pause <account> [--provider <name>]', 'Pause account (skip in rotation)'],
|
||||||
['resume <account>', 'Resume paused account'],
|
['resume <account> [--provider <name>]', 'Resume paused account'],
|
||||||
[
|
[
|
||||||
'quota',
|
'quota',
|
||||||
'Show quota status + pool context (drain order, per-account available/cooling/paused)',
|
'Show quota status + pool context (drain order, per-account available/cooling/paused)',
|
||||||
@@ -89,9 +89,9 @@ export async function showHelp(): Promise<void> {
|
|||||||
[
|
[
|
||||||
['start', 'Start CLIProxy instance in background'],
|
['start', 'Start CLIProxy instance in background'],
|
||||||
['restart', 'Restart CLIProxy instance'],
|
['restart', 'Restart CLIProxy instance'],
|
||||||
['status', 'Show running CLIProxy status'],
|
['status [--verbose]', 'Show running CLIProxy status (--verbose adds uptime)'],
|
||||||
['stop', 'Stop running CLIProxy instance'],
|
['stop', 'Stop running CLIProxy instance'],
|
||||||
['doctor', 'Quota diagnostics and shared project detection'],
|
['doctor | diag', 'Quota diagnostics and shared project detection'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ export async function handleCliproxyCommand(args: string[]): Promise<void> {
|
|||||||
start: async () => handleStart(verbose),
|
start: async () => handleStart(verbose),
|
||||||
stop: async () => handleStop(),
|
stop: async () => handleStop(),
|
||||||
restart: async () => handleRestart(verbose),
|
restart: async () => handleRestart(verbose),
|
||||||
status: async () => handleProxyStatus(),
|
status: async () => handleProxyStatus(verbose),
|
||||||
doctor: async () => handleDoctor(verbose),
|
doctor: async () => handleDoctor(verbose),
|
||||||
diag: async () => handleDoctor(verbose),
|
diag: async () => handleDoctor(verbose),
|
||||||
default: async () => handleSetDefault(remainingArgs.slice(1)),
|
default: async () => handleSetDefault(remainingArgs.slice(1)),
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export async function handleRestart(verbose = false): Promise<void> {
|
|||||||
console.log('');
|
console.log('');
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function handleProxyStatus(): Promise<void> {
|
export async function handleProxyStatus(verbose = false): Promise<void> {
|
||||||
await initUI();
|
await initUI();
|
||||||
console.log(header('CLIProxy Status'));
|
console.log(header('CLIProxy Status'));
|
||||||
console.log('');
|
console.log('');
|
||||||
@@ -80,7 +80,17 @@ export async function handleProxyStatus(): Promise<void> {
|
|||||||
console.log(` Sessions: ${status.sessionCount || 0} active`);
|
console.log(` Sessions: ${status.sessionCount || 0} active`);
|
||||||
if (status.startedAt) {
|
if (status.startedAt) {
|
||||||
console.log(` Started: ${new Date(status.startedAt).toLocaleString()}`);
|
console.log(` Started: ${new Date(status.startedAt).toLocaleString()}`);
|
||||||
|
if (verbose) {
|
||||||
|
const uptimeMs = Date.now() - new Date(status.startedAt).getTime();
|
||||||
|
const uptimeSec = Math.floor(uptimeMs / 1000);
|
||||||
|
const h = Math.floor(uptimeSec / 3600);
|
||||||
|
const m = Math.floor((uptimeSec % 3600) / 60);
|
||||||
|
const s = uptimeSec % 60;
|
||||||
|
const uptimeStr = h > 0 ? `${h}h ${m}m ${s}s` : m > 0 ? `${m}m ${s}s` : `${s}s`;
|
||||||
|
console.log(` Uptime: ${uptimeStr}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log(dim('To stop: ccs cliproxy stop'));
|
console.log(dim('To stop: ccs cliproxy stop'));
|
||||||
} else {
|
} else {
|
||||||
@@ -94,6 +104,9 @@ export async function handleProxyStatus(): Promise<void> {
|
|||||||
if (!detected.sessionCount) {
|
if (!detected.sessionCount) {
|
||||||
console.log(dim(' Note: Detected running proxy without local session lock'));
|
console.log(dim(' Note: Detected running proxy without local session lock'));
|
||||||
}
|
}
|
||||||
|
if (verbose) {
|
||||||
|
console.log(dim(' Note: Process detected via port scan; no local lock file present'));
|
||||||
|
}
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log(dim('To stop: ccs cliproxy stop'));
|
console.log(dim('To stop: ccs cliproxy stop'));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user