Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoid restating the short description; the second sentence now adds new information (file or stdin) rather than repeating. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
loadInputFromFile now delegates to loadInput after opening the file, eliminating the duplicated JSON unmarshal logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @tooky's task in 2m 39s —— View job PR Review:
|
- Remove duplicate Slice 3 entry in TODO.md - Broaden parent evaluate command description to cover both API-backed trail evaluation and local input evaluation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Addressed the review feedback in 841836c: 1. TODO.md duplicate — Removed the unchecked duplicate Slice 3 line. 2. Parent
3. Flag registration duplication — Left as-is per the review (non-blocking). Three flags registered by hand is simpler than embedding 4. |
| type evaluateInputOptions struct { | ||
| inputFile string | ||
| policyFile string | ||
| output string | ||
| showInput bool | ||
| } |
There was a problem hiding this comment.
Nit / future consideration: evaluateTrailOptions embeds commonEvaluateOptions and calls addFlags() to register the shared flags (policy, output, show-input). This struct re-declares those same three fields, and lines 62-64 duplicate the registration.
One option to avoid the duplication while keeping evaluate input free of the API-specific flags:
type evaluateInputOptions struct {
commonEvaluateOptions
inputFile string
}Then in newEvaluateInputCmd, call o.addFlags(cmd, "...") and hide the flags that don't apply:
o.addFlags(cmd, "Path to a Rego policy file to evaluate against the input.")
cmd.Flags().StringVarP(&o.inputFile, "input-file", "i", "", "...")
// hide API-only flags
cmd.Flags().Lookup("flow").Hidden = true
cmd.Flags().Lookup("attestations").Hidden = trueOverride RequireFlags to only require "policy" (not "flow").
This is the same observation from the earlier review comment — just fleshing out a concrete approach. Not blocking.
| var err error | ||
|
|
||
| if o.inputFile == "" { | ||
| input, err = loadInput(os.Stdin) |
There was a problem hiding this comment.
Minor: os.Stdin is a package-level global, which makes this path harder to test in isolation (the suite test for "missing --input-file reads from stdin" relies on the process stdin being empty). Consider accepting the reader as a parameter to run() — e.g. injecting cmd.InOrStdin() — so a future test could supply a non-empty stdin without touching the global.
Not blocking for this slice, since the empty-stdin error path is already tested.
|
From Alex — feedback on This is a strong addition that directly addresses a gap we've been working around in the agentic SDLC demo. We run 10 control gates in CI, each calling How we'd use this immediately:
A few suggestions:
Implementation looks clean — good reuse of |
Summary
kosli evaluate input— evaluate a local JSON file (or stdin) against a Rego policy, with no API dependencyPrompted by this discussion where we realised
kosli evaluate trailalways hits the API, so there's no way to iterate on policies locally. Dan raised conftest as the alternative, but our tooling should support this natively — Rego is our language choice, and local testing should be turnkey.In response to Alex's comparison of Rego vs pipeline controls — as more controls move into
kosli evaluate, a fast local feedback loop becomes essential.Usage
Test plan
go test -v -run TestEvaluateInputCommandTestSuite ./cmd/kosli/)loadInput(io.Reader)unit tests passmake lintcleankosli evaluate input --helpshows expected output--show-inputJSON against a policy🤖 Generated with Claude Code