@rely-ai/caliber 1.26.0-dev.1773936625 → 1.26.0-dev.1773940224

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 +184 -185
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -4019,7 +4019,7 @@ ${f.content}
4019
4019
  }
4020
4020
 
4021
4021
  // src/writers/index.ts
4022
- import fs15 from "fs";
4022
+ import fs16 from "fs";
4023
4023
 
4024
4024
  // src/writers/claude/index.ts
4025
4025
  import fs9 from "fs";
@@ -4253,35 +4253,182 @@ function restoreBackup(backupDir, file) {
4253
4253
  return true;
4254
4254
  }
4255
4255
 
4256
+ // src/lib/builtin-skills.ts
4257
+ import fs14 from "fs";
4258
+ import path14 from "path";
4259
+ function buildSkillContent(skill) {
4260
+ const frontmatter = `---
4261
+ name: ${skill.name}
4262
+ description: ${skill.description}
4263
+ ---
4264
+
4265
+ `;
4266
+ return frontmatter + skill.content;
4267
+ }
4268
+ var FIND_SKILLS_SKILL = {
4269
+ name: "find-skills",
4270
+ description: "Discovers and installs community skills from the public registry. Use when the user mentions a technology, framework, or task that could benefit from specialized skills not yet installed, asks 'how do I do X', 'find a skill for X', or starts work in a new technology area. Proactively suggest when the user's task involves tools or frameworks without existing skills.",
4271
+ content: `# Find Skills
4272
+
4273
+ Search the public skill registry for community-contributed skills
4274
+ relevant to the user's current task and install them into this project.
4275
+
4276
+ ## Instructions
4277
+
4278
+ 1. Identify the key technologies, frameworks, or task types from the
4279
+ user's request that might have community skills available
4280
+ 2. Ask the user: "Would you like me to search for community skills
4281
+ for [identified technologies]?"
4282
+ 3. If the user agrees, run:
4283
+ \`\`\`bash
4284
+ caliber skills --query "<relevant terms>"
4285
+ \`\`\`
4286
+ This outputs the top 5 matching skills with scores and descriptions.
4287
+ 4. Present the results to the user and ask which ones to install
4288
+ 5. Install the selected skills:
4289
+ \`\`\`bash
4290
+ caliber skills --install <slug1>,<slug2>
4291
+ \`\`\`
4292
+ 6. Read the installed SKILL.md files to load them into your current
4293
+ context so you can use them immediately in this session
4294
+ 7. Summarize what was installed and continue with the user's task
4295
+
4296
+ ## Examples
4297
+
4298
+ User: "let's build a web app using React"
4299
+ -> "I notice you want to work with React. Would you like me to search
4300
+ for community skills that could help with React development?"
4301
+ -> If yes: run \`caliber skills --query "react frontend"\`
4302
+ -> Show the user the results, ask which to install
4303
+ -> Run \`caliber skills --install <selected-slugs>\`
4304
+ -> Read the installed files and continue
4305
+
4306
+ User: "help me set up Docker for this project"
4307
+ -> "Would you like me to search for Docker-related skills?"
4308
+ -> If yes: run \`caliber skills --query "docker deployment"\`
4309
+
4310
+ User: "I need to write tests for this Python ML pipeline"
4311
+ -> "Would you like me to find skills for Python ML testing?"
4312
+ -> If yes: run \`caliber skills --query "python machine-learning testing"\`
4313
+
4314
+ ## When NOT to trigger
4315
+
4316
+ - The user is working within an already well-configured area
4317
+ - You already suggested skills for this technology in this session
4318
+ - The user is in the middle of urgent debugging or time-sensitive work
4319
+ - The technology is too generic (e.g. just "code" or "programming")
4320
+ `
4321
+ };
4322
+ var SAVE_LEARNING_SKILL = {
4323
+ name: "save-learning",
4324
+ description: "Saves user instructions as persistent learnings for future sessions. Use when the user says 'remember this', 'always do X', 'from now on', 'never do Y', or gives any instruction they want persisted across sessions. Proactively suggest when the user states a preference, convention, or rule they clearly want followed in the future.",
4325
+ content: `# Save Learning
4326
+
4327
+ Save a user's instruction or preference as a persistent learning that
4328
+ will be applied in all future sessions on this project.
4329
+
4330
+ ## Instructions
4331
+
4332
+ 1. Detect when the user gives an instruction to remember, such as:
4333
+ - "remember this", "save this", "always do X", "never do Y"
4334
+ - "from now on", "going forward", "in this project we..."
4335
+ - Any stated convention, preference, or rule
4336
+ 2. Refine the instruction into a clean, actionable learning bullet with
4337
+ an appropriate type prefix:
4338
+ - \`**[convention]**\` \u2014 coding style, workflow, git conventions
4339
+ - \`**[pattern]**\` \u2014 reusable code patterns
4340
+ - \`**[anti-pattern]**\` \u2014 things to avoid
4341
+ - \`**[preference]**\` \u2014 personal/team preferences
4342
+ - \`**[context]**\` \u2014 project-specific context
4343
+ 3. Show the refined learning to the user and ask for confirmation
4344
+ 4. If confirmed, run:
4345
+ \`\`\`bash
4346
+ caliber learn add "<refined learning>"
4347
+ \`\`\`
4348
+ For personal preferences (not project-level), add \`--personal\`:
4349
+ \`\`\`bash
4350
+ caliber learn add --personal "<refined learning>"
4351
+ \`\`\`
4352
+ 5. Stage the learnings file for the next commit:
4353
+ \`\`\`bash
4354
+ git add CALIBER_LEARNINGS.md
4355
+ \`\`\`
4356
+
4357
+ ## Examples
4358
+
4359
+ User: "when developing features, push to next branch not master, remember it"
4360
+ -> Refine: \`**[convention]** Push feature commits to the \\\`next\\\` branch, not \\\`master\\\`\`
4361
+ -> "I'll save this as a project learning:
4362
+ **[convention]** Push feature commits to the \\\`next\\\` branch, not \\\`master\\\`
4363
+ Save for future sessions?"
4364
+ -> If yes: run \`caliber learn add "**[convention]** Push feature commits to the next branch, not master"\`
4365
+ -> Run \`git add CALIBER_LEARNINGS.md\`
4366
+
4367
+ User: "always use bun instead of npm"
4368
+ -> Refine: \`**[preference]** Use \\\`bun\\\` instead of \\\`npm\\\` for package management\`
4369
+ -> Confirm and save
4370
+
4371
+ User: "never use any in TypeScript, use unknown instead"
4372
+ -> Refine: \`**[convention]** Use \\\`unknown\\\` instead of \\\`any\\\` in TypeScript\`
4373
+ -> Confirm and save
4374
+
4375
+ ## When NOT to trigger
4376
+
4377
+ - The user is giving a one-time instruction for the current task only
4378
+ - The instruction is too vague to be actionable
4379
+ - The user explicitly says "just for now" or "only this time"
4380
+ `
4381
+ };
4382
+ var BUILTIN_SKILLS = [FIND_SKILLS_SKILL, SAVE_LEARNING_SKILL];
4383
+ var PLATFORM_CONFIGS = [
4384
+ { platformDir: ".claude", skillsDir: path14.join(".claude", "skills") },
4385
+ { platformDir: ".cursor", skillsDir: path14.join(".cursor", "skills") },
4386
+ { platformDir: ".agents", skillsDir: path14.join(".agents", "skills") }
4387
+ ];
4388
+ function ensureBuiltinSkills() {
4389
+ const written = [];
4390
+ for (const { platformDir, skillsDir } of PLATFORM_CONFIGS) {
4391
+ if (!fs14.existsSync(platformDir)) continue;
4392
+ for (const skill of BUILTIN_SKILLS) {
4393
+ const skillPath = path14.join(skillsDir, skill.name, "SKILL.md");
4394
+ if (fs14.existsSync(skillPath)) continue;
4395
+ fs14.mkdirSync(path14.dirname(skillPath), { recursive: true });
4396
+ fs14.writeFileSync(skillPath, buildSkillContent(skill));
4397
+ written.push(skillPath);
4398
+ }
4399
+ }
4400
+ return written;
4401
+ }
4402
+
4256
4403
  // src/writers/manifest.ts
4257
4404
  init_constants();
4258
- import fs14 from "fs";
4405
+ import fs15 from "fs";
4259
4406
  import crypto2 from "crypto";
4260
4407
  function readManifest() {
4261
4408
  try {
4262
- if (!fs14.existsSync(MANIFEST_FILE)) return null;
4263
- return JSON.parse(fs14.readFileSync(MANIFEST_FILE, "utf-8"));
4409
+ if (!fs15.existsSync(MANIFEST_FILE)) return null;
4410
+ return JSON.parse(fs15.readFileSync(MANIFEST_FILE, "utf-8"));
4264
4411
  } catch {
4265
4412
  return null;
4266
4413
  }
4267
4414
  }
4268
4415
  function writeManifest(manifest) {
4269
- if (!fs14.existsSync(CALIBER_DIR)) {
4270
- fs14.mkdirSync(CALIBER_DIR, { recursive: true });
4416
+ if (!fs15.existsSync(CALIBER_DIR)) {
4417
+ fs15.mkdirSync(CALIBER_DIR, { recursive: true });
4271
4418
  }
4272
- fs14.writeFileSync(MANIFEST_FILE, JSON.stringify(manifest, null, 2));
4419
+ fs15.writeFileSync(MANIFEST_FILE, JSON.stringify(manifest, null, 2));
4273
4420
  }
4274
4421
  function fileChecksum(filePath) {
4275
- const content = fs14.readFileSync(filePath);
4422
+ const content = fs15.readFileSync(filePath);
4276
4423
  return crypto2.createHash("sha256").update(content).digest("hex");
4277
4424
  }
4278
4425
 
4279
4426
  // src/writers/index.ts
4280
4427
  function writeSetup(setup) {
4281
4428
  const filesToWrite = getFilesToWrite(setup);
4282
- const filesToDelete = (setup.deletions || []).map((d) => d.filePath).filter((f) => fs15.existsSync(f));
4429
+ const filesToDelete = (setup.deletions || []).map((d) => d.filePath).filter((f) => fs16.existsSync(f));
4283
4430
  const existingFiles = [
4284
- ...filesToWrite.filter((f) => fs15.existsSync(f)),
4431
+ ...filesToWrite.filter((f) => fs16.existsSync(f)),
4285
4432
  ...filesToDelete
4286
4433
  ];
4287
4434
  const backupDir = existingFiles.length > 0 ? createBackup(existingFiles) : void 0;
@@ -4300,9 +4447,10 @@ function writeSetup(setup) {
4300
4447
  }
4301
4448
  const deleted = [];
4302
4449
  for (const filePath of filesToDelete) {
4303
- fs15.unlinkSync(filePath);
4450
+ fs16.unlinkSync(filePath);
4304
4451
  deleted.push(filePath);
4305
4452
  }
4453
+ written.push(...ensureBuiltinSkills());
4306
4454
  ensureGitignore();
4307
4455
  const entries = [
4308
4456
  ...written.map((file) => ({
@@ -4330,8 +4478,8 @@ function undoSetup() {
4330
4478
  const removed = [];
4331
4479
  for (const entry of manifest.entries) {
4332
4480
  if (entry.action === "created") {
4333
- if (fs15.existsSync(entry.path)) {
4334
- fs15.unlinkSync(entry.path);
4481
+ if (fs16.existsSync(entry.path)) {
4482
+ fs16.unlinkSync(entry.path);
4335
4483
  removed.push(entry.path);
4336
4484
  }
4337
4485
  } else if ((entry.action === "modified" || entry.action === "deleted") && manifest.backupDir) {
@@ -4341,8 +4489,8 @@ function undoSetup() {
4341
4489
  }
4342
4490
  }
4343
4491
  const { MANIFEST_FILE: MANIFEST_FILE2 } = (init_constants(), __toCommonJS(constants_exports));
4344
- if (fs15.existsSync(MANIFEST_FILE2)) {
4345
- fs15.unlinkSync(MANIFEST_FILE2);
4492
+ if (fs16.existsSync(MANIFEST_FILE2)) {
4493
+ fs16.unlinkSync(MANIFEST_FILE2);
4346
4494
  }
4347
4495
  return { restored, removed };
4348
4496
  }
@@ -4383,23 +4531,23 @@ function getFilesToWrite(setup) {
4383
4531
  }
4384
4532
  function ensureGitignore() {
4385
4533
  const gitignorePath = ".gitignore";
4386
- if (fs15.existsSync(gitignorePath)) {
4387
- const content = fs15.readFileSync(gitignorePath, "utf-8");
4534
+ if (fs16.existsSync(gitignorePath)) {
4535
+ const content = fs16.readFileSync(gitignorePath, "utf-8");
4388
4536
  if (!content.includes(".caliber/")) {
4389
- fs15.appendFileSync(gitignorePath, "\n# Caliber local state\n.caliber/\n");
4537
+ fs16.appendFileSync(gitignorePath, "\n# Caliber local state\n.caliber/\n");
4390
4538
  }
4391
4539
  } else {
4392
- fs15.writeFileSync(gitignorePath, "# Caliber local state\n.caliber/\n");
4540
+ fs16.writeFileSync(gitignorePath, "# Caliber local state\n.caliber/\n");
4393
4541
  }
4394
4542
  }
4395
4543
 
4396
4544
  // src/writers/staging.ts
4397
4545
  init_constants();
4398
- import fs16 from "fs";
4399
- import path14 from "path";
4400
- var STAGED_DIR = path14.join(CALIBER_DIR, "staged");
4401
- var PROPOSED_DIR = path14.join(STAGED_DIR, "proposed");
4402
- var CURRENT_DIR = path14.join(STAGED_DIR, "current");
4546
+ import fs17 from "fs";
4547
+ import path15 from "path";
4548
+ var STAGED_DIR = path15.join(CALIBER_DIR, "staged");
4549
+ var PROPOSED_DIR = path15.join(STAGED_DIR, "proposed");
4550
+ var CURRENT_DIR = path15.join(STAGED_DIR, "current");
4403
4551
  function normalizeContent(content) {
4404
4552
  return content.split("\n").map((line) => line.trimEnd()).join("\n").replace(/\n{3,}/g, "\n\n").trim();
4405
4553
  }
@@ -4409,20 +4557,20 @@ function stageFiles(files, projectDir) {
4409
4557
  let modifiedFiles = 0;
4410
4558
  const stagedFiles = [];
4411
4559
  for (const file of files) {
4412
- const originalPath = path14.join(projectDir, file.path);
4413
- if (fs16.existsSync(originalPath)) {
4414
- const existing = fs16.readFileSync(originalPath, "utf-8");
4560
+ const originalPath = path15.join(projectDir, file.path);
4561
+ if (fs17.existsSync(originalPath)) {
4562
+ const existing = fs17.readFileSync(originalPath, "utf-8");
4415
4563
  if (normalizeContent(existing) === normalizeContent(file.content)) {
4416
4564
  continue;
4417
4565
  }
4418
4566
  }
4419
- const proposedPath = path14.join(PROPOSED_DIR, file.path);
4420
- fs16.mkdirSync(path14.dirname(proposedPath), { recursive: true });
4421
- fs16.writeFileSync(proposedPath, file.content);
4422
- if (fs16.existsSync(originalPath)) {
4423
- const currentPath = path14.join(CURRENT_DIR, file.path);
4424
- fs16.mkdirSync(path14.dirname(currentPath), { recursive: true });
4425
- fs16.copyFileSync(originalPath, currentPath);
4567
+ const proposedPath = path15.join(PROPOSED_DIR, file.path);
4568
+ fs17.mkdirSync(path15.dirname(proposedPath), { recursive: true });
4569
+ fs17.writeFileSync(proposedPath, file.content);
4570
+ if (fs17.existsSync(originalPath)) {
4571
+ const currentPath = path15.join(CURRENT_DIR, file.path);
4572
+ fs17.mkdirSync(path15.dirname(currentPath), { recursive: true });
4573
+ fs17.copyFileSync(originalPath, currentPath);
4426
4574
  modifiedFiles++;
4427
4575
  stagedFiles.push({ relativePath: file.path, proposedPath, currentPath, originalPath, isNew: false });
4428
4576
  } else {
@@ -4433,162 +4581,13 @@ function stageFiles(files, projectDir) {
4433
4581
  return { newFiles, modifiedFiles, stagedFiles };
4434
4582
  }
4435
4583
  function cleanupStaging() {
4436
- if (fs16.existsSync(STAGED_DIR)) {
4437
- fs16.rmSync(STAGED_DIR, { recursive: true, force: true });
4584
+ if (fs17.existsSync(STAGED_DIR)) {
4585
+ fs17.rmSync(STAGED_DIR, { recursive: true, force: true });
4438
4586
  }
4439
4587
  }
4440
4588
 
4441
4589
  // src/commands/setup-files.ts
4442
4590
  import fs18 from "fs";
4443
-
4444
- // src/lib/builtin-skills.ts
4445
- import fs17 from "fs";
4446
- import path15 from "path";
4447
- function buildSkillContent(skill) {
4448
- const frontmatter = `---
4449
- name: ${skill.name}
4450
- description: ${skill.description}
4451
- ---
4452
-
4453
- `;
4454
- return frontmatter + skill.content;
4455
- }
4456
- var FIND_SKILLS_SKILL = {
4457
- name: "find-skills",
4458
- description: "Discovers and installs community skills from the public registry. Use when the user mentions a technology, framework, or task that could benefit from specialized skills not yet installed, asks 'how do I do X', 'find a skill for X', or starts work in a new technology area. Proactively suggest when the user's task involves tools or frameworks without existing skills.",
4459
- content: `# Find Skills
4460
-
4461
- Search the public skill registry for community-contributed skills
4462
- relevant to the user's current task and install them into this project.
4463
-
4464
- ## Instructions
4465
-
4466
- 1. Identify the key technologies, frameworks, or task types from the
4467
- user's request that might have community skills available
4468
- 2. Ask the user: "Would you like me to search for community skills
4469
- for [identified technologies]?"
4470
- 3. If the user agrees, run:
4471
- \`\`\`bash
4472
- caliber skills --query "<relevant terms>"
4473
- \`\`\`
4474
- This outputs the top 5 matching skills with scores and descriptions.
4475
- 4. Present the results to the user and ask which ones to install
4476
- 5. Install the selected skills:
4477
- \`\`\`bash
4478
- caliber skills --install <slug1>,<slug2>
4479
- \`\`\`
4480
- 6. Read the installed SKILL.md files to load them into your current
4481
- context so you can use them immediately in this session
4482
- 7. Summarize what was installed and continue with the user's task
4483
-
4484
- ## Examples
4485
-
4486
- User: "let's build a web app using React"
4487
- -> "I notice you want to work with React. Would you like me to search
4488
- for community skills that could help with React development?"
4489
- -> If yes: run \`caliber skills --query "react frontend"\`
4490
- -> Show the user the results, ask which to install
4491
- -> Run \`caliber skills --install <selected-slugs>\`
4492
- -> Read the installed files and continue
4493
-
4494
- User: "help me set up Docker for this project"
4495
- -> "Would you like me to search for Docker-related skills?"
4496
- -> If yes: run \`caliber skills --query "docker deployment"\`
4497
-
4498
- User: "I need to write tests for this Python ML pipeline"
4499
- -> "Would you like me to find skills for Python ML testing?"
4500
- -> If yes: run \`caliber skills --query "python machine-learning testing"\`
4501
-
4502
- ## When NOT to trigger
4503
-
4504
- - The user is working within an already well-configured area
4505
- - You already suggested skills for this technology in this session
4506
- - The user is in the middle of urgent debugging or time-sensitive work
4507
- - The technology is too generic (e.g. just "code" or "programming")
4508
- `
4509
- };
4510
- var SAVE_LEARNING_SKILL = {
4511
- name: "save-learning",
4512
- description: "Saves user instructions as persistent learnings for future sessions. Use when the user says 'remember this', 'always do X', 'from now on', 'never do Y', or gives any instruction they want persisted across sessions. Proactively suggest when the user states a preference, convention, or rule they clearly want followed in the future.",
4513
- content: `# Save Learning
4514
-
4515
- Save a user's instruction or preference as a persistent learning that
4516
- will be applied in all future sessions on this project.
4517
-
4518
- ## Instructions
4519
-
4520
- 1. Detect when the user gives an instruction to remember, such as:
4521
- - "remember this", "save this", "always do X", "never do Y"
4522
- - "from now on", "going forward", "in this project we..."
4523
- - Any stated convention, preference, or rule
4524
- 2. Refine the instruction into a clean, actionable learning bullet with
4525
- an appropriate type prefix:
4526
- - \`**[convention]**\` \u2014 coding style, workflow, git conventions
4527
- - \`**[pattern]**\` \u2014 reusable code patterns
4528
- - \`**[anti-pattern]**\` \u2014 things to avoid
4529
- - \`**[preference]**\` \u2014 personal/team preferences
4530
- - \`**[context]**\` \u2014 project-specific context
4531
- 3. Show the refined learning to the user and ask for confirmation
4532
- 4. If confirmed, run:
4533
- \`\`\`bash
4534
- caliber learn add "<refined learning>"
4535
- \`\`\`
4536
- For personal preferences (not project-level), add \`--personal\`:
4537
- \`\`\`bash
4538
- caliber learn add --personal "<refined learning>"
4539
- \`\`\`
4540
- 5. Stage the learnings file for the next commit:
4541
- \`\`\`bash
4542
- git add CALIBER_LEARNINGS.md
4543
- \`\`\`
4544
-
4545
- ## Examples
4546
-
4547
- User: "when developing features, push to next branch not master, remember it"
4548
- -> Refine: \`**[convention]** Push feature commits to the \\\`next\\\` branch, not \\\`master\\\`\`
4549
- -> "I'll save this as a project learning:
4550
- **[convention]** Push feature commits to the \\\`next\\\` branch, not \\\`master\\\`
4551
- Save for future sessions?"
4552
- -> If yes: run \`caliber learn add "**[convention]** Push feature commits to the next branch, not master"\`
4553
- -> Run \`git add CALIBER_LEARNINGS.md\`
4554
-
4555
- User: "always use bun instead of npm"
4556
- -> Refine: \`**[preference]** Use \\\`bun\\\` instead of \\\`npm\\\` for package management\`
4557
- -> Confirm and save
4558
-
4559
- User: "never use any in TypeScript, use unknown instead"
4560
- -> Refine: \`**[convention]** Use \\\`unknown\\\` instead of \\\`any\\\` in TypeScript\`
4561
- -> Confirm and save
4562
-
4563
- ## When NOT to trigger
4564
-
4565
- - The user is giving a one-time instruction for the current task only
4566
- - The instruction is too vague to be actionable
4567
- - The user explicitly says "just for now" or "only this time"
4568
- `
4569
- };
4570
- var BUILTIN_SKILLS = [FIND_SKILLS_SKILL, SAVE_LEARNING_SKILL];
4571
- var PLATFORM_CONFIGS = [
4572
- { platformDir: ".claude", skillsDir: path15.join(".claude", "skills") },
4573
- { platformDir: ".cursor", skillsDir: path15.join(".cursor", "skills") },
4574
- { platformDir: ".agents", skillsDir: path15.join(".agents", "skills") }
4575
- ];
4576
- function ensureBuiltinSkills() {
4577
- const written = [];
4578
- for (const { platformDir, skillsDir } of PLATFORM_CONFIGS) {
4579
- if (!fs17.existsSync(platformDir)) continue;
4580
- for (const skill of BUILTIN_SKILLS) {
4581
- const skillPath = path15.join(skillsDir, skill.name, "SKILL.md");
4582
- if (fs17.existsSync(skillPath)) continue;
4583
- fs17.mkdirSync(path15.dirname(skillPath), { recursive: true });
4584
- fs17.writeFileSync(skillPath, buildSkillContent(skill));
4585
- written.push(skillPath);
4586
- }
4587
- }
4588
- return written;
4589
- }
4590
-
4591
- // src/commands/setup-files.ts
4592
4591
  function collectSetupFiles(setup, targetAgent) {
4593
4592
  const files = [];
4594
4593
  const claude = setup.claude;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.26.0-dev.1773936625",
3
+ "version": "1.26.0-dev.1773940224",
4
4
  "description": "Analyze your codebase and generate optimized AI agent configs (CLAUDE.md, .cursorrules, skills) — no API key needed",
5
5
  "type": "module",
6
6
  "bin": {