Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
**/.cursor/commands/ai-rules/
**/.cursor/mcp.json
**/.cursor/rules/
**/.cursor/skills/ai-rules-generated-*
**/.firebender/skills/ai-rules-generated-*
**/.gemini/settings.json
**/.mcp.json
Expand Down
21 changes: 13 additions & 8 deletions src/agents/amp.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::agents::amp_command_generator::AmpCommandGenerator;
use crate::agents::command_generator::CommandGeneratorTrait;
use crate::agents::external_commands_generator::ExternalCommandsGenerator;
use crate::agents::external_skills_generator::ExternalSkillsGenerator;
use crate::agents::rule_generator::AgentRuleGenerator;
use crate::agents::single_file_based::{
check_in_sync, clean_generated_files, generate_agent_file_contents,
};
use crate::agents::skills_generator::SkillsGeneratorTrait;
use crate::constants::{AGENTS_MD_FILENAME, AMP_SKILLS_DIR};
use crate::constants::{AGENTS_MD_FILENAME, AMP_COMMANDS_DIR, AMP_SKILLS_DIR};
use crate::models::SourceFile;
use crate::utils::file_utils::{check_agents_md_symlink, create_symlink_to_agents_md};
use anyhow::Result;
Expand Down Expand Up @@ -59,7 +59,7 @@ impl AgentRuleGenerator for AmpGenerator {
}

fn command_generator(&self) -> Option<Box<dyn CommandGeneratorTrait>> {
Some(Box::new(AmpCommandGenerator))
Some(Box::new(ExternalCommandsGenerator::new(AMP_COMMANDS_DIR)))
}

fn skills_generator(&self) -> Option<Box<dyn SkillsGeneratorTrait>> {
Expand Down Expand Up @@ -104,13 +104,18 @@ mod tests {

let generator = AmpGenerator;
let cmd_gen = generator.command_generator().unwrap();
let files = cmd_gen.generate_commands(temp_dir.path());

assert_eq!(files.len(), 1);
// generate_command_symlinks creates symlinks (flat structure with -ai-rules.md suffix)
let symlinks = cmd_gen.generate_command_symlinks(temp_dir.path()).unwrap();
assert_eq!(symlinks.len(), 1);

// Verify frontmatter is stripped
let (_, content) = files.iter().next().unwrap();
assert!(!content.contains("---"));
// Verify symlink was created with correct naming
let symlink_path = temp_dir.path().join(".agents/commands/test-ai-rules.md");
assert!(symlink_path.is_symlink());

// Verify symlink points to source with frontmatter preserved
let content = fs::read_to_string(&symlink_path).unwrap();
assert!(content.contains("---"));
assert!(content.contains("Command content"));
}
}
240 changes: 0 additions & 240 deletions src/agents/amp_command_generator.rs

This file was deleted.

12 changes: 9 additions & 3 deletions src/agents/claude.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use crate::agents::claude_command_generator::ClaudeCommandGenerator;
use crate::agents::command_generator::CommandGeneratorTrait;
use crate::agents::external_commands_generator::ExternalCommandsGenerator;
use crate::agents::external_skills_generator::ExternalSkillsGenerator;
use crate::agents::mcp_generator::{ExternalMcpGenerator, McpGeneratorTrait};
use crate::agents::rule_generator::AgentRuleGenerator;
use crate::agents::skills_generator::SkillsGeneratorTrait;
use crate::constants::{CLAUDE_MCP_JSON, CLAUDE_SKILLS_DIR, GENERATED_FILE_PREFIX};
use crate::constants::{
CLAUDE_COMMANDS_DIR, CLAUDE_COMMANDS_SUBDIR, CLAUDE_MCP_JSON, CLAUDE_SKILLS_DIR,
GENERATED_FILE_PREFIX,
};
use crate::models::source_file::SourceFile;
use crate::operations::{
claude_skills, generate_all_rule_references, generate_required_rule_references,
Expand Down Expand Up @@ -137,7 +140,10 @@ impl AgentRuleGenerator for ClaudeGenerator {
}

fn command_generator(&self) -> Option<Box<dyn CommandGeneratorTrait>> {
Some(Box::new(ClaudeCommandGenerator))
Some(Box::new(ExternalCommandsGenerator::with_subdir(
CLAUDE_COMMANDS_DIR,
CLAUDE_COMMANDS_SUBDIR,
)))
}

fn skills_generator(&self) -> Option<Box<dyn SkillsGeneratorTrait>> {
Expand Down
Loading