Skip to content

holasoymalva/perplexity-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Perplexity-Code 🧠💻

AI-Driven Code Assistant — Built for Cursor, VSCode & CLI
NPM Package: perplexity-code

npm version License: MIT Build Twitter

The power of Perplexity, reimagined for developers.
Ask questions. Generate code. Debug. Refactor. All from your favorite terminal or editor.

image


✨ What is perplexity-code?

Perplexity-Code is an open-source, NPM-installable CLI tool for AI-enhanced software development.
It integrates seamlessly with your terminal, Cursor, or VSCode workflow and helps you:

  • Search technical topics
  • Explain or debug code
  • Convert between programming languages
  • Refactor and optimize code snippets

Powered by Perplexity (or configurable LLM APIs), this tool turns your terminal into a coding knowledge copilot.


🔧 Installation

Global installation

npm install -g perplexity-code

You can now run the CLI using perplexity-code or pxc.

One-off use (no install required)

npx perplexity-code "What is the difference between var, let and const?"

🚀 Usage Examples

pxc "How do I write a GraphQL resolver in Node.js?"
pxc /explain "./src/hooks/useAuth.ts"
pxc /convert "Convert this Python dict to a TypeScript interface"
pxc /debug "Cannot read property 'length' of undefined"

You can also pipe code:

cat main.py | pxc /refactor

⚙️ Configuration

Create a .perplexityrc or perplexity.config.json in your project or home directory:

{
  "apiKey": "sk-XXXXXX",
  "model": "perplexity-codellama",
  "language": "typescript",
  "editor": "vscode"
}

Or pass options via CLI:

pxc "Explain async/await" --model perplexity-codellama --language javascript

🧩 Editor Integrations

✅ Cursor

  1. Open Cursor → Settings → Plugins
  2. Add path to perplexity-code binary
  3. Use inline queries like /explain or /debug in the editor

✅ VSCode (coming soon)

  • Native extension with slash commands and inline answers
  • Chat-style interface with syntax-aware suggestions

🔥 Features

  • 💬 Slash-based commands: /explain, /debug, /convert, /optimize, /summarize
  • 🧠 Context-aware answers with code formatting
  • 🧪 Multi-model support (Perplexity, Gemini, OpenAI)
  • 📂 File-based input and stdin piping
  • 🛠️ Works inside tmux, iterm, Warp, or Cursor

🛤 Roadmap

  • VSCode extension release
  • Git diff-aware prompts (/review)
  • Multi-language translation mode
  • Plugins: /test, /doc, /summarize
  • Local LLM fallback (offline mode)

🤝 Contributing

We’d love your input, ideas, and PRs. Start with:

git clone https://github.com/holasoymalva/perplexity-code.git
cd perplexity-code
npm install
npm link # for local CLI testing

Want to contribute a command? Check out /src/commands.


📦 Publishing Notes (for maintainers)

To publish a new version to NPM:

npm version patch
npm publish

Ensure you are logged in to NPM with correct credentials.


📄 License

MIT License © 2025 @holasoymalva


🌐 Links

Built for the curious. Made for developers. Ready for your terminal. ⚡️

About

The power of Perplexity, reimagined for developers. Ask questions, generate code, debug, and refactor—all from your favorite terminal or editor.

Topics

Resources

License

Stars

Watchers

Forks

Contributors