Skip to main content

Show HN: Code-Narrator: Automating Documentation with GPT-4 https://ift.tt/yikXSaK

Show HN: Code-Narrator: Automating Documentation with GPT-4 As a solo developer on a sizeable project, I found myself facing the challenge of creating documentation, a task I admittedly do not enjoy. Fortunately, ChatGPT arrived just in time. After experimenting with it, I discovered that it generates high-quality documentation for code files, even better than what I could produce manually. This realization led me to develop Code-Narrator, a client that simplifies the documentation process. Code-Narrator ( https://ift.tt/bcdnxpw ) utilizes GPT-4 to analyze your code files and automatically generate documentation. The tool is language-agnostic and has been tested with TypeScript, GraphQL, Solidity, C#, Kotlin, and more. As long as the files are in plain text, Code-Narrator should work seamlessly. The primary goal of Code-Narrator is to ease the documentation process for developers, transforming them from writers to editors. While developers are still responsible for verifying the accuracy of the generated documentation, the initial writing is handled by the AI. If GPT-4 produces incorrect documentation, it typically indicates that the code needs clarification, or a brief comment should be added to guide the AI. A general rule of thumb is that if GPT-4 cannot comprehend the code, it may be too complex for the next developer. However, Code-Narrator is constrained by GPT-4's 8192-token limit, which can be problematic for extensive code files. Those with access to the gpt-4-32k variant should expect better results. Upon its first run, Code-Narrator creates a configuration file by analyzing your project, and then prompts you to review it for accuracy. The key configuration aspects include the "include," "config_files," and "source_path" settings. In its second run, Code-Narrator generates documentation for your entire project. The process is time-consuming, taking approximately 45 minutes to complete from scratch. However, the tool is: - Flexible, allowing for the creation of custom pages such as How-To guides, tutorials, FAQs, READMEs, and other bespoke content. - Multilingual, supporting 25+ languages (as many as GPT-4 supports). - Versatile, capable of generating documentation in various formats (LaTeX, HTML, with the default being Markdown). For a demonstration on transforming a few lines into a How-To guide, watch this video: https://www.youtube.com/watch?v=uJtVCUOTkvw . Remember that brevity is key, as the more concise the input, the more GPT-4 can contribute. Code-Narrator also supports custom plugins, with tutorials available at https://ift.tt/VfitdyB... . In terms of size and cost, Code-Narrator consists of 45 files and 1712 lines of code. The total cost of generating documentation for the entire project is approximately $2.5, a significant savings compared to manual documentation. During the development of Code-Narrator, I noticed several benefits: - Improved function naming: Reading the generated documentation led me to revise vague or overly general function names, resulting in better code and documentation. - Concise input: Focusing on reducing the size of the input file (liquid) became a fun challenge, helping to optimize the process. - Enjoyable interaction: Working with ChatGPT proved more enjoyable than manually writing documentation, and the more I experimented, the better the results. - Minimal input for tutorials: I was pleasantly surprised by how little input was required to create How-To guides and tutorials using GPT-4. - Encouragement to refactor: The 8K token limitation may be restrictive, but it also encourages developers to refactor their code for improved readability and structure. As a prototype and proof of concept, Code-Narrator has some limitations. I'm excited to see where Code-Narrator goes from here, and your feedback is invaluable. Thank you for taking the time to explore this project! https://ift.tt/bcdnxpw April 28, 2023 at 04:19PM

Comments

Popular posts from this blog

Women Pioneers at Muni: Adeline Svendsen and Muni’s First Newsletter

Women Pioneers at Muni: Adeline Svendsen and Muni’s First Newsletter By Jeremy Menzies To close out Women’s History Month, here’s a look back at one woman whose work to bring Muni staff together in the late 1940s created a legacy that lives on to this day. Adeline “Addy” Svendsen was founding editor of Muni’s first internal newsletter, “ Trolley Topics .” Adeline Svendsen sits at her desk in the Geneva Carhouse office building in this 1949 shot. Trolley Topics was a new venture when it started in February 1946. As Svendsen wrote in the first issue it was created, “to bring a little fun, a little news, and a lot of good will to all our fellow employees in the Railway.” Just two years prior in 1944, Muni merged with the Market Street Railway Company, expanding the small municipal operation into the largest transit provider in the city with hundreds of employees, vehicles of every shape and size, and dozens of facilities scattered across town. The newsletter was meant to help unite ...

Show HN: StreetComplete, an OpenStreetMap Editor for Humans https://ift.tt/2J8IL02

Show HN: StreetComplete, an OpenStreetMap Editor for Humans StreetComplete is an OpenStreetMap[0] editor directed at people who want to contribute and want to do this using their smartphone, without learning how to edit things[1]. It is available as an Android application. It is intended to be used as one walks, with quests appearing as markers on the map. Selecting a marker allows one to answer a simple question. The answer will be added to the OpenStreetMap database, with app handling selecting objects for editing, transforming answer into OSM tags and making edits. OpenStreetMap account is needed to apply edits, but it is possible to start without it, make some edits and login/register later. Note: I am not the main author, but I am one of the active contributors. Github page is at https://ift.tt/2g8lasH and https://ift.tt/3nR9PzS shows what was recently released. [0]OpenStreetMap is a Wikipedia of maps, available on the open licence. This dataset is already used for many interestin...

Show HN: Launch VM workloads securely and instantaneously, without VMs https://ift.tt/2QwJ1Kd

Show HN: Launch VM workloads securely and instantaneously, without VMs Hello HN! We've been working on a new hypervisor https://kwarantine.xyz that can run strongly isolated containers. This is still a WIP, but we wanted to give the community an idea about our approach, its benefits, and various use cases it unlocks. Today, VMs are used to host containers, and make up for the lack of strong security as well as kernel isolation in containers. This work adds this missing security piece in containers. We plan on launching a free private beta soon. Meanwhile, we'd deeply appreciate any feedback, and happy to answer any questions here or on our slack channel. Thanks! April 29, 2021 at 07:50AM