# Repo

Analyze and manage project repository

* [`sfp repo clone`](#sfp-repo-clone)
* [`sfp repo diff`](#sfp-repo-diff)
* [`sfp repo list`](#sfp-repo-list)
* [`sfp repo patch`](#sfp-repo-patch)
* [`sfp repo visualize`](#sfp-repo-visualize)
* [`sfp repo workspace-tree`](#sfp-repo-workspace-tree)

## `sfp repo clone`

Clone a repository using authenticated credentials from the SFP server.

```
USAGE
  $ sfp repo clone [--json] [--repository <value>] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-d
    <value>] [--depth <value>] [-b <value>] [--default-branch] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -b, --branch=<value>             Clone a specific branch instead of the default branch.
  -d, --directory=<value>          Target directory for the cloned repository. Defaults to the repository name in the
                                   current directory.
  -e, --email=<value>              Email address for authenticated user. Ignored if --application-token is provided. Can
                                   be set via SFP_SERVER_USER env var.
  -t, --application-token=<value>  Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                   (CLI flags take precedence over env vars).
      --default-branch             After cloning, switch to the default branch (e.g., main or master). Useful when
                                   cloning a specific branch but wanting to end up on the default.
      --depth=<value>              Create a shallow clone with the specified number of commits. Use 0 for full history
                                   (default). Useful for faster clones when full history is not needed.
      --loglevel=<option>          [default: info] logging level for this command invocation
                                   <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --repository=<value>         The repository identifier. E.g `owner/repo` for GitHub/GitLab or `org/project/repo`
                                   for Azure DevOps
      --sfp-server-url=<value>     URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                   config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Clone a repository using authenticated credentials from the SFP server.

  This command fetches an authenticated clone URL from the SFP server and clones the repository. The authentication
  token is automatically embedded in the clone URL, making it suitable for CI/CD pipelines and automated workflows.

EXAMPLES
  Clone a repository:
  `sfp repo clone --repository owner/repo --application-token $SFP_SERVER_TOKEN --sfp-server-url http://localhost:3029`

  Clone with shallow depth for faster cloning:
  `sfp repo clone --repository owner/repo --depth 1 --application-token $SFP_SERVER_TOKEN`

  Clone a specific branch:
  `sfp repo clone --repository owner/repo --branch feature/my-branch --application-token $SFP_SERVER_TOKEN`

  Clone to a specific directory:
  `sfp repo clone --repository owner/repo --directory ./my-project --application-token $SFP_SERVER_TOKEN`

  Clone and switch to default branch:
  `sfp repo clone --repository owner/repo --branch release/v1.0 --default-branch --application-token $SFP_SERVER_TOKEN`
```

*See code:* [*src/commands/repo/clone.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp repo diff`

Analyze and output changed components between two git branches

```
USAGE
  $ sfp repo diff --basebranch <value> [--json] [-b <value>] [--output-dir <value> | --create-package <value>]
    [-p <value>...] [--releaseconfig <value>...] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -b, --branch=<value>            [default: HEAD] Target branch to compare (defaults to HEAD)
  -p, --packages=<value>...       Comma-separated list of packages to include in the diff
      --basebranch=<value>        (required) Base branch to compare against (e.g., main)
      --create-package=<value>    Create diff as a package directory in the current repo and rewrite sfdx-project.json
      --loglevel=<option>         [default: info] logging level for this command invocation
                                  <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --output-dir=<value>        Generate a self-contained project directory with the diff
      --releaseconfig=<value>...  Path to release config file to filter packages by domain

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Analyze and output changed components between two git branches

EXAMPLES
  # Show summary of changed components

  $ sfp repo diff --basebranch main



  # Generate self-contained project with diff

  $ sfp repo diff --basebranch main --output-dir .diff



  # Create diff as package in repo

  $ sfp repo diff --basebranch main --create-package my-diff



  # Filter to specific packages

  $ sfp repo diff --basebranch main --packages core-utils,sales-app
```

*See code:* [*src/commands/repo/diff.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp repo list`

List all registered repositories/projects from the SFP server.

```
USAGE
  $ sfp repo list [--json] [--repository <value>] [-e <value>] [-t <value>] [--sfp-server-url <value>]
    [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>              Email address for authenticated user. Ignored if --application-token is provided. Can
                                   be set via SFP_SERVER_USER env var.
  -t, --application-token=<value>  Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                   (CLI flags take precedence over env vars).
      --loglevel=<option>          [default: info] logging level for this command invocation
                                   <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --repository=<value>         The repository identifier. E.g `owner/repo` for GitHub/GitLab or `org/project/repo`
                                   for Azure DevOps
      --sfp-server-url=<value>     URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                   config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  List all registered repositories/projects from the SFP server.

  This command retrieves the list of all projects that have been registered with the SFP server. Each project represents
  a repository that can be cloned, built, and deployed using SFP.

EXAMPLES
  List all registered repositories:
  `sfp repo list --application-token $SFP_SERVER_TOKEN --sfp-server-url http://localhost:3029`

  List repositories with JSON output:
  `sfp repo list --json --application-token $SFP_SERVER_TOKEN`
```

*See code:* [*src/commands/repo/list.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp repo patch`

Generate a dynamic branch with the packages patched to the contents as mentioned in the release config file

```
USAGE
  $ sfp repo patch -p <value>... -s <value> --targetbranchname <value> [--json] [--repository <value>] [-e
    <value>] [-t <value>] [--sfp-server-url <value>] [--scope <value>] [--npmrcpath <value> [--npm | -f <value>]] [-g
    <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>                  Email address for authenticated user. Ignored if --application-token is provided.
                                       Can be set via SFP_SERVER_USER env var.
  -f, --scriptpath=<value>             (Optional: no-NPM) Path to script that authenticates and downloads artifacts from
                                       the registry
  -g, --logsgroupsymbol=<value>...     Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                       opening group, and an optional closing group symbol.
  -p, --releasedefinitions=<value>...  (required) Path to release definiton yaml
  -s, --sourcebranchname=<value>       (required) Name of the source branch to be used on which the alignment need to be
                                       applied
  -t, --application-token=<value>      Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env
                                       var (CLI flags take precedence over env vars).
      --loglevel=<option>              [default: info] logging level for this command invocation
                                       <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --npm                            Download artifacts from a pre-authenticated private npm registry
      --npmrcpath=<value>              Path to .npmrc file used for authentication to registry. If left blank, defaults
                                       to home directory
      --repository=<value>             The repository identifier. E.g `owner/repo` for GitHub/GitLab or
                                       `org/project/repo` for Azure DevOps
      --scope=<value>                  (required for NPM) User or Organisation scope of the NPM package
      --sfp-server-url=<value>         URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                       config:set server-url
      --targetbranchname=<value>       (required) Name of the target branch to be created after the alignment

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Generate a dynamic branch with the packages patched to the contents as mentioned in the release config file

EXAMPLES
  $ sfp repo:patch -p myreleasedefinition.yaml -s main --targetbranchname patch-branch --npm --scope myscope

  $ sfp repo:patch -p "core/JUN25" -s release/JUN25 --targetbranchname release-JUN25-patch --npm --repository owner/repo --sfp-server-url http://localhost:3029
```

*See code:* [*src/commands/repo/patch.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp repo visualize`

Collect package visualization data from repository history.

```
USAGE
  $ sfp repo visualize -c <value> [--json] [--repository <value>] [-e <value>] [-t <value>] [--sfp-server-url
    <value>] [-b <value>] [-m <value>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -b, --branch=<value>               [default: main] The git branch to analyze. Defaults to 'main'.
  -c, --release-config-path=<value>  (required) Path to the directory containing release configuration YAML files. These
                                     files are used to map packages to their domains (e.g., sales, service).
  -e, --email=<value>                Email address for authenticated user. Ignored if --application-token is provided.
                                     Can be set via SFP_SERVER_USER env var.
  -m, --max-commits=<value>          Maximum depth of commits to analyze from HEAD backwards. If not specified, all
                                     commits from the beginning of repository history will be analyzed.
  -t, --application-token=<value>    Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                     (CLI flags take precedence over env vars).
      --loglevel=<option>            [default: info] logging level for this command invocation
                                     <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --repository=<value>           The repository identifier. E.g `owner/repo` for GitHub/GitLab or `org/project/repo`
                                     for Azure DevOps
      --sfp-server-url=<value>       URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                     config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Collect package visualization data from repository history.

  This command analyzes the git history of sfdx-project.json to track package evolution over time. It extracts package
  metadata, file counts, and domain mappings from release configurations, then stores the visualization data in the
  DocStore for later retrieval and visualization.

EXAMPLES
  Collect package visualization data:
  `sfp repo visualize --repository org/repo --release-config-path ./release-configs --application-token $SFP_SERVER_TOKEN`

  Collect with specific branch:
  `sfp repo visualize --repository org/repo --release-config-path ./release-configs --branch develop --application-token $SFP_SERVER_TOKEN`

  Limit the depth of commits analyzed:
  `sfp repo visualize --repository org/repo --release-config-path ./release-configs --max-commits 500 --application-token $SFP_SERVER_TOKEN`

  Get JSON output:
  `sfp repo visualize --repository org/repo --release-config-path ./release-configs --json --application-token $SFP_SERVER_TOKEN`
```

*See code:* [*src/commands/repo/visualize.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp repo workspace-tree`

Build and publish a workspace metadata tree for a repository.

```
USAGE
  $ sfp repo workspace-tree --target-repo <value> [--json] [--repository <value>] [-e <value>] [-t <value>]
    [--sfp-server-url <value>] [--branch <value>] [-o <value>] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>              Email address for authenticated user. Ignored if --application-token is provided. Can
                                   be set via SFP_SERVER_USER env var.
  -o, --output-file=<value>        Write the tree JSON to a local file instead of stdout.
  -t, --application-token=<value>  Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                   (CLI flags take precedence over env vars).
      --branch=<value>             [default: main] Source branch name for the tree. Defaults to 'main'.
      --loglevel=<option>          [default: info] logging level for this command invocation
                                   <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --repository=<value>         The repository identifier. E.g `owner/repo` for GitHub/GitLab or `org/project/repo`
                                   for Azure DevOps
      --sfp-server-url=<value>     URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                   config:set server-url
      --target-repo=<value>        (required) Repository identifier in owner/repo format (e.g., flxbl-io/sf-core).

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Build and publish a workspace metadata tree for a repository.

  Scans the Salesforce project structure, resolves metadata types and categories, and produces a hierarchical tree of
  all packages and their contents. The tree can be output as JSON and/or published to the SFP server for use by the web
  application.

EXAMPLES
  Build workspace tree and output as JSON:
  `sfp repo workspace-tree --target-repo flxbl-io/sf-core --branch main --json`

  Build workspace tree and save to file:
  `sfp repo workspace-tree --target-repo flxbl-io/sf-core --branch main -o tree.json`

  Build and publish to server:
  `sfp repo workspace-tree --target-repo flxbl-io/sf-core --branch main --application-token $TOKEN --sfp-server-url http://localhost:3029`
```

*See code:* [*src/commands/repo/workspace-tree.ts*](https://source.flxbl.io/flxbl/sfp-pro)


---

# Agent Instructions: 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:

```
GET https://docs.flxbl.io/flxbl/sfp/cli-reference-v51-release-v3/advanced/repo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
