mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 20:34:19 +00:00
fix(log): --stats --cmd audit now reads audit.log instead of operations.log
runLogStats() only checked the --audit flag to pick the log file, ignoring filter.Cmd. This caused `log --stats --cmd audit` to read operations.log and report "No log entries" even when audit data existed. Align with runLog() by also checking f.Cmd == "audit".
This commit is contained in:
@@ -245,7 +245,7 @@ Examples:
|
||||
|
||||
func runLogStats(configPath string, auditOnly bool, f oplog.Filter) error {
|
||||
filename := oplog.OpsFile
|
||||
if auditOnly {
|
||||
if auditOnly || f.Cmd == "audit" {
|
||||
filename = oplog.AuditFile
|
||||
}
|
||||
|
||||
|
||||
@@ -464,6 +464,26 @@ targets:
|
||||
result.AssertOutputContains(t, "OK:")
|
||||
}
|
||||
|
||||
func TestLog_StatsCmdAuditReadsAuditLog(t *testing.T) {
|
||||
sb := testutil.NewSandbox(t)
|
||||
defer sb.Cleanup()
|
||||
|
||||
sb.CreateSkill("s1", map[string]string{"SKILL.md": "# S\n\nTest."})
|
||||
tp := sb.CreateTarget("claude")
|
||||
sb.WriteConfig(`source: ` + sb.SourcePath + `
|
||||
targets:
|
||||
claude:
|
||||
path: ` + tp + `
|
||||
`)
|
||||
|
||||
sb.RunCLI("audit")
|
||||
|
||||
result := sb.RunCLI("log", "--stats", "--cmd", "audit")
|
||||
result.AssertSuccess(t)
|
||||
result.AssertOutputContains(t, "audit")
|
||||
result.AssertOutputContains(t, "OK:")
|
||||
}
|
||||
|
||||
func TestLog_CheckCreatesEntry(t *testing.T) {
|
||||
sb := testutil.NewSandbox(t)
|
||||
defer sb.Cleanup()
|
||||
|
||||
Reference in New Issue
Block a user