@rely-ai/caliber 0.4.2 → 0.4.3
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/bin.js +44 -10
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -997,7 +997,7 @@ function isCursorAgentAvailable() {
|
|
|
997
997
|
// src/llm/claude-cli.ts
|
|
998
998
|
import { spawn as spawn2, execSync as execSync3 } from "child_process";
|
|
999
999
|
var CLAUDE_CLI_BIN = "claude";
|
|
1000
|
-
var DEFAULT_TIMEOUT_MS =
|
|
1000
|
+
var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
1001
1001
|
var ClaudeCliProvider = class {
|
|
1002
1002
|
defaultModel;
|
|
1003
1003
|
timeoutMs;
|
|
@@ -1014,13 +1014,48 @@ var ClaudeCliProvider = class {
|
|
|
1014
1014
|
return this.runClaudePrint(combined);
|
|
1015
1015
|
}
|
|
1016
1016
|
async stream(options, callbacks) {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1017
|
+
const combined = this.buildCombinedPrompt(options);
|
|
1018
|
+
const child = spawn2(CLAUDE_CLI_BIN, ["-p", combined], {
|
|
1019
|
+
cwd: process.cwd(),
|
|
1020
|
+
stdio: ["ignore", "pipe", "inherit"],
|
|
1021
|
+
env: process.env
|
|
1022
|
+
});
|
|
1023
|
+
let settled = false;
|
|
1024
|
+
const chunks = [];
|
|
1025
|
+
child.stdout.on("data", (chunk) => {
|
|
1026
|
+
chunks.push(chunk);
|
|
1027
|
+
callbacks.onText(chunk.toString("utf-8"));
|
|
1028
|
+
});
|
|
1029
|
+
const timer = setTimeout(() => {
|
|
1030
|
+
child.kill("SIGTERM");
|
|
1031
|
+
if (!settled) {
|
|
1032
|
+
settled = true;
|
|
1033
|
+
callbacks.onError(
|
|
1034
|
+
new Error(
|
|
1035
|
+
`Claude CLI timed out after ${this.timeoutMs / 1e3}s. Set CALIBER_CLAUDE_CLI_TIMEOUT_MS to increase.`
|
|
1036
|
+
)
|
|
1037
|
+
);
|
|
1038
|
+
}
|
|
1039
|
+
}, this.timeoutMs);
|
|
1040
|
+
child.on("error", (err) => {
|
|
1041
|
+
clearTimeout(timer);
|
|
1042
|
+
if (!settled) {
|
|
1043
|
+
settled = true;
|
|
1044
|
+
callbacks.onError(err);
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
child.on("close", (code, signal) => {
|
|
1048
|
+
clearTimeout(timer);
|
|
1049
|
+
if (settled) return;
|
|
1050
|
+
settled = true;
|
|
1051
|
+
if (code === 0) {
|
|
1052
|
+
callbacks.onEnd({ stopReason: "end_turn" });
|
|
1053
|
+
} else {
|
|
1054
|
+
const stdout = Buffer.concat(chunks).toString("utf-8").trim();
|
|
1055
|
+
const msg = signal ? `Claude CLI killed (${signal})` : code != null ? `Claude CLI exited with code ${code}` : "Claude CLI exited";
|
|
1056
|
+
callbacks.onError(new Error(stdout ? `${msg}. Output: ${stdout.slice(0, 200)}` : msg));
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1024
1059
|
}
|
|
1025
1060
|
buildCombinedPrompt(options) {
|
|
1026
1061
|
const streamOpts = options;
|
|
@@ -3799,10 +3834,9 @@ async function initCommand(options) {
|
|
|
3799
3834
|
`));
|
|
3800
3835
|
const targetAgent = options.agent || await promptAgent();
|
|
3801
3836
|
const baselineScore = computeLocalScore(process.cwd(), targetAgent);
|
|
3837
|
+
displayScore(baselineScore);
|
|
3802
3838
|
const hasExistingConfig = !!(fingerprint.existingConfigs.claudeMd || fingerprint.existingConfigs.claudeSettings || fingerprint.existingConfigs.claudeSkills?.length || fingerprint.existingConfigs.cursorrules || fingerprint.existingConfigs.cursorRules?.length);
|
|
3803
3839
|
if (hasExistingConfig && baselineScore.score === 100) {
|
|
3804
|
-
console.log(chalk4.hex("#6366f1").bold(" Step 3/4 \u2014 Score check\n"));
|
|
3805
|
-
displayScore(baselineScore);
|
|
3806
3840
|
console.log(chalk4.bold.green(" Your setup is already optimal \u2014 nothing to change.\n"));
|
|
3807
3841
|
console.log(chalk4.dim(" Run `caliber init --force` to regenerate anyway.\n"));
|
|
3808
3842
|
if (!options.force) return;
|
package/package.json
CHANGED