feat: implement AI-assisted rename prompting feature
- Added data model for AI-assisted renaming including structures for prompts, responses, and policies. - Created implementation plan detailing the integration of Google Genkit into the CLI for renaming tasks. - Developed quickstart guide for setting up and using the new AI rename functionality. - Documented research decisions regarding Genkit orchestration and prompt composition. - Established tasks for phased implementation, including setup, foundational work, and user stories. - Implemented contract tests to ensure AI rename policies and ledger metadata are correctly applied. - Developed integration tests for validating AI rename flows, including preview, apply, and undo functionalities. - Added tooling to pin Genkit dependency for consistent builds.
This commit is contained in:
@@ -3,6 +3,7 @@ package output
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// plainFormatter emits one entry per line suitable for piping into other tools.
|
||||
@@ -26,3 +27,41 @@ func (plainFormatter) WriteSummary(w io.Writer, summary Summary) error {
|
||||
_, err := fmt.Fprintln(w, DefaultSummaryLine(summary))
|
||||
return err
|
||||
}
|
||||
|
||||
// WriteAIPlanDebug emits prompt hashes and warnings to the provided writer.
|
||||
func WriteAIPlanDebug(w io.Writer, promptHash string, warnings []string) {
|
||||
if w == nil {
|
||||
return
|
||||
}
|
||||
if promptHash != "" {
|
||||
fmt.Fprintf(w, "Prompt hash: %s\n", promptHash)
|
||||
}
|
||||
for _, warning := range warnings {
|
||||
if strings.TrimSpace(warning) == "" {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(w, "%s\n", warning)
|
||||
}
|
||||
}
|
||||
|
||||
// PolicyViolationMessage describes a single policy failure for display purposes.
|
||||
type PolicyViolationMessage struct {
|
||||
Original string
|
||||
Proposed string
|
||||
Rule string
|
||||
Message string
|
||||
}
|
||||
|
||||
// WritePolicyViolations prints detailed policy failure information to the writer.
|
||||
func WritePolicyViolations(w io.Writer, violations []PolicyViolationMessage) {
|
||||
if w == nil {
|
||||
return
|
||||
}
|
||||
for _, violation := range violations {
|
||||
rule := violation.Rule
|
||||
if rule == "" {
|
||||
rule = "policy"
|
||||
}
|
||||
fmt.Fprintf(w, "Policy violation (%s): %s -> %s (%s)\n", rule, violation.Original, violation.Proposed, violation.Message)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user