今天午夜,我做了一些我以前从未做过的事情;就是把我的程序gimme_readme发布到npm注册中心,供全世界使用!
gimme_readme 命令行工具获取用户的本地源代码文件,并使用它们创建一个解释其代码的 README.md 文件。 gimme_readme 允许您选择不同的 AI API(例如 Gemini 的 gemini-1.5-flash 模型和 Groq 的 llama3-8b-8192 模型)来分析提供的代码并创建解释代码的文档。
要了解有关 gimme_readme 的更多信息,我邀请您查看下面我的存储库,或者观看 0.1 的发布演示,该演示也链接在我的存储库中。
彼得丹湾
/
给我自述文件
给我自述文件
gimme_readme 是一个由 AI 提供支持的命令行工具,可为您的项目生成全面的 README.md 文件。它可以同时分析多个源代码文件,并在一个易于阅读的文档中提供每个文件的用途、功能和关键组件的简明解释。这使得您的项目对其他人来说更容易理解和理解。
查看我们的 0.1 版本演示!
目录
- 开始使用
- 用法
- 用法示例
- 提供商支持的型号
- 贡献
- 作者
1.开始使用
要开始使用 gimme_readme,请按照以下步骤操作:
-
为您的操作系统安装最新版本的 Node.js。
-
运行以下命令全局安装 gimme_readme:
npm i -g gimme_readme
注意:MAC/LINUX 用户可能需要运行 sudo npm i -g gimme_readme
-
通过在您想要的任何文件夹中运行来生成配置文件:
gr-ai -c
此命令会在您的主目录中创建一个 .gimme_readme_config 文件。 请勿从此位置移动此文件。
…
Table of Contents
- Developing gimme_readme
- Getting started with gimme_readme
- Features of gimme_readme
- Example usage
- Conclusion
- 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.
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:
- The ability to display a help page.
- The ability to get gimme_readme's version number.
- The ability to create a .gimme_readme_config file or locate it
- The ability to send it source files, and have an AI model provide an explanation for your source code files.
- The ability to choose where the AI model's explanation is outputted (i.e., to a file or to your terminal).
- The ability to specify the AI model that provides explanations for you.
- The ability to send your own custom AI prompt.
- 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
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
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
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中文网其他相关文章!

JavaScript字符串替换方法详解及常见问题解答 本文将探讨两种在JavaScript中替换字符串字符的方法:在JavaScript代码内部替换和在网页HTML内部替换。 在JavaScript代码内部替换字符串 最直接的方法是使用replace()方法: str = str.replace("find","replace"); 该方法仅替换第一个匹配项。要替换所有匹配项,需使用正则表达式并添加全局标志g: str = str.replace(/fi

简单JavaScript函数用于检查日期是否有效。 function isValidDate(s) { var bits = s.split('/'); var d = new Date(bits[2] '/' bits[1] '/' bits[0]); return !!(d && (d.getMonth() 1) == bits[1] && d.getDate() == Number(bits[0])); } //测试 var

本文探讨如何使用 jQuery 获取和设置 DOM 元素的内边距和外边距值,特别是元素外边距和内边距的具体位置。虽然可以使用 CSS 设置元素的内边距和外边距,但获取准确的值可能会比较棘手。 // 设置 $("div.header").css("margin","10px"); $("div.header").css("padding","10px"); 你可能会认为这段代码很

本文探讨了十个特殊的jQuery选项卡和手风琴。 选项卡和手风琴之间的关键区别在于其内容面板的显示和隐藏方式。让我们深入研究这十个示例。 相关文章:10个jQuery选项卡插件

发现十个杰出的jQuery插件,以提升您的网站的活力和视觉吸引力!这个精选的收藏品提供了不同的功能,从图像动画到交互式画廊。让我们探索这些强大的工具: 相关文章: 1

HTTP-Console是一个节点模块,可为您提供用于执行HTTP命令的命令行接口。不管您是否针对Web服务器,Web Serv

本教程向您展示了如何将自定义的Google搜索API集成到您的博客或网站中,提供了比标准WordPress主题搜索功能更精致的搜索体验。 令人惊讶的是简单!您将能够将搜索限制为Y

当div内容超出容器元素区域时,以下jQuery代码片段可用于添加滚动条。 (无演示,请直接复制到Firebug中) //D = document //W = window //$ = jQuery var contentArea = $(this), wintop = contentArea.scrollTop(), docheight = $(D).height(), winheight = $(W).height(), divheight = $('#c


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

Atom编辑器mac版下载
最流行的的开源编辑器

Dreamweaver Mac版
视觉化网页开发工具

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。