Skip to content

feat(catasto): add catasto CLI#1431

Open
robertobissanti wants to merge 1 commit into
mvanhorn:mainfrom
robertobissanti:feat/catasto
Open

feat(catasto): add catasto CLI#1431
robertobissanti wants to merge 1 commit into
mvanhorn:mainfrom
robertobissanti:feat/catasto

Conversation

@robertobissanti

@robertobissanti robertobissanti commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Publishes the Catasto printed CLI under library/other/catasto.

The CLI bridges Italian cadastral references and WGS84 coordinates with agent-native JSON. It supports GPS -> cadastral lookup, cadastral reference -> GPS centroid lookup via the ondata/AdE geometry dataset, and syntax/comune validation helpers.

Notes

  • Adds catasto-pp-cli and catasto-pp-mcp sources under library/other/catasto only.
  • Does not touch registry.json or cli-skills/; those are left for the library post-merge generators.
  • Includes a local patch that clarifies when a Catasto Fabbricati unit may exist in official records but is not represented in the mapped ondata/AdE geometry dataset.

Verification

  • go test ./... passed in the Catasto CLI tree.
  • cli-printing-press publish validate --dir /Users/robertobissanti/printing-press/library/catasto --json passed.
  • cli-printing-press publish validate --dir /Users/robertobissanti/printing-press/.publish-repo-robertobissanti-6489bbc0/library/other/catasto --json passed on the staged package.

Scope

All changed files are under library/other/catasto/.

@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces catasto-pp-cli and catasto-pp-mcp, a new Go-based CLI under library/other/catasto that bridges Italian cadastral references and WGS84 coordinates using the Agenzia delle Entrate public AJAX endpoint and the ondata/dati_catastali Parquet dataset.

  • GPS → cadastral lookup (gps command): queries the AdE AJAX endpoint for a single point or a CSV stream of lon,lat pairs; previous review thread flagged a bounding-box mismatch in the error message and an io.EOF string-compare in the streaming path.
  • Cadastral → GPS reverse lookup (cadastral command): resolves comune (by Belfiore code, name, or CAP) then reads the per-region Parquet file cached locally; previous thread flagged narrowComuneHits returning unfiltered hits on zero match, silently yielding the wrong comune.
  • Local SQLite store + sync command: WAL-mode SQLite with FTS5 full-text search, schema-versioned migrations, and a worker-pool sync loop; this review finds that --latest-only combined with --since is silently ignored in JSON/agent mode with no structured event emitted.

Confidence Score: 4/5

The core lookup paths work correctly; the main concern is that narrowComuneHits can silently return the wrong comune, and --latest-only combined with --since is silently ignored in JSON/agent mode with no structured event emitted.

Two code paths produce incorrect or surprising behavior without any error signal to the caller. narrowComuneHits falling back to unfiltered hits returns wrong parcel coordinates silently. The sync command drops the --latest-only flag without warning when the caller is using the JSON/agent mode this CLI is explicitly designed for.

internal/cli/cadastral.go (narrowComuneHits fallback), internal/cli/sync.go (--latest-only+--since interaction in agent mode), and internal/cli/gps.go (bounding-box bounds mismatch in error text).

Important Files Changed

Filename Overview
library/other/catasto/internal/cli/sync.go Sync command with worker pool, cursor management, and JSON event streaming. Silent --latest-only suppression in agent/JSON mode is a new finding.
library/other/catasto/internal/store/store.go SQLite store with WAL mode, FTS5 full-text search, schema versioning, and composite-key migration. FTS5 ORDER BY rank qualification is a new style note.
library/other/catasto/internal/ondata/ondata.go Parquet-based geocoding client with local cache. Cache has no TTL (prior thread finding). Diagnostic error messages for missing parcels are well-structured.
library/other/catasto/internal/cli/cadastral.go Reverse-lookup command (cadastral ref to GPS centroid). The narrowComuneHits silent-wrong-result bug is the prior thread's primary finding.
library/other/catasto/internal/cli/gps.go Single-point GPS to cadastral lookup command. Bounding-box values in error message differ from pointInItalyBBox check (prior thread).
library/other/catasto/internal/cli/gps_stream.go Streaming GPS lookup from CSV stdin. EOF string-compare instead of errors.Is noted in prior thread; stream wrapping and error-per-row approach is correct.
library/other/catasto/internal/comuni/comuni.go Embedded Italian comuni dataset with resolvers by Belfiore code, name, and CAP. Normalization, disambiguation, and error types are clean.
library/other/catasto/internal/mcp/cobratree/shellout.go MCP tool handler that shells out to the CLI binary. blockedRootFlags prevents credential/config injection; exec.CommandContext avoids shell-injection risks.
library/other/catasto/internal/client/client.go HTTP client with 5-minute response cache, adaptive rate limiter, and structured API error type. Cache TTL and key construction look correct.

Reviews (3): Last reviewed commit: "feat(catasto): add catasto CLI" | Re-trigger Greptile

Comment thread library/other/catasto/internal/cli/cadastral.go
Comment thread library/other/catasto/internal/store/store.go
Comment thread library/other/catasto/internal/ondata/ondata.go
Comment thread library/other/catasto/internal/cli/gps_stream.go
Comment thread library/other/catasto/internal/cli/gps.go
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.

1 participant