overai 1.4.11 → 1.4.13
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 +24 -0
- package/dist/cli/create.js +32 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,6 +46,30 @@ While tools like **n8n** and **Zapier** are excellent for linear automation (e.g
|
|
|
46
46
|
npm install overai
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
## ✨ Auto-Coder CLI (Magic Project Generator)
|
|
50
|
+
|
|
51
|
+
Want to build a project instantly? OverAI includes a powerful CLI that can scaffold entire projects (React, Node, Python, etc.) from a single prompt.
|
|
52
|
+
|
|
53
|
+
**Usage:**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 1. Set your API Key (OpenAI, Gemini, or Anthropic)
|
|
57
|
+
export OPENAI_API_KEY=sk-...
|
|
58
|
+
# OR
|
|
59
|
+
export GOOGLE_API_KEY=AIza...
|
|
60
|
+
|
|
61
|
+
# 2. Run the magic command
|
|
62
|
+
npx overai-create "A personal portfolio website with HTML/CSS"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Options:**
|
|
66
|
+
|
|
67
|
+
* **Auto-Detection**: The CLI automatically picks the best model based on your environment variables.
|
|
68
|
+
* **Force Model**: You can specify a model manually:
|
|
69
|
+
```bash
|
|
70
|
+
npx overai-create "A snake game in Python" --model google/gemini-2.0-flash-exp
|
|
71
|
+
```
|
|
72
|
+
|
|
49
73
|
---
|
|
50
74
|
|
|
51
75
|
## ⚡ Quick Start: Gemini Example
|
package/dist/cli/create.js
CHANGED
|
@@ -117,13 +117,36 @@ const rl = readline.createInterface({
|
|
|
117
117
|
output: process.stdout
|
|
118
118
|
});
|
|
119
119
|
async function main() {
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
// Model Selection Logic
|
|
121
|
+
let model = "gpt-4o";
|
|
122
|
+
const args = process.argv.slice(2);
|
|
123
|
+
const modelArgIndex = args.indexOf('--model');
|
|
124
|
+
// Handle --model flag
|
|
125
|
+
if (modelArgIndex !== -1 && args[modelArgIndex + 1]) {
|
|
126
|
+
model = args[modelArgIndex + 1];
|
|
127
|
+
args.splice(modelArgIndex, 2); // Remove flag from args so it doesn't become part of the prompt
|
|
126
128
|
}
|
|
129
|
+
else {
|
|
130
|
+
// Auto-detect best available model based on env vars
|
|
131
|
+
if (process.env.OPENAI_API_KEY) {
|
|
132
|
+
model = "gpt-4o";
|
|
133
|
+
}
|
|
134
|
+
else if (process.env.GOOGLE_API_KEY) {
|
|
135
|
+
model = "google/gemini-2.0-flash-exp";
|
|
136
|
+
}
|
|
137
|
+
else if (process.env.ANTHROPIC_API_KEY) {
|
|
138
|
+
model = "anthropic/claude-3-5-sonnet-20240620";
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
console.error("❌ Error: No API Key found.");
|
|
142
|
+
console.error("Please set ONE of the following environment variables:");
|
|
143
|
+
console.error(" export OPENAI_API_KEY=sk-...");
|
|
144
|
+
console.error(" export GOOGLE_API_KEY=AIza...");
|
|
145
|
+
console.error(" export ANTHROPIC_API_KEY=sk-ant-...");
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
console.log(`🧠 Using AI Model: \x1b[36m${model}\x1b[0m`);
|
|
127
150
|
// 2. Create the "AutoCoder" Agent
|
|
128
151
|
const coder = new index_1.Agent({
|
|
129
152
|
name: "AutoCoder",
|
|
@@ -148,7 +171,7 @@ async function main() {
|
|
|
148
171
|
- Be comprehensive: Include README.md, .gitignore, and config files.
|
|
149
172
|
- If something fails, try to fix it or report the specific error.
|
|
150
173
|
- Do not ask for permission for each step, proceed autonomously until completion.`,
|
|
151
|
-
llm:
|
|
174
|
+
llm: model,
|
|
152
175
|
tools: fileTools
|
|
153
176
|
});
|
|
154
177
|
// 3. Get User Input
|
|
@@ -158,8 +181,8 @@ async function main() {
|
|
|
158
181
|
console.log("\n🚀 **OverAI Auto-Coder** initialized.");
|
|
159
182
|
console.log("I can build any project for you (Node.js, Python, simple websites, scripts...).");
|
|
160
183
|
// If argument provided via CLI, use it. Otherwise ask.
|
|
161
|
-
let userRequest =
|
|
162
|
-
if (!userRequest) {
|
|
184
|
+
let userRequest = args.join(" ");
|
|
185
|
+
if (!userRequest.trim()) {
|
|
163
186
|
userRequest = await question("\n🛠️ What project should I build for you? (e.g., 'A weather CLI in Python', 'A React Todo app'): ");
|
|
164
187
|
}
|
|
165
188
|
else {
|