Skip to content

Work on image inspector - #124

Open
chocolatkey wants to merge 1 commit into
developfrom
image-inspector
Open

Work on image inspector#124
chocolatkey wants to merge 1 commit into
developfrom
image-inspector

Conversation

@chocolatkey

@chocolatkey chocolatkey commented Aug 31, 2026

Copy link
Copy Markdown
Member

For #88

@chocolatkey chocolatkey changed the title WIP: Work on image inspector Work on image inspector Sep 9, 2026
@chocolatkey
chocolatkey requested a balanced review from Copilot September 9, 2026 06:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The manifest inspection relies on discarding Manifest.Copy's return value and working only through in-place backing-array mutation, which is fragile and should assign the result back, alongside minor naming/error-message consistency fixes.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refactors the CLI's image-inspection logic into a new pluggable pkg/inspector package and adds a new --inspect-html capability that uses the publication's guided-navigation documents (generated from the (X)HTML with textref locators) to attach image references (source location, description, and role) onto image links in the manifest, working toward issue #88. It replaces the single helpers.ImageInspector with a composable Inspector interface aggregated by a Run orchestrator that implements go-toolkit's ManifestTransformer. It also bumps go-toolkit and many transitive dependencies.

Changes:

  • Introduce pkg/inspector with an Inspector interface and a Run aggregator, plus Image (size/hash) and ImageUsage (HTML-derived references) inspectors; remove the old helpers/inspector.go.
  • Wire a new --inspect-html flag in the manifest command that configures the guided-navigation service and runs the inspectors over the manifest.
  • Update go.mod/go.sum (notably go-toolkit to the 298d30d pseudo-version) and transitive dependency versions.
File summaries
File Description
pkg/inspector/inspector.go New Inspector interface and Run orchestrator implementing ManifestTransformer.
pkg/inspector/image_inspector.go New Image inspector delegating bitmap analysis to analyzer.InspectImage.
pkg/inspector/image_usage_inspector.go New ImageUsage inspector building image references from guided-navigation objects.
pkg/helpers/inspector.go Removed; superseded by the pkg/inspector package.
internal/cli/manifest.go Adds --inspect-html, sets up the guided-nav service, and runs inspectors via Manifest.Copy.
go.mod / go.sum Dependency version bumps, including go-toolkit.
Review details
  • Files reviewed: 6/7 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/cli/manifest.go

if len(inspectors) > 0 {
inspection := inspector.CreateInspection(inspectors)
publication.Manifest.Copy(inspection)
Comment thread internal/cli/manifest.go
Comment on lines +201 to +205
inspector := &inspector.Image{
Algorithms: hashAlgorithms,
Filesystem: fetcher.ToFS(context.TODO(), pub.Fetcher),
Filesystem: fetcher.ToFS(context.TODO(), publication.Fetcher),
}
inspectors = append(inspectors, inspector)
for i := range n.inspectors {
newHREF, err := n.inspectors[i].InspectHREF(href)
if err != nil {
n.err = errors.Wrap(err, "failed inspecting href "+href.String()+" with inspector for "+n.inspectors[i].Name())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants