Display current configuration. API keys are masked for security (showing only first and last 4 characters). Examples: \b # Display configuration $ codewiki config show \b # Display as JSON $ codewiki config show --json
(output_json: bool)
| 332 | help="Output in JSON format" |
| 333 | ) |
| 334 | def config_show(output_json: bool): |
| 335 | """ |
| 336 | Display current configuration. |
| 337 | |
| 338 | API keys are masked for security (showing only first and last 4 characters). |
| 339 | |
| 340 | Examples: |
| 341 | |
| 342 | \b |
| 343 | # Display configuration |
| 344 | $ codewiki config show |
| 345 | |
| 346 | \b |
| 347 | # Display as JSON |
| 348 | $ codewiki config show --json |
| 349 | """ |
| 350 | try: |
| 351 | manager = ConfigManager() |
| 352 | |
| 353 | if not manager.load(): |
| 354 | click.secho("\n✗ Configuration not found.", fg="red", err=True) |
| 355 | click.echo("\nPlease run 'codewiki config set' to configure your API credentials:") |
| 356 | click.echo(" codewiki config set --api-key <key> --base-url <url> \\") |
| 357 | click.echo(" --main-model <model> --cluster-model <model> --fallback-model <model>") |
| 358 | click.echo("\nFor more help: codewiki config set --help") |
| 359 | sys.exit(EXIT_CONFIG_ERROR) |
| 360 | |
| 361 | config = manager.get_config() |
| 362 | api_key = manager.get_api_key() |
| 363 | |
| 364 | if output_json: |
| 365 | # JSON output |
| 366 | output = { |
| 367 | "api_key": mask_api_key(api_key) if api_key else "Not set", |
| 368 | "api_key_storage": "keychain" if manager.keyring_available else "encrypted_file", |
| 369 | "base_url": config.base_url if config else "", |
| 370 | "main_model": config.main_model if config else "", |
| 371 | "cluster_model": config.cluster_model if config else "", |
| 372 | "fallback_model": config.fallback_model if config else "glm-4p5", |
| 373 | "default_output": config.default_output if config else "docs", |
| 374 | "max_tokens": config.max_tokens if config else 32768, |
| 375 | "max_token_per_module": config.max_token_per_module if config else 36369, |
| 376 | "max_token_per_leaf_module": config.max_token_per_leaf_module if config else 16000, |
| 377 | "max_depth": config.max_depth if config else 2, |
| 378 | "agent_instructions": config.agent_instructions.to_dict() if config and config.agent_instructions else {}, |
| 379 | "config_file": str(manager.config_file_path) |
| 380 | } |
| 381 | click.echo(json.dumps(output, indent=2)) |
| 382 | else: |
| 383 | # Human-readable output |
| 384 | click.echo() |
| 385 | click.secho("CodeWiki Configuration", fg="blue", bold=True) |
| 386 | click.echo("━" * 40) |
| 387 | click.echo() |
| 388 | |
| 389 | from codewiki.src.be.backend import is_caw_provider |
| 390 | caw_mode = bool(config) and is_caw_provider(config.provider) |
| 391 |
nothing calls this directly
no test coverage detected