@drewsepsi/nextpi 0.1.0 β 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -15
- package/bin/cli.js +4 -1
- package/components/ui/file-tree.tsx +0 -1
- package/lib/config.js +45 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# π NextPi: The Agentic IDE
|
|
2
|
+
[](https://www.npmjs.com/package/@drewsepsi/nextpi)
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
2
4
|
|
|
3
|
-
**NextPi** is your project's personal secret agent. It's a
|
|
5
|
+
**NextPi** is your project's personal secret agent. It's a lightweight, powerful AI-IDE that lives in your project folder and helps you research, code, and debug using top-tier LLMsβall through a beautiful, VS-Code-like interface in your browser.
|
|
4
6
|
|
|
5
7
|
Turn any folder into an intelligent workspace with just one command.
|
|
6
8
|
|
|
@@ -16,35 +18,47 @@ npx @drewsepsi/nextpi
|
|
|
16
18
|
|
|
17
19
|
*Requires [Node.js](https://nodejs.org/) installed.*
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## π€ Why NextPi?
|
|
24
|
+
|
|
25
|
+
ChatGPT and Claude are great, but they don't have **context**. They can't see your files, they can't run your code, and they can't confirm if their suggestions actually work.
|
|
26
|
+
|
|
27
|
+
**NextPi is different.** It is an *agent*, not just a chatbot.
|
|
28
|
+
1. **It sees what you see**: It automatically indexes your local files.
|
|
29
|
+
2. **It takes action**: It can create files, fix bugs, and run terminal commands.
|
|
30
|
+
3. **It researches**: If it doesn't know something, it searches the web and reads documentation for you.
|
|
24
31
|
|
|
25
32
|
---
|
|
26
33
|
|
|
27
34
|
## β¨ Features
|
|
28
35
|
|
|
29
|
-
- **π Folder-Aware**:
|
|
30
|
-
- **π Web Research**:
|
|
31
|
-
-
|
|
32
|
-
- **π§ Multi-Model Support**:
|
|
33
|
-
- **π
|
|
36
|
+
- **π Folder-Aware**: Instant context for your current workspace.
|
|
37
|
+
- **π Web Research**: Real-time internet access to find the latest API docs and solutions.
|
|
38
|
+
- **π Code Editing**: High-fidelity file modifications and bug fixes.
|
|
39
|
+
- **π§ Multi-Model Support**: Powered by OpenRouterβuse Claude 3.5 Sonnet, GPT-4o, Gemini 1.5 Pro, and more.
|
|
40
|
+
- **π Live Preview**: Launch your app (e.g., `npm run dev`) and view it side-by-side with the agent.
|
|
41
|
+
- **π Sleek UI**: A premium dark-mode interface with glassmorphism and smooth animations.
|
|
34
42
|
|
|
35
43
|
---
|
|
36
44
|
|
|
37
|
-
##
|
|
45
|
+
## π Setup & Config
|
|
46
|
+
|
|
47
|
+
NextPi works out of the box. You'll need an [OpenRouter](https://openrouter.ai/) API key to power the AI.
|
|
38
48
|
|
|
39
|
-
|
|
49
|
+
You can set it up in two ways:
|
|
50
|
+
1. **In the UI**: Click the **Settings** gear in the top right and paste your key.
|
|
51
|
+
2. **Via Terminal**:
|
|
52
|
+
```bash
|
|
53
|
+
export OPENROUTER_API_KEY=your_key_here
|
|
54
|
+
```
|
|
40
55
|
|
|
41
56
|
---
|
|
42
57
|
|
|
43
58
|
## π Privacy & Safety
|
|
44
59
|
|
|
45
|
-
NextPi runs
|
|
60
|
+
NextPi runs **locally** on your machine. While it communicates with AI providers via API, it only reads the files in the directory where you launch it. Your local environment remains under your total control.
|
|
46
61
|
|
|
47
62
|
---
|
|
48
63
|
|
|
49
64
|
Built with β€οΈ by [drewsepsi](https://github.com/drewsepsi)
|
|
50
|
-
# nextpi
|
package/bin/cli.js
CHANGED
|
@@ -30,7 +30,10 @@ if (!process.env.OPENROUTER_API_KEY) {
|
|
|
30
30
|
// 4. Determine if we should run in dev mode or production mode
|
|
31
31
|
// If we are running from a local development folder, we likely want dev.
|
|
32
32
|
// If we are installed as a package, we likely want 'next start'.
|
|
33
|
-
const
|
|
33
|
+
const hasNextConfig = fs.existsSync(path.join(packageRoot, 'next.config.js')) ||
|
|
34
|
+
fs.existsSync(path.join(packageRoot, 'next.config.mjs')) ||
|
|
35
|
+
fs.existsSync(path.join(packageRoot, 'next.config.ts'));
|
|
36
|
+
const isDev = hasNextConfig && !fs.existsSync(path.join(packageRoot, '.next'));
|
|
34
37
|
|
|
35
38
|
console.log(`\x1b[35m%s\x1b[0m`, `
|
|
36
39
|
_ __ __ ____ _
|
package/lib/config.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
|
|
5
|
+
const CONFIG_DIR = path.join(os.homedir(), '.nextpi');
|
|
6
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
7
|
+
|
|
8
|
+
export function getConfig() {
|
|
9
|
+
try {
|
|
10
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
const data = fs.readFileSync(CONFIG_FILE, 'utf-8');
|
|
14
|
+
return JSON.parse(data);
|
|
15
|
+
} catch (err) {
|
|
16
|
+
console.error('Error reading config:', err);
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function saveConfig(newConfig) {
|
|
22
|
+
try {
|
|
23
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
24
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
25
|
+
}
|
|
26
|
+
const current = getConfig();
|
|
27
|
+
const updated = { ...current, ...newConfig };
|
|
28
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(updated, null, 2));
|
|
29
|
+
|
|
30
|
+
// Also update current process env for immediate use
|
|
31
|
+
if (updated.openRouterApiKey) {
|
|
32
|
+
process.env.OPENROUTER_API_KEY = updated.openRouterApiKey;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return updated;
|
|
36
|
+
} catch (err) {
|
|
37
|
+
console.error('Error saving config:', err);
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function getEffectiveApiKey() {
|
|
43
|
+
// Priority: 1. Environment Variable, 2. Config File
|
|
44
|
+
return process.env.OPENROUTER_API_KEY || getConfig().openRouterApiKey;
|
|
45
|
+
}
|