@bamptee/aia-code 2.0.8 → 2.0.9
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/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import { writeFileSync, unlinkSync } from 'node:fs';
|
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import { randomBytes } from 'node:crypto';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
+
import chalk from 'chalk';
|
|
5
6
|
import { runCli } from './cli-runner.js';
|
|
6
7
|
|
|
7
8
|
export async function generate(prompt, model, { verbose = false, apply = false, onData } = {}) {
|
|
@@ -21,8 +22,11 @@ export async function generate(prompt, model, { verbose = false, apply = false,
|
|
|
21
22
|
if (apply) {
|
|
22
23
|
const tmpFile = path.join(tmpdir(), `aia-prompt-${randomBytes(6).toString('hex')}.md`);
|
|
23
24
|
writeFileSync(tmpFile, prompt, 'utf-8');
|
|
25
|
+
console.error(chalk.gray(`[AI] Prompt written to temp file (${(prompt.length / 1024).toFixed(1)}KB): ${tmpFile}`));
|
|
24
26
|
const shortPrompt = `Read the file at ${tmpFile} — it contains your full instructions and context. Follow them exactly.`;
|
|
25
27
|
args.push('-');
|
|
28
|
+
console.error(chalk.gray(`[AI] Spawning: claude ${args.join(' ')}`));
|
|
29
|
+
console.error(chalk.gray(`[AI] Waiting for Claude agent response...`));
|
|
26
30
|
try {
|
|
27
31
|
return await runCli('claude', args, { stdin: shortPrompt, verbose: verbose || apply, apply, onData });
|
|
28
32
|
} finally {
|
|
@@ -31,5 +35,6 @@ export async function generate(prompt, model, { verbose = false, apply = false,
|
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
args.push('-');
|
|
38
|
+
console.error(chalk.gray(`[AI] Spawning: claude ${args.join(' ')} (${(prompt.length / 1024).toFixed(1)}KB prompt)`));
|
|
34
39
|
return runCli('claude', args, { stdin: prompt, verbose: verbose || apply, apply, onData });
|
|
35
40
|
}
|
|
@@ -18,6 +18,7 @@ export function runCli(command, args, { stdin: stdinData, verbose = false, apply
|
|
|
18
18
|
const chunks = [];
|
|
19
19
|
let stderr = '';
|
|
20
20
|
let settled = false;
|
|
21
|
+
let gotFirstOutput = false;
|
|
21
22
|
|
|
22
23
|
function resetTimer() {
|
|
23
24
|
clearTimeout(timer);
|
|
@@ -39,6 +40,10 @@ export function runCli(command, args, { stdin: stdinData, verbose = false, apply
|
|
|
39
40
|
resetTimer();
|
|
40
41
|
|
|
41
42
|
child.stdout.on('data', (data) => {
|
|
43
|
+
if (!gotFirstOutput) {
|
|
44
|
+
gotFirstOutput = true;
|
|
45
|
+
console.error(chalk.gray('[AI] First stdout received — agent is running'));
|
|
46
|
+
}
|
|
42
47
|
const text = data.toString();
|
|
43
48
|
process.stdout.write(text);
|
|
44
49
|
chunks.push(text);
|
|
@@ -47,6 +52,10 @@ export function runCli(command, args, { stdin: stdinData, verbose = false, apply
|
|
|
47
52
|
});
|
|
48
53
|
|
|
49
54
|
child.stderr.on('data', (data) => {
|
|
55
|
+
if (!gotFirstOutput) {
|
|
56
|
+
gotFirstOutput = true;
|
|
57
|
+
console.error(chalk.gray('[AI] First stderr received — agent is running'));
|
|
58
|
+
}
|
|
50
59
|
const text = data.toString();
|
|
51
60
|
stderr += text;
|
|
52
61
|
if (verbose) {
|