> For the complete documentation index, see [llms.txt](https://docs.flxbl.io/flxbl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flxbl.io/flxbl/sfp/analysing-a-project/ai-powered-report.md).

# AI Assisted Insight Report

\
The AI-powered report functionality generates comprehensive analysis reports for your Salesforce projects using advanced language models. This feature provides deep insights into code quality, architecture, and best practices specific to the Flxbl framework.

### Overview

The report generator analyzes your codebase through multiple perspectives:

* Package architecture and design patterns
* Dependencies and coupling between packages
* Code quality and technical debt
* Flxbl best practices compliance
* Security and compliance considerations

### Prerequisites

A configured AI provider. Locally, set the provider's API key (e.g. `ANTHROPIC_API_KEY`); when connected to an sfp server, the report command fetches credentials from the server automatically. For complete setup and configuration instructions, see [Configuring LLM Providers](/flxbl/sfp/getting-started/configuring-llm-providers.md).

### Basic Usage

#### Package Analysis

```bash
# Analyze single package
sfp project report --package nextGen

# Analyze multiple packages
sfp project report --package core --package utils --output core-utils-analysis.md
```

#### Domain Analysis ( sfp-pro only)

```bash
# Analyze all packages in a domain
sfp project report --domain billing --output billing-analysis.md
```

### Provider-Specific Examples

#### Anthropic (Recommended)

```bash
# Uses defaults (provider: anthropic, model: claude-sonnet-4-5-20250929)
sfp project report --package nextGen --output nextgen-analysis.md

# Specify a different model (if needed)
sfp project report --model claude-sonnet-4-5-20250929 --package core
```

#### Amazon Bedrock

```bash
# Set an explicit Bedrock model id via --model
sfp project report --provider amazon-bedrock --model anthropic.claude-sonnet-4-5-20250929-v1:0 --package core

# Specify a different region (if not in environment)
export AWS_REGION=eu-west-1
sfp project report --provider amazon-bedrock --domain billing
```

### Command Flags

`sfp project report` (alias `sfp project:ai-report`) accepts:

| Flag             | Alias | Default              | Purpose                                                                 |
| ---------------- | ----- | -------------------- | ----------------------------------------------------------------------- |
| `--output`       |       | `analysis-report.md` | Output markdown file path.                                              |
| `--package`      | `-p`  | —                    | Package(s) to analyse. Repeatable; mutually exclusive with `--domain`.  |
| `--domain`       | `-d`  | —                    | Domain to analyse (sfp-pro only). Mutually exclusive with `--package`.  |
| `--provider`     |       | `anthropic`          | AI provider: `anthropic`, `openai`, `amazon-bedrock`, `github-copilot`. |
| `--model`        |       | provider default     | Model id to use.                                                        |
| `--prompt-count` |       | all                  | Limit the number of analysis prompts (useful for quick test runs).      |

When connected to an sfp server, the command also accepts the standard server flags (`--sfp-server-url`, `--application-token`, `--repository`) and uses them to fetch provider credentials. With no package or domain specified, the whole project is analysed.

### Output Format

Reports are generated in Markdown format with the following structure:

1. **Executive Summary** - High-level findings and recommendations
2. **Package/Domain Overview** - Architecture and design analysis
3. **Dependencies Analysis** - Inter-package relationships
4. **Code Quality Insights** - Technical debt and improvement opportunities
5. **Recommendations** - Prioritized action items

### Troubleshooting

#### Rate Limiting

If you encounter rate limits:

* Reduce `--prompt-count` to lower token usage
* Analyze smaller scopes (single package vs domain)
* Consider using a different model with higher limits


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flxbl.io/flxbl/sfp/analysing-a-project/ai-powered-report.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
