Skip to content

cu configure#137

Merged
aluzzardi merged 45 commits intodagger:mainfrom
kpenfound:configure
Jul 9, 2025
Merged

cu configure#137
aluzzardi merged 45 commits intodagger:mainfrom
kpenfound:configure

Conversation

@kpenfound
Copy link
Contributor

@kpenfound kpenfound commented Jun 26, 2025

Paired on this with Warp.

An interactive experience to configure your agent with container-use

Currently supports:

  • Claude Code
  • Goose
  • Cursor
  • Codex
  • Amazon Q

Leaving other agents out for now to get this POC in. Some agents require the user to configure things in a UI instead of an easily editable config file.

The interactive UI uses bubbletea for a nice experience.

This should add container use to your existing agent configuration, or create a configuration that enables container use. If container use is already configured, we should not break that. This should be able to run multiple times.

Bonus: I ran into some errors with environment_file_read and fixed naming consistency and range validation on this branch

kpenfound added 12 commits June 26, 2025 15:48
Creating environment to implement the cu configure subcommand for automatic MCP server configuration
Adding Go development tools for implementing the configure command
Adding configure command to support automatic MCP server configuration for different agents
Fixed missing comma after Long field on line 13
Updating to Go 1.24 to meet the go.mod requirements
Removed unused imports and variables, added proper error messages for unimplemented functions
Implementing full configuration logic for all agents based on README specifications
Removing TOML dependency and simplifying Codex configuration to just print instructions
Fixed syntax error in VSCode configuration function and implemented interactive agent selection
Removed unused strings import
Updated Goose configuration to use a generic map to preserve all YAML data
Updated Goose configuration to use proper interface types for compatibility with YAML marshaling
@aluzzardi
Copy link
Contributor

There's a couple of features from #105 you may want to consider porting here. Maybe.

  • Play nice with existing rule files. Like, append to the rules file and use a markdown marker as delimiter to be re-entrant (e.g. on next run, update only the container-use instructions)
  • Agent Auto-Detection with Manual Override: oftentimes we can guess the user's agent (.cursor, .claude, CLAUDE.md, ...) and not ask the user
  • Auto-Approve MCP tools

As a nit, there's no need to download any files from cu configure, the rules are available in a go embed (rules.AGENT or something?)

kpenfound added 17 commits July 3, 2025 16:03
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
…TOML configuration updates like configureGoose does.
… the TOML configuration file, similar to configureGoose.
Signed-off-by: kpenfound <kyle@dagger.io>
…nterface by replacing the interactiveConfiguration function.
…t names without icons to avoid any branding concerns.
…lusive

Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
@kpenfound kpenfound marked this pull request as ready for review July 3, 2025 21:55
@kpenfound
Copy link
Contributor Author

@aluzzardi this should play nice with existing rules files now

  • auto detection makes sense, should be easy enough to check for local configs. Maybe an additional "auto" option in the interactive flow to update all local configs for container-use?
  • I added the auto-approve configs for codex to try it out. I need to double check the configurations for the other agents
  • yeah i can definitely embed the rules files, thats a good call

Copy link
Contributor

@aluzzardi aluzzardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Left a bunch of minor comments

Also, question: should this be cu configure or cu mcp configure or cu agent configure? Concerned about "giving away" the top-level configure command which could be used to configure the environment itself?

Short: "Configure MCP server for different agents",
Long: `Setup the container-use MCP server according to the specified agent including Claude Code, Goose, Cursor, and others.`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably open the repository at this point (to make sure we're actually in a repo) and also get the repo.SourcePath() and make sure all commands are relative to this path?

e.g. it's filepath.Join(repo.SourcePath(), ".cursor", ...) rather than just .cursor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also may want to let the user select between local and global. ./.cursor vs ~/.cursor

kpenfound added 8 commits July 3, 2025 21:55
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
@aluzzardi
Copy link
Contributor

Naming:

cu config agent makes sense to me (no strong opinion though)

not sure about cu config env since it (at least in the current implementation) has a bunch of sub-commands: e.g. base-image set, env set ... and cu config env env set would be weird :D

But:

  • cu config agent <-- this PR
  • cu config base-image set <-- the other PR
  • cu config secret add <-- soon to be PR
  • cu config <-- interactive

Makes sense I think?

Signed-off-by: kpenfound <kyle@dagger.io>
@kpenfound
Copy link
Contributor Author

@aluzzardi agreed, I'll move the configure command and add an interactive entrypoint for cu config

@cwlbraa
Copy link
Contributor

cwlbraa commented Jul 8, 2025

can we get some sort of manual test harness for this? like maybe something that plops out a gitignored directory full of freshly configured empty git repos and best-effort opens a bajillion agent apps?

(trying to be productive about the fact i hate how untestable this is lol)

kpenfound added 6 commits July 9, 2025 14:53
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
…'agent' and add it as a subcommand of config instead of root.
@kpenfound
Copy link
Contributor Author

Added tests and moved cu configure [agent] to cu config agent [agent]

Signed-off-by: kpenfound <kyle@dagger.io>
@aluzzardi aluzzardi merged commit 7e0de4a into dagger:main Jul 9, 2025
3 checks passed
gsnaiper pushed a commit to gsnaiper/container-use that referenced this pull request Nov 19, 2025
* Create env upward-mule

Creating environment to implement the cu configure subcommand for automatic MCP server configuration

* Update env upward-mule

Adding Go development tools for implementing the configure command

* Write cmd/cu/configure.go

Adding configure command to support automatic MCP server configuration for different agents

* Write cmd/cu/configure.go

Fixed missing comma after Long field on line 13

* Update env upward-mule

Updating to Go 1.24 to meet the go.mod requirements

* Write cmd/cu/configure.go

Removed unused imports and variables, added proper error messages for unimplemented functions

* Write cmd/cu/configure.go

Implementing full configuration logic for all agents based on README specifications

* Write cmd/cu/configure.go

Removing TOML dependency and simplifying Codex configuration to just print instructions

* Write cmd/cu/configure.go

Fixed syntax error in VSCode configuration function and implemented interactive agent selection

* Write cmd/cu/configure.go

Removed unused strings import

* Write cmd/cu/configure.go

Updated Goose configuration to use a generic map to preserve all YAML data

* Write cmd/cu/configure.go

Updated Goose configuration to use proper interface types for compatibility with YAML marshaling

* reduce selections to claude, goose, cursor, codex, amazonq

Signed-off-by: kpenfound <kyle@dagger.io>

* Creating environment to modify the configureCodex function to handle TOML configuration updates like configureGoose does.

* Adding a TOML library to handle TOML configuration files.

* Updating the configure.go file to make configureCodex actually modify the TOML configuration file, similar to configureGoose.

* Formatting the code to ensure it follows Go conventions.

* add autoapprove to codex config

Signed-off-by: kpenfound <kyle@dagger.io>

* Adding bubbletea dependency for the improved interactive interface.

* Creating a new file for the bubbletea interactive interface for agent selection.

* Creating the bubbletea interactive UI for agent selection with a modern, colorful interface.

* Updating the configure.go file to use the new bubbletea interactive interface by replacing the interactiveConfiguration function.

* Formatting the Go code to ensure it follows proper style guidelines.

* Removing icons from the agent selection interface - just showing agent names without icons to avoid any branding concerns.

* FileRead: rename start_line_one_indexed to start_line_one_indexed_inclusive

Signed-off-by: kpenfound <kyle@dagger.io>

* FileRead: improve invalid range error handling

Signed-off-by: kpenfound <kyle@dagger.io>

* update agent descriptions

Signed-off-by: kpenfound <kyle@dagger.io>

* embedded rules files, loaded mcp tools, and added todos

Signed-off-by: kpenfound <kyle@dagger.io>

* configure claude allow list

Signed-off-by: kpenfound <kyle@dagger.io>

* claude double underscore

Signed-off-by: kpenfound <kyle@dagger.io>

* make configure re-entrant

Signed-off-by: kpenfound <kyle@dagger.io>

* refactor configurable agents into interface

Signed-off-by: kpenfound <kyle@dagger.io>

* fix lints

Signed-off-by: kpenfound <kyle@dagger.io>

* update configs to be local where possible

Signed-off-by: kpenfound <kyle@dagger.io>

* rename container-use binary

Signed-off-by: kpenfound <kyle@dagger.io>

* add tests for configure tasks

Signed-off-by: kpenfound <kyle@dagger.io>

* merge main conflict

Signed-off-by: kpenfound <kyle@dagger.io>

* Creating environment to restructure the configure subcommand to be accessible via config agent instead.

* Creating a new config.go file that will contain the parent config command.

* Updating configure.go to change the command name from 'configure' to 'agent' and add it as a subcommand of config instead of root.

* better configure tests

Signed-off-by: kpenfound <kyle@dagger.io>

---------

Signed-off-by: kpenfound <kyle@dagger.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants