aela-ai 1.0.1 → 1.0.2
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/dist/main.js +37 -4
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -172,11 +172,44 @@ async function main() {
|
|
|
172
172
|
apiKey: apiKey,
|
|
173
173
|
baseURL: baseURL,
|
|
174
174
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
// --- Auto-detect environment & project context ---
|
|
176
|
+
const cwd = process.cwd();
|
|
177
|
+
const shell = process.env.SHELL || "unknown";
|
|
178
|
+
const username = os.userInfo().username;
|
|
179
|
+
const homeDir = os.homedir();
|
|
180
|
+
const nodeVersion = process.version;
|
|
181
|
+
const hasGit = fs.existsSync(path.join(cwd, ".git"));
|
|
182
|
+
const hasPackageJson = fs.existsSync(path.join(cwd, "package.json"));
|
|
183
|
+
const packageManager = fs.existsSync(path.join(cwd, "bun.lockb")) ? "bun"
|
|
184
|
+
: fs.existsSync(path.join(cwd, "yarn.lock")) ? "yarn"
|
|
185
|
+
: fs.existsSync(path.join(cwd, "pnpm-lock.yaml")) ? "pnpm"
|
|
186
|
+
: fs.existsSync(path.join(cwd, "package-lock.json")) ? "npm"
|
|
187
|
+
: null;
|
|
188
|
+
let gitBranch = "";
|
|
189
|
+
if (hasGit) {
|
|
190
|
+
try {
|
|
191
|
+
const { stdout } = await exec("git rev-parse --abbrev-ref HEAD");
|
|
192
|
+
gitBranch = stdout.trim();
|
|
193
|
+
}
|
|
194
|
+
catch { }
|
|
195
|
+
}
|
|
196
|
+
const systemPrompt = `You are Aela, an agentic terminal AI assistant.
|
|
197
|
+
|
|
198
|
+
Current working directory: ${cwd}
|
|
199
|
+
User: ${username}
|
|
200
|
+
Home directory: ${homeDir}
|
|
201
|
+
Shell: ${shell}
|
|
202
|
+
Operating system: ${os.type()} ${os.release()} (${os.arch()})
|
|
203
|
+
Node version: ${nodeVersion}
|
|
204
|
+
Current date: ${new Date().toLocaleString()}
|
|
205
|
+
${hasGit ? `Git branch: ${gitBranch}` : "Not a git repository"}
|
|
206
|
+
${hasPackageJson && packageManager ? `Package manager: ${packageManager}` : ""}
|
|
207
|
+
|
|
208
|
+
When the user asks about "this codebase", "this project", or "here", they mean the current working directory above. Use the Read and Bash tools to explore it.
|
|
178
209
|
Use your tools to help the user. If they ask about current time or dates, you can use the time provided above.
|
|
179
|
-
IMPORTANT: If you need to ask the user a clarifying question or request permission, you MUST use the "AskUser" tool. Do not just output the question as text, because the program will exit immediately and you will not get an answer
|
|
210
|
+
IMPORTANT: If you need to ask the user a clarifying question or request permission, you MUST use the "AskUser" tool. Do not just output the question as text, because the program will exit immediately and you will not get an answer.
|
|
211
|
+
SAFETY: Before any destructive operation (deleting files, force-pushing, overwriting existing files), you MUST use AskUser to confirm with the user first.
|
|
212
|
+
When reading large files or command outputs, summarize or truncate to keep responses concise.`;
|
|
180
213
|
const messages = [
|
|
181
214
|
{ role: "system", content: systemPrompt },
|
|
182
215
|
{ role: "user", content: prompt }
|