# flxbl-io/sfp architecture

> Architecture diagram of the GitHub repository flxbl-io/sfp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/flxbl-io/sfp
- Repository: https://github.com/flxbl-io/sfp

## Overview

sfp is a Salesforce CLI for artifact-centric development and release management. The central workflow validates a project, builds package artifacts in dependency-aware order, publishes or fetches artifacts, and deploys or releases them to Salesforce orgs. Separate command families support validation, scratch-org pools, impact analysis, profile reconciliation, changelogs, and Apex testing. The graph emphasizes documented workflow and major README capabilities; unsampled command implementations are represented by their exact enclosing paths, and their internal call links are omitted where evidence is unavailable.

Main entry points: [`src/commands`](https://github.com/flxbl-io/sfp/tree/main/src/commands) (CLI commands), [`src/impl/deploy/DeployImpl.ts`](https://github.com/flxbl-io/sfp/blob/main/src/impl/deploy/DeployImpl.ts) (Deploy artifacts), [`src/SfpCommand.ts`](https://github.com/flxbl-io/sfp/blob/main/src/SfpCommand.ts) (Command setup), [`src/core/package/SfpPackageBuilder.ts`](https://github.com/flxbl-io/sfp/blob/main/src/core/package/SfpPackageBuilder.ts) (Package builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_commands["CLI commands"]
  node_commandbase["Command setup<br/>[SfpCommand.ts]"]
  node_project["Project config<br/>[ProjectConfig.ts]"]
  node_impact["Impact analysis"]
  node_profiles["Profile tools"]
end

subgraph group_packages["Packages and artifacts"]
  node_build["Dependency build<br/>[BuildImpl.ts]"]
  node_packagebuilder["Package builder"]
  node_package["Package model<br/>[SfpPackage.ts]"]
  node_packagecreate["Package creation"]
  node_artifactgenerator["Artifact generation"]
  node_artifactfetch["Artifact fetch<br/>[ArtifactFetcher.ts]"]
  node_publish["Publish artifacts<br/>[publish.ts]"]
end

subgraph group_release["Deployment and release"]
  node_deploy["Deploy artifacts<br/>[DeployImpl.ts]"]
  node_releaseimpl["Release orchestration<br/>[ReleaseImpl.ts]"]
  node_releaseconfig["Release definitions"]
  node_validation["Org validation<br/>[ValidateImpl.ts]"]
  node_changelog["Changelogs"]
end

subgraph group_orgs["Org lifecycle"]
  node_salesforce[("Salesforce orgs")]
  node_orgmodel["Org access<br/>[SFPOrg.ts]"]
  node_pool["Scratch org pools"]
  node_query["Salesforce query<br/>[QueryHelper.ts]"]
end

subgraph group_insight["Testing and observability"]
  node_apextests["Apex testing"]
  node_coverage["Package coverage"]
  node_metrics["Metrics sender<br/>[SFPStatsSender.ts]"]
  node_metricsservices["Metric integrations"]
end

node_user(("Engineer / CI"))

node_user -->|"invokes"| node_commands
node_commands -->|"initializes"| node_commandbase
node_commandbase -->|"validates project"| node_project
node_commands -.->|"builds packages"| node_build
node_build -->|"builds package"| node_packagebuilder
node_packagebuilder -->|"creates"| node_package
node_commands -.->|"creates packages"| node_packagecreate
node_packagecreate -->|"generates artifacts"| node_artifactgenerator
node_commands -->|"publishes"| node_publish
node_publish -->|"fetches artifacts"| node_artifactfetch
node_commands -.->|"deploys"| node_deploy
node_deploy -->|"fetches artifacts"| node_artifactfetch
node_commands -.->|"runs release"| node_releaseimpl
node_releaseimpl -->|"orchestrates deployment"| node_deploy
node_releaseimpl -->|"loads definitions"| node_releaseconfig
node_commands -.->|"validates orgs"| node_validation
node_validation -->|"builds packages"| node_build
node_validation -->|"deploys validation"| node_deploy
node_deploy -->|"uses org access"| node_orgmodel
node_orgmodel -->|"queries org"| node_salesforce
node_orgmodel -->|"runs queries"| node_query
node_commands -.->|"manages pools"| node_pool
node_commands -.->|"analyzes changes"| node_impact
node_commands -.->|"reconciles profiles"| node_profiles
node_commands -.->|"generates changelogs"| node_changelog
node_commands -.->|"runs Apex tests"| node_apextests
node_packagebuilder -.->|"coverage capability"| node_coverage
node_commandbase -->|"initializes metrics"| node_metrics
node_metrics -->|"dispatches metrics"| node_metricsservices

click node_commands "https://github.com/flxbl-io/sfp/tree/main/src/commands"
click node_commandbase "https://github.com/flxbl-io/sfp/blob/main/src/SfpCommand.ts"
click node_project "https://github.com/flxbl-io/sfp/blob/main/src/core/project/ProjectConfig.ts"
click node_build "https://github.com/flxbl-io/sfp/blob/main/src/impl/parallelBuilder/BuildImpl.ts"
click node_packagebuilder "https://github.com/flxbl-io/sfp/blob/main/src/core/package/SfpPackageBuilder.ts"
click node_package "https://github.com/flxbl-io/sfp/blob/main/src/core/package/SfpPackage.ts"
click node_packagecreate "https://github.com/flxbl-io/sfp/blob/main/src/PackageCreateCommand.ts"
click node_artifactgenerator "https://github.com/flxbl-io/sfp/blob/main/src/core/artifacts/generators/ArtifactGenerator.ts"
click node_artifactfetch "https://github.com/flxbl-io/sfp/blob/main/src/core/artifacts/ArtifactFetcher.ts"
click node_publish "https://github.com/flxbl-io/sfp/blob/main/src/commands/publish.ts"
click node_deploy "https://github.com/flxbl-io/sfp/blob/main/src/impl/deploy/DeployImpl.ts"
click node_releaseimpl "https://github.com/flxbl-io/sfp/blob/main/src/impl/release/ReleaseImpl.ts"
click node_releaseconfig "https://github.com/flxbl-io/sfp/tree/main/src/impl/release"
click node_validation "https://github.com/flxbl-io/sfp/blob/main/src/impl/validate/ValidateImpl.ts"
click node_orgmodel "https://github.com/flxbl-io/sfp/blob/main/src/core/org/SFPOrg.ts"
click node_pool "https://github.com/flxbl-io/sfp/tree/main/src/core/scratchorg/pool"
click node_impact "https://github.com/flxbl-io/sfp/tree/main/src/impl/impact"
click node_profiles "https://github.com/flxbl-io/sfp/tree/main/src/commands/profile"
click node_changelog "https://github.com/flxbl-io/sfp/tree/main/src/impl/changelog"
click node_apextests "https://github.com/flxbl-io/sfp/tree/main/src/core/apextest"
click node_coverage "https://github.com/flxbl-io/sfp/blob/main/src/core/package/coverage/PackageTestCoverage.ts"
click node_metrics "https://github.com/flxbl-io/sfp/blob/main/src/core/stats/SFPStatsSender.ts"
click node_metricsservices "https://github.com/flxbl-io/sfp/tree/main/src/core/stats/nativeMetricSenderImpl"
click node_query "https://github.com/flxbl-io/sfp/blob/main/src/core/queryHelper/QueryHelper.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_commands,node_commandbase,node_project,node_impact,node_profiles toneBlue
class node_build,node_packagebuilder,node_package,node_packagecreate,node_artifactgenerator,node_artifactfetch,node_publish toneAmber
class node_deploy,node_releaseimpl,node_releaseconfig,node_validation,node_changelog toneMint
class node_salesforce,node_orgmodel,node_pool,node_query toneRose
class node_apextests,node_coverage,node_metrics,node_metricsservices,node_user toneIndigo
```

## Components

### CLI workflow

- [CLI commands](https://github.com/flxbl-io/sfp/tree/main/src/commands): `src/commands`
- [Command setup](https://github.com/flxbl-io/sfp/blob/main/src/SfpCommand.ts): `src/SfpCommand.ts`
- [Project config](https://github.com/flxbl-io/sfp/blob/main/src/core/project/ProjectConfig.ts): `src/core/project/ProjectConfig.ts`
- [Impact analysis](https://github.com/flxbl-io/sfp/tree/main/src/impl/impact): `src/impl/impact`
- [Profile tools](https://github.com/flxbl-io/sfp/tree/main/src/commands/profile): `src/commands/profile`

### Packages and artifacts

- [Dependency build](https://github.com/flxbl-io/sfp/blob/main/src/impl/parallelBuilder/BuildImpl.ts): `src/impl/parallelBuilder/BuildImpl.ts`
- [Package builder](https://github.com/flxbl-io/sfp/blob/main/src/core/package/SfpPackageBuilder.ts): `src/core/package/SfpPackageBuilder.ts`
- [Package model](https://github.com/flxbl-io/sfp/blob/main/src/core/package/SfpPackage.ts): `src/core/package/SfpPackage.ts`
- [Package creation](https://github.com/flxbl-io/sfp/blob/main/src/PackageCreateCommand.ts): `src/PackageCreateCommand.ts`
- [Artifact generation](https://github.com/flxbl-io/sfp/blob/main/src/core/artifacts/generators/ArtifactGenerator.ts): `src/core/artifacts/generators/ArtifactGenerator.ts`
- [Artifact fetch](https://github.com/flxbl-io/sfp/blob/main/src/core/artifacts/ArtifactFetcher.ts): `src/core/artifacts/ArtifactFetcher.ts`
- [Publish artifacts](https://github.com/flxbl-io/sfp/blob/main/src/commands/publish.ts): `src/commands/publish.ts`

### Deployment and release

- [Deploy artifacts](https://github.com/flxbl-io/sfp/blob/main/src/impl/deploy/DeployImpl.ts): `src/impl/deploy/DeployImpl.ts`
- [Release orchestration](https://github.com/flxbl-io/sfp/blob/main/src/impl/release/ReleaseImpl.ts): `src/impl/release/ReleaseImpl.ts`
- [Release definitions](https://github.com/flxbl-io/sfp/tree/main/src/impl/release): `src/impl/release`
- [Org validation](https://github.com/flxbl-io/sfp/blob/main/src/impl/validate/ValidateImpl.ts): `src/impl/validate/ValidateImpl.ts`
- [Changelogs](https://github.com/flxbl-io/sfp/tree/main/src/impl/changelog): `src/impl/changelog`

### Org lifecycle

- **Salesforce orgs**
- [Org access](https://github.com/flxbl-io/sfp/blob/main/src/core/org/SFPOrg.ts): `src/core/org/SFPOrg.ts`
- [Scratch org pools](https://github.com/flxbl-io/sfp/tree/main/src/core/scratchorg/pool): `src/core/scratchorg/pool`
- [Salesforce query](https://github.com/flxbl-io/sfp/blob/main/src/core/queryHelper/QueryHelper.ts): `src/core/queryHelper/QueryHelper.ts`

### Testing and observability

- [Apex testing](https://github.com/flxbl-io/sfp/tree/main/src/core/apextest): `src/core/apextest`
- [Package coverage](https://github.com/flxbl-io/sfp/blob/main/src/core/package/coverage/PackageTestCoverage.ts): `src/core/package/coverage/PackageTestCoverage.ts`
- [Metrics sender](https://github.com/flxbl-io/sfp/blob/main/src/core/stats/SFPStatsSender.ts): `src/core/stats/SFPStatsSender.ts`
- [Metric integrations](https://github.com/flxbl-io/sfp/tree/main/src/core/stats/nativeMetricSenderImpl): `src/core/stats/nativeMetricSenderImpl`

### Other components

- **Engineer / CI**

## Connections

- Engineer / CI → CLI commands: invokes (evidence: `README.md`)
- CLI commands → Command setup: initializes (evidence: `src/SfpCommand.ts`)
- Command setup → Project config: validates project (evidence: `src/SfpCommand.ts`)
- CLI commands → Dependency build: builds packages
- Dependency build → Package builder: builds package (evidence: `src/impl/parallelBuilder/BuildImpl.ts`)
- Package builder → Package model: creates (evidence: `src/core/package/SfpPackageBuilder.ts`)
- CLI commands → Package creation: creates packages
- Package creation → Artifact generation: generates artifacts (evidence: `src/PackageCreateCommand.ts`)
- CLI commands → Publish artifacts: publishes (evidence: `README.md`)
- Publish artifacts → Artifact fetch: fetches artifacts (evidence: `src/commands/publish.ts`)
- CLI commands → Deploy artifacts: deploys
- Deploy artifacts → Artifact fetch: fetches artifacts (evidence: `src/impl/deploy/DeployImpl.ts`)
- CLI commands → Release orchestration: runs release
- Release orchestration → Deploy artifacts: orchestrates deployment (evidence: `src/impl/release/ReleaseImpl.ts`)
- Release orchestration → Release definitions: loads definitions (evidence: `src/impl/release/ReleaseImpl.ts`)
- CLI commands → Org validation: validates orgs
- Org validation → Dependency build: builds packages (evidence: `src/impl/validate/ValidateImpl.ts`)
- Org validation → Deploy artifacts: deploys validation (evidence: `src/impl/validate/ValidateImpl.ts`)
- Deploy artifacts → Org access: uses org access (evidence: `src/impl/deploy/DeployImpl.ts`)
- Org access → Salesforce orgs: queries org (evidence: `src/core/org/SFPOrg.ts`)
- Org access → Salesforce query: runs queries (evidence: `src/core/org/SFPOrg.ts`)
- CLI commands → Scratch org pools: manages pools
- CLI commands → Impact analysis: analyzes changes
- CLI commands → Profile tools: reconciles profiles
- CLI commands → Changelogs: generates changelogs
- CLI commands → Apex testing: runs Apex tests
- Package builder → Package coverage: coverage capability
- Command setup → Metrics sender: initializes metrics (evidence: `src/SfpCommand.ts`)
- Metrics sender → Metric integrations: dispatches metrics (evidence: `src/core/stats/SFPStatsSender.ts`)
