MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / config_show

Function config_show

codewiki/cli/commands/config.py:334–461  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

332 click.echo("No options provided. Use --help for usage information.")
333 sys.exit(EXIT_CONFIG_ERROR)
334
335 # Atlas Cloud convenience defaults: it's an OpenAI-compatible endpoint, so
336 # auto-fill its base URL and pull the API key from ATLASCLOUD_API_KEY when the
337 # user does not pass them explicitly.
338 if provider and provider.lower() == "atlas-cloud":
339 from codewiki.src.config import ATLAS_CLOUD_BASE_URL
340
341 if not base_url:
342 base_url = ATLAS_CLOUD_BASE_URL
343 if not api_key:
344 api_key = os.getenv("ATLASCLOUD_API_KEY")
345
346 manager = ConfigManager()
347 manager.load() # Load existing config if present
348
349 if provider and provider.lower() == "google" and not api_key:
350 api_key = os.getenv("GEMINI_API_KEY") or os.getenv("GOOGLE_API_KEY")
351 previous = manager.get_config()
352 if not api_key and not (previous and previous.provider == "google"):
353 # The keyring has one key slot: reusing it would send another
354 # provider's key to Google.
355 raise ConfigurationError(
356 "--provider google needs a Gemini API key: pass --api-key or set "
357 "GEMINI_API_KEY (or GOOGLE_API_KEY)."
358 )
359
360 # Validate inputs before saving
361 validated_data = {}
362
363 if api_key:
364 validated_data["api_key"] = validate_api_key(api_key)
365
366 if base_url:
367 validated_data["base_url"] = validate_url(base_url)
368
369 if main_model:
370 validated_data["main_model"] = validate_model_name(main_model)
371
372 if cluster_model:
373 validated_data["cluster_model"] = validate_model_name(cluster_model)
374
375 if fallback_model:
376 validated_data["fallback_model"] = validate_model_name(fallback_model)
377
378 if max_tokens is not None:
379 if max_tokens < 1:
380 raise ConfigurationError("max_tokens must be a positive integer")
381 validated_data["max_tokens"] = max_tokens
382
383 if min_token_per_module is not None:
384 validated_data["min_token_per_module"] = min_token_per_module
385
386 if max_token_per_module is not None:
387 if max_token_per_module < 1:
388 raise ConfigurationError("max_token_per_module must be a positive integer")
389 validated_data["max_token_per_module"] = max_token_per_module
390
391 if max_token_per_leaf_module is not None:

Callers

nothing calls this directly

Calls 9

loadMethod · 0.95
get_configMethod · 0.95
get_api_keyMethod · 0.95
ConfigManagerClass · 0.90
mask_api_keyFunction · 0.90
is_caw_providerFunction · 0.90
handle_errorFunction · 0.90
is_emptyMethod · 0.80
to_dictMethod · 0.45

Tested by

no test coverage detected