Skip to content
Open
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
17 changes: 7 additions & 10 deletions cli/cmd/initialize/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,14 @@ func InitCmd(ch *cmdutil.Helper) *cobra.Command {

// If a project already exists, we allow adding agent files via --agent, but no other changes.
if cmdutil.HasRillProject(projectPath) {
if explicitAgent {
if numFlags > 1 {
return fmt.Errorf("when adding agent instructions to an existing project, --agent must be the only flag set")
}
repo, _, err := cmdutil.RepoForProjectPath(projectPath)
if err != nil {
return fmt.Errorf("failed to open project: %w", err)
}
return writeAgentInstructions(cmd.Context(), ch, repo, agent)
if !explicitAgent || numFlags > 1 {
return fmt.Errorf("init failed because a Rill project already exists at %q (hint: only the --agent flag is supported for updating an existing project)", projectPath)
}
repo, _, err := cmdutil.RepoForProjectPath(projectPath)
if err != nil {
return fmt.Errorf("failed to open project: %w", err)
}
return fmt.Errorf("a Rill project already exists at %q (use --agent to update agent instructions)", projectPath)
return writeAgentInstructions(cmd.Context(), ch, repo, agent)
}

// In interactive mode, if no flags were provided, we prompt for input.
Expand Down
Loading