calabasas 0.17.0 → 0.17.2
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 +13 -2
- package/dist/index.js +8 -127
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -31,16 +31,27 @@ export type CommandOptionType = "string" | "integer" | "number" | "boolean" | "u
|
|
|
31
31
|
export type CommandOption = {
|
|
32
32
|
name: string;
|
|
33
33
|
description: string;
|
|
34
|
+
name_localizations?: Record<string, string>;
|
|
35
|
+
description_localizations?: Record<string, string>;
|
|
34
36
|
type: CommandOptionType;
|
|
35
37
|
required?: boolean;
|
|
36
|
-
choices?: Array<{ name: string; value: string | number }>;
|
|
38
|
+
choices?: Array<{ name: string; name_localizations?: Record<string, string>; value: string | number }>;
|
|
37
39
|
autocomplete?: boolean;
|
|
38
40
|
};
|
|
39
41
|
|
|
42
|
+
export type SubcommandDefinition = {
|
|
43
|
+
description: string;
|
|
44
|
+
name_localizations?: Record<string, string>;
|
|
45
|
+
description_localizations?: Record<string, string>;
|
|
46
|
+
options?: CommandOption[];
|
|
47
|
+
};
|
|
48
|
+
|
|
40
49
|
export type CommandDefinition = {
|
|
41
50
|
description: string;
|
|
51
|
+
name_localizations?: Record<string, string>;
|
|
52
|
+
description_localizations?: Record<string, string>;
|
|
42
53
|
options?: CommandOption[];
|
|
43
|
-
subcommands?: Record<string,
|
|
54
|
+
subcommands?: Record<string, SubcommandDefinition>;
|
|
44
55
|
defaultMemberPermissions?: string;
|
|
45
56
|
dmPermission?: boolean;
|
|
46
57
|
};
|
package/dist/index.js
CHANGED
|
@@ -2594,7 +2594,7 @@ async function generate(options) {
|
|
|
2594
2594
|
import * as fs5 from "fs";
|
|
2595
2595
|
import * as path5 from "path";
|
|
2596
2596
|
import * as p6 from "@clack/prompts";
|
|
2597
|
-
var
|
|
2597
|
+
var SKILL_PATH = ".claude/skills/calabasas/SKILL.md";
|
|
2598
2598
|
async function fetchSkillContent(env) {
|
|
2599
2599
|
const apiUrl = getApiUrlForEnv(env);
|
|
2600
2600
|
const response = await fetch(`${apiUrl}/api/skill`);
|
|
@@ -2603,28 +2603,6 @@ async function fetchSkillContent(env) {
|
|
|
2603
2603
|
}
|
|
2604
2604
|
return response.text();
|
|
2605
2605
|
}
|
|
2606
|
-
var SEARCH_PATHS = [
|
|
2607
|
-
"CLAUDE.md",
|
|
2608
|
-
"AGENTS.md",
|
|
2609
|
-
".claude/CLAUDE.md",
|
|
2610
|
-
".cursor/AGENTS.md",
|
|
2611
|
-
"docs/CLAUDE.md",
|
|
2612
|
-
"docs/AGENTS.md"
|
|
2613
|
-
];
|
|
2614
|
-
function detectExistingFiles(cwd) {
|
|
2615
|
-
const found = [];
|
|
2616
|
-
for (const searchPath of SEARCH_PATHS) {
|
|
2617
|
-
const fullPath = path5.resolve(cwd, searchPath);
|
|
2618
|
-
if (fs5.existsSync(fullPath)) {
|
|
2619
|
-
const type = searchPath.includes("CLAUDE") ? "CLAUDE.md" : "AGENTS.md";
|
|
2620
|
-
found.push({ path: searchPath, fullPath, type });
|
|
2621
|
-
}
|
|
2622
|
-
}
|
|
2623
|
-
return found;
|
|
2624
|
-
}
|
|
2625
|
-
function hasCalabsasSection(content) {
|
|
2626
|
-
return content.includes(SECTION_HEADER) || content.includes("## Calabasas Guidelines");
|
|
2627
|
-
}
|
|
2628
2606
|
async function skill(options) {
|
|
2629
2607
|
const env = resolveEnv(options);
|
|
2630
2608
|
p6.intro("calabasas skill");
|
|
@@ -2640,110 +2618,13 @@ async function skill(options) {
|
|
|
2640
2618
|
}
|
|
2641
2619
|
s.stop("Guidelines fetched");
|
|
2642
2620
|
const cwd = process.cwd();
|
|
2643
|
-
const
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
createPath = options.file;
|
|
2648
|
-
} else {
|
|
2649
|
-
const selected = await p6.select({
|
|
2650
|
-
message: "No CLAUDE.md or AGENTS.md found. Where should we create one?",
|
|
2651
|
-
options: [
|
|
2652
|
-
{ value: "CLAUDE.md", label: "CLAUDE.md (project root)" },
|
|
2653
|
-
{ value: "AGENTS.md", label: "AGENTS.md (project root)" },
|
|
2654
|
-
{ value: ".claude/CLAUDE.md", label: ".claude/CLAUDE.md" }
|
|
2655
|
-
]
|
|
2656
|
-
});
|
|
2657
|
-
if (p6.isCancel(selected)) {
|
|
2658
|
-
p6.cancel("Cancelled.");
|
|
2659
|
-
return;
|
|
2660
|
-
}
|
|
2661
|
-
createPath = selected;
|
|
2662
|
-
}
|
|
2663
|
-
const fullPath = path5.resolve(cwd, createPath);
|
|
2664
|
-
const dir = path5.dirname(fullPath);
|
|
2665
|
-
if (!fs5.existsSync(dir)) {
|
|
2666
|
-
fs5.mkdirSync(dir, { recursive: true });
|
|
2667
|
-
}
|
|
2668
|
-
const projectName = path5.basename(cwd);
|
|
2669
|
-
const initialContent = `# ${projectName}
|
|
2670
|
-
|
|
2671
|
-
${skillContent}`;
|
|
2672
|
-
fs5.writeFileSync(fullPath, initialContent);
|
|
2673
|
-
p6.outro(`Created ${createPath} with Calabasas guidelines`);
|
|
2674
|
-
return;
|
|
2675
|
-
}
|
|
2676
|
-
let selectedFile;
|
|
2677
|
-
if (options.file) {
|
|
2678
|
-
const match = detectedFiles.find((f) => f.path === options.file);
|
|
2679
|
-
if (match) {
|
|
2680
|
-
selectedFile = match;
|
|
2681
|
-
} else {
|
|
2682
|
-
const fullPath = path5.resolve(cwd, options.file);
|
|
2683
|
-
const dir = path5.dirname(fullPath);
|
|
2684
|
-
if (!fs5.existsSync(dir)) {
|
|
2685
|
-
fs5.mkdirSync(dir, { recursive: true });
|
|
2686
|
-
}
|
|
2687
|
-
if (fs5.existsSync(fullPath)) {
|
|
2688
|
-
selectedFile = {
|
|
2689
|
-
path: options.file,
|
|
2690
|
-
fullPath,
|
|
2691
|
-
type: options.file.includes("CLAUDE") ? "CLAUDE.md" : "AGENTS.md"
|
|
2692
|
-
};
|
|
2693
|
-
} else {
|
|
2694
|
-
const projectName = path5.basename(cwd);
|
|
2695
|
-
const initialContent = `# ${projectName}
|
|
2696
|
-
|
|
2697
|
-
${skillContent}`;
|
|
2698
|
-
fs5.writeFileSync(fullPath, initialContent);
|
|
2699
|
-
p6.outro(`Created ${options.file} with Calabasas guidelines`);
|
|
2700
|
-
return;
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2703
|
-
} else if (detectedFiles.length === 1) {
|
|
2704
|
-
selectedFile = detectedFiles[0];
|
|
2705
|
-
} else {
|
|
2706
|
-
const selected = await p6.select({
|
|
2707
|
-
message: "Which file should receive the Calabasas guidelines?",
|
|
2708
|
-
options: detectedFiles.map((file) => ({
|
|
2709
|
-
value: file.path,
|
|
2710
|
-
label: file.path
|
|
2711
|
-
}))
|
|
2712
|
-
});
|
|
2713
|
-
if (p6.isCancel(selected)) {
|
|
2714
|
-
p6.cancel("Cancelled.");
|
|
2715
|
-
return;
|
|
2716
|
-
}
|
|
2717
|
-
selectedFile = detectedFiles.find((f) => f.path === selected);
|
|
2718
|
-
}
|
|
2719
|
-
const existingContent = fs5.readFileSync(selectedFile.fullPath, "utf8");
|
|
2720
|
-
if (hasCalabsasSection(existingContent)) {
|
|
2721
|
-
if (!options.yes) {
|
|
2722
|
-
const update = await p6.confirm({
|
|
2723
|
-
message: `Calabasas guidelines already exist in ${selectedFile.path}. Replace?`
|
|
2724
|
-
});
|
|
2725
|
-
if (p6.isCancel(update) || !update) {
|
|
2726
|
-
p6.cancel("Cancelled.");
|
|
2727
|
-
return;
|
|
2728
|
-
}
|
|
2729
|
-
}
|
|
2730
|
-
const sectionRegex = /## Calabasas Guidelines[\s\S]*?(?=\n## |\n# |$)/;
|
|
2731
|
-
const contentWithoutSection = existingContent.replace(sectionRegex, "").trimEnd();
|
|
2732
|
-
const newContent = `${contentWithoutSection}
|
|
2733
|
-
|
|
2734
|
-
${skillContent}`;
|
|
2735
|
-
fs5.writeFileSync(selectedFile.fullPath, newContent);
|
|
2736
|
-
p6.outro(`Updated Calabasas guidelines in ${selectedFile.path}`);
|
|
2737
|
-
} else {
|
|
2738
|
-
const separator = existingContent.endsWith(`
|
|
2739
|
-
`) ? `
|
|
2740
|
-
` : `
|
|
2741
|
-
|
|
2742
|
-
`;
|
|
2743
|
-
const newContent = `${existingContent}${separator}${skillContent}`;
|
|
2744
|
-
fs5.writeFileSync(selectedFile.fullPath, newContent);
|
|
2745
|
-
p6.outro(`Added Calabasas guidelines to ${selectedFile.path}`);
|
|
2621
|
+
const fullPath = path5.resolve(cwd, SKILL_PATH);
|
|
2622
|
+
const dir = path5.dirname(fullPath);
|
|
2623
|
+
if (!fs5.existsSync(dir)) {
|
|
2624
|
+
fs5.mkdirSync(dir, { recursive: true });
|
|
2746
2625
|
}
|
|
2626
|
+
fs5.writeFileSync(fullPath, skillContent);
|
|
2627
|
+
p6.outro(`Wrote Calabasas skill to ${SKILL_PATH}`);
|
|
2747
2628
|
}
|
|
2748
2629
|
|
|
2749
2630
|
// src/commands/add.ts
|
|
@@ -7834,7 +7715,7 @@ program2.command("logout").description("Clear stored credentials").option("--dev
|
|
|
7834
7715
|
program2.command("init").description("Initialize Calabasas config in your Convex project").action(init);
|
|
7835
7716
|
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);
|
|
7836
7717
|
program2.command("generate").description("Generate type-safe Discord handlers and helpers").option("-o, --output <path>", "Output path", "convex/calabasas/_generated/discord.ts").option("--dev", "Use development environment").option("--prod", "Use production environment").action(generate);
|
|
7837
|
-
program2.command("skill").description("Generate Calabasas
|
|
7718
|
+
program2.command("skill").description("Generate Calabasas skill for AI assistants").option("--dev", "Use development environment").option("--prod", "Use production environment").action(skill);
|
|
7838
7719
|
program2.command("add [components...]").description("Add Discord UI components to your project").action(add);
|
|
7839
7720
|
program2.command("migrate [name]").description("Run a codemod migration (list available if no name given)").action(migrate);
|
|
7840
7721
|
program2.command("config").description("View and modify your Calabasas config").option("-c, --config <path>", "Path to config file", "convex/calabasas/config.ts").option("-l, --list", "List current and available config options").option("--add-event <events...>", "Enable event handlers").option("--remove-event <events...>", "Disable event handlers").option("--add-sync <properties...>", "Enable sync properties").option("--remove-sync <properties...>", "Disable sync properties").action(config);
|