spets 0.1.21 → 0.1.23
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/assets/github/workflows/spets.yml +2 -1
- package/dist/index.js +25 -21
- package/package.json +1 -1
|
@@ -104,7 +104,8 @@ jobs:
|
|
|
104
104
|
github.event.action == 'created' && (
|
|
105
105
|
contains(github.event.comment.body, '/approve') ||
|
|
106
106
|
contains(github.event.comment.body, '/revise') ||
|
|
107
|
-
contains(github.event.comment.body, '/reject')
|
|
107
|
+
contains(github.event.comment.body, '/reject') ||
|
|
108
|
+
contains(github.event.comment.body, '/answer')
|
|
108
109
|
)
|
|
109
110
|
runs-on: ubuntu-latest
|
|
110
111
|
|
package/dist/index.js
CHANGED
|
@@ -1532,20 +1532,21 @@ var CLIAIAdapter = class {
|
|
|
1532
1532
|
async execute(params) {
|
|
1533
1533
|
console.log(`
|
|
1534
1534
|
\u{1F4DD} Generating...`);
|
|
1535
|
-
const response = await this.callClaude(params.prompt);
|
|
1536
1535
|
if (params.outputPath) {
|
|
1537
1536
|
const outputDir = dirname3(params.outputPath);
|
|
1538
1537
|
if (!existsSync7(outputDir)) {
|
|
1539
1538
|
mkdirSync4(outputDir, { recursive: true });
|
|
1540
1539
|
}
|
|
1541
|
-
writeFileSync5(params.outputPath, response);
|
|
1542
1540
|
}
|
|
1543
|
-
|
|
1541
|
+
await this.callClaude(params.prompt);
|
|
1542
|
+
if (params.outputPath && existsSync7(params.outputPath)) {
|
|
1543
|
+
return readFileSync7(params.outputPath, "utf-8");
|
|
1544
|
+
}
|
|
1545
|
+
return "";
|
|
1544
1546
|
}
|
|
1545
1547
|
async callClaude(prompt) {
|
|
1546
1548
|
return new Promise((resolve, reject) => {
|
|
1547
1549
|
const proc = spawn(this.claudeCommand, [
|
|
1548
|
-
"--print",
|
|
1549
1550
|
"--permission-mode",
|
|
1550
1551
|
"bypassPermissions"
|
|
1551
1552
|
], {
|
|
@@ -1553,23 +1554,30 @@ var CLIAIAdapter = class {
|
|
|
1553
1554
|
});
|
|
1554
1555
|
proc.stdin.write(prompt);
|
|
1555
1556
|
proc.stdin.end();
|
|
1556
|
-
let stdout = "";
|
|
1557
1557
|
let stderr = "";
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1558
|
+
const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
1559
|
+
let frameIndex = 0;
|
|
1560
|
+
const spinner = setInterval(() => {
|
|
1561
|
+
process.stdout.write(`\r${frames[frameIndex++ % frames.length]} Claude is working...`);
|
|
1562
|
+
}, 100);
|
|
1563
|
+
const stopSpinner = (success) => {
|
|
1564
|
+
clearInterval(spinner);
|
|
1565
|
+
process.stdout.write(`\r${success ? "\u2713" : "\u2717"} Claude ${success ? "done" : "failed"}
|
|
1566
|
+
`);
|
|
1567
|
+
};
|
|
1562
1568
|
proc.stderr.on("data", (data) => {
|
|
1563
1569
|
stderr += data.toString();
|
|
1564
1570
|
});
|
|
1565
1571
|
proc.on("close", (code) => {
|
|
1572
|
+
stopSpinner(code === 0);
|
|
1566
1573
|
if (code !== 0) {
|
|
1567
1574
|
reject(new Error(`Claude CLI exited with code ${code}: ${stderr}`));
|
|
1568
1575
|
} else {
|
|
1569
|
-
resolve(
|
|
1576
|
+
resolve();
|
|
1570
1577
|
}
|
|
1571
1578
|
});
|
|
1572
1579
|
proc.on("error", (err) => {
|
|
1580
|
+
stopSpinner(false);
|
|
1573
1581
|
reject(new Error(`Failed to run Claude CLI: ${err.message}`));
|
|
1574
1582
|
});
|
|
1575
1583
|
});
|
|
@@ -1704,33 +1712,29 @@ var GitHubAIAdapter = class {
|
|
|
1704
1712
|
async execute(params) {
|
|
1705
1713
|
console.log(`
|
|
1706
1714
|
\u{1F4DD} Generating...`);
|
|
1707
|
-
const response = await this.callClaude(params.prompt);
|
|
1708
1715
|
if (params.outputPath) {
|
|
1709
1716
|
const outputDir = dirname4(params.outputPath);
|
|
1710
1717
|
if (!existsSync8(outputDir)) {
|
|
1711
1718
|
mkdirSync5(outputDir, { recursive: true });
|
|
1712
1719
|
}
|
|
1713
|
-
writeFileSync6(params.outputPath, response);
|
|
1714
1720
|
}
|
|
1715
|
-
|
|
1721
|
+
await this.callClaude(params.prompt);
|
|
1722
|
+
if (params.outputPath && existsSync8(params.outputPath)) {
|
|
1723
|
+
return readFileSync8(params.outputPath, "utf-8");
|
|
1724
|
+
}
|
|
1725
|
+
return "";
|
|
1716
1726
|
}
|
|
1717
1727
|
async callClaude(prompt) {
|
|
1718
1728
|
return new Promise((resolve, reject) => {
|
|
1719
1729
|
const proc = spawn2(this.claudeCommand, [
|
|
1720
|
-
"--print",
|
|
1721
1730
|
"--permission-mode",
|
|
1722
1731
|
"bypassPermissions"
|
|
1723
1732
|
], {
|
|
1724
|
-
stdio: ["pipe", "
|
|
1733
|
+
stdio: ["pipe", "inherit", "pipe"]
|
|
1725
1734
|
});
|
|
1726
1735
|
proc.stdin.write(prompt);
|
|
1727
1736
|
proc.stdin.end();
|
|
1728
|
-
let stdout = "";
|
|
1729
1737
|
let stderr = "";
|
|
1730
|
-
proc.stdout.on("data", (data) => {
|
|
1731
|
-
stdout += data.toString();
|
|
1732
|
-
process.stdout.write(data);
|
|
1733
|
-
});
|
|
1734
1738
|
proc.stderr.on("data", (data) => {
|
|
1735
1739
|
stderr += data.toString();
|
|
1736
1740
|
});
|
|
@@ -1738,7 +1742,7 @@ var GitHubAIAdapter = class {
|
|
|
1738
1742
|
if (code !== 0) {
|
|
1739
1743
|
reject(new Error(`Claude CLI exited with code ${code}: ${stderr}`));
|
|
1740
1744
|
} else {
|
|
1741
|
-
resolve(
|
|
1745
|
+
resolve();
|
|
1742
1746
|
}
|
|
1743
1747
|
});
|
|
1744
1748
|
proc.on("error", (err) => {
|