MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / init

Function init

web/js/main.js:6–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { initChat, showWelcome } from "./chat.js";
5
6async function init() {
7 try {
8 const config = await loadConfig();
9
10 // Set Pack Name & Description
11 const elName = document.getElementById("pack-name");
12 const elDesc = document.getElementById("pack-desc");
13 if (elName) elName.textContent = config.name || "Skills Pack";
14 if (elDesc) elDesc.textContent = config.description || "";
15 document.title = config.name || "Skills Pack";
16
17 // Set Sidebar Skills list
18 const skillsList = document.getElementById("skills-list");
19 if (skillsList && config.skills) {
20 skillsList.innerHTML = config.skills
21 .map(
22 (s) =>
23 `<li><div class="skill-name">${s.name}</div><div class="skill-desc">${s.description}</div></li>`,
24 )
25 .join("");
26 }
27
28 // Pre-fill prompt if exactly one
29 if (config.prompts && config.prompts.length === 1) {
30 const input = document.getElementById("user-input");
31 if (input) {
32 input.value = config.prompts[0];
33 input.style.height = "auto";
34 input.style.height = Math.min(input.scrollHeight, 120) + "px";
35 }
36 }
37
38 showWelcome(config);
39 } catch (err) {
40 console.error("Initialization Failed:", err);
41 }
42
43 initApiKeyDialog();
44 initChatAppsDialog();
45
46 try {
47 await initChat();
48 } catch (err) {
49 console.error("Chat initialization failed:", err);
50 }
51
52 updateApiKeyButton();
53 updateChatAppsButton();
54}
55
56// Start application
57init();

Callers 1

main.jsFile · 0.85

Calls 7

loadConfigFunction · 0.90
showWelcomeFunction · 0.90
initApiKeyDialogFunction · 0.90
initChatAppsDialogFunction · 0.90
initChatFunction · 0.90
updateApiKeyButtonFunction · 0.90
updateChatAppsButtonFunction · 0.90

Tested by

no test coverage detected