|
| 1 | +# Team-to-Team Copy (T2TC) Commands |
| 2 | + |
| 3 | +The `t2tc package` command group moves whole packages — and, optionally, their dependencies and variables — between teams and realms. These commands power the **Team-to-Team Copy** feature: the T2TC backend drives the copy by exporting from a source team and importing into a target team through this CLI. |
| 4 | + |
| 5 | +These commands are a **self-contained, batch-specific set**. `t2tc package export` produces a multi-package **batch archive**, and only the other `t2tc package` commands (`import`, `diff`) understand that archive. It is **not** interchangeable with the package format used by [`config package import`](./config-commands.md#package-commands-config-package) (see [Batch archive vs. package format](#batch-archive-vs-package-format)). |
| 6 | + |
| 7 | +> **Migrating from `config`?** `t2tc package list/export/import/diff` replace the deprecated `config list/export/import/diff` commands. The flags and behaviour are identical — only the command path changed. |
| 8 | +
|
| 9 | +| Old (deprecated) | New | |
| 10 | +|---|---| |
| 11 | +| `config list` | `t2tc package list` | |
| 12 | +| `config export` | `t2tc package export` | |
| 13 | +| `config import` | `t2tc package import` | |
| 14 | +| `config diff` | `t2tc package diff` | |
| 15 | + |
| 16 | +## Permissions |
| 17 | + |
| 18 | +`t2tc package` commands run against the Pacman API and are subject to the same permission checks the platform applies in the UI. The required permission depends on the **flavor** of the target package: |
| 19 | + |
| 20 | +| Package flavor | Required permission | |
| 21 | +|---|---| |
| 22 | +| **Studio** (Studio packages and their assets) | **Edit package** permission on the package | |
| 23 | +| **OCDM** (OCDM packages and their assets) | **Edit** (admin) permission on the **data pool** the OCDM package is connected to | |
| 24 | + |
| 25 | +`t2tc package list` is the one exception: instead of failing, it **filters out packages the profile does not have permission to access**. If a package you expect to see is missing from the list, the most likely cause is missing edit permission on the package (Studio) or on its connected data pool (OCDM). |
| 26 | + |
| 27 | +## Batch archive vs. package format |
| 28 | + |
| 29 | +`t2tc package export` produces a multi-package **batch archive** — a top-level `manifest.json`, `variables.json`, `studio.json`, and one nested `<packageKey>_<version>.zip` per package — that is produced and consumed **only** by the `t2tc package` commands. [`config package import`](./config-commands.md#package-commands-config-package), by contrast, works with a plain **package zip** (a `package.json`, an optional `variables.json`, and a `nodes/` folder). The two formats are **not interchangeable**: |
| 30 | + |
| 31 | +- An archive from `t2tc package export` can be imported with `t2tc package import` or inspected with `t2tc package diff` — but **not** with `config package import`. |
| 32 | +- A package zip used by `config package import` **cannot** be imported with `t2tc package import` or diffed with `t2tc package diff`. |
| 33 | + |
| 34 | +Reach for `t2tc package` only for its specific bulk use-case — moving a set of packages together (for example, a migration between teams). To work with a single package, use [`config package import`](./config-commands.md#package-commands-config-package). |
| 35 | + |
| 36 | +## List Packages |
| 37 | + |
| 38 | +Packages can be listed using the following command: |
| 39 | + |
| 40 | +```bash |
| 41 | +content-cli t2tc package list -p <sourceProfile> |
| 42 | +``` |
| 43 | + |
| 44 | +The result will be printed in the console containing only the package name and key: |
| 45 | + |
| 46 | +```bash |
| 47 | +info: Package1 - Key: "package-1" |
| 48 | +``` |
| 49 | + |
| 50 | +By using the `--json` option, packages can be exported (saved) in an extended form as a json file in the current working directory. |
| 51 | + |
| 52 | +```bash |
| 53 | +content-cli t2tc package list -p <sourceProfile> --json |
| 54 | +``` |
| 55 | + |
| 56 | +The name of the file will be printed in the console with the following format: |
| 57 | + |
| 58 | +```bash |
| 59 | +info: File downloaded successfully. New filename: 9560f81f-f746-4117-83ee-dd1f614ad624.json |
| 60 | +``` |
| 61 | + |
| 62 | +By using the `--flavors` option, you can filter which packages to list. The available flavors are: **STUDIO** and **OCDM**. |
| 63 | + |
| 64 | +To list staging packages instead of deployed packages use the `--staging` option. Please note that this flag is not compatible with the below options. |
| 65 | + |
| 66 | +> For day-to-day staging listing outside the copy workflow, prefer [`config package list`](./config-commands.md#list-packages-config-package-list), which lists staging packages by default. |
| 67 | +
|
| 68 | +### List Packages with Dependencies |
| 69 | + |
| 70 | +When using the listing command with the `--json` option, two additional options are available: |
| 71 | + |
| 72 | +- **--withDependencies**: This option will include the dependencies of the packages in the output. |
| 73 | + |
| 74 | +```bash |
| 75 | +content-cli t2tc package list -p <sourceProfile> --withDependencies |
| 76 | +``` |
| 77 | + |
| 78 | +- **--packageKeys**: This option allows you to filter the packages by their keys. You can specify multiple package keys separated by spaces. |
| 79 | + |
| 80 | +```bash |
| 81 | +content-cli t2tc package list -p <sourceProfile> --packageKeys key1 ... keyN |
| 82 | +[optional] --withDependencies |
| 83 | +``` |
| 84 | + |
| 85 | +## Export Packages |
| 86 | + |
| 87 | +Packages can be exported using the following command: |
| 88 | + |
| 89 | +```bash |
| 90 | +content-cli t2tc package export -p <sourceProfile> --packageKeys key1 ... keyN |
| 91 | +``` |
| 92 | + |
| 93 | +The `--keysByVersion` option can be used to export packages by specific version. You can specify multiple packages with version separated by spaces, in the format of 'packageKey.version'. |
| 94 | +The `--withDependencies` option can be used to also export dependencies of the given packages. |
| 95 | +The `--unzip` option can be used to unzip the exported packages into the current working directory. |
| 96 | + |
| 97 | +Depending on the `--unzip` option used, a zip file, or a directory containing the exported packages, will be created in the current working directory containing: |
| 98 | + |
| 99 | +```bash |
| 100 | +exported_package_random_uuid/ |
| 101 | +├─ manifest.json |
| 102 | +├─ variable.json |
| 103 | +├─ studio.json |
| 104 | +├─ package_key1-version.zip |
| 105 | +├─ ... |
| 106 | +├─ package_keyN-version.zip |
| 107 | +``` |
| 108 | + |
| 109 | +### Git Integration for Export |
| 110 | + |
| 111 | +The following **Git options** are available: |
| 112 | + |
| 113 | +- `--gitProfile <gitProfileName>` – specifies the Git profile to use for exporting directly to a repository. |
| 114 | + If not specified, the default profile will be used. |
| 115 | +- `--gitBranch <branchName>` – specifies the branch in the Github repository where the export will be pushed. |
| 116 | + |
| 117 | +Example exporting to Git: |
| 118 | + |
| 119 | +```bash |
| 120 | +content-cli t2tc package export -p <sourceProfile> --packageKeys key1 key2 --gitProfile myGitProfile --gitBranch feature-branch |
| 121 | +``` |
| 122 | + |
| 123 | +### Export Directory Structure |
| 124 | + |
| 125 | +- manifest.json - File which contains the metadata of the exported packages. |
| 126 | +- studio.json - File which contains the metadata of the exported packages in a format compatible with Studio. |
| 127 | +- variables.json - File which contains the variables of the exported packages. |
| 128 | +- exported packages directories - Directories containing the exported package files, each directory is named after the package key and the version. |
| 129 | + |
| 130 | +Inside each exported package directory, the following files will be present: |
| 131 | + |
| 132 | +- package.json - File which contains the configuration of the exported package. |
| 133 | +- nodes/ - Directory containing the nodes of the exported package. |
| 134 | + |
| 135 | +Inside the nodes directory, a file for each node will be present: |
| 136 | + |
| 137 | +- node_key.json - File which contains the configuration of the exported node. |
| 138 | + |
| 139 | +## Import Packages |
| 140 | + |
| 141 | +Packages can be imported using the following commands, if importing from a zip file: |
| 142 | + |
| 143 | +```bash |
| 144 | +content-cli t2tc package import -p <sourceProfile> -f <relative exported zip file path> |
| 145 | +``` |
| 146 | + |
| 147 | +Where `-f` is the short hand operation for `--file`. |
| 148 | +If importing from a directory containing the exported packages, the following command can be used: |
| 149 | + |
| 150 | +```bash |
| 151 | +content-cli t2tc package import -p <sourceProfile> -d <relative exported directory file path> |
| 152 | +``` |
| 153 | + |
| 154 | +Where `-d` is the shorthand operation for `--directory`. |
| 155 | +When packages with the same keys exist in the target team, the `--overwrite` option can be used for allowing overwriting of those packages. If the package in target environment contains unpublished changes, they are automatically saved under a new version. This allows you to audit, compare, or roll back to your previous state via the version history if needed. |
| 156 | + |
| 157 | +```bash |
| 158 | +content-cli t2tc package import -p <sourceProfile> -f <file path> --overwrite |
| 159 | +``` |
| 160 | + |
| 161 | +### Git Integration for Import |
| 162 | + |
| 163 | +The following **Git options** are available: |
| 164 | + |
| 165 | +- `--gitProfile <gitProfileName>` – specifies the Git profile to use for importing directly from a repository. |
| 166 | + If not specified, the default profile will be used. |
| 167 | +- `--gitBranch <branchName>` – specifies the branch in the Github repository from which to import. |
| 168 | + |
| 169 | +Example importing from Git: |
| 170 | + |
| 171 | +```bash |
| 172 | +content-cli t2tc package import -p <sourceProfile> --gitProfile myGitProfile --gitBranch feature-branch |
| 173 | +``` |
| 174 | + |
| 175 | +Finally, the result of this command will be a list of PostPackageImportData exported as a json file. The file name will be printed with the following message format: |
| 176 | + |
| 177 | +```bash |
| 178 | +info: Config import report file: 9560f81f-f746-4117-83ee-dd1f614ad624.json |
| 179 | +``` |
| 180 | + |
| 181 | +### Validate During Import |
| 182 | + |
| 183 | +Add `--validate` to `t2tc package import` to run validation against each node **before** the import is committed: |
| 184 | + |
| 185 | +```bash |
| 186 | +content-cli t2tc package import -p <sourceProfile> -d <export_dir> --validate --overwrite |
| 187 | +``` |
| 188 | + |
| 189 | +`t2tc package import --validate` runs the **SCHEMA** layer only. It does **not** run BUSINESS-layer checks (PQL parsing, data-model availability, KPI uniqueness, etc.) or PACKAGE_SETTINGS checks (package dependencies, variables, and flavor-specific package settings). To run those validations, use [`config package validate`](./config-commands.md#validate-package-configurations-config-package-validate) after the import. |
| 190 | + |
| 191 | +## Diff local zip with deployed version/specific version/staging |
| 192 | + |
| 193 | +To compare local zipped packages with online packages use: |
| 194 | + |
| 195 | +```bash |
| 196 | +content-cli t2tc package diff --file <file> |
| 197 | +``` |
| 198 | + |
| 199 | +As with other commands, use `--json` to export the diff to a file. |
| 200 | +To diff against a specific version use the `--baseVersion` parameter. When omitted it will diff against the current deployed version. |
| 201 | +To diff against staging use `--baseVersion STAGING`. |
| 202 | + |
| 203 | +```bash |
| 204 | +content-cli t2tc package diff --file <file> --baseVersion <version> |
| 205 | +``` |
| 206 | + |
| 207 | +To diff against the current deployed version and only return whether there are any changes, use the `--hasChanges` flag. |
| 208 | + |
| 209 | +```bash |
| 210 | +content-cli t2tc package diff --file <file> --hasChanges |
| 211 | +``` |
0 commit comments