Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions ProExporter/Serializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,15 @@ private static async Task WriteAgentsFileAsync(string path, ExportContext contex
var content = $@"# ArcGIS Pro Session Context

> **Snapshot taken:** {timestamp} UTC
> **Use the `arcgispro` CLI to query this data.**
> **Use the `arcgis` CLI to query this data.** (Aliases: `arcgispro`, `agp`)

## Quick Start

```bash
arcgispro layers # List all layers
arcgispro layer ""LayerName"" # Layer details + fields
arcgispro fields ""LayerName"" # Just the fields
arcgispro context # Full markdown summary
arcgis layers # List all layers
arcgis layer ""LayerName"" # Layer details + fields
arcgis fields ""LayerName"" # Just the fields
arcgis context # Full markdown summary
```

Add `--json` to any command for structured output.
Expand All @@ -485,19 +485,19 @@ arcgispro context # Full markdown summary

| Command | Purpose |
|---------|---------|
| `arcgispro project` | Project name, path, geodatabases |
| `arcgispro maps` | List all maps |
| `arcgispro map ""Name""` | Map details (scale, extent, SR) |
| `arcgispro layers` | List all layers across all maps |
| `arcgispro layers --broken` | Only layers with broken data sources |
| `arcgispro layer ""Name""` | Layer details + field schema |
| `arcgispro fields ""Name""` | Just the fields for a layer |
| `arcgispro tables` | Standalone tables |
| `arcgispro connections` | Database/folder connections |
| `arcgispro notebooks` | Jupyter notebooks in project |
| `arcgispro context` | Full markdown dump (good for pasting) |
| `arcgispro diagram` | Render Mermaid diagram of project structure |
| `arcgispro status` | Validate export files |
| `arcgis project` | Project name, path, geodatabases |
| `arcgis maps` | List all maps |
| `arcgis map ""Name""` | Map details (scale, extent, SR) |
| `arcgis layers` | List all layers across all maps |
| `arcgis layers --broken` | Only layers with broken data sources |
| `arcgis layer ""Name""` | Layer details + field schema |
| `arcgis fields ""Name""` | Just the fields for a layer |
| `arcgis tables` | Standalone tables |
| `arcgis connections` | Database/folder connections |
| `arcgis notebooks` | Jupyter notebooks in project |
| `arcgis context` | Full markdown dump (good for pasting) |
| `arcgis diagram` | Render Mermaid diagram of project structure |
| `arcgis status` | Validate export files |

## File Structure

Expand Down Expand Up @@ -606,7 +606,7 @@ What question are we answering?

## Tips

- Use `arcgispro layer ""partial""` — partial name matching works
- Use `arcgis layer ""partial""` — partial name matching works
- Check `selectionCount` to see if user has features selected
- The CLI is **read-only** — it never modifies the .aprx or data
- Run from the project folder or any subfolder
Expand All @@ -620,7 +620,7 @@ What question are we answering?

Access via: https://api.x402layer.cc/e/esri-smells

Run `arcgispro inspect` to see context-aware suggestions for when to use these advisors.
Run `arcgis inspect` to see context-aware suggestions for when to use these advisors.
";
await File.WriteAllTextAsync(path, content, Encoding.UTF8);
}
Expand Down
75 changes: 39 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Give AI agents eyes into ArcGIS Pro.

```bash
pip install arcgispro-cli
arcgispro install
arcgis install
```

## First 5 Minutes (Quickstart)
Expand All @@ -16,9 +16,9 @@ arcgispro install
2. Click **Snapshot** in the **CLI** ribbon tab
3. In a terminal, run:
```bash
arcgispro status
arcgispro layers
arcgispro layer "Parcels"
arcgis status
arcgis layers
arcgis layer "Parcels"
```

More: [docs/quickstart.md](docs/quickstart.md)
Expand All @@ -33,15 +33,17 @@ More: [docs/quickstart.md](docs/quickstart.md)

## How It Works

ProExporter (Pro add-in) creates detailed flat files that explain the state of your ArcGIS Pro project. `arcgispro` CLI tool facilitates frictionless reasoning over the context. Fewer assumptions and annoying follow-up questions. Helps the AI help you.
ProExporter (Pro add-in) creates detailed flat files that explain the state of your ArcGIS Pro project. The `arcgis` CLI tool facilitates frictionless reasoning over the context. Fewer assumptions and annoying follow-up questions. Helps the AI help you.

(Backwards compatible aliases: `arcgispro`, `agp`.)

1. Open a project in ArcGIS Pro
2. Click **Snapshot** in the **CLI** ribbon tab
3. Ask questions:
```bash
arcgispro layers # What layers do I have?
arcgispro layer "Parcels" # Tell me about this layer
arcgispro fields "Parcels" # What fields are in it?
arcgis layers # What layers do I have?
arcgis layer "Parcels" # Tell me about this layer
arcgis fields "Parcels" # What fields are in it?
```

## CLI Commands
Expand All @@ -50,29 +52,29 @@ ProExporter (Pro add-in) creates detailed flat files that explain the state of y

| Command | Description |
|---------|-------------|
| `arcgispro install` | Install the ProExporter add-in |
| `arcgispro uninstall` | Show uninstall instructions |
| `arcgispro launch` | Launch ArcGIS Pro (opens .aprx in current dir if found) |
| `arcgispro status` | Show export status and validate files |
| `arcgispro clean` | Remove generated files |
| `arcgispro open` | Open export folder |
| `arcgis install` | Install the ProExporter add-in |
| `arcgis uninstall` | Show uninstall instructions |
| `arcgis launch` | Launch ArcGIS Pro (opens .aprx in current dir if found) |
| `arcgis status` | Show export status and validate files |
| `arcgis clean` | Remove generated files |
| `arcgis open` | Open export folder |

### Query

| Command | Description |
|---------|-------------|
| `arcgispro project` | Show project info |
| `arcgispro maps` | List all maps |
| `arcgispro map [name]` | Map details |
| `arcgispro layers` | List all layers |
| `arcgispro layers --broken` | Just the broken ones |
| `arcgispro layer <name>` | Layer details + fields |
| `arcgispro fields <name>` | Just the fields |
| `arcgispro tables` | Standalone tables |
| `arcgispro connections` | Data connections |
| `arcgispro notebooks` | Jupyter notebooks in project |
| `arcgispro context` | Full markdown dump |
| `arcgispro diagram` | Render Mermaid diagram of project structure |
| `arcgis project` | Show project info |
| `arcgis maps` | List all maps |
| `arcgis map [name]` | Map details |
| `arcgis layers` | List all layers |
| `arcgis layers --broken` | Just the broken ones |
| `arcgis layer <name>` | Layer details + fields |
| `arcgis fields <name>` | Just the fields |
| `arcgis tables` | Standalone tables |
| `arcgis connections` | Data connections |
| `arcgis notebooks` | Jupyter notebooks in project |
| `arcgis context` | Full markdown dump |
| `arcgis diagram` | Render Mermaid diagram of project structure |

Add `--json` to any query command for machine-readable output.

Expand All @@ -81,7 +83,8 @@ Add `--json` to any query command for machine-readable output.
**`arcgispro` launches ArcGIS Pro instead of the CLI?**

This happens if `C:\Program Files\ArcGIS\Pro\bin` is on your PATH. Options:
- Use `agp` instead (alias): `agp layers`, `agp launch`
- Prefer `arcgis` (new default): `arcgis layers`, `arcgis launch`
- Use `agp` (alias): `agp layers`, `agp launch`
- Or fix PATH order: ensure Python Scripts comes before ArcGIS Pro bin

## Requirements
Expand Down Expand Up @@ -176,16 +179,16 @@ claude # or: copilot, gemini

```
What layers are in this project?
> AI runs: arcgispro layers
> AI runs: arcgis layers

What fields are in the Parcels layer?
> AI runs: arcgispro fields "Parcels"
> AI runs: arcgis fields "Parcels"

Which layers have broken data sources?
> AI runs: arcgispro layers --broken
> AI runs: arcgis layers --broken

Give me the full project context
> AI runs: arcgispro context
> AI runs: arcgis context

Look at the map screenshot and describe what you see
> AI reads: .arcgispro/images/map_*.png
Expand All @@ -196,14 +199,14 @@ Look at the map screenshot and describe what you see
1. **Click Snapshot in Pro before starting your AI session** - ensures context is fresh

2. **Ask naturally** - the CLI commands map to common questions:
- "What layers do I have?" → `arcgispro layers`
- "Tell me about the Parcels layer" → `arcgispro layer Parcels`
- "What's the schema?" → `arcgispro fields Parcels`
- "What layers do I have?" → `arcgis layers`
- "Tell me about the Parcels layer" → `arcgis layer Parcels`
- "What's the schema?" → `arcgis fields Parcels`

3. **Use `--json` for programmatic access** - AI can parse structured output:
```bash
arcgispro layers --json
arcgispro layer "Parcels" --json
arcgis layers --json
arcgis layer "Parcels" --json
```

4. **Check images for visual context** - map screenshots help AI understand spatial data
Expand Down
18 changes: 10 additions & 8 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,29 @@ pip install -e .

```bash
# View help
arcgispro --help
arcgis --help

# Inspect exported context
arcgispro inspect
arcgis inspect

# Validate JSON exports
arcgispro dump
arcgis dump

# Validate images
arcgispro images
arcgis images

# Render project diagram
arcgispro diagram
arcgis diagram

# Clean up exports
arcgispro clean --all
arcgis clean --all

# Select active project
arcgispro open
arcgis open
```

(Backwards compatible aliases: `arcgispro`, `agp`.)

## Using arcpy with Terminal Sessions

The ArcGIS Pro CLI add-in includes a **Terminal** button that opens cmd.exe with the Pro Python environment activated. To avoid "Directory does not exist" errors with stale temp workspace paths, use the session helper:
Expand Down Expand Up @@ -65,7 +67,7 @@ ERROR Directory does not exist or cannot be accessed: C:\Users\...\Temp\ArcGISPr
## Workflow

1. **In ArcGIS Pro:** Click "Snapshot" button in the **CLI** ribbon tab
2. **In terminal:** Run `arcgispro inspect` to see what was exported
2. **In terminal:** Run `arcgis inspect` to see what was exported
3. **Use context:** Read JSON files or markdown summary for AI analysis

## Folder Structure
Expand Down
44 changes: 22 additions & 22 deletions cli/arcgispro_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@

Commands:
# Setup
arcgispro install - Install the ProExporter add-in
arcgispro uninstall - Show uninstall instructions
arcgispro status - Show export status and validate files
arcgispro clean - Remove generated files
arcgispro open - Open folder or select project
arcgispro launch - Launch ArcGIS Pro
arcgis install - Install the ProExporter add-in
arcgis uninstall - Show uninstall instructions
arcgis status - Show export status and validate files
arcgis clean - Remove generated files
arcgis open - Open folder or select project
arcgis launch - Launch ArcGIS Pro

# Query
arcgispro project - Show project info
arcgispro maps - List all maps
arcgispro map [name] - Show map details
arcgispro layers - List all layers
arcgispro layer <name> - Show layer details + fields
arcgispro fields <name> - Show field schema for a layer
arcgispro tables - List standalone tables
arcgispro connections - List data connections
arcgispro notebooks - List Jupyter notebooks
arcgispro context - Print full markdown summary
arcgispro diagram - Render project structure diagram
arcgis project - Show project info
arcgis maps - List all maps
arcgis map [name] - Show map details
arcgis layers - List all layers
arcgis layer <name> - Show layer details + fields
arcgis fields <name> - Show field schema for a layer
arcgis tables - List standalone tables
arcgis connections - List data connections
arcgis notebooks - List Jupyter notebooks
arcgis context - Print full markdown summary
arcgis diagram - Render project structure diagram
"""

import sys
Expand All @@ -42,7 +42,7 @@


@click.group(invoke_without_command=True)
@click.version_option(version=__version__, prog_name="arcgispro")
@click.version_option(version=__version__, prog_name="arcgis")
@click.pass_context
def main(ctx):
"""ArcGIS Pro CLI - Query exported session context.
Expand All @@ -54,11 +54,11 @@ def main(ctx):
\b
Quick start:
pip install arcgispro-cli
arcgispro install # Install add-in (one time)
arcgis install # Install add-in (one time)
# In ArcGIS Pro: Click "Snapshot" in the CLI tab
arcgispro layers # List layers
arcgispro layer "Parcels" # Get layer details
arcgispro fields "Parcels" # Get field schema
arcgis layers # List layers
arcgis layer "Parcels" # Get layer details
arcgis fields "Parcels" # Get field schema
"""
ctx.ensure_object(dict)
if ctx.invoked_subcommand is None:
Expand Down
4 changes: 4 additions & 0 deletions cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ dev = [
]

[project.scripts]
# Primary CLI entrypoint
arcgis = "arcgispro_cli.cli:main"

# Backwards-compatible aliases
arcgispro = "arcgispro_cli.cli:main"
agp = "arcgispro_cli.cli:main"

Expand Down
3 changes: 2 additions & 1 deletion cli/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def test_version():
runner = CliRunner()
result = runner.invoke(main, ["--version"])
assert result.exit_code == 0
assert "arcgispro" in result.output.lower()
# The preferred entrypoint is now `arcgis` (with aliases `arcgispro`, `agp`).
assert "arcgis" in result.output.lower()


def test_help():
Expand Down