Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions cmd/optiqor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ var errFindings = errors.New("optiqor: findings exceed threshold")

var version = "dev"

const accuracyDisclosure = "Sandbox accuracy: ±40%. Install the Optiqor agent for exact numbers (optiqor.dev/get)."

func main() {
err := newRootCmd().Execute()
switch {
Expand Down Expand Up @@ -71,7 +69,7 @@ As a bonus, it also flags obvious security misconfigurations it spots while
parsing your chart (runAsRoot, :latest tags, missing securityContext, host
namespaces, etc.). Cost is the headline; security is a side-effect.

` + accuracyDisclosure,
` + htmlrender.AccuracyDisclosure,
Example: ` # Analyze a Helm chart directory
optiqor analyze ./my-chart

Expand Down Expand Up @@ -147,7 +145,7 @@ func newAnalyzeCmd() *cobra.Command {
inefficiencies. Obvious security misconfigurations are flagged as a bonus
side-effect of parsing — they are not the headline feature.

` + accuracyDisclosure,
` + htmlrender.AccuracyDisclosure,
Example: ` optiqor analyze ./my-chart
optiqor analyze ./values.yaml --json
optiqor analyze ./chart --severity=med --fail-on=high
Expand Down
4 changes: 3 additions & 1 deletion cmd/optiqor/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"bytes"
"strings"
"testing"

"github.com/optiqor/optiqor-cli/pkg/htmlrender"
)

// TestRoot_Help just exercises the top-level cobra wiring; ensures we
Expand All @@ -19,7 +21,7 @@ func TestRoot_Help(t *testing.T) {
for _, want := range []string{
"analyze",
"demo",
accuracyDisclosure,
htmlrender.AccuracyDisclosure,
"Examples:",
"optiqor analyze",
"--no-color",
Expand Down
5 changes: 3 additions & 2 deletions internal/analyze/diff_render.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/optiqor/optiqor-cli/internal/render"
"github.com/optiqor/optiqor-cli/internal/render/style"
"github.com/optiqor/optiqor-cli/pkg/htmlrender"
"github.com/optiqor/optiqor-cli/pkg/parser"
)

Expand Down Expand Up @@ -53,7 +54,7 @@ func (r DiffReport) WriteText(w io.Writer, opts render.Options) error {
t.Muted.Render("(±40%)"),
)
}
fmt.Fprintf(&b, " %s\n", t.Disclosure.Render(render.AccuracyDisclosure))
fmt.Fprintf(&b, " %s\n", t.Disclosure.Render(htmlrender.AccuracyDisclosure))

_, err := io.WriteString(w, b.String())
return err
Expand All @@ -70,7 +71,7 @@ func (r DiffReport) WriteJSON(w io.Writer) error {
Entries []DiffEntry `json:"entries"`
MonthlyUSDDelta float64 `json:"monthly_usd_delta"`
}{
AccuracyDisclosure: render.AccuracyDisclosure,
AccuracyDisclosure: htmlrender.AccuracyDisclosure,
A: r.A,
B: r.B,
Entries: r.Entries,
Expand Down
5 changes: 3 additions & 2 deletions internal/analyze/score_render.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/optiqor/optiqor-cli/internal/render"
"github.com/optiqor/optiqor-cli/internal/render/style"
"github.com/optiqor/optiqor-cli/pkg/htmlrender"
)

const scoreDefaultWidth = 78
Expand Down Expand Up @@ -132,7 +133,7 @@ func writeScorePenalties(b *strings.Builder, t style.Theme, s Score) {

func writeScoreFooter(b *strings.Builder, t style.Theme, width int) {
fmt.Fprintf(b, "%s\n", t.DividerLine(width))
fmt.Fprintf(b, " %s\n", t.Disclosure.Render(render.AccuracyDisclosure))
fmt.Fprintf(b, " %s\n", t.Disclosure.Render(htmlrender.AccuracyDisclosure))
fmt.Fprintf(b, " %s %s\n",
t.Muted.Render("Calibration:"),
t.Muted.Render("static benchmark distribution; agent install unlocks live percentile vs your fleet."),
Expand All @@ -149,7 +150,7 @@ func (s Score) WriteJSON(w io.Writer) error {
AccuracyDisclosure string `json:"accuracy_disclosure"`
Score Score `json:"score_report"`
}{
AccuracyDisclosure: render.AccuracyDisclosure,
AccuracyDisclosure: htmlrender.AccuracyDisclosure,
Score: s,
})
}
Expand Down
10 changes: 4 additions & 6 deletions internal/render/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ import (
"github.com/charmbracelet/lipgloss"

"github.com/optiqor/optiqor-cli/internal/render/style"
"github.com/optiqor/optiqor-cli/pkg/htmlrender"
"github.com/optiqor/optiqor-cli/pkg/rules"
)

// AccuracyDisclosure is the mandatory line every output must contain.
const AccuracyDisclosure = "Sandbox accuracy: ±40%. Install the Optiqor agent for exact numbers (optiqor.dev/get)."

// Brand strings used in the header banner.
const (
BrandName = "optiqor"
Expand Down Expand Up @@ -225,7 +223,7 @@ func writeSummary(b *strings.Builder, t style.Theme, r Report, costCount, secCou
if secCount > 0 {
rows = append(rows, [2]string{
"Security",
t.Muted.Render(plural(secCount, "finding", "findings")+" — bonus, surfaced while parsing"),
t.Muted.Render(plural(secCount, "finding", "findings") + " — bonus, surfaced while parsing"),
})
}

Expand Down Expand Up @@ -584,7 +582,7 @@ func writeFooter(b *strings.Builder, t style.Theme, width int, totalCents int64,
}
// Accuracy disclosure is mandatory and exact (CLAUDE.md hard rule).
// Roast can add a quip BELOW it; it never replaces it.
fmt.Fprintf(b, "%s%s\n", contentIndent, t.Disclosure.Render(AccuracyDisclosure))
fmt.Fprintf(b, "%s%s\n", contentIndent, t.Disclosure.Render(htmlrender.AccuracyDisclosure))
linkLabel := t.CallToLink.Render("optiqor.dev/get")
fmt.Fprintf(b, "%s%s %s\n", contentIndent,
t.Muted.Render("→ install the agent for exact numbers:"),
Expand Down Expand Up @@ -613,7 +611,7 @@ func JSON(w io.Writer, r Report) error {
MonthlySavingsUSD float64 `json:"monthly_savings_usd"`
AnnualSavingsUSD float64 `json:"annual_savings_usd"`
}{
AccuracyDisclosure: AccuracyDisclosure,
AccuracyDisclosure: htmlrender.AccuracyDisclosure,
Source: r.Source,
Workloads: r.Workloads,
Findings: r.Findings,
Expand Down
7 changes: 4 additions & 3 deletions internal/render/text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
"testing"

"github.com/optiqor/optiqor-cli/pkg/htmlrender"
"github.com/optiqor/optiqor-cli/pkg/rules"
)

Expand Down Expand Up @@ -66,7 +67,7 @@ func TestText_PlainAlwaysIncludesAccuracyDisclosure(t *testing.T) {
if err := Text(&buf, r, Options{Color: false}); err != nil {
t.Fatalf("Text(%s): %v", r.Source, err)
}
if !strings.Contains(buf.String(), AccuracyDisclosure) {
if !strings.Contains(buf.String(), htmlrender.AccuracyDisclosure) {
t.Fatalf("Text(%s): missing accuracy disclosure:\n%s", r.Source, buf.String())
}
}
Expand All @@ -81,7 +82,7 @@ func TestText_ColoredAlwaysIncludesAccuracyDisclosure(t *testing.T) {
t.Fatal(err)
}
stripped := stripANSI(buf.String())
if !strings.Contains(stripped, AccuracyDisclosure) {
if !strings.Contains(stripped, htmlrender.AccuracyDisclosure) {
t.Fatalf("colored output missing disclosure (stripped):\n%s", stripped)
}
}
Expand Down Expand Up @@ -193,7 +194,7 @@ func TestJSON_IncludesDisclosureAndShape(t *testing.T) {
if err := json.Unmarshal(buf.Bytes(), &got); err != nil {
t.Fatalf("decode: %v\nbody=%s", err, buf.String())
}
if got.AccuracyDisclosure != AccuracyDisclosure {
if got.AccuracyDisclosure != htmlrender.AccuracyDisclosure {
t.Errorf("disclosure missing or wrong: %q", got.AccuracyDisclosure)
}
if got.MonthlySavingsUSD != 1.0 {
Expand Down
Loading