跳到正文
DEV Community· EffessDev·· 3 小時前AI 評分46

ReptClip 如何將任何瀏覽器聊天機械人變成 VS Code 編碼智能體(毋須 API 金鑰)

Turn any browser chatbot into a VS Code coding agent (no API keys!)

AI 導讀

ReptClip 是免費開源的 VS Code 擴充功能,可將專案內容整理成 Markdown,貼到免費聊天機械人,並把生成的差異檔一次過套用到專案。用戶可一鍵套用修改,亦可還原或重做;ReptClip 只會處理 Git 追蹤的檔案,並禁止讀取或修改被 .gitignore 排除的內容。

正文

Ok here is how it works:

Paste your project as clean Markdown context into any free Chatbot, and apply the generated diffs in one click.

Already know about ReptClip? Skip to v2.1 updates!

Watch the video demo below to see it in action 🔥

How ReptClip works (briefly)

ReptClip is a free, open-source VS Code extension. Installing it adds a ReptClip tab to the bottom panel in VS Code. This is where everything happens:

You can move it anywhere you want (like the sidebar), and the ReptClip UI will adapt!

Step 1: Copy context to clipboard

By default, the context consists of the Project structure, AI instructions, attached files, and an empty Prompt section to put your prompt. All in Markdown.

Use "Files to attach" text box to attach files to the context. You can use relative paths or glob patterns (e.g., **/*.py to add all Python files). You will get live suggestion dropdowns and syntax highlighting as you type. Press "Enter" or click the "Context" button to copy the context straight to your clipboard.

If no files are selected, ReptClip shows "No files attached." and keeps the remaining enabled context sections.

Step 2: Paste context to your chatbot, along with your prompt

The chatbot will generate the diffs in a single code block, according to the instructions provided in the context.

Step 3: Apply the generated diffs

The chatbot outputs all diffs in a single code block covering line removals, additions, edits, updates, file moves or renames, file creation, and file deletion. Copy the block and click Apply Diffs to apply the changes.

Didn't like it? Click the Undo button. Changed your mind? Click the Redo button!

Optional step (before step 3): Add more context

If the chatbot wants to see more files or search the project, it will generate a code block containing the following custom commands:

  • cat <path> To read a file.
  • read-lines <path> <start_line> [end_line] To read sections of a file.
  • grep <flags> <pattern> [paths...]: To search across the project with grepts.

You can copy that block and click the "More Context" button to copy the output to the clipboard, and paste it back to the chatbot.

Other key features

  • UI state remembered per project: You don't have to re-enter them every time, and they won't be mixed up with other projects.
  • Hide labels: To save screen space once you memorize the layout.
  • Context customization: Each section in the context can be easily toggled on/off using checkboxes.
  • Zero dependencies: ReptClip doesn't need Git initialized (a .git folder), or Git installed in your system.
  • Estimated token count: Displayed in the status.
  • And much more!

Why you can trust it

ReptClip only touches files that are tracked by git. Anything your .gitignore files (at any depth) exclude is completely off-limits, for reading, searching, writing, creating, deleting, whatever. .git folders are always off-limits too. If something ever goes wrong anyway, you can simply discard the changes with git, since they are tracked.

If the AI attempts to touch a .gitignore file, ReptClip for confirmation first, since that can un-ignore something that was previously protected.

And that's just the beginning! Check out the README to learn more about ReptClip & its full feature set and security measures. Or continue reading for the updates!

Ok. Now, the updates 🥳

Here is what changed:

  • Now, you can hide the labels: The labels take up too much vertical space. Since I have memorized the layout, I wanted a way to hide them. This setting is remembered globally, not project-wise.
  • Now, it shows an estimated token count: It uses the cheap number of characters / 4 rule.
  • Optimize UI for the sidebar: Before this update, certain parts of the UI would overflow. I optimized it so it adapts to wherever you put it:

You can even put it under the explorer so your files, terminal, and ReptClip are all visible at the same time!

Also, the ReptClip panel finally has an icon!!!

Ah, and I started CHANGELOG.md. Now it's MUCH easier to post the updates when I release a new version (I wish I had started earlier).

If you liked ReptClip, or think it'd be useful for you or others, I'd appreciate it if you could drop a ⭐ on GitHub 🥺🙏

來源:DEV Community · dev.to