{"id":19511642,"url":"https://github.com/thecodetherapy/thecodegpt","last_synced_at":"2025-02-25T23:15:13.989Z","repository":{"id":255871489,"uuid":"853790690","full_name":"TheCodeTherapy/thecodegpt","owner":"TheCodeTherapy","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-07T15:16:58.000Z","size":710,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T11:49:19.956Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheCodeTherapy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-07T14:47:17.000Z","updated_at":"2024-09-07T16:28:32.000Z","dependencies_parsed_at":"2024-09-07T16:18:22.141Z","dependency_job_id":"56911912-f332-44a7-a677-87bfffaaa0e0","html_url":"https://github.com/TheCodeTherapy/thecodegpt","commit_stats":null,"previous_names":["thecodetherapy/thecodegpt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeTherapy%2Fthecodegpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeTherapy%2Fthecodegpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeTherapy%2Fthecodegpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeTherapy%2Fthecodegpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheCodeTherapy","download_url":"https://codeload.github.com/TheCodeTherapy/thecodegpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240761142,"owners_count":19853256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T23:22:03.877Z","updated_at":"2025-02-25T23:15:13.935Z","avatar_url":"https://github.com/TheCodeTherapy.png","language":"TypeScript","readme":"# TheCodeGPT\n\nThis small extension works as a wrapper to ask ChatGPT questions while offering information about the current workspace as part of the system prompt, giving it a chance to reply with more informed answers.\n\nThe default bind key to ask a question is `Alt+q`\n\n![TheCodeGPT screenshot 1](./screenshots/screenshot_01.png)\n\n![TheCodeGPT screenshot 1](./screenshots/screenshot_01.png)\n\n## Features\n\nThe extension will generate information about the workspace, given the settings provided by a JSON file called `.repoinfo.json` that must exist in the workspace's root directory.\n\nSuch JSON object will inform about:\n\n- The code extensions that should be included in the prompt context;\n\n- Which directories should be ignored while traversing and looking for files that end with the desired extensions;\n\n- Which specific files should be manually added even though they don't belong to the list of tracked code extensions.\n\nHere follows a `.repoinfo.json` example:\n\n```JSON\n{\n  \"codeFileExtensions\": [\".cpp\", \".hpp\", \".sh\", \".fs\", \".vs\"],\n  \"ignoredDirectories\": [\n    \".git\",\n    \".cache\",\n    \"deps\",\n    \"build\"\n  ],\n  \"includeSpecificFiles\": [\"CMakeLists.txt\", \"cfg/path.cfg\"]\n}\n```\n\n## Requirements\n\nYou must have a `.repoinfo.json` as described above in the root directory of the workspace you're using this extension with; otherwise, you risk parsing many files that shouldn't be included (as project dependencies).\n\nFor now, to prevent the risk of accidentally leaking an API key into repos, this extension retrieves the `OPENAI_API_KEY` from an environment variable (that I'm currently setting by using:\n\n```BASH\n source ~/.openai_api_key\n ```\n \n ... on my `.profile` file on Linux, while making sure such `.openai_api_key` is not tracked by any of my repos). I'll update this method once I can find the time.\n\n## Extension Settings\n\nA `.repoinfo.json` must be present in the root directory of the workspace you're using this extension on.\n\n`.repoinfo.json` example:\n\n```JSON\n{\n  \"codeFileExtensions\": [\".cpp\", \".hpp\", \".sh\", \".fs\", \".vs\"],\n  \"ignoredDirectories\": [\n    \".git\",\n    \".cache\",\n    \"deps\",\n    \"build\"\n  ],\n  \"includeSpecificFiles\": [\"CMakeLists.txt\", \"cfg/path.cfg\"]\n}\n```\n\nHere follows another `.repoinfo.json` example, that would be more suitable for a React + TypeScript project:\n\n```JSON\n{\n  \"codeFileExtensions\": [\".ts\", \".tsx\", \".js\", \".cjs\", \".mjs\"],\n  \"ignoredDirectories\": [\n    \".git\",\n    \"node_modules\",\n    \"build\",\n    \"dist\"\n  ],\n  \"includeSpecificFiles\": [\".eslintrc\", \".prettierrc\", \"package.json\"]\n}\n```\n\n\n## Known Issues\n\nI just started drafting this extension, so I wouldn't recommend it for projects in production. Lots of changes are expected.\n\nFor now, until I can find some time to improve the extension settings, I'm using hardcoded settings for the ChatGPT request, which follows:\n\n```Javascript\nconst response = await fetch(\"https://api.openai.com/v1/chat/completions\", {\n      method: \"POST\",\n      headers: {\n        Authorization: `Bearer ${apiKey}`,\n        \"Content-Type\": \"application/json\",\n      },\n      body: JSON.stringify({\n        model: \"gpt-4\",\n        messages: [\n          { role: \"system\", content: systemPrompt },\n          { role: \"user\", content: userInput },\n        ],\n        max_tokens: 1500,\n        temperature: 0.7,\n        stream: true,\n      }),\n    });\n```\n\nIn further updates I plan to gather such settings from the `.repoinfo.json` file, but I still haven´t decided the granularity level I want for this.\n\nFor now, this extension will automatically generate text files with information about the workspace, according to the files allowed to be tracked by the `.repoinfo.json` settings file, instead of just handling the system-prompt in memory. Please keep that in mind so you may exclude such files through your `.gitignore`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodetherapy%2Fthecodegpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodetherapy%2Fthecodegpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodetherapy%2Fthecodegpt/lists"}