calabasas 0.7.0 → 0.8.1
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/config.d.ts +1 -0
- package/dist/index.js +53 -19
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3678,17 +3678,23 @@ async function skill(options) {
|
|
|
3678
3678
|
const cwd = process.cwd();
|
|
3679
3679
|
const detectedFiles = detectExistingFiles(cwd);
|
|
3680
3680
|
if (detectedFiles.length === 0) {
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
options
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3681
|
+
let createPath;
|
|
3682
|
+
if (options.file) {
|
|
3683
|
+
createPath = options.file;
|
|
3684
|
+
} else {
|
|
3685
|
+
const selected = await p6.select({
|
|
3686
|
+
message: "No CLAUDE.md or AGENTS.md found. Where should we create one?",
|
|
3687
|
+
options: [
|
|
3688
|
+
{ value: "CLAUDE.md", label: "CLAUDE.md (project root)" },
|
|
3689
|
+
{ value: "AGENTS.md", label: "AGENTS.md (project root)" },
|
|
3690
|
+
{ value: ".claude/CLAUDE.md", label: ".claude/CLAUDE.md" }
|
|
3691
|
+
]
|
|
3692
|
+
});
|
|
3693
|
+
if (p6.isCancel(selected)) {
|
|
3694
|
+
p6.cancel("Cancelled.");
|
|
3695
|
+
return;
|
|
3696
|
+
}
|
|
3697
|
+
createPath = selected;
|
|
3692
3698
|
}
|
|
3693
3699
|
const fullPath = path5.resolve(cwd, createPath);
|
|
3694
3700
|
const dir = path5.dirname(fullPath);
|
|
@@ -3704,7 +3710,33 @@ ${skillContent}`;
|
|
|
3704
3710
|
return;
|
|
3705
3711
|
}
|
|
3706
3712
|
let selectedFile;
|
|
3707
|
-
if (
|
|
3713
|
+
if (options.file) {
|
|
3714
|
+
const match = detectedFiles.find((f) => f.path === options.file);
|
|
3715
|
+
if (match) {
|
|
3716
|
+
selectedFile = match;
|
|
3717
|
+
} else {
|
|
3718
|
+
const fullPath = path5.resolve(cwd, options.file);
|
|
3719
|
+
const dir = path5.dirname(fullPath);
|
|
3720
|
+
if (!fs5.existsSync(dir)) {
|
|
3721
|
+
fs5.mkdirSync(dir, { recursive: true });
|
|
3722
|
+
}
|
|
3723
|
+
if (fs5.existsSync(fullPath)) {
|
|
3724
|
+
selectedFile = {
|
|
3725
|
+
path: options.file,
|
|
3726
|
+
fullPath,
|
|
3727
|
+
type: options.file.includes("CLAUDE") ? "CLAUDE.md" : "AGENTS.md"
|
|
3728
|
+
};
|
|
3729
|
+
} else {
|
|
3730
|
+
const projectName = path5.basename(cwd);
|
|
3731
|
+
const initialContent = `# ${projectName}
|
|
3732
|
+
|
|
3733
|
+
${skillContent}`;
|
|
3734
|
+
fs5.writeFileSync(fullPath, initialContent);
|
|
3735
|
+
p6.outro(`Created ${options.file} with Calabasas guidelines`);
|
|
3736
|
+
return;
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
} else if (detectedFiles.length === 1) {
|
|
3708
3740
|
selectedFile = detectedFiles[0];
|
|
3709
3741
|
} else {
|
|
3710
3742
|
const selected = await p6.select({
|
|
@@ -3722,12 +3754,14 @@ ${skillContent}`;
|
|
|
3722
3754
|
}
|
|
3723
3755
|
const existingContent = fs5.readFileSync(selectedFile.fullPath, "utf8");
|
|
3724
3756
|
if (hasCalabsasSection(existingContent)) {
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
p6.
|
|
3730
|
-
|
|
3757
|
+
if (!options.yes) {
|
|
3758
|
+
const update = await p6.confirm({
|
|
3759
|
+
message: `Calabasas guidelines already exist in ${selectedFile.path}. Replace?`
|
|
3760
|
+
});
|
|
3761
|
+
if (p6.isCancel(update) || !update) {
|
|
3762
|
+
p6.cancel("Cancelled.");
|
|
3763
|
+
return;
|
|
3764
|
+
}
|
|
3731
3765
|
}
|
|
3732
3766
|
const sectionRegex = /## Calabasas Guidelines[\s\S]*?(?=\n## |\n# |$)/;
|
|
3733
3767
|
const contentWithoutSection = existingContent.replace(sectionRegex, "").trimEnd();
|
|
@@ -6482,7 +6516,7 @@ program2.command("logout").description("Clear stored credentials").option("--dev
|
|
|
6482
6516
|
program2.command("init").description("Initialize Calabasas config in your Convex project").action(init);
|
|
6483
6517
|
program2.command("push").description("Push your Calabasas config to the server").option("-c, --config <path>", "Path to config file", "convex/calabasas/config.ts").option("-b, --bot <botId>", "Bot ID to configure (prompts if not specified)").option("--dev", "Push to development environment").option("--prod", "Push to production environment").action(push);
|
|
6484
6518
|
program2.command("generate").description("Generate type-safe Discord handlers and helpers").option("-o, --output <path>", "Output path", "convex/calabasas/_generated/discord.ts").action(generate);
|
|
6485
|
-
program2.command("skill").description("Generate Calabasas documentation for AI assistants").option("--dev", "Use development environment").option("--prod", "Use production environment").action(skill);
|
|
6519
|
+
program2.command("skill").description("Generate Calabasas documentation for AI assistants").option("--dev", "Use development environment").option("--prod", "Use production environment").option("-f, --file <path>", "Target file path (e.g. CLAUDE.md)").option("-y, --yes", "Auto-confirm replacing existing guidelines").action(skill);
|
|
6486
6520
|
program2.command("add [components...]").description("Add Discord UI components to your project").action(add);
|
|
6487
6521
|
program2.command("migrate [name]").description("Run a codemod migration (list available if no name given)").action(migrate);
|
|
6488
6522
|
program2.command("status").alias("dashboard").description("Real-time dashboard showing bot status, events, and stats").option("--dev", "Use development environment").option("--prod", "Use production environment").action(dashboard);
|