spets 0.1.21 → 0.1.22
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 +14 -22
- 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,33 +1532,29 @@ 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
|
], {
|
|
1552
|
-
stdio: ["pipe", "
|
|
1553
|
+
stdio: ["pipe", "inherit", "pipe"]
|
|
1553
1554
|
});
|
|
1554
1555
|
proc.stdin.write(prompt);
|
|
1555
1556
|
proc.stdin.end();
|
|
1556
|
-
let stdout = "";
|
|
1557
1557
|
let stderr = "";
|
|
1558
|
-
proc.stdout.on("data", (data) => {
|
|
1559
|
-
stdout += data.toString();
|
|
1560
|
-
process.stdout.write(data);
|
|
1561
|
-
});
|
|
1562
1558
|
proc.stderr.on("data", (data) => {
|
|
1563
1559
|
stderr += data.toString();
|
|
1564
1560
|
});
|
|
@@ -1566,7 +1562,7 @@ var CLIAIAdapter = class {
|
|
|
1566
1562
|
if (code !== 0) {
|
|
1567
1563
|
reject(new Error(`Claude CLI exited with code ${code}: ${stderr}`));
|
|
1568
1564
|
} else {
|
|
1569
|
-
resolve(
|
|
1565
|
+
resolve();
|
|
1570
1566
|
}
|
|
1571
1567
|
});
|
|
1572
1568
|
proc.on("error", (err) => {
|
|
@@ -1704,33 +1700,29 @@ var GitHubAIAdapter = class {
|
|
|
1704
1700
|
async execute(params) {
|
|
1705
1701
|
console.log(`
|
|
1706
1702
|
\u{1F4DD} Generating...`);
|
|
1707
|
-
const response = await this.callClaude(params.prompt);
|
|
1708
1703
|
if (params.outputPath) {
|
|
1709
1704
|
const outputDir = dirname4(params.outputPath);
|
|
1710
1705
|
if (!existsSync8(outputDir)) {
|
|
1711
1706
|
mkdirSync5(outputDir, { recursive: true });
|
|
1712
1707
|
}
|
|
1713
|
-
writeFileSync6(params.outputPath, response);
|
|
1714
1708
|
}
|
|
1715
|
-
|
|
1709
|
+
await this.callClaude(params.prompt);
|
|
1710
|
+
if (params.outputPath && existsSync8(params.outputPath)) {
|
|
1711
|
+
return readFileSync8(params.outputPath, "utf-8");
|
|
1712
|
+
}
|
|
1713
|
+
return "";
|
|
1716
1714
|
}
|
|
1717
1715
|
async callClaude(prompt) {
|
|
1718
1716
|
return new Promise((resolve, reject) => {
|
|
1719
1717
|
const proc = spawn2(this.claudeCommand, [
|
|
1720
|
-
"--print",
|
|
1721
1718
|
"--permission-mode",
|
|
1722
1719
|
"bypassPermissions"
|
|
1723
1720
|
], {
|
|
1724
|
-
stdio: ["pipe", "
|
|
1721
|
+
stdio: ["pipe", "inherit", "pipe"]
|
|
1725
1722
|
});
|
|
1726
1723
|
proc.stdin.write(prompt);
|
|
1727
1724
|
proc.stdin.end();
|
|
1728
|
-
let stdout = "";
|
|
1729
1725
|
let stderr = "";
|
|
1730
|
-
proc.stdout.on("data", (data) => {
|
|
1731
|
-
stdout += data.toString();
|
|
1732
|
-
process.stdout.write(data);
|
|
1733
|
-
});
|
|
1734
1726
|
proc.stderr.on("data", (data) => {
|
|
1735
1727
|
stderr += data.toString();
|
|
1736
1728
|
});
|
|
@@ -1738,7 +1730,7 @@ var GitHubAIAdapter = class {
|
|
|
1738
1730
|
if (code !== 0) {
|
|
1739
1731
|
reject(new Error(`Claude CLI exited with code ${code}: ${stderr}`));
|
|
1740
1732
|
} else {
|
|
1741
|
-
resolve(
|
|
1733
|
+
resolve();
|
|
1742
1734
|
}
|
|
1743
1735
|
});
|
|
1744
1736
|
proc.on("error", (err) => {
|