🚀 LFG! 💬 Chat Assisted Programming Tools to JustBuild it 💻
Project description
LFG! Tools for better Chat Assisted Programming
We all use ChatGPT, Claude, Copilot, or others to us all more productive programmers. However, the workflow has a lot of jank™ doesn't it? This little program tries to smooth the experience for all of us.
Problem 1: Code Sections Missing in the chat
I hate it when we are writing code with ChatGPT or the Claude Artifacts and suddenly we get the annoying
// ... (rest of the previous code remains the same)
Suddenly we have either beg or threaten the LLM to give us the full code or else I'll lose my job!
. This takes extra time and money and is not ideal; I like to code in a relaxed way and this sortof kills my vibe.
Alternatively, we are manually copy-pasting blocks of code inside our several hundred line programs. This breaks me out of the higher-level conversational state I was in when talking with the LLM, and now I am stuck in syntax hell as I jump around the file trying to make sure I didn't drop an import or miss a couple lines of code. It honestly kills the magic of these LLMs and makes me feel like a junior dev again.
On the plus side, these comments make the LLM's responses faster and keeps the context windows smaller, thus keeping the accuracy high and costs lower.
So let's embrace the comments and solve this with a little tooling. The solution:
# First, copy the new code to the clipboard (with the // Code remains the same blocks)
lfg paste ./dope_new_program.py
This will paste the new code into your file, and will try to keep as much of the old code as it can.
Also if you copied the new code already into your file in your IDE, you can just run:
# Run for the whole repo and compare against the last commit
lfg merge
# Or run for a specific file
lfg merge old_file.py new_code_from_llm_with_missing_sections.py
This looks at git diff
and reverts all code blocks where good code was replaced with these // Code Was Here
blocks.
Usage within AI Agents
If you are building AI Agents, CoPilots or other automated code generation tools, you can use this tool to help you manage the code that is generated by the LLMs. This way you can keep the code clean and the diffs small and manageable.
# TODO python example of using lfg
import lfg
from lfg import merge_code
Other Problems?
I'd love to know about them! Raise an issue or DM me @seankruzel Let's go make the Chat Assisted Programming experience better!
So why is this needed?
Using Language Models to write code is pretty effective, but ultimately it's not quite the right tool for the job. Since these models don't think about code the same way we do, or even the same way computers view code,
Take this python code example:
TODO write a small two-function multi-step example with a loop
If you're like me, you might read this code and view it in a functional way:
TODO insert flow chart
If you are the python compiler you might view it as an Abstract Syntax Tree
TODO insert tree viz
However if you are a language model, you view it as a linear set of tokens where every couple of characters is replaced by a different integer and stored as an array of numbers
TODO insert a token visualization of the code
So as a result we can have a lot of information lost in translation if we intuitively understand the task as a Graph and have to communicate it in words that are translated into an Array which are then copy-pasted into python code to be compiled into a Tree. It's all quite messy.
In reality when we write code, we incrementally build out functionality so that the code slowly matches our mental model and implements the functions we desire. The compiler views our progress as us jumping around the AST and modifying edges, adding / removing nodes etc.
However there is another program on your computer that sees the world in a similar way to the LLM: git
Version Control to the Rescue
git
and other version control systems just see line changes, they do not see syntax trees and so we can observe local changes to the file. git diff
just shows us what changed locally and we can reason whether we wanted to delete the code, or whether the code was omitted for brevity by the LLM.
For now lfg paste
and lfg merge
are wrappers around this git diff
view into the code to help us better manage the coding experience.
Other Projects
LFG is a sister project of autocomplete.sh. Definitely check it out if you are new to linux and are learning the magic of the Terminal or if you are a DevOps professional and want to use --help
less and get more
done.
License
MIT License - ClosedLoop Technologies, Copyright 2024 - All rights reserved
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file justbuild-0.3.2.tar.gz
.
File metadata
- Download URL: justbuild-0.3.2.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76646cad88c8512203b9c3095775648685138fe23cc90e78bcd17b1fb60af1a2 |
|
MD5 | a023313a6db54a5ef35ce62259f0da2a |
|
BLAKE2b-256 | 51c28777dde7cb3e640eb59992d57fa55493e720cc65673884c59a05e384ff88 |
File details
Details for the file justbuild-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: justbuild-0.3.2-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bc64cb33d337ceda0d598779a244231af74e1ff37488672e1d0d63fa5c18ab5 |
|
MD5 | e51f7a15e325e233fd92f655cf73be07 |
|
BLAKE2b-256 | 4d97acc477afa2171d1708cddf5ae085a60b3471a107e4e0a3ec46f0f8b1ddba |