refactor(commands): share cliproxy default port for setup and help

- source setup wizard local port default from port-manager

- render help text defaults from shared constant
This commit is contained in:
Tam Nhu Tran
2026-02-18 03:10:09 +07:00
parent 90b8d04d71
commit 688f3e3889
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ import * as path from 'path';
import { initUI, box, color, dim, sectionHeader, subheader } from '../utils/ui';
import { isUnifiedMode } from '../config/unified-config-loader';
import { getCcsDir, getCcsDirSource } from '../utils/config-manager';
import { CLIPROXY_DEFAULT_PORT } from '../cliproxy/config/port-manager';
// Get version from package.json (same as version-command.ts)
const VERSION = JSON.parse(
@@ -345,7 +346,7 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim();
// CLI Proxy configuration flags (new)
printSubSection('CLI Proxy Configuration', [
['--proxy-host <host>', 'Remote proxy hostname/IP'],
['--proxy-port <port>', 'Proxy port (default: 8317)'],
['--proxy-port <port>', `Proxy port (default: ${CLIPROXY_DEFAULT_PORT})`],
['--proxy-protocol <proto>', 'Protocol: http or https (default: http)'],
['--proxy-auth-token <token>', 'Auth token for remote proxy'],
['--proxy-timeout <ms>', 'Connection timeout in ms (default: 2000)'],
@@ -421,7 +422,7 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim();
console.log(` Binary: ${color(`${dirDisplay}/cliproxy/bin/cli-proxy-api-plus`, 'path')}`);
console.log(` Config: ${color(`${dirDisplay}/cliproxy/config.yaml`, 'path')}`);
console.log(` Auth: ${color(`${dirDisplay}/cliproxy/auth/`, 'path')}`);
console.log(` ${dim('Port: 8317 (default)')}`);
console.log(` ${dim(`Port: ${CLIPROXY_DEFAULT_PORT} (default)`)}`);
console.log('');
// Shared Data
+3 -2
View File
@@ -24,6 +24,7 @@ import {
} from '../config/unified-config-loader';
import { DEFAULT_CLIPROXY_SERVER_CONFIG } from '../config/unified-config-types';
import { getCcsDir } from '../utils/config-manager';
import { CLIPROXY_DEFAULT_PORT } from '../cliproxy/config/port-manager';
/** Custom error for user cancellation (Ctrl+C) */
class UserCancelledError extends Error {
@@ -318,7 +319,7 @@ async function runSetupWizard(force: boolean = false): Promise<void> {
auto_start: false,
},
local: {
port: 8317,
port: CLIPROXY_DEFAULT_PORT,
auto_start: false, // Disable local auto-start when using remote
},
};
@@ -341,7 +342,7 @@ async function runSetupWizard(force: boolean = false): Promise<void> {
auth_token: '',
},
local: {
port: 8317,
port: CLIPROXY_DEFAULT_PORT,
auto_start: true,
},
};