Skip to main content

CLI Plan Review Commands

This guide provides comprehensive examples for using the cli/codeproof.sh command-line interface to perform architectural plan review operations, including project creation, file ingestion, code applicability analysis, and compliance report generation.

Prerequisites

Before running any CLI commands, ensure you:

  1. Build the project: Run mvn clean package -DskipTests to generate the thin JAR and dependencies
  2. Set environment variables: Source the appropriate environment configuration:
    source env/dev/setvars.sh

Project Management

Create a New Project

Create a new architectural plan project container:

cli/codeproof.sh architectural-plan create \
--project US.CA.SanJose-1550-Tech.Dr-rev2002-07-09 \
--name "1550 Tech Drive, San Jose" \
--description "Commercial building renovation project" \
--filesystem GCS

Upload Files to Project

Upload PDF files to a project's inputs folder:

cli/codeproof.sh architectural-plan upload \
--project US.CA.SanJose-1550-Tech.Dr-rev2002-07-09 \
--filesystem GCS \
"2002-040168-000-TM Plans Building Plans 07-09-2002 4367298.pdf"

List Projects

List all available architectural plan projects:

cli/codeproof.sh architectural-plan list --filesystem GCS

Check Project Status

Check the status of a specific project:

cli/codeproof.sh architectural-plan status \
--project US.CA.SanJose-1550-Tech.Dr-rev2002-07-09 \
--filesystem GCS

Plan Ingestion

Ingest and process PDF pages from an architectural plan. This extracts text, generates summaries, and prepares pages for analysis.

Basic Ingestion

Ingest specific pages from a PDF file:

cli/codeproof.sh architectural-plan ingest \
--project US.CA.SanJose-1550-Tech.Dr-rev2002-07-09 \
--pages "1,2,3,4,5" \
--filesystem GCS \
"2002-040168-000-TM Plans Building Plans 07-09-2002 4367298.pdf"

Ingest Single Page

cli/codeproof.sh architectural-plan ingest \
--project US.FL.Miami-2215.NW.1ST.PL-rev.2025-03-03 \
--pages "24" \
--filesystem GCS \
"Architectural Plans.pdf"

Ingest Multiple Pages

cli/codeproof.sh architectural-plan ingest \
--project A.0155.01-2025-06-12 \
--pages "1,2,3,5,8,12,18,19,20,22" \
--filesystem GCS \
"Studio Hiller Plans.pdf"

Note: Page ingestion is a long-running operation that involves:

  • PDF page extraction
  • LLM-based text extraction to Markdown
  • Page summarization
  • Sheet ID detection

See GitHub Issue #151 for performance considerations.

Code Applicability Analysis

Analyze which code sections are applicable to specific pages of an architectural plan.

Single Page Analysis

cli/codeproof.sh code-applicability \
--model gemini-1.5-pro-002 \
--plan-id A.0155.01-2025-06-12 \
--book-id 3123 \
--page-numbers 12

Multiple Page Analysis

Analyze multiple pages at once:

cli/codeproof.sh code-applicability \
--model gemini-1.5-flash-002 \
--plan-id US.FL.Miami-2215.NW.1ST.PL-rev.2025-03-03 \
--book-id 3815 \
--page-numbers 4,5,6,9,10,11,15,58,59,60,73,74,75

Performance Note: Multi-page analysis can be time-intensive. See GitHub Issue #128 for performance considerations.

Common Book IDs

  • 2217 - IBC 2021
  • 3123 - IBC 2021 (NJ Edition)
  • 3815 - Florida Building Code 2023
  • 3100 - ICC/ANSI A117.1-2017 (Accessibility)
  • 1156 - ICC 300-2017

See GitHub Issue #102 for more regulation texts popular among architects.

Compliance Report Generation

Generate detailed compliance reports for specific code sections and pages.

Basic Compliance Report

source env/dev/setvars.sh

cli/codeproof.sh code-compliance \
--model gemini-2.5-flash-preview-05-20 \
--page-number 7 \
--book-id 2217 \
--relevance-filter HIGH \
--section-prefix IBC2021P2_Ch11_

Relevance Filters

The --relevance-filter option allows you to focus on sections with specific relevance levels:

  • HIGH - Only sections with high relevance to the page
  • MEDIUM - Medium and high relevance sections
  • LOW - All sections (low, medium, and high)

Generate Reports for Multiple Sections

For comprehensive compliance analysis, you may need to generate reports for multiple sections across different pages:

# Generate applicability report first
cli/codeproof.sh code-applicability \
--model gemini-1.5-flash-002 \
--plan-id A.0155.01-2025-06-12 \
--book-id 3123 \
--page-numbers 12,18,19,20

# Then generate compliance reports for high-relevance sections
cli/codeproof.sh code-compliance \
--model gemini-2.5-flash-preview-05-20 \
--plan-id A.0155.01-2025-06-12 \
--page-number 12 \
--book-id 3123 \
--relevance-filter HIGH \
--section-prefix IBC2021P2_Ch03_

Workflow Examples

Complete Project Onboarding Workflow

This is a typical workflow for onboarding a new architectural plan project:

# Step 1: Set environment
source env/dev/setvars.sh

# Step 2: Create project
cli/codeproof.sh architectural-plan create \
--project A.0155.01-2025-06-12 \
--name "Studio Hiller Project" \
--filesystem GCS

# Step 3: Upload PDF
cli/codeproof.sh architectural-plan upload \
--project A.0155.01-2025-06-12 \
--filesystem GCS \
"Studio-Hiller-Plans.pdf"

# Step 4: Ingest pages
cli/codeproof.sh architectural-plan ingest \
--project A.0155.01-2025-06-12 \
--pages "1,2,3,5,8,12,18,19,20,22" \
--filesystem GCS \
"Studio-Hiller-Plans.pdf"

# Step 5: Run applicability analysis for all pages
cli/codeproof.sh code-applicability \
--model gemini-1.5-flash-002 \
--plan-id A.0155.01-2025-06-12 \
--book-id 3123 \
--page-numbers 1,2,3,5,8,12,18,19,20,22

# Step 6: Generate compliance reports for high-relevance sections
cli/codeproof.sh code-compliance \
--model gemini-2.5-flash-preview-05-20 \
--plan-id A.0155.01-2025-06-12 \
--page-number 12 \
--book-id 3123 \
--relevance-filter HIGH \
--section-prefix IBC2021P2_Ch11_

# Step 7: Sync to GCS (if using LOCAL filesystem)
gsutil rsync -r projects/A.0155.01-2025-06-12/ \
gs://construction-code-expert-dev/projects/A.0155.01-2025-06-12

See GitHub Issue #115 for a complete project onboarding example.

Troubleshooting

Model Not Found Error

If you encounter NOT_FOUND: Publisher Model ... was not found, the model version may have been deprecated. Update to a current model version:

# Check available models in your GCP project
gcloud ai models list --region=us-central1

# Use a stable model version
cli/codeproof.sh architectural-plan ingest \
--project <project-id> \
--model gemini-1.5-flash-002 \
...

See GitHub Issue #150 for more details.

Performance Issues

Long-running operations (especially multi-page applicability analysis) may take hours. Consider:

  1. Process pages in smaller batches
  2. Use faster models (e.g., gemini-1.5-flash-002 instead of gemini-1.5-pro-002)
  3. Monitor progress via log output

See GitHub Issue #128 for performance investigation.

Getting Help

View help for any command:

# Main CLI help
cli/codeproof.sh --help

# Architectural plan commands help
cli/codeproof.sh architectural-plan --help

# Specific subcommand help
cli/codeproof.sh architectural-plan ingest --help
cli/codeproof.sh code-applicability --help
cli/codeproof.sh code-compliance --help