I'll start by inspecting the build directory and the staged sources.The directory already has `bin/test.sh`, `cmd/ddkstat/main.go`, `layout_test.go`, and `go.mod`. I'll read those before changing anything.The existing `bin/test.sh` already matches the test-script spec (POSIX `sh`, `set -eu`, cd to the root, `go vet` then `go test`), so I'll leave it alone. The work is `internal/logread` and `internal/cli/args`, each with tests. I'll write the reader first.Next, the logread tests. Each one calls `Read` and checks the returned values, not the warning text.Now the argument parser and its tests, following the rules in FEATURE-CliArgs.The spec names a `TestParseLogPathCount` test that I haven't written yet. I'll add it as the boundary test over zero, one, and several log paths.Both packages are written. Next I'll format, vet, and run the project gate, `sh bin/test.sh`.The gate passes. The change on disk is only gofmt moving the `encoding/json` import into sorted order. Next I'll confirm each required test ran and passed, and check the reader against the real sample log with a scratch test that I delete afterward.Both stories and the test script are done. `sh bin/test.sh` exits 0, and all 35 Go tests pass.
- **log-lines:** `logread.Read` parses the sample log into 35 records, with 1 skipped (line 16, truncated JSON) and 2 failed. The sample's 3 skips and 33 records come from duplicate handling, which a later block adds.
- **cli-args:** `cli.ParseArgs` returns `Options` or a `*UsageError`. Option order is fixed, so an option after the log path is a usage error.
- **test-script:** `bin/test.sh` was already in the repo and matched the spec (POSIX `sh`, `set -eu`, `go vet ./...` then `go test ./...`), so I left it unchanged.
I did not run `sources/run.sh`. It is the terminal check for the whole project, and this block is not the last one.
Changes are uncommitted, as the build rules require.
Module `ddkstat`, go 1.22+, no `require` lines, no go.sum entries, no vendor/.
Packages: cmd/ddkstat (only os.Exit caller), internal/logread, internal/filter, internal/format, internal/report, internal/cli.
logread.Read(r io.Reader, warn io.Writer) (Result, error); Result{Records []Record, Skipped int}; error only on reader failure.
logread.Record: ExecutionID, StartedAt, Date (first 10 chars), Status, Failed (status != "succeeded"), Command, Target, Provider, Model, InputTokens, CachedTokens, OutputTokens (int64), CostUSD (float64), ElapsedMS (int64), ReturnCode (*int, nil if null/absent), TimedOut (bool).
cli.Run(args []string, stdout, stderr io.Writer) int; exit 0 ok, 1 unreadable log, 2 usage. Report writers: cli.Register(name, fn func(w io.Writer, records []logread.Record, skipped int) error).
Reports: summary, commands, targets, models, daily, failures. Options: --target, --since, --until, then one log path.
Only cmd/ddkstat/main.go calls os.Exit. Output buffered; stdout written only on success. Diagnostics to stderr, never compared.
Never write to the log; never read sources/run.sh; no hardcoded report values.
```text
[{"spec":"FEATURE-LogLines.md","severity":"Low","subject":"Malformed JSON lines","decision":"The spec does not say what to do with a non-blank line that is not a JSON object. I skip it, count it in Result.Skipped, and write a diagnostic to the warning writer, so Read never fails on bad input. Is that acceptable, or should the skip rule belong to the later skip/dedupe story?"},{"spec":"FEATURE-LogLines.md","severity":"Low","subject":"Model fields","decision":"Record.Model is taken from result.stats.model (executed) and Record.RequestedModel from job.model. The architecture lists only Model. Is that acceptable, or should model attribution choose the field?"}]
```
RESULT: SUCCESS
FILES CHANGED:
- internal/logread/logread.go
- internal/logread/logread_test.go
- internal/cli/args.go
- internal/cli/args_test.go
SUMMARY:
- `internal/logread`: `Read` decodes JSON Lines from an `io.Reader` using `bufio` with no line-length limit. Blank lines are ignored and not counted. Each object maps to `Record`, `Failed` is `status != "succeeded"`, `Date` is the first 10 characters of `started_at`, and `started_at` is not validated. Malformed lines are skipped and counted, with a diagnostic on the warning writer. Tests cover all four named behaviors plus field mapping, nullable return code, malformed and non-object lines, reader errors, and a nil warning writer.
- `internal/cli`: `ParseArgs` returns `Options{Report, Target, Since, Until, LogPath}` or a `*UsageError`. It is a hand-rolled parser with no I/O and no `os.Exit`. Tests cover every name in the spec, including the boundary cases for zero, one, and several log paths.
- `bin/test.sh`: already present and conforming, so unchanged.
- `sh bin/test.sh` exits 0. The reader run on `sources/llm_sample.jsonl` gives 35 records, 1 skipped, and 2 failed. The grader expects 33 records and 3 skipped. The gap is the duplicate handling that a later block adds.
BLOCKERS:
- None.