@rely-ai/caliber 0.4.2 → 0.4.4

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.
Files changed (2) hide show
  1. package/dist/bin.js +60 -12
  2. 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 = 5 * 60 * 1e3;
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
- try {
1018
- const text = await this.call(options);
1019
- if (text) callbacks.onText(text);
1020
- callbacks.onEnd({ stopReason: "end_turn" });
1021
- } catch (err) {
1022
- callbacks.onError(err instanceof Error ? err : new Error(String(err)));
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;
@@ -2709,9 +2744,22 @@ function extractNpmDeps(dir) {
2709
2744
  "rimraf",
2710
2745
  "cross-env",
2711
2746
  "dotenv",
2712
- "nodemon"
2747
+ "nodemon",
2748
+ "husky",
2749
+ "lint-staged",
2750
+ "commitlint",
2751
+ "@commitlint/cli",
2752
+ "@commitlint/config-conventional"
2713
2753
  ]);
2714
- return Object.keys(deps).filter((d) => !trivial.has(d) && !d.startsWith("@types/")).slice(0, 30);
2754
+ const trivialPatterns = [
2755
+ /^@rely-ai\//,
2756
+ /^@caliber-ai\//,
2757
+ /^eslint-/,
2758
+ /^@eslint\//,
2759
+ /^prettier-/,
2760
+ /^@typescript-eslint\//
2761
+ ];
2762
+ return Object.keys(deps).filter((d) => !trivial.has(d) && !d.startsWith("@types/") && !trivialPatterns.some((p) => p.test(d))).slice(0, 30);
2715
2763
  }
2716
2764
  function extractPythonDeps(dir) {
2717
2765
  const reqTxt = readFileOrNull(join(dir, "requirements.txt"));
@@ -3799,10 +3847,10 @@ async function initCommand(options) {
3799
3847
  `));
3800
3848
  const targetAgent = options.agent || await promptAgent();
3801
3849
  const baselineScore = computeLocalScore(process.cwd(), targetAgent);
3850
+ console.log(chalk4.hex("#6366f1").bold(" Current project score\n"));
3851
+ displayScore(baselineScore);
3802
3852
  const hasExistingConfig = !!(fingerprint.existingConfigs.claudeMd || fingerprint.existingConfigs.claudeSettings || fingerprint.existingConfigs.claudeSkills?.length || fingerprint.existingConfigs.cursorrules || fingerprint.existingConfigs.cursorRules?.length);
3803
3853
  if (hasExistingConfig && baselineScore.score === 100) {
3804
- console.log(chalk4.hex("#6366f1").bold(" Step 3/4 \u2014 Score check\n"));
3805
- displayScore(baselineScore);
3806
3854
  console.log(chalk4.bold.green(" Your setup is already optimal \u2014 nothing to change.\n"));
3807
3855
  console.log(chalk4.dim(" Run `caliber init --force` to regenerate anyway.\n"));
3808
3856
  if (!options.force) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Open-source CLI for configuring coding agent environments (CLAUDE.md, .cursorrules, skills). Bring your own LLM.",
5
5
  "type": "module",
6
6
  "bin": {