MCPcopy
hub / github.com/di-sukharev/opencommit / runSetup

Function runSetup

out/cli.cjs:86718–86803  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86716 });
86717 if (hD2(apiUrl)) return null;
86718 return {
86719 provider: "llamacpp" /* LLAMACPP */,
86720 model: "",
86721 apiUrl: apiUrl || defaultUrl
86722 };
86723}
86724async function runSetup() {
86725 ae(source_default.bgCyan(" Welcome to OpenCommit! "));
86726 const provider = await selectProvider();
86727 if (hD2(provider)) {
86728 ce("Setup cancelled");
86729 return false;
86730 }
86731 let config8 = {};
86732 if (provider === "ollama" /* OLLAMA */) {
86733 const ollamaConfig = await setupOllama();
86734 if (!ollamaConfig) {
86735 ce("Setup cancelled");
86736 return false;
86737 }
86738 config8 = {
86739 OCO_AI_PROVIDER: ollamaConfig.provider,
86740 OCO_MODEL: ollamaConfig.model,
86741 OCO_API_URL: ollamaConfig.apiUrl,
86742 OCO_API_KEY: "ollama"
86743 // Placeholder
86744 };
86745 } else if (provider === "mlx" /* MLX */) {
86746 console.log(source_default.cyan("\n MLX - Apple Silicon Local AI\n"));
86747 console.log(source_default.dim(" MLX runs locally on Apple Silicon Macs."));
86748 console.log(source_default.dim(" No API key required.\n"));
86749 const model = await J4({
86750 message: "Enter model name:",
86751 placeholder: "mlx-community/Llama-3-8B-Instruct-4bit"
86752 });
86753 if (hD2(model)) {
86754 ce("Setup cancelled");
86755 return false;
86756 }
86757 config8 = {
86758 OCO_AI_PROVIDER: "mlx" /* MLX */,
86759 OCO_MODEL: model,
86760 OCO_API_KEY: "mlx"
86761 // Placeholder
86762 };
86763 } else if (provider === "llamacpp" /* LLAMACPP */) {
86764 const llamacppConfig = await setupLlamaCpp();
86765 if (!llamacppConfig) {
86766 ce("Setup cancelled");
86767 return false;
86768 }
86769 config8 = {
86770 OCO_AI_PROVIDER: llamacppConfig.provider,
86771 OCO_MODEL: llamacppConfig.model,
86772 OCO_API_URL: llamacppConfig.apiUrl,
86773 OCO_API_KEY: "llamacpp"
86774 // Placeholder
86775 };

Callers 1

cli.cjsFile · 0.70

Calls 9

hD2Function · 0.85
selectProviderFunction · 0.70
setupOllamaFunction · 0.70
setupLlamaCppFunction · 0.70
getApiKeyFunction · 0.70
selectModelFunction · 0.70
getGlobalConfigFunction · 0.70
setGlobalConfigFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…