개발 로그: gimme_readme 릴리스

DDD
풀어 주다: 2024-09-14 08:15:32
원래의
511명이 탐색했습니다.

오늘 자정에 저는 한 번도 해본 적이 없는 일을 해냈습니다. 즉, 내 프로그램 gimme_readme를 전 세계가 사용할 수 있도록 npm 레지스트리에 게시하는 것입니다!

gimme_readme 명령줄 도구는 사용자의 로컬 소스 코드 파일을 가져와 이를 사용하여 코드를 설명하는 README.md 파일을 만듭니다. gimme_readme를 사용하면 다양한 AI API(예: Gemini의 gemini-1.5-flash 모델 및 Groq의 llama3-8b-8192 모델)를 선택하여 제공된 코드를 분석하고 코드를 설명하는 문서를 생성할 수 있습니다.

Dev log: gimme_readme  release

gimme_readme에 대해 자세히 알아보려면 아래 저장소를 확인하거나 저장소에도 링크되어 있는 0.1 릴리스 데모를 시청하시기 바랍니다.

Dev log: gimme_readme  release 피터단완 / gimme_readme

gimme_readme

gimme_readme는 프로젝트에 대한 포괄적인 README.md 파일을 생성하는 AI 기반 명령줄 도구입니다. 여러 소스 코드 파일을 한 번에 분석하여 각 파일의 목적, 기능 및 주요 구성 요소에 대한 간결한 설명을 읽기 쉬운 단일 문서로 제공합니다. 이렇게 하면 다른 사람들이 귀하의 프로젝트에 더 쉽게 접근하고 이해할 수 있습니다.

Dev log: gimme_readme  release

0.1 릴리스 데모를 확인하세요!

목차

  1. 시작하기
  2. 사용방법
  3. 사용예
  4. 공급자 지원 모델
  5. 기여
  6. 작가

1. 시작하기

gimme_readme를 시작하려면 다음 단계를 따르세요.

  1. 운영 체제에 맞는 최신 버전의 Node.js를 설치하세요.

  2. gimme_readme를 전역적으로 설치하려면 다음 명령을 실행하세요.

    npm i -g gimme_readme
    로그인 후 복사
    전체 화면 모드로 전환 전체 화면 모드 종료

    참고: MAC/LINUX 사용자는 sudo npm i -g gimme_readme를 실행해야 할 수도 있습니다

  3. 원하는 모든 폴더에서 실행하여 구성 파일을 생성하세요.

    gr-ai -c
    로그인 후 복사
    전체 화면 모드로 전환 전체 화면 모드 종료

    이 명령은 홈 디렉터리에 .gimme_readme_config 파일을 생성합니다. 이 파일을 이 위치에서 이동하지 마세요.

GitHub에서 보기

Table of Contents

  1. Developing gimme_readme
  2. Getting started with gimme_readme
  3. Features of gimme_readme
  4. Example usage
  5. Conclusion
  6. Links

Developing gimme_readme

"Stand on the shoulders of giants"

This quote echoed in my head as I was creating my command-line tool since I know very well that without the work of many other companies and distinct individuals, I would not be able to release my own project.

To that end, let me delve into some of the technologies I used to create gimme_readme.

To start, I knew I wanted to work with JavaScript because of its simple syntax, and its ability to run on Linux, Mac, and Windows. Since cross-platform availability is something I value, I knew I wanted to work with JavaScript from the start.

After choosing JavaScript as the programming language I'd write in, I thought about how I would publish my code. The first thought that came to mind was npm. npm or the node package manager is the largest open source registry in the world. People from around the world use code from npm and share their code to npm and the process of using npm is very straightforward.

When I started my computer science journey in 2022, I was fascinated with how easy it was to just write:

npm i NPM_PACKAGE
로그인 후 복사

and my code would magically work. I was even more impressed when I found out that the packages that were installed (if they were maintained correctly), were able to be installed on different operating systems.

To show you how easy node / npm's ecosystem is, let me show you how easy it is to make your JavaScript code into an executable that runs on every operating system.

You can make your script executable by adding a line similar to this to your package.json file:

{
  "bin": {
    // Makes an executable called "gr-ai" which simply calls my JS script
    "gr-ai": "./src/_gr.js"
  }
}
로그인 후 복사

How neat is that? With just a few lines of code (minus my comment), you are halfway done with making an executable called gr-ai which calls ./src/_gr.js that can run on all operating systems.

The final piece of the puzzle for making an executable is simulating how you would publish your code OR publishing your code for real.

To simulate publishing your code, run the following command in the root of your JavaScript project (i.e., where your package.json is):

npm link
로그인 후 복사

This command simulates you having installed your program globally and will give you access to your own gr-ai command!

In the event that you no longer want to have the code for this command installed globally (whether it be your simulated code / code that you installed globally via npm), you can run:

npm uninstall -g gimme_readme
로그인 후 복사

Please note, that you need to specify the name of your package when uninstalling and not the name of your executable.

I had to simulate publishing my code several times before actually publishing it to npm. For a really good guide on publishing your code to the npm registry, I suggest watching Web Dev Simplified's video on creating and publishing your first npm package.

With direction on how I'd publish my code, I was able to start thinking about all the different dependencies I would need to get my program to work.

The dependencies and packages I'm currently using for gimme_readme are:

  • @google/generative-ai & groq/sdk, which give me access to different LLMs that will help explain the user's source code
  • commander, which made it easy to configure the different options of my command-line tool
  • chalk, which allows me to colourize my command-line text
  • dotenv, which helps me work with secret files that store sensitive information
  • ora, which gives code that produces a loading spinner

It was with these great APIs and libraries that I was able to produce a tool of my own. With that said, let me show you how you can get started with gimme_readme so you can make heads or tails of your local source code files.

Getting started with gimme_readme

To get started with gimme_readme, follow these steps:

1. Install the latest version of Node.js for your operating system

The download for Node.js can be found here: https://nodejs.org/en/download/package-manager.

Node.js will come with npm and allow you to install gimme_readme.

2. Run the following command to install gimme_readme globally

npm i -g gimme_readme
로그인 후 복사

NOTE: MAC/LINUX users may need to run sudo npm i -g gimme_readme

3. Generate a configuration file by running in any folder you'd like

gr-ai -c
로그인 후 복사
로그인 후 복사

This command creates a .gimme_readme_config file in your home directory. Do not move this file from this location.

Follow the instructions in the file to create your own API keys and set your own default values.

Dev log: gimme_readme  release

Congratulations! You just installed gimme_readme to your system and if you created your own API keys, you should be able to use gimme_readme on the command-line!

With installation out of the way, let's delve into how you can use gimme_readme.

Features of gimme_readme

At a top level, gimme_readme supports the following features:

  1. The ability to display a help page.
  2. The ability to get gimme_readme's version number.
  3. The ability to create a .gimme_readme_config file or locate it
  4. The ability to send it source files, and have an AI model provide an explanation for your source code files.
  5. The ability to choose where the AI model's explanation is outputted (i.e., to a file or to your terminal).
  6. The ability to specify the AI model that provides explanations for you.
  7. The ability to send your own custom AI prompt.
  8. The ability to set the temperature of your model (i.e., how deterministic you want your model's response to be).

Let's show you demonstrations of each feature.

Example usage

Display the help page

The most basic gimme_readme command is:

gr-ai
로그인 후 복사

Dev log: gimme_readme  release

This shows us how use gr-ai and its different options.

Display the version number

Providing the -v option to the gr-ai command returns the version number

gr-ai -v
로그인 후 복사

Dev log: gimme_readme  release

Create a .gimme_readme_config file or find the path to your existing one

gr-ai -c
로그인 후 복사
로그인 후 복사

Takes several input files, choose your LLM of choice, and outputs the selected LLM's response to a file

#         file            file         model               output file
gr-ai -f .prettierignore .gitignore -m gemini-1.5-flash -o explain.md
로그인 후 복사

Dev log: gimme_readme  release

Conclusion

If you made it this far, I'd like to thank you for giving this blog a read. Creating the 0.1 release of gimme_readme has been a great experience, and I’m excited to continue developing new features and improving the tool. If you're interested in trying it out or contributing, feel free to check out the GitHub repository.

Stay tuned for more updates in the coming weeks!

Links

  • GitHub Repository: gimme_readme
  • Demo Video: Watch the 0.1 Release Demo

위 내용은 개발 로그: gimme_readme 릴리스의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

원천:dev.to
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!