Add progress output - #29
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds extraction progress output to the xt CLI by wiring golift.io/xtractr progress updates into the existing job-driven extraction flow, along with dependency and CI/workflow updates to support the new behavior.
Changes:
- Add progress reporting via an
xtractr.Progresschannel onJoband pass it intoxtractr.XFileupdates during extraction. - Update Go module dependencies/tooling and GitHub workflows to newer versions and to use
go.modas the Go version source. - Minor supporting tweaks (log output stream, linter config, license year bump).
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/xt/xt.go | Initializes progress reporting and passes update channel into per-archive extraction. |
| pkg/xt/job.go | Adds a progress channel to Job for progress updates. |
| pkg/xt/filemode.go | Adjusts FileMode type declaration (affects lint behavior). |
| main.go | Routes log output to stdout (aligning with stdout-based progress output). |
| LICENSE | Updates copyright year. |
| go.mod | Bumps Go version and updates/extends dependencies (adds golang.org/x/term, updates xtractr). |
| go.sum | Refreshes dependency checksums after module changes. |
| .golangci.yml | Updates golangci-lint config (disables additional linters). |
| .github/workflows/release.yml | Updates action versions and switches to go-version-file. |
| .github/workflows/codetests.yml | Updates action versions and golangci-lint version. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| job.fixModes() | ||
| job.setupProgress() | ||
|
|
There was a problem hiding this comment.
Good catch. Progress now starts only when there is at least one archive and debug is off. The printer channel is closed (and we wait for the goroutine) when the job finishes, so an empty run cannot leak a blocked printer.
| isTerm := term.IsTerminal(int(os.Stdout.Fd())) | ||
| if isTerm { | ||
| every = 0.1 | ||
| } | ||
|
|
||
| if !j.DebugLog { // Only print progress if debug is off. | ||
| j.progress = make(chan xtractr.Progress) | ||
| go xtractr.ArchiveProgress(every, j.progress, term.IsTerminal(int(os.Stdout.Fd())), false) | ||
| } |
There was a problem hiding this comment.
Reused isTerm for both the update interval and ArchiveProgress.
Skip starting it when there is nothing to extract (or debug is on), close the channel when the job finishes, and reuse the TTY check Copilot flagged. Co-authored-by: Cursor <cursoragent@cursor.com>
Print extraction progress.