@@ -71,9 +71,64 @@ Example:
7171 RunE : runGenerateDeployment ,
7272}
7373
74+ var (
75+ agentsSpecDir string
76+ agentsTarget string
77+ agentsOutputDir string
78+ )
79+
80+ var generateAgentsCmd = & cobra.Command {
81+ Use : "agents" ,
82+ Short : "Generate agents from specs directory (simplified)" ,
83+ Long : `Generate platform-specific agents from a specs directory.
84+
85+ This is a simplified command that reads from specs/agents/*.md and uses
86+ specs/deployments/<target>.json to determine output locations.
87+
88+ The specs directory should contain:
89+ - agents/: Agent definitions (*.md with YAML frontmatter)
90+ - deployments/: Deployment definitions (*.json, defaults to local.json)
91+
92+ Example:
93+ assistantkit generate agents
94+ assistantkit generate agents --specs=specs --target=local --output=.` ,
95+ RunE : runGenerateAgents ,
96+ }
97+
98+ var (
99+ allSpecsDir string
100+ allTarget string
101+ allOutputDir string
102+ allPlatforms []string
103+ )
104+
105+ var generateAllCmd = & cobra.Command {
106+ Use : "all" ,
107+ Short : "Generate all plugin artifacts from a unified specs directory" ,
108+ Long : `Generate all platform-specific artifacts from a unified specs directory.
109+
110+ This command combines 'generate plugins' and 'generate agents' into a single
111+ operation. It reads all specs from a single directory and generates complete
112+ plugin packages for each platform.
113+
114+ The specs directory should contain:
115+ - plugin.json: Plugin metadata
116+ - commands/: Command definitions (*.md or *.json)
117+ - skills/: Skill definitions (*.md or *.json)
118+ - agents/: Agent definitions (*.md with YAML frontmatter)
119+ - deployments/: Deployment definitions (*.json)
120+
121+ Example:
122+ assistantkit generate all --specs=specs --target=local
123+ assistantkit generate all --specs=specs --target=local --output=. --platforms=claude,kiro,gemini` ,
124+ RunE : runGenerateAll ,
125+ }
126+
74127func init () {
75128 generateCmd .AddCommand (generatePluginsCmd )
76129 generateCmd .AddCommand (generateDeploymentCmd )
130+ generateCmd .AddCommand (generateAgentsCmd )
131+ generateCmd .AddCommand (generateAllCmd )
77132
78133 generatePluginsCmd .Flags ().StringVar (& specDir , "spec" , "plugins/spec" , "Path to canonical spec directory" )
79134 generatePluginsCmd .Flags ().StringVar (& outputDir , "output" , "plugins" , "Output directory for generated plugins" )
@@ -83,6 +138,15 @@ func init() {
83138 generateDeploymentCmd .Flags ().StringVar (& deploymentSpecDir , "specs" , "specs" , "Path to multi-agent-spec directory" )
84139 generateDeploymentCmd .Flags ().StringVar (& deploymentFile , "deployment" , "" , "Path to deployment definition file (required)" )
85140 _ = generateDeploymentCmd .MarkFlagRequired ("deployment" )
141+
142+ generateAgentsCmd .Flags ().StringVar (& agentsSpecDir , "specs" , "specs" , "Path to specs directory" )
143+ generateAgentsCmd .Flags ().StringVar (& agentsTarget , "target" , "local" , "Deployment target (looks for specs/deployments/<target>.json)" )
144+ generateAgentsCmd .Flags ().StringVar (& agentsOutputDir , "output" , "." , "Output base directory (repo root)" )
145+
146+ generateAllCmd .Flags ().StringVar (& allSpecsDir , "specs" , "specs" , "Path to unified specs directory" )
147+ generateAllCmd .Flags ().StringVar (& allTarget , "target" , "local" , "Deployment target (looks for specs/deployments/<target>.json)" )
148+ generateAllCmd .Flags ().StringVar (& allOutputDir , "output" , "." , "Output base directory (repo root)" )
149+ generateAllCmd .Flags ().StringSliceVar (& allPlatforms , "platforms" , []string {"claude" , "kiro" , "gemini" }, "Platforms to generate" )
86150}
87151
88152func runGenerateDeployment (cmd * cobra.Command , args []string ) error {
@@ -172,3 +236,106 @@ func runGeneratePlugins(cmd *cobra.Command, args []string) error {
172236 fmt .Println ("\n Done!" )
173237 return nil
174238}
239+
240+ func runGenerateAgents (cmd * cobra.Command , args []string ) error {
241+ // Resolve paths
242+ absSpecsDir , err := filepath .Abs (agentsSpecDir )
243+ if err != nil {
244+ return fmt .Errorf ("resolving specs dir: %w" , err )
245+ }
246+
247+ absOutputDir , err := filepath .Abs (agentsOutputDir )
248+ if err != nil {
249+ return fmt .Errorf ("resolving output dir: %w" , err )
250+ }
251+
252+ // Validate specs directory exists
253+ if _ , err := os .Stat (absSpecsDir ); os .IsNotExist (err ) {
254+ return fmt .Errorf ("specs directory not found: %s" , absSpecsDir )
255+ }
256+
257+ // Print header
258+ fmt .Println ("=== AssistantKit Agent Generator ===" )
259+ fmt .Printf ("Specs directory: %s\n " , absSpecsDir )
260+ fmt .Printf ("Target: %s\n " , agentsTarget )
261+ fmt .Printf ("Output directory: %s\n " , absOutputDir )
262+ fmt .Println ()
263+
264+ // Generate agents
265+ result , err := generate .Agents (absSpecsDir , agentsTarget , absOutputDir )
266+ if err != nil {
267+ return fmt .Errorf ("generating agents: %w" , err )
268+ }
269+
270+ // Print results
271+ fmt .Printf ("Team: %s\n " , result .TeamName )
272+ fmt .Printf ("Loaded: %d agents\n \n " , result .AgentCount )
273+
274+ fmt .Println ("Generated targets:" )
275+ for _ , target := range result .TargetsGenerated {
276+ dir := result .GeneratedDirs [target ]
277+ fmt .Printf (" - %s: %s\n " , target , dir )
278+ }
279+
280+ fmt .Println ("\n Done!" )
281+ return nil
282+ }
283+
284+ func runGenerateAll (cmd * cobra.Command , args []string ) error {
285+ // Resolve paths
286+ absSpecsDir , err := filepath .Abs (allSpecsDir )
287+ if err != nil {
288+ return fmt .Errorf ("resolving specs dir: %w" , err )
289+ }
290+
291+ absOutputDir , err := filepath .Abs (allOutputDir )
292+ if err != nil {
293+ return fmt .Errorf ("resolving output dir: %w" , err )
294+ }
295+
296+ // Validate specs directory exists
297+ if _ , err := os .Stat (absSpecsDir ); os .IsNotExist (err ) {
298+ return fmt .Errorf ("specs directory not found: %s" , absSpecsDir )
299+ }
300+
301+ // Print header
302+ fmt .Println ("=== AssistantKit Unified Generator ===" )
303+ fmt .Printf ("Specs directory: %s\n " , absSpecsDir )
304+ fmt .Printf ("Output directory: %s\n " , absOutputDir )
305+ fmt .Printf ("Target: %s\n " , allTarget )
306+ fmt .Printf ("Platforms: %s\n " , strings .Join (allPlatforms , ", " ))
307+ fmt .Println ()
308+
309+ // Step 1: Generate plugins (commands, skills, plugin manifest)
310+ pluginsOutputDir := filepath .Join (absOutputDir , "plugins" )
311+ fmt .Println ("1. Generating plugins (commands, skills, manifest)..." )
312+
313+ pluginResult , err := generate .Plugins (absSpecsDir , pluginsOutputDir , allPlatforms )
314+ if err != nil {
315+ return fmt .Errorf ("generating plugins: %w" , err )
316+ }
317+
318+ fmt .Printf (" Loaded: %d commands, %d skills\n " , pluginResult .CommandCount , pluginResult .SkillCount )
319+ for platform , dir := range pluginResult .GeneratedDirs {
320+ fmt .Printf (" Generated %s: %s\n " , platform , dir )
321+ }
322+ fmt .Println ()
323+
324+ // Step 2: Generate agents from deployment target
325+ fmt .Println ("2. Generating agents from deployment target..." )
326+
327+ agentResult , err := generate .Agents (absSpecsDir , allTarget , absOutputDir )
328+ if err != nil {
329+ return fmt .Errorf ("generating agents: %w" , err )
330+ }
331+
332+ fmt .Printf (" Team: %s\n " , agentResult .TeamName )
333+ fmt .Printf (" Loaded: %d agents\n " , agentResult .AgentCount )
334+ for _ , target := range agentResult .TargetsGenerated {
335+ dir := agentResult .GeneratedDirs [target ]
336+ fmt .Printf (" Generated %s: %s\n " , target , dir )
337+ }
338+
339+ fmt .Println ("\n Done!" )
340+ return nil
341+ }
0 commit comments