[
  {
    "path": ".gitignore",
    "content": "node_modules\n\n# Output\n.output\n.vercel\n/.svelte-kit\n/build\n\n# OS\n.DS_Store\nThumbs.db\n\n# Env\n.env\n.env.*\n!.env.example\n!.env.test\n\n# Vite\nvite.config.js.timestamp-*\nvite.config.ts.timestamp-*\n"
  },
  {
    "path": ".npmrc",
    "content": "engine-strict=true\n"
  },
  {
    "path": "README.md",
    "content": "# New Version\n- new version in branch `v2`\n- new version using sveltekit api so don't need to run backend api\n\n\n## Local Development\nBackend API repo : https://github.com/bagusindrayana/roastgithub-api\n- Clone the repository\n- Run `npm install`\n- make .env file and add the following\n```\nPUBLIC_API_URL=http://localhost:3001\n```\n- Run `npm run dev`\n\n\n## Support Me!\n<a href=\"https://trakteer.id/bagood\" target=\"_blank\"\n                ><img\n                    id=\"wse-buttons-preview\"\n                    src=\"https://cdn.trakteer.id/images/embed/trbtn-red-1.png?date=18-11-2023\"\n                    height=\"40\"\n                    style=\"border: 0px; height: 40px; --darkreader-inline-border-top: 0px; --darkreader-inline-border-right: 0px; --darkreader-inline-border-bottom: 0px; --darkreader-inline-border-left: 0px;\"\n                    alt=\"Trakteer Saya\"\n                    data-darkreader-inline-border-top=\"\"\n                    data-darkreader-inline-border-right=\"\"\n                    data-darkreader-inline-border-bottom=\"\"\n                    data-darkreader-inline-border-left=\"\"\n                /></a\n            >"
  },
  {
    "path": "package.json",
    "content": "{\n\t\"name\": \"roastgithub\",\n\t\"version\": \"0.0.1\",\n\t\"private\": true,\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"build\": \"vite build\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"check:watch\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@sveltejs/adapter-auto\": \"^3.0.0\",\n\t\t\"@sveltejs/kit\": \"^2.0.0\",\n\t\t\"@sveltejs/vite-plugin-svelte\": \"^3.0.0\",\n\t\t\"svelte\": \"^4.2.7\",\n\t\t\"svelte-check\": \"^3.6.0\",\n\t\t\"typescript\": \"^5.0.0\",\n\t\t\"vite\": \"^5.0.3\"\n\t},\n\t\"type\": \"module\",\n\t\"dependencies\": {\n\t\t\"axios\": \"^1.7.3\"\n\t}\n}\n"
  },
  {
    "path": "src/app.d.ts",
    "content": "// See https://kit.svelte.dev/docs/types#app\n// for information about these interfaces\ndeclare global {\n\tnamespace App {\n\t\t// interface Error {}\n\t\t// interface Locals {}\n\t\t// interface PageData {}\n\t\t// interface PageState {}\n\t\t// interface Platform {}\n\t}\n}\n\nexport {};\n"
  },
  {
    "path": "src/app.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<link rel=\"icon\" href=\"%sveltekit.assets%/favicon.png\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t%sveltekit.head%\n\t</head>\n\t<body data-sveltekit-preload-data=\"hover\">\n\t\t<div style=\"display: contents\">%sveltekit.body%</div>\n\t</body>\n</html>\n"
  },
  {
    "path": "src/lib/index.ts",
    "content": "// place files you want to import through the `$lib` alias in this folder.\n"
  },
  {
    "path": "src/routes/+page.svelte",
    "content": "<script lang=\"ts\">\n    import { PUBLIC_API_URL } from \"$env/static/public\";\n    import axios from \"axios\";\n\n    let apiUrl =\n        import.meta.env.VITE_API_URL ??\n        PUBLIC_API_URL ??\n        \"http://localhost:3001\";\n    let username: string = \"\";\n    let model: string = \"gemini\";\n    let language: string = \"auto\";\n    let roastingResult: string = \"\";\n    let status: string = \"idle\";\n    let apiKey:string = \"\";\n\n    async function fetchGithubData() {\n        if (!username || status == \"loading\") return;\n        status = \"loading\";\n        var datas = null;\n        var readmeResponse = { status: 404, data: null };\n        try {\n            var profileResponse = await axios.get(\n                `https://api.github.com/users/${username}`,\n            );\n            const repoResponse = await axios.get(\n                `https://api.github.com/users/${username}/repos?sort=updated`,\n            );\n\n            try {\n                readmeResponse = await axios.get(\n                    `https://raw.githubusercontent.com/${username}/${username}/main/README.md`,\n                );\n            } catch (error) {\n                try {\n                    readmeResponse = await axios.get(\n                        `https://raw.githubusercontent.com/${username}/${username}/master/README.md`,\n                    );\n                } catch (error) {}\n            }\n            datas = {\n                name: profileResponse.data.name,\n                bio: profileResponse.data.bio,\n                company: profileResponse.data.company,\n                location: profileResponse.data.location,\n                followers: profileResponse.data.followers,\n                following: profileResponse.data.following,\n                public_repos: profileResponse.data.public_repos,\n                created_at: profileResponse.data.created_at,\n                updated_at: profileResponse.data.updated_at,\n                repositories: repoResponse.data\n                    .map(\n                        (repo: {\n                            name: any;\n                            description: any;\n                            language: any;\n                            stargazers_count: any;\n                            open_issues_count: any;\n                            license: any;\n                            fork: any;\n                            created_at: any;\n                            updated_at: any;\n                        }) => ({\n                            name: repo.name,\n                            description: repo.description,\n                            language: repo.language,\n                            stargazers_count: repo.stargazers_count,\n                            open_issues_count: repo.open_issues_count,\n                            license: repo.license,\n                            fork: repo.fork,\n                            created_at: repo.created_at,\n                            updated_at: repo.updated_at,\n                        }),\n                    )\n                    .slice(0, 50),\n            };\n        } catch (error) {\n            console.error(\n                \"Error fetching GitHub data in client, try in server...\",\n                error,\n            );\n        }\n\n        try {\n            // Send data to Gemini AI for roasting\n            const geminiResponse = await axios.post<{ roasting: string }>(\n                apiUrl + \"/roasting?username=\" + username,\n                {\n                    jsonData: JSON.stringify(datas),\n                    README: readmeResponse.data,\n                    model:model,\n                    language:language,\n                    apiKey:apiKey\n                },\n            );\n            roastingResult = geminiResponse.data.roasting;\n        } catch (error: any) {\n            console.error(\"Error : \", error);\n            if (axios.isAxiosError(error)) {\n                //get response from error\n                var responseData = error.response?.data;\n                if(responseData != undefined && responseData.error){\n                    roastingResult =\n                        \"Failed to fetch response, error in server : \" +\n                        responseData.error;\n                } else {\n                    roastingResult =\n                        \"Failed to fetch response, error in server : \" +\n                        error?.message;\n                }\n            } else {\n                roastingResult = `Failed to fetch response, something wrong : ${error?.message}. please try again later ...`;\n            }\n        }\n        status = \"done\";\n    }\n</script>\n\n<svelte:head>\n    <title>GitHub Profile Roasting 🔥🔥🔥</title>\n    <meta\n        name=\"description\"\n        content=\"Roasting Your GitHub Profile with AI\"/>\n</svelte:head>\n<main>\n    <div id=\"header\">\n        <marquee style=\"color:red;\">Siapkan mental anda sebelum menekan tombol submit, semua response digenerate oleh AI, bisa saja response yang diberikan sangat menyinggung anda.</marquee>\n    </div>\n    <h1>GitHub Profile Roasting 🔥🔥🔥</h1>\n\n    <div>\n        <input\n            type=\"text\"\n            bind:value={username}\n            placeholder=\"Enter GitHub username\"\n        />\n        <button on:click={fetchGithubData}>Submit</button>\n    </div>\n    {#if status == \"idle\"}\n        <p>Enter a GitHub username to get started.</p>\n    {/if}\n    <br>\n    <details>\n        <summary>Setting</summary>\n        <div class=\"input-group\">\n            <label for=\"language\">Language</label>\n            <select bind:value={language} name=\"language\" id=\"language\">\n                <option value=\"auto\">Auto</option>\n                <option value=\"english\">English</option>\n                <option value=\"indonesia\">Indonesia</option>\n            </select>\n        </div>\n        <div class=\"input-group\">\n            <label for=\"model\">AI Model</label>\n            <select bind:value={model} name=\"model\" id=\"model\">\n                <option value=\"gemini\">Gemini AI</option>\n                <option value=\"llama\">LLama (Groq AI)</option>\n            </select>\n            <input type=\"password\" bind:value={apiKey} placeholder=\"(Optional) API KEY...\">\n        </div>\n    </details>\n\n    {#if status == \"done\"}\n        <h2>Roasting For {username}</h2>\n        <p>{roastingResult}</p>\n    {:else if status == \"loading\"}\n        <p>Loading...</p>\n    {/if}\n    <div style=\"height: 100px;\"></div>\n    <div id=\"footer\">\n        <div>\n            <div>\n                <a\n                href=\"https://wallofdonations.my.id\"\n                class=\"underline\"\n                target=\"_blank\"\n            >\n                WallOfDonations\n            </a>\n            <a\n                href=\"https://roastgithub.my.id\"\n                class=\"underline\"\n                target=\"_blank\">New RoastGithub</a\n            >\n                <a href=\"https://roastlinkedin.my.id\" target=\"_blank\">RoastLinkedin</a>\n                <a href=\"https://roastwaifu.my.id\" target=\"_blank\">RoastWaifu</a>\n            </div>\n            <br>\n            <div class=\"btn-list\">\n                <a href=\"https://trakteer.id/bagood\" target=\"_blank\"\n                ><img\n                    id=\"wse-buttons-preview\"\n                    src=\"https://cdn.trakteer.id/images/embed/trbtn-red-1.png?date=18-11-2023\"\n                    height=\"40\"\n                    style=\"border: 0px; height: 40px; --darkreader-inline-border-top: 0px; --darkreader-inline-border-right: 0px; --darkreader-inline-border-bottom: 0px; --darkreader-inline-border-left: 0px;\"\n                    alt=\"Trakteer Saya\"\n                    data-darkreader-inline-border-top=\"\"\n                    data-darkreader-inline-border-right=\"\"\n                    data-darkreader-inline-border-bottom=\"\"\n                    data-darkreader-inline-border-left=\"\"\n                /></a\n            >\n            <iframe src=\"https://ghbtns.com/github-btn.html?user=bagusindrayana&repo=roastgithub&type=star&count=true&size=large\" frameborder=\"0\" scrolling=\"0\" width=\"170\" height=\"30\" title=\"GitHub\"></iframe>\n            </div>\n        </div>\n        \n    </div>\n</main>\n\n<style>\n    main {\n        padding: 1em;\n        max-width: 800px;\n        margin: 0 auto;\n    }\n    input {\n        margin-right: 0.5em;\n        padding: 0.5em;\n    }\n    button {\n        padding: 0.5em;\n    }\n\n    #header {\n        display: flex;\n        justify-content: center;\n        align-items: center;\n        position: fixed;\n        top: 0;\n        left: 0;\n        right: 0;\n        margin: auto;\n        padding: 16px;\n        text-align: center;\n        background-color: white;\n    }\n\n    #footer {\n        display: flex;\n        justify-content: center;\n        align-items: center;\n        position: fixed;\n        bottom: 0;\n        left: 0;\n        right: 0;\n        margin: auto;\n        padding: 16px;\n        text-align: center;\n        background-color: white;\n    }\n\n    .input-group {\n        margin-bottom: 16px;\n        display: flex;\n        gap: 6px;\n        flex-direction: column;\n    }\n\n    .btn-list {\n        display: flex;\n        gap: 6px;\n        justify-content: center;\n        align-items: center;\n    }\n</style>\n"
  },
  {
    "path": "svelte.config.js",
    "content": "import adapter from '@sveltejs/adapter-auto';\nimport { vitePreprocess } from '@sveltejs/vite-plugin-svelte';\n\n/** @type {import('@sveltejs/kit').Config} */\nconst config = {\n\t// Consult https://kit.svelte.dev/docs/integrations#preprocessors\n\t// for more information about preprocessors\n\tpreprocess: vitePreprocess(),\n\n\tkit: {\n\t\t// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.\n\t\t// If your environment is not supported, or you settled on a specific environment, switch out the adapter.\n\t\t// See https://kit.svelte.dev/docs/adapters for more information about adapters.\n\t\tadapter: adapter()\n\t}\n};\n\nexport default config;\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n\t\"extends\": \"./.svelte-kit/tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"allowJs\": true,\n\t\t\"checkJs\": true,\n\t\t\"esModuleInterop\": true,\n\t\t\"forceConsistentCasingInFileNames\": true,\n\t\t\"resolveJsonModule\": true,\n\t\t\"skipLibCheck\": true,\n\t\t\"sourceMap\": true,\n\t\t\"strict\": true,\n\t\t\"moduleResolution\": \"bundler\"\n\t}\n\t// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias\n\t// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files\n\t//\n\t// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes\n\t// from the referenced tsconfig.json - TypeScript does not merge them in\n}\n"
  },
  {
    "path": "vite.config.ts",
    "content": "import { sveltekit } from '@sveltejs/kit/vite';\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n\tplugins: [sveltekit()]\n});\n"
  }
]