Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

Fix self-review issues: add missing CLI commands, clean unused imports

Ryohei Sasaki9412347b096e
diff --git a/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/cloudanalyzer_cli.py b/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/cloudanalyzer_cli.py
index 77a5b42d3..13aade69f 100644
--- a/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/cloudanalyzer_cli.py
+++ b/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/cloudanalyzer_cli.py
@@ -15,7 +15,6 @@ Backend: CloudAnalyzer Python package (direct import, no subprocess)
"""
import json
-import sys
from pathlib import Path
from typing import Optional
@@ -183,6 +182,41 @@ def evaluate_ground(
ctx.exit(1)
[email protected]("directory")
[email protected]("reference")
[email protected]("--min-auc", type=float, default=None)
[email protected]("--max-chamfer", type=float, default=None)
+def evaluate_batch(ctx: click.Context, directory: str, reference: str, min_auc: Optional[float], max_chamfer: Optional[float]) -> None:
+ """Batch evaluation of multiple point clouds."""
+ try:
+ from ca.batch import batch_evaluate
+ result = batch_evaluate(directory, reference, min_auc=min_auc, max_chamfer=max_chamfer)
+ _out(ctx, result)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
[email protected]("pipeline")
[email protected]("input_path")
[email protected]("reference")
[email protected]("-o", "--output", required=True)
[email protected]("-v", "--voxel-size", type=float, default=0.05)
[email protected]("--filter/--no-filter", "apply_filter", default=False)
+def evaluate_pipeline(ctx: click.Context, input_path: str, reference: str, output: str, voxel_size: float, apply_filter: bool) -> None:
+ """Filter, downsample, evaluate in one command."""
+ try:
+ from ca.pipeline import run_pipeline
+ result = run_pipeline(input_path, reference, output, voxel_size=voxel_size, apply_filter=apply_filter)
+ _out(ctx, result)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
# ── trajectory group ──────────────────────────────────────────────────────────
@cli.group()
@@ -219,6 +253,45 @@ def trajectory_evaluate(
ctx.exit(1)
[email protected]("directory")
[email protected]("--reference-dir", required=True)
[email protected]("--max-ate", type=float, default=None)
[email protected]("--max-rpe", type=float, default=None)
[email protected]("--max-drift", type=float, default=None)
[email protected]("--min-coverage", type=float, default=None)
+def trajectory_batch(ctx: click.Context, directory: str, reference_dir: str, **kwargs) -> None:
+ """Batch trajectory evaluation."""
+ try:
+ from ca.batch import trajectory_batch_evaluate
+ result = trajectory_batch_evaluate(directory, reference_dir, **kwargs)
+ _out(ctx, result)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
[email protected]("run-evaluate")
[email protected]("map_path")
[email protected]("map_reference")
[email protected]("trajectory_path")
[email protected]("trajectory_reference")
[email protected]("--min-auc", type=float, default=None)
[email protected]("--max-ate", type=float, default=None)
[email protected]("--report", default=None)
+def trajectory_run_evaluate(ctx: click.Context, map_path: str, map_reference: str, trajectory_path: str, trajectory_reference: str, **kwargs) -> None:
+ """Integrated map + trajectory evaluation."""
+ try:
+ from ca.run_evaluate import run_evaluate
+ result = run_evaluate(map_path, map_reference, trajectory_path, trajectory_reference, **kwargs)
+ _out(ctx, result)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
# ── check group ───────────────────────────────────────────────────────────────
@cli.group()
@@ -378,6 +451,123 @@ def process_split(ctx: click.Context, input_path: str, output_dir: str, grid_siz
ctx.exit(1)
[email protected]("input_path")
[email protected]("-o", "--output", required=True)
[email protected]("-n", "--num-points", type=int, required=True)
+def process_sample(ctx: click.Context, input_path: str, output: str, num_points: int) -> None:
+ """Random point sampling."""
+ try:
+ from ca.sample import random_sample
+ result = random_sample(input_path, output, num_points)
+ _out(ctx, result)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
[email protected]("input_path")
[email protected]("-o", "--output", required=True)
[email protected]("--nb-neighbors", type=int, default=20)
[email protected]("--std-ratio", type=float, default=2.0)
+def process_filter(ctx: click.Context, input_path: str, output: str, nb_neighbors: int, std_ratio: float) -> None:
+ """Statistical outlier removal."""
+ try:
+ from ca.filter import filter_outliers
+ result = filter_outliers(input_path, output, nb_neighbors=nb_neighbors, std_ratio=std_ratio)
+ _out(ctx, result)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
[email protected]("inputs", nargs=-1, required=True)
[email protected]("-o", "--output", required=True)
+def process_merge(ctx: click.Context, inputs: tuple[str, ...], output: str) -> None:
+ """Merge multiple point clouds."""
+ try:
+ from ca.merge import merge
+ result = merge(list(inputs), output)
+ _out(ctx, result)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
[email protected]("input_path")
[email protected]("-o", "--output", required=True)
+def process_convert(ctx: click.Context, input_path: str, output: str) -> None:
+ """Convert between point cloud formats."""
+ try:
+ from ca.convert import convert
+ result = convert(input_path, output)
+ _out(ctx, result)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
+# ── inspect group ─────────────────────────────────────────────────────────────
+
+def inspect(ctx: click.Context) -> None:
+ """Visualization and inspection commands."""
+
+
+def inspect_view(ctx: click.Context, path: str) -> None:
+ """Open a point cloud viewer."""
+ try:
+ from ca.view import view
+ view(path)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
[email protected]("reference", required=False, default=None)
[email protected]("--heatmap", is_flag=True)
[email protected]("--trajectory", default=None)
[email protected]("--port", type=int, default=8080)
+def inspect_web(ctx: click.Context, source: str, reference: Optional[str], heatmap: bool, trajectory: Optional[str], port: int) -> None:
+ """Interactive browser inspection."""
+ try:
+ from ca.web import launch_web
+ launch_web(source, reference=reference, heatmap=heatmap, trajectory=trajectory, port=port)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
[email protected]("web-export")
[email protected]("reference", required=False, default=None)
[email protected]("-o", "--output", required=True)
+def inspect_web_export(ctx: click.Context, source: str, reference: Optional[str], output: str) -> None:
+ """Export a static HTML inspection bundle."""
+ try:
+ from ca.web import export_web
+ result = export_web(source, reference=reference, output_dir=output)
+ _out(ctx, result)
+ except Exception as e:
+ _error(str(e), ctx.obj.get("json", False))
+ ctx.exit(1)
+
+
# ── info group ────────────────────────────────────────────────────────────────
@cli.group()
@@ -422,7 +612,7 @@ def session(ctx: click.Context) -> None:
def session_new(ctx: click.Context, output: str, name: str) -> None:
"""Create a new project file."""
try:
- project = create_project(output, name=name)
+ create_project(output, name=name)
_out(ctx, {"created": output, "name": name})
except Exception as e:
_error(str(e), ctx.obj.get("json", False))
diff --git a/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/tests/test_core.py b/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/tests/test_core.py
index aede685ae..c6539d0d2 100644
--- a/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/tests/test_core.py
+++ b/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/tests/test_core.py
@@ -2,7 +2,6 @@
import json
import os
-import tempfile
import pytest
diff --git a/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/tests/test_full_e2e.py b/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/tests/test_full_e2e.py
index 713d0ba8d..3efd6a4a9 100644
--- a/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/tests/test_full_e2e.py
+++ b/cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/tests/test_full_e2e.py
@@ -1,8 +1,6 @@
"""E2E tests — requires CloudAnalyzer and Open3D installed."""
import json
-import subprocess
-import sys
import pytest
diff --git a/cloudanalyzer/agent-harness/setup.py b/cloudanalyzer/agent-harness/setup.py
index 616044574..108a11f01 100644
--- a/cloudanalyzer/agent-harness/setup.py
+++ b/cloudanalyzer/agent-harness/setup.py
@@ -28,7 +28,7 @@ setup(
},
classifiers=[
"Programming Language :: Python :: 3",
- "License :: OSI Approved :: MIT License",
+ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Topic :: Scientific/Engineering :: GIS",
"Topic :: Scientific/Engineering :: Information Analysis",
],