@rely-ai/caliber 1.31.0-dev.1774711564 → 1.31.0-dev.1774711990
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 +216 -134
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -230,6 +230,140 @@ var init_types = __esm({
|
|
|
230
230
|
}
|
|
231
231
|
});
|
|
232
232
|
|
|
233
|
+
// src/writers/pre-commit-block.ts
|
|
234
|
+
var pre_commit_block_exports = {};
|
|
235
|
+
__export(pre_commit_block_exports, {
|
|
236
|
+
appendLearningsBlock: () => appendLearningsBlock,
|
|
237
|
+
appendPreCommitBlock: () => appendPreCommitBlock,
|
|
238
|
+
appendSyncBlock: () => appendSyncBlock,
|
|
239
|
+
getCursorLearningsRule: () => getCursorLearningsRule,
|
|
240
|
+
getCursorPreCommitRule: () => getCursorPreCommitRule,
|
|
241
|
+
getCursorSyncRule: () => getCursorSyncRule,
|
|
242
|
+
hasLearningsBlock: () => hasLearningsBlock,
|
|
243
|
+
hasPreCommitBlock: () => hasPreCommitBlock,
|
|
244
|
+
hasSyncBlock: () => hasSyncBlock
|
|
245
|
+
});
|
|
246
|
+
function getPreCommitBlock() {
|
|
247
|
+
const bin = resolveCaliber();
|
|
248
|
+
return `${BLOCK_START}
|
|
249
|
+
## Before Committing
|
|
250
|
+
|
|
251
|
+
**IMPORTANT:** Before every git commit, you MUST ensure Caliber syncs agent configs with the latest code changes.
|
|
252
|
+
|
|
253
|
+
First, check if the pre-commit hook is already installed:
|
|
254
|
+
\`\`\`bash
|
|
255
|
+
grep -q "caliber" .git/hooks/pre-commit 2>/dev/null && echo "hook-active" || echo "no-hook"
|
|
256
|
+
\`\`\`
|
|
257
|
+
|
|
258
|
+
- If **hook-active**: the hook handles sync automatically \u2014 just commit normally. Tell the user: "Caliber will sync your agent configs automatically via the pre-commit hook."
|
|
259
|
+
- If **no-hook**: run Caliber manually before committing:
|
|
260
|
+
1. Tell the user: "Caliber: Syncing agent configs with your latest changes..."
|
|
261
|
+
2. Run: \`${bin} refresh && git add ${MANAGED_DOC_PATHS} 2>/dev/null\`
|
|
262
|
+
3. After it completes, briefly tell the user what Caliber updated. Then proceed with the commit.
|
|
263
|
+
|
|
264
|
+
If \`${bin}\` is not found, tell the user: "This project uses Caliber for agent config sync. Install it with: npm install -g @rely-ai/caliber"
|
|
265
|
+
${BLOCK_END}`;
|
|
266
|
+
}
|
|
267
|
+
function getCursorRuleContent() {
|
|
268
|
+
const bin = resolveCaliber();
|
|
269
|
+
return `---
|
|
270
|
+
description: Run Caliber sync before git commits to keep agent configs up to date
|
|
271
|
+
alwaysApply: true
|
|
272
|
+
---
|
|
273
|
+
Before every git commit, check if the Caliber pre-commit hook is installed:
|
|
274
|
+
Run: \`grep -q "caliber" .git/hooks/pre-commit 2>/dev/null && echo "hook-active" || echo "no-hook"\`
|
|
275
|
+
|
|
276
|
+
If hook-active: just commit normally \u2014 Caliber syncs automatically via the hook. Tell the user: "Caliber will sync your agent configs automatically."
|
|
277
|
+
If no-hook: run \`${bin} refresh && git add ${MANAGED_DOC_PATHS} 2>/dev/null\` before committing, and tell the user what was updated.
|
|
278
|
+
|
|
279
|
+
If \`${bin}\` is not found, tell the user: "This project uses Caliber for agent config sync. Install with: npm install -g @rely-ai/caliber"
|
|
280
|
+
`;
|
|
281
|
+
}
|
|
282
|
+
function hasPreCommitBlock(content) {
|
|
283
|
+
return content.includes(BLOCK_START);
|
|
284
|
+
}
|
|
285
|
+
function appendPreCommitBlock(content) {
|
|
286
|
+
if (hasPreCommitBlock(content)) return content;
|
|
287
|
+
const trimmed = content.trimEnd();
|
|
288
|
+
return trimmed + "\n\n" + getPreCommitBlock() + "\n";
|
|
289
|
+
}
|
|
290
|
+
function getCursorPreCommitRule() {
|
|
291
|
+
return { filename: CURSOR_RULE_FILENAME, content: getCursorRuleContent() };
|
|
292
|
+
}
|
|
293
|
+
function hasLearningsBlock(content) {
|
|
294
|
+
return content.includes(LEARNINGS_BLOCK_START);
|
|
295
|
+
}
|
|
296
|
+
function appendLearningsBlock(content) {
|
|
297
|
+
if (hasLearningsBlock(content)) return content;
|
|
298
|
+
const trimmed = content.trimEnd();
|
|
299
|
+
return trimmed + "\n\n" + LEARNINGS_BLOCK + "\n";
|
|
300
|
+
}
|
|
301
|
+
function getCursorLearningsRule() {
|
|
302
|
+
return { filename: CURSOR_LEARNINGS_FILENAME, content: CURSOR_LEARNINGS_CONTENT };
|
|
303
|
+
}
|
|
304
|
+
function getSyncBlock() {
|
|
305
|
+
const bin = resolveCaliber();
|
|
306
|
+
return `${SYNC_BLOCK_START}
|
|
307
|
+
## Context Sync
|
|
308
|
+
|
|
309
|
+
This project uses [Caliber](https://github.com/rely-ai/caliber) to keep AI agent configs in sync across Claude Code, Cursor, Copilot, and Codex.
|
|
310
|
+
Configs update automatically before each commit via \`${bin} refresh\`.
|
|
311
|
+
If the pre-commit hook is not set up, run \`${bin} hooks --install\` to enable automatic sync.
|
|
312
|
+
${SYNC_BLOCK_END}`;
|
|
313
|
+
}
|
|
314
|
+
function hasSyncBlock(content) {
|
|
315
|
+
return content.includes(SYNC_BLOCK_START);
|
|
316
|
+
}
|
|
317
|
+
function appendSyncBlock(content) {
|
|
318
|
+
if (hasSyncBlock(content)) return content;
|
|
319
|
+
const trimmed = content.trimEnd();
|
|
320
|
+
return trimmed + "\n\n" + getSyncBlock() + "\n";
|
|
321
|
+
}
|
|
322
|
+
function getCursorSyncContent() {
|
|
323
|
+
const bin = resolveCaliber();
|
|
324
|
+
return `---
|
|
325
|
+
description: This project uses Caliber for automatic AI agent context sync
|
|
326
|
+
alwaysApply: true
|
|
327
|
+
---
|
|
328
|
+
This project uses Caliber to keep AI agent configs (CLAUDE.md, Cursor rules, Copilot instructions)
|
|
329
|
+
in sync with the codebase automatically. Before each commit, run \`${bin} refresh\` to sync configs.
|
|
330
|
+
If \`${bin}\` is not found, tell the user: "This project uses Caliber for agent config sync. Install with: npm install -g @rely-ai/caliber"
|
|
331
|
+
`;
|
|
332
|
+
}
|
|
333
|
+
function getCursorSyncRule() {
|
|
334
|
+
return { filename: CURSOR_SYNC_FILENAME, content: getCursorSyncContent() };
|
|
335
|
+
}
|
|
336
|
+
var BLOCK_START, BLOCK_END, MANAGED_DOC_PATHS, CURSOR_RULE_FILENAME, LEARNINGS_BLOCK_START, LEARNINGS_BLOCK_END, LEARNINGS_BLOCK, CURSOR_LEARNINGS_FILENAME, CURSOR_LEARNINGS_CONTENT, SYNC_BLOCK_START, SYNC_BLOCK_END, CURSOR_SYNC_FILENAME;
|
|
337
|
+
var init_pre_commit_block = __esm({
|
|
338
|
+
"src/writers/pre-commit-block.ts"() {
|
|
339
|
+
"use strict";
|
|
340
|
+
init_resolve_caliber();
|
|
341
|
+
BLOCK_START = "<!-- caliber:managed:pre-commit -->";
|
|
342
|
+
BLOCK_END = "<!-- /caliber:managed:pre-commit -->";
|
|
343
|
+
MANAGED_DOC_PATHS = "CLAUDE.md .claude/ .cursor/ .cursorrules .github/copilot-instructions.md .github/instructions/ AGENTS.md CALIBER_LEARNINGS.md";
|
|
344
|
+
CURSOR_RULE_FILENAME = "caliber-pre-commit.mdc";
|
|
345
|
+
LEARNINGS_BLOCK_START = "<!-- caliber:managed:learnings -->";
|
|
346
|
+
LEARNINGS_BLOCK_END = "<!-- /caliber:managed:learnings -->";
|
|
347
|
+
LEARNINGS_BLOCK = `${LEARNINGS_BLOCK_START}
|
|
348
|
+
## Session Learnings
|
|
349
|
+
|
|
350
|
+
Read \`CALIBER_LEARNINGS.md\` for patterns and anti-patterns learned from previous sessions.
|
|
351
|
+
These are auto-extracted from real tool usage \u2014 treat them as project-specific rules.
|
|
352
|
+
${LEARNINGS_BLOCK_END}`;
|
|
353
|
+
CURSOR_LEARNINGS_FILENAME = "caliber-learnings.mdc";
|
|
354
|
+
CURSOR_LEARNINGS_CONTENT = `---
|
|
355
|
+
description: Reference session-learned patterns from CALIBER_LEARNINGS.md
|
|
356
|
+
alwaysApply: true
|
|
357
|
+
---
|
|
358
|
+
Read \`CALIBER_LEARNINGS.md\` for patterns and anti-patterns learned from previous sessions.
|
|
359
|
+
These are auto-extracted from real tool usage \u2014 treat them as project-specific rules.
|
|
360
|
+
`;
|
|
361
|
+
SYNC_BLOCK_START = "<!-- caliber:managed:sync -->";
|
|
362
|
+
SYNC_BLOCK_END = "<!-- /caliber:managed:sync -->";
|
|
363
|
+
CURSOR_SYNC_FILENAME = "caliber-sync.mdc";
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
|
|
233
367
|
// src/lib/builtin-skills.ts
|
|
234
368
|
var builtin_skills_exports = {};
|
|
235
369
|
__export(builtin_skills_exports, {
|
|
@@ -4718,126 +4852,9 @@ ${f.content}
|
|
|
4718
4852
|
import fs19 from "fs";
|
|
4719
4853
|
|
|
4720
4854
|
// src/writers/claude/index.ts
|
|
4855
|
+
init_pre_commit_block();
|
|
4721
4856
|
import fs12 from "fs";
|
|
4722
4857
|
import path11 from "path";
|
|
4723
|
-
|
|
4724
|
-
// src/writers/pre-commit-block.ts
|
|
4725
|
-
init_resolve_caliber();
|
|
4726
|
-
var BLOCK_START = "<!-- caliber:managed:pre-commit -->";
|
|
4727
|
-
var BLOCK_END = "<!-- /caliber:managed:pre-commit -->";
|
|
4728
|
-
var MANAGED_DOC_PATHS = "CLAUDE.md .claude/ .cursor/ .cursorrules .github/copilot-instructions.md .github/instructions/ AGENTS.md CALIBER_LEARNINGS.md";
|
|
4729
|
-
function getPreCommitBlock() {
|
|
4730
|
-
const bin = resolveCaliber();
|
|
4731
|
-
return `${BLOCK_START}
|
|
4732
|
-
## Before Committing
|
|
4733
|
-
|
|
4734
|
-
**IMPORTANT:** Before every git commit, you MUST ensure Caliber syncs agent configs with the latest code changes.
|
|
4735
|
-
|
|
4736
|
-
First, check if the pre-commit hook is already installed:
|
|
4737
|
-
\`\`\`bash
|
|
4738
|
-
grep -q "caliber" .git/hooks/pre-commit 2>/dev/null && echo "hook-active" || echo "no-hook"
|
|
4739
|
-
\`\`\`
|
|
4740
|
-
|
|
4741
|
-
- If **hook-active**: the hook handles sync automatically \u2014 just commit normally. Tell the user: "Caliber will sync your agent configs automatically via the pre-commit hook."
|
|
4742
|
-
- If **no-hook**: run Caliber manually before committing:
|
|
4743
|
-
1. Tell the user: "Caliber: Syncing agent configs with your latest changes..."
|
|
4744
|
-
2. Run: \`${bin} refresh && git add ${MANAGED_DOC_PATHS} 2>/dev/null\`
|
|
4745
|
-
3. After it completes, briefly tell the user what Caliber updated. Then proceed with the commit.
|
|
4746
|
-
|
|
4747
|
-
If \`${bin}\` is not found, tell the user: "This project uses Caliber for agent config sync. Install it with: npm install -g @rely-ai/caliber"
|
|
4748
|
-
${BLOCK_END}`;
|
|
4749
|
-
}
|
|
4750
|
-
var CURSOR_RULE_FILENAME = "caliber-pre-commit.mdc";
|
|
4751
|
-
function getCursorRuleContent() {
|
|
4752
|
-
const bin = resolveCaliber();
|
|
4753
|
-
return `---
|
|
4754
|
-
description: Run Caliber sync before git commits to keep agent configs up to date
|
|
4755
|
-
alwaysApply: true
|
|
4756
|
-
---
|
|
4757
|
-
Before every git commit, check if the Caliber pre-commit hook is installed:
|
|
4758
|
-
Run: \`grep -q "caliber" .git/hooks/pre-commit 2>/dev/null && echo "hook-active" || echo "no-hook"\`
|
|
4759
|
-
|
|
4760
|
-
If hook-active: just commit normally \u2014 Caliber syncs automatically via the hook. Tell the user: "Caliber will sync your agent configs automatically."
|
|
4761
|
-
If no-hook: run \`${bin} refresh && git add ${MANAGED_DOC_PATHS} 2>/dev/null\` before committing, and tell the user what was updated.
|
|
4762
|
-
|
|
4763
|
-
If \`${bin}\` is not found, tell the user: "This project uses Caliber for agent config sync. Install with: npm install -g @rely-ai/caliber"
|
|
4764
|
-
`;
|
|
4765
|
-
}
|
|
4766
|
-
function hasPreCommitBlock(content) {
|
|
4767
|
-
return content.includes(BLOCK_START);
|
|
4768
|
-
}
|
|
4769
|
-
function appendPreCommitBlock(content) {
|
|
4770
|
-
if (hasPreCommitBlock(content)) return content;
|
|
4771
|
-
const trimmed = content.trimEnd();
|
|
4772
|
-
return trimmed + "\n\n" + getPreCommitBlock() + "\n";
|
|
4773
|
-
}
|
|
4774
|
-
function getCursorPreCommitRule() {
|
|
4775
|
-
return { filename: CURSOR_RULE_FILENAME, content: getCursorRuleContent() };
|
|
4776
|
-
}
|
|
4777
|
-
var LEARNINGS_BLOCK_START = "<!-- caliber:managed:learnings -->";
|
|
4778
|
-
var LEARNINGS_BLOCK_END = "<!-- /caliber:managed:learnings -->";
|
|
4779
|
-
var LEARNINGS_BLOCK = `${LEARNINGS_BLOCK_START}
|
|
4780
|
-
## Session Learnings
|
|
4781
|
-
|
|
4782
|
-
Read \`CALIBER_LEARNINGS.md\` for patterns and anti-patterns learned from previous sessions.
|
|
4783
|
-
These are auto-extracted from real tool usage \u2014 treat them as project-specific rules.
|
|
4784
|
-
${LEARNINGS_BLOCK_END}`;
|
|
4785
|
-
var CURSOR_LEARNINGS_FILENAME = "caliber-learnings.mdc";
|
|
4786
|
-
var CURSOR_LEARNINGS_CONTENT = `---
|
|
4787
|
-
description: Reference session-learned patterns from CALIBER_LEARNINGS.md
|
|
4788
|
-
alwaysApply: true
|
|
4789
|
-
---
|
|
4790
|
-
Read \`CALIBER_LEARNINGS.md\` for patterns and anti-patterns learned from previous sessions.
|
|
4791
|
-
These are auto-extracted from real tool usage \u2014 treat them as project-specific rules.
|
|
4792
|
-
`;
|
|
4793
|
-
function hasLearningsBlock(content) {
|
|
4794
|
-
return content.includes(LEARNINGS_BLOCK_START);
|
|
4795
|
-
}
|
|
4796
|
-
function appendLearningsBlock(content) {
|
|
4797
|
-
if (hasLearningsBlock(content)) return content;
|
|
4798
|
-
const trimmed = content.trimEnd();
|
|
4799
|
-
return trimmed + "\n\n" + LEARNINGS_BLOCK + "\n";
|
|
4800
|
-
}
|
|
4801
|
-
function getCursorLearningsRule() {
|
|
4802
|
-
return { filename: CURSOR_LEARNINGS_FILENAME, content: CURSOR_LEARNINGS_CONTENT };
|
|
4803
|
-
}
|
|
4804
|
-
var SYNC_BLOCK_START = "<!-- caliber:managed:sync -->";
|
|
4805
|
-
var SYNC_BLOCK_END = "<!-- /caliber:managed:sync -->";
|
|
4806
|
-
function getSyncBlock() {
|
|
4807
|
-
const bin = resolveCaliber();
|
|
4808
|
-
return `${SYNC_BLOCK_START}
|
|
4809
|
-
## Context Sync
|
|
4810
|
-
|
|
4811
|
-
This project uses [Caliber](https://github.com/rely-ai/caliber) to keep AI agent configs in sync across Claude Code, Cursor, Copilot, and Codex.
|
|
4812
|
-
Configs update automatically before each commit via \`${bin} refresh\`.
|
|
4813
|
-
If the pre-commit hook is not set up, run \`${bin} hooks --install\` to enable automatic sync.
|
|
4814
|
-
${SYNC_BLOCK_END}`;
|
|
4815
|
-
}
|
|
4816
|
-
function hasSyncBlock(content) {
|
|
4817
|
-
return content.includes(SYNC_BLOCK_START);
|
|
4818
|
-
}
|
|
4819
|
-
function appendSyncBlock(content) {
|
|
4820
|
-
if (hasSyncBlock(content)) return content;
|
|
4821
|
-
const trimmed = content.trimEnd();
|
|
4822
|
-
return trimmed + "\n\n" + getSyncBlock() + "\n";
|
|
4823
|
-
}
|
|
4824
|
-
var CURSOR_SYNC_FILENAME = "caliber-sync.mdc";
|
|
4825
|
-
function getCursorSyncContent() {
|
|
4826
|
-
const bin = resolveCaliber();
|
|
4827
|
-
return `---
|
|
4828
|
-
description: This project uses Caliber for automatic AI agent context sync
|
|
4829
|
-
alwaysApply: true
|
|
4830
|
-
---
|
|
4831
|
-
This project uses Caliber to keep AI agent configs (CLAUDE.md, Cursor rules, Copilot instructions)
|
|
4832
|
-
in sync with the codebase automatically. Before each commit, run \`${bin} refresh\` to sync configs.
|
|
4833
|
-
If \`${bin}\` is not found, tell the user: "This project uses Caliber for agent config sync. Install with: npm install -g @rely-ai/caliber"
|
|
4834
|
-
`;
|
|
4835
|
-
}
|
|
4836
|
-
function getCursorSyncRule() {
|
|
4837
|
-
return { filename: CURSOR_SYNC_FILENAME, content: getCursorSyncContent() };
|
|
4838
|
-
}
|
|
4839
|
-
|
|
4840
|
-
// src/writers/claude/index.ts
|
|
4841
4858
|
function writeClaudeConfig(config) {
|
|
4842
4859
|
const written = [];
|
|
4843
4860
|
fs12.writeFileSync("CLAUDE.md", appendSyncBlock(appendLearningsBlock(appendPreCommitBlock(config.claudeMd))));
|
|
@@ -4875,6 +4892,7 @@ function writeClaudeConfig(config) {
|
|
|
4875
4892
|
}
|
|
4876
4893
|
|
|
4877
4894
|
// src/writers/cursor/index.ts
|
|
4895
|
+
init_pre_commit_block();
|
|
4878
4896
|
import fs13 from "fs";
|
|
4879
4897
|
import path12 from "path";
|
|
4880
4898
|
function writeCursorConfig(config) {
|
|
@@ -4930,6 +4948,7 @@ function writeCursorConfig(config) {
|
|
|
4930
4948
|
}
|
|
4931
4949
|
|
|
4932
4950
|
// src/writers/codex/index.ts
|
|
4951
|
+
init_pre_commit_block();
|
|
4933
4952
|
import fs14 from "fs";
|
|
4934
4953
|
import path13 from "path";
|
|
4935
4954
|
function writeCodexConfig(config) {
|
|
@@ -4956,6 +4975,7 @@ function writeCodexConfig(config) {
|
|
|
4956
4975
|
}
|
|
4957
4976
|
|
|
4958
4977
|
// src/writers/github-copilot/index.ts
|
|
4978
|
+
init_pre_commit_block();
|
|
4959
4979
|
import fs15 from "fs";
|
|
4960
4980
|
import path14 from "path";
|
|
4961
4981
|
function writeGithubCopilotConfig(config) {
|
|
@@ -6355,6 +6375,7 @@ import { existsSync as existsSync6, readdirSync as readdirSync3 } from "fs";
|
|
|
6355
6375
|
import { execSync as execSync12 } from "child_process";
|
|
6356
6376
|
import { join as join7 } from "path";
|
|
6357
6377
|
init_resolve_caliber();
|
|
6378
|
+
init_pre_commit_block();
|
|
6358
6379
|
function hasPreCommitHook(dir) {
|
|
6359
6380
|
try {
|
|
6360
6381
|
const gitDir = execSync12("git rev-parse --git-dir", { cwd: dir, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
@@ -9138,7 +9159,7 @@ async function initCommand(options) {
|
|
|
9138
9159
|
console.log(chalk14.dim(" 3. Generate Audit existing config or generate from scratch"));
|
|
9139
9160
|
console.log(chalk14.dim(" 4. Finalize Review changes and score your setup\n"));
|
|
9140
9161
|
} else {
|
|
9141
|
-
console.log(brand.bold("\n CALIBER") + chalk14.dim(" \u2014
|
|
9162
|
+
console.log(brand.bold("\n CALIBER") + chalk14.dim(" \u2014 setting up continuous sync\n"));
|
|
9142
9163
|
}
|
|
9143
9164
|
const platforms = detectPlatforms();
|
|
9144
9165
|
if (!platforms.claude && !platforms.cursor && !platforms.codex) {
|
|
@@ -9187,11 +9208,12 @@ async function initCommand(options) {
|
|
|
9187
9208
|
`));
|
|
9188
9209
|
trackInitAgentSelected(targetAgent, agentAutoDetected);
|
|
9189
9210
|
console.log(title.bold(" Step 2/4 \u2014 Setup\n"));
|
|
9211
|
+
console.log(chalk14.dim(" Installing sync infrastructure...\n"));
|
|
9190
9212
|
const hookResult = installPreCommitHook();
|
|
9191
9213
|
if (hookResult.installed) {
|
|
9192
|
-
console.log(` ${chalk14.green("\u2713")} Pre-commit hook \u2014 configs sync on every commit`);
|
|
9214
|
+
console.log(` ${chalk14.green("\u2713")} Pre-commit hook installed \u2014 configs sync on every commit`);
|
|
9193
9215
|
} else if (hookResult.alreadyInstalled) {
|
|
9194
|
-
console.log(` ${chalk14.green("\u2713")} Pre-commit hook \u2014
|
|
9216
|
+
console.log(` ${chalk14.green("\u2713")} Pre-commit hook \u2014 active`);
|
|
9195
9217
|
}
|
|
9196
9218
|
const { ensureBuiltinSkills: ensureBuiltinSkills2 } = await Promise.resolve().then(() => (init_builtin_skills(), builtin_skills_exports));
|
|
9197
9219
|
for (const agent of targetAgent) {
|
|
@@ -9201,7 +9223,9 @@ async function initCommand(options) {
|
|
|
9201
9223
|
}
|
|
9202
9224
|
const skillsWritten = ensureBuiltinSkills2();
|
|
9203
9225
|
if (skillsWritten.length > 0) {
|
|
9204
|
-
console.log(` ${chalk14.green("\u2713")} Agent skills \u2014
|
|
9226
|
+
console.log(` ${chalk14.green("\u2713")} Agent skills installed \u2014 /setup-caliber, /find-skills, /save-learning`);
|
|
9227
|
+
} else {
|
|
9228
|
+
console.log(` ${chalk14.green("\u2713")} Agent skills \u2014 already installed`);
|
|
9205
9229
|
}
|
|
9206
9230
|
console.log("");
|
|
9207
9231
|
let baselineScore = computeLocalScore(process.cwd(), targetAgent);
|
|
@@ -9239,16 +9263,69 @@ async function initCommand(options) {
|
|
|
9239
9263
|
skipGeneration = !options.force;
|
|
9240
9264
|
} else if (hasExistingConfig && !options.force && !options.autoApprove) {
|
|
9241
9265
|
trackInitScoreComputed(baselineScore.score, passingCount, failingCount, false);
|
|
9242
|
-
|
|
9266
|
+
console.log(chalk14.dim("\n Sync infrastructure is ready. Caliber can also audit your existing"));
|
|
9267
|
+
console.log(chalk14.dim(" configs and improve them using AI.\n"));
|
|
9268
|
+
const auditAnswer = await promptInput(" Audit and improve your existing config? (Y/n) ");
|
|
9243
9269
|
skipGeneration = auditAnswer.toLowerCase() === "n";
|
|
9244
9270
|
} else if (!hasExistingConfig && !options.force && !options.autoApprove) {
|
|
9245
9271
|
trackInitScoreComputed(baselineScore.score, passingCount, failingCount, false);
|
|
9246
|
-
|
|
9272
|
+
console.log(chalk14.dim("\n Sync infrastructure is ready. Caliber can also generate tailored"));
|
|
9273
|
+
console.log(chalk14.dim(" CLAUDE.md, Cursor rules, and Codex configs for your project.\n"));
|
|
9274
|
+
const generateAnswer = await promptInput(" Generate agent configs? (Y/n) ");
|
|
9247
9275
|
skipGeneration = generateAnswer.toLowerCase() === "n";
|
|
9248
9276
|
} else {
|
|
9249
9277
|
trackInitScoreComputed(baselineScore.score, passingCount, failingCount, false);
|
|
9250
9278
|
}
|
|
9251
9279
|
if (skipGeneration) {
|
|
9280
|
+
const {
|
|
9281
|
+
appendPreCommitBlock: appendPreCommitBlock2,
|
|
9282
|
+
appendLearningsBlock: appendLearningsBlock2,
|
|
9283
|
+
appendSyncBlock: appendSyncBlock2,
|
|
9284
|
+
getCursorPreCommitRule: getCursorPreCommitRule2,
|
|
9285
|
+
getCursorLearningsRule: getCursorLearningsRule2,
|
|
9286
|
+
getCursorSyncRule: getCursorSyncRule2
|
|
9287
|
+
} = await Promise.resolve().then(() => (init_pre_commit_block(), pre_commit_block_exports));
|
|
9288
|
+
const claudeMdPath = "CLAUDE.md";
|
|
9289
|
+
let claudeContent = "";
|
|
9290
|
+
try {
|
|
9291
|
+
claudeContent = fs33.readFileSync(claudeMdPath, "utf-8");
|
|
9292
|
+
} catch {
|
|
9293
|
+
}
|
|
9294
|
+
if (!claudeContent) {
|
|
9295
|
+
claudeContent = `# ${path26.basename(process.cwd())}
|
|
9296
|
+
`;
|
|
9297
|
+
}
|
|
9298
|
+
const updatedClaude = appendSyncBlock2(appendLearningsBlock2(appendPreCommitBlock2(claudeContent)));
|
|
9299
|
+
if (updatedClaude !== claudeContent || !fs33.existsSync(claudeMdPath)) {
|
|
9300
|
+
fs33.writeFileSync(claudeMdPath, updatedClaude);
|
|
9301
|
+
console.log(` ${chalk14.green("\u2713")} CLAUDE.md \u2014 added Caliber sync instructions`);
|
|
9302
|
+
}
|
|
9303
|
+
if (targetAgent.includes("cursor")) {
|
|
9304
|
+
const rulesDir = path26.join(".cursor", "rules");
|
|
9305
|
+
if (!fs33.existsSync(rulesDir)) fs33.mkdirSync(rulesDir, { recursive: true });
|
|
9306
|
+
for (const rule of [getCursorPreCommitRule2(), getCursorLearningsRule2(), getCursorSyncRule2()]) {
|
|
9307
|
+
fs33.writeFileSync(path26.join(rulesDir, rule.filename), rule.content);
|
|
9308
|
+
}
|
|
9309
|
+
console.log(` ${chalk14.green("\u2713")} Cursor rules \u2014 added Caliber sync rules`);
|
|
9310
|
+
}
|
|
9311
|
+
if (targetAgent.includes("github-copilot")) {
|
|
9312
|
+
const copilotPath = path26.join(".github", "copilot-instructions.md");
|
|
9313
|
+
let copilotContent = "";
|
|
9314
|
+
try {
|
|
9315
|
+
copilotContent = fs33.readFileSync(copilotPath, "utf-8");
|
|
9316
|
+
} catch {
|
|
9317
|
+
}
|
|
9318
|
+
if (!copilotContent) {
|
|
9319
|
+
fs33.mkdirSync(".github", { recursive: true });
|
|
9320
|
+
copilotContent = `# ${path26.basename(process.cwd())}
|
|
9321
|
+
`;
|
|
9322
|
+
}
|
|
9323
|
+
const updatedCopilot = appendSyncBlock2(appendLearningsBlock2(appendPreCommitBlock2(copilotContent)));
|
|
9324
|
+
if (updatedCopilot !== copilotContent) {
|
|
9325
|
+
fs33.writeFileSync(copilotPath, updatedCopilot);
|
|
9326
|
+
console.log(` ${chalk14.green("\u2713")} Copilot instructions \u2014 added Caliber sync instructions`);
|
|
9327
|
+
}
|
|
9328
|
+
}
|
|
9252
9329
|
const sha2 = getCurrentHeadSha();
|
|
9253
9330
|
writeState({
|
|
9254
9331
|
lastRefreshSha: sha2 ?? "",
|
|
@@ -9658,23 +9735,27 @@ ${agentRefs.join(" ")}
|
|
|
9658
9735
|
const done = chalk14.green("\u2713");
|
|
9659
9736
|
const skip = chalk14.dim("\u2013");
|
|
9660
9737
|
console.log(chalk14.bold(" What was configured:\n"));
|
|
9661
|
-
console.log(` ${done}
|
|
9662
|
-
console.log(` ${done}
|
|
9738
|
+
console.log(` ${done} Continuous sync ${chalk14.dim("pre-commit hook keeps all agent configs in sync")}`);
|
|
9739
|
+
console.log(` ${done} Config generated ${title(`${bin} score`)} ${chalk14.dim("for full breakdown")}`);
|
|
9740
|
+
console.log(` ${done} Agent skills ${chalk14.dim("/setup-caliber for new team members")}`);
|
|
9663
9741
|
if (hasLearnableAgent) {
|
|
9664
9742
|
if (enableLearn) {
|
|
9665
|
-
console.log(` ${done} Session learning
|
|
9743
|
+
console.log(` ${done} Session learning ${chalk14.dim("agent learns from your feedback")}`);
|
|
9666
9744
|
} else {
|
|
9667
|
-
console.log(` ${skip} Session learning
|
|
9745
|
+
console.log(` ${skip} Session learning ${title(`${bin} learn install`)} ${chalk14.dim("to enable later")}`);
|
|
9668
9746
|
}
|
|
9669
9747
|
}
|
|
9670
9748
|
if (communitySkillsInstalled > 0) {
|
|
9671
|
-
console.log(` ${done} Community skills
|
|
9749
|
+
console.log(` ${done} Community skills ${chalk14.dim(`${communitySkillsInstalled} skill${communitySkillsInstalled > 1 ? "s" : ""} installed for your stack`)}`);
|
|
9672
9750
|
} else if (skillSearchResult.results.length > 0) {
|
|
9673
|
-
console.log(` ${skip} Community skills
|
|
9674
|
-
}
|
|
9675
|
-
console.log(chalk14.bold("\n
|
|
9676
|
-
console.log(
|
|
9677
|
-
console.log(
|
|
9751
|
+
console.log(` ${skip} Community skills ${chalk14.dim("available but skipped")}`);
|
|
9752
|
+
}
|
|
9753
|
+
console.log(chalk14.bold("\n What happens next:\n"));
|
|
9754
|
+
console.log(chalk14.dim(" Every commit will automatically sync your agent configs."));
|
|
9755
|
+
console.log(chalk14.dim(" New team members can run /setup-caliber to get set up instantly.\n"));
|
|
9756
|
+
console.log(chalk14.bold(" Explore:\n"));
|
|
9757
|
+
console.log(` ${title(`${bin} score`)} Full scoring breakdown with improvement tips`);
|
|
9758
|
+
console.log(` ${title(`${bin} skills`)} Find community skills for your stack`);
|
|
9678
9759
|
console.log(` ${title(`${bin} undo`)} Revert all changes from this run`);
|
|
9679
9760
|
console.log("");
|
|
9680
9761
|
if (options.showTokens) {
|
|
@@ -10086,6 +10167,7 @@ function collectDiff(lastSha) {
|
|
|
10086
10167
|
}
|
|
10087
10168
|
|
|
10088
10169
|
// src/writers/refresh.ts
|
|
10170
|
+
init_pre_commit_block();
|
|
10089
10171
|
import fs36 from "fs";
|
|
10090
10172
|
import path28 from "path";
|
|
10091
10173
|
function writeRefreshDocs(docs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rely-ai/caliber",
|
|
3
|
-
"version": "1.31.0-dev.
|
|
3
|
+
"version": "1.31.0-dev.1774711990",
|
|
4
4
|
"description": "AI context infrastructure for coding agents — keeps CLAUDE.md, Cursor rules, and skills in sync as your codebase evolves",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|