Skip to content

Commit f477698

Browse files
committed
ai agent open
1 parent e11fb2b commit f477698

File tree

3 files changed

+158
-14
lines changed

3 files changed

+158
-14
lines changed

commands/coldbox/ai/agents/help.cfc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ component excludeFromHelp=true extends="coldbox-cli.models.BaseCommand" {
2424
.greenLine( " coldbox ai agents remove <agent> Remove an agent configuration" )
2525
.greenLine( " coldbox ai agents list List configured agents" )
2626
.greenLine( " coldbox ai agents active <agent> Set the active agent" )
27+
.greenLine( " coldbox ai agents open [agent] Open agent config in editor" )
2728
.line()
2829
.yellowLine( "Examples:" )
2930
.line()
@@ -39,6 +40,9 @@ component excludeFromHelp=true extends="coldbox-cli.models.BaseCommand" {
3940
.dim( " ## See all configured agents" )
4041
.line( " coldbox ai agents list" )
4142
.line()
43+
.dim( " ## Open active agent config" )
44+
.line( " coldbox ai agents open" )
45+
.line()
4246
.line()
4347
.yellowLine( "Note: Each agent creates its own configuration file:" )
4448
.line( " Claude: CLAUDE.md" )
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/**
2+
* Open the active AI agent configuration file in your editor
3+
*
4+
* Examples:
5+
* coldbox ai agents open
6+
* coldbox ai agents open claude (open specific agent config)
7+
*/
8+
component extends="coldbox-cli.models.BaseAICommand" {
9+
10+
// DI
11+
property name="agentRegistry" inject="AgentRegistry@coldbox-cli";
12+
13+
/**
14+
* Run the command
15+
*
16+
* @agent Optional agent name to open (defaults to active agent)
17+
* @directory The target directory (defaults to current directory)
18+
*/
19+
function run(
20+
string agent = "",
21+
string directory = getCwd()
22+
){
23+
showColdBoxBanner( "Open Agent Config" )
24+
25+
var info = ensureInstalled( arguments.directory )
26+
var manifest = loadManifest( arguments.directory )
27+
28+
print.line()
29+
30+
// Determine which agent to open
31+
var agentToOpen = ""
32+
33+
if ( arguments.agent.len() ) {
34+
// Specific agent requested
35+
agentToOpen = arguments.agent
36+
37+
// Check if agent is configured
38+
if ( !info.agents.find( agentToOpen ) ) {
39+
printError( "Agent '#agentToOpen#' is not configured." )
40+
print.line()
41+
printTip( "Use 'coldbox ai agents list' to see configured agents" )
42+
printTip( "Use 'coldbox ai agents add #agentToOpen#' to add this agent" )
43+
return
44+
}
45+
} else {
46+
// Use active agent
47+
var activeAgent = manifest.activeAgent ?: "none"
48+
49+
if ( activeAgent == "none" ) {
50+
printWarn( "No active agent is set." )
51+
print.line()
52+
53+
// If only one agent configured, use it
54+
if ( info.agents.len() == 1 ) {
55+
agentToOpen = info.agents[ 1 ]
56+
printInfo( "Opening configured agent: #agentToOpen#" )
57+
print.line()
58+
} else if ( info.agents.len() > 1 ) {
59+
// Prompt to select
60+
agentToOpen = multiSelect( "Which agent configuration would you like to open?" )
61+
.options(
62+
info.agents.map( ( agent ) => {
63+
return {
64+
display : agent,
65+
value : agent
66+
}
67+
} )
68+
)
69+
.required()
70+
.ask()
71+
72+
if ( !agentToOpen.len() ) {
73+
return
74+
}
75+
} else {
76+
printError( "No agents configured yet." )
77+
print.line()
78+
printTip( "Use 'coldbox ai agents add' to configure AI agents" )
79+
return
80+
}
81+
} else {
82+
agentToOpen = activeAgent
83+
}
84+
}
85+
86+
// Get the config file path
87+
var configPath = variables.agentRegistry.getAgentConfigPath( arguments.directory, agentToOpen )
88+
89+
// Check if file exists
90+
if ( !fileExists( configPath ) ) {
91+
printError( "Agent config file not found: #configPath#" )
92+
print.line()
93+
printTip( "Run 'coldbox ai refresh' to regenerate agent configuration files" )
94+
return
95+
}
96+
97+
// Open the file
98+
printInfo( "Opening #agentToOpen# configuration..." )
99+
print.line()
100+
openPath( configPath )
101+
}
102+
103+
}

commands/coldbox/create/help.cfc

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,57 @@
11
component excludeFromHelp=true extends="coldbox-cli.models.BaseCommand" {
22

33
function run(){
4-
showColdBoxBanner()
5-
variables.print
6-
.line()
7-
.blue( "The " )
8-
.boldblue( "coldbox create" )
9-
.blueLine( " namespace allows you to quickly scaffold applications " )
10-
.blueLine( "and individual app pieces. Use these commands to stub out placeholder files" )
11-
.blue( "as you plan your application. Most commands create a single file, but """ )
12-
.boldblue( "coldbox create app" )
13-
.blueLine( """" )
14-
.blueLine( "will generate an entire, working application into an empty folder for you. Type help before" )
15-
.blueLine( "any command name to get additional information on how to call that specific command." )
16-
.line()
17-
.line();
4+
showColdBoxBanner( "Code Generation" )
5+
print.line();
6+
print
7+
.boldCyan( "ColdBox Code Generation Commands" )
8+
.line()
9+
.line()
10+
.whiteLine( "Scaffold complete applications or individual components with intelligent code generation" )
11+
.line()
12+
.boldWhiteLine( "Application Scaffolding:" )
13+
.line()
14+
.greenLine( " coldbox create app-wizard Interactive wizard to create a new application" )
15+
.greenLine( " coldbox create app Create an application with manual options" )
16+
.greenLine( " coldbox create module Create a ColdBox module" )
17+
.line()
18+
.boldWhiteLine( "MVC Components:" )
19+
.line()
20+
.greenLine( " coldbox create handler Create an event handler (controller)" )
21+
.greenLine( " coldbox create model Create a model (service/bean)" )
22+
.greenLine( " coldbox create view Create a view template" )
23+
.greenLine( " coldbox create layout Create a layout template" )
24+
.greenLine( " coldbox create interceptor Create an interceptor (AOP)" )
25+
.line()
26+
.boldWhiteLine( "REST & Resources:" )
27+
.line()
28+
.greenLine( " coldbox create resource Create a complete RESTful resource (handler + routes)" )
29+
.greenLine( " coldbox create orm-crud Create CRUD handler for an ORM entity" )
30+
.greenLine( " coldbox create orm-entity Create an ORM entity" )
31+
.line()
32+
.boldWhiteLine( "Testing:" )
33+
.line()
34+
.greenLine( " coldbox create integration-test Create an integration test" )
35+
.greenLine( " coldbox create unit-test Create a unit test" )
36+
.greenLine( " coldbox create bdd Create a BDD test spec" )
37+
.line()
38+
.yellowLine( "Examples:" )
39+
.line()
40+
.dim( " ## Create new app interactively" )
41+
.line( " coldbox create app-wizard" )
42+
.line()
43+
.dim( " ## Create a handler with views" )
44+
.line( " coldbox create handler Users --views=index,show,edit" )
45+
.line()
46+
.dim( " ## Create a RESTful resource" )
47+
.line( " coldbox create resource api.Products" )
48+
.line()
49+
.dim( " ## Create a service with tests" )
50+
.line( " coldbox create model services.UserService --tests" )
51+
.line()
52+
.line()
53+
.yellowLine( "Tip: Type 'coldbox create <command> --help' for detailed command options" )
54+
.line()
1855
}
1956

2057
}

0 commit comments

Comments
 (0)