⚠️ Malware / Trojaner / VirenAnthropic Says Russian Hackers Used Claude AI to Automate Malware Evasion(11.09.2026 um 10:47 Uhr)
🕵️ SicherheitslückenCheck Point Patches Critical VPN Vulnerabilities(11.09.2026 um 13:10 Uhr)
⚠️ Malware / Trojaner / VirenUkrainian Conti Ransomware Developer Sentenced to 4 Years in US Prison(11.09.2026 um 13:29 Uhr)
🕵️ SicherheitslückenGitLab Vulnerability Exploited One Day After Disclosure(11.09.2026 um 18:11 Uhr)
🔧 AI Nachrichten OpenAI Targets Work of Wall Street Junior Bankers(10.09.2026 um 21:02 Uhr)
🔧 AI Nachrichten Altman Considers Slowing Down AI Development(11.09.2026 um 20:00 Uhr)
⚠️ Malware / Trojaner / VirenMessengerdienste: Ermittler lesen Telegram und Whatsapp ohne Trojaner mit(03.09.2026 um 09:57 Uhr)
⚠️ Malware / Trojaner / VirenAnthropic Says Russian Hackers Used Claude AI to Automate Malware Evasion(11.09.2026 um 10:47 Uhr)
🕵️ SicherheitslückenCheck Point Patches Critical VPN Vulnerabilities(11.09.2026 um 13:10 Uhr)
⚠️ Malware / Trojaner / VirenUkrainian Conti Ransomware Developer Sentenced to 4 Years in US Prison(11.09.2026 um 13:29 Uhr)
🕵️ SicherheitslückenGitLab Vulnerability Exploited One Day After Disclosure(11.09.2026 um 18:11 Uhr)
🔧 AI Nachrichten OpenAI Targets Work of Wall Street Junior Bankers(10.09.2026 um 21:02 Uhr)
🔧 AI Nachrichten Altman Considers Slowing Down AI Development(11.09.2026 um 20:00 Uhr)
⚠️ Malware / Trojaner / VirenMessengerdienste: Ermittler lesen Telegram und Whatsapp ohne Trojaner mit(03.09.2026 um 09:57 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 10 Min Lesezeit
0

RAG - Designing the CLI interface

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

This is the second article of a series in which I am building an open source RAG CLI tool. In the for this project.




But you said you need to compile your code into a single binary, can Typescritpt do that?




Yes, Bun can produce a binary of your code: https://bun.sh/docs/bundler/executables




I thought Python was the preferred language for AI stuff, and it seems to fit your constraints.




Yes, Python would be a good option. I just chose Typescript because I am more familiar with it.






Creating the project



Let's start by creating an empty bun project:




CODE
bun init






After writing the project name rag and the entry file src/main.ts, I have the following directory structure:




CODE
node_modules/
src/
main.ts
.gitignore
bun.lockb
package.json
tsconfig.json






I like to use Prettier to format my code, so




CODE
bun add -D prettier






and create a .prettierrc file:




CODE
{
"printWidth": 155,
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true
}









Implementing the CLI interface



I chose to use the commander package to implement the CLI interface. After installing it, I wrote the following code in src/main.ts:




CODE
import { program } from 'commander'

program.name('rag').version('0.0.1').description('Simple RAG system for developers')

const docs = program.command('docs').description('Manage documentations')

docs
.command('add')
.description('Add new documentation')
.argument('<name>', 'Name of the documentation')
.argument('<repo_url>', 'URL of the Git repository')
.option('--subdir <subdir>', 'Subdirectory within the repository', '.')
.option('--branch <branch>', 'Branch to use', 'main')
.action((name, repo_url, options) => {
console.log(`Adding documentation ${name} from ${repo_url} with options ${JSON.stringify(options)}`)
})

docs
.command('update')
.description('Update existing documentation')
.argument('<name>', 'Name of the documentation')
.option('--repo_url <repo_url>', 'New repository URL')
.option('--subdir <subdir>', 'New subdirectory within the repository')
.option('--branch <branch>', 'New branch to use')
.action((name, options) => {
console.log(`Updating documentation ${name} with options ${JSON.stringify(options)}`)
})

docs
.command('remove')
.description('Remove existing documentation')
.argument('<name>', 'Name of the documentation')
.action((name) => {
console.log(`Removing documentation ${name}`)
})

program
.command('get')
.description('Get relevant parts from documentations')
.argument('<prompt>', 'Search prompt')
.option('--count <count>', 'Number of relevant parts to retrieve', '5')
.option('--json', 'Output results in JSON format')
.action((prompt, options) => {
console.log(`Getting relevant parts from documentations for prompt ${prompt} with options ${JSON.stringify(options)}`)
})

program.parseAsync().catch((err) => {
console.error(err)
process.exit(1)
})






Now running bun src/main.ts shows the following output:




CODE
Usage: rag [options] [command]

Simple RAG system for developers

Options:
-V, --version output the version number
-h, --help display help for command

Commands:
docs Manage documentations
get [options] <prompt> Get relevant parts from documentations
help [command] display help for command






And doing bun src/main.ts docs add tailwindcss https://github.com/tailwindlabs/tailwindcss shows the following output:




CODE
Adding documentation tailwindcss from https://github.com/tailwindlabs/tailwindcss with options {"branch":"main", "subdir":"."}






So I guess the CLI interface is working as expected.




No, you said that the prompt argument should be read from stdin if it doesn't exist. But it seems to be required right now.




You are right, if I do




CODE
bun src/main.ts get






I get the following error:




CODE
Missing required argument 'prompt'






To make the argument optional, we should use [prompt] instead of <prompt> in the argument definition. And now we can check when the argument is missing, and read it from stdin.




CODE
program
.command('get')
.argument('[prompt]', 'Search prompt')
// ...
.action(async (prompt, options) => {
prompt = prompt || await Bun.stdin.text()
console.log(`Getting relevant parts from documentations for prompt "${prompt}" with options ${JSON.stringify(options)}`)
})






Which gives the following:




CODE
❯ bun src/main.ts get "arg prompt"
Getting relevant parts from documentations for prompt "arg prompt" with options {"count":"5"}

❯ echo "stdin prompt" | bun src/main.ts get
Getting relevant parts from documentations for prompt "stdin prompt
" with options {"count":"5"}









Summary



In this article,




  • we designed the CLI interface and chose to have the commands add, update, remove and get.

  • we chose to implement the tool using Typescript and Bun.

  • we implemented the CLI interface using the commander package.






What's next



The next steps are:




  • Add the database

  • Implement the commands logic

  • Add tests

  • Create CI/CD pipeline



Feel free to comment if you have any suggestions or feedback. See you in the next article!

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Text Watermarking in Python: Catch Whoever Copies Your Writing
1 Quelle
Why Most Multi-Agent Systems Fail Even When Evaluation Passes
1 Quelle
A Beginner’s Guide to World Models
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten RAG - Designing the CLI interface

Thematisch verwandte Begriffe: Designing, interface · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...