recce-cloud 1.34.0__py3-none-any.whl → 1.35.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
recce_cloud/VERSION CHANGED
@@ -1 +1 @@
1
- 1.34.0
1
+ 1.35.0
recce_cloud/cli.py CHANGED
@@ -43,6 +43,7 @@ logging.getLogger("recce_cloud.ci_providers.detector").setLevel(logging.WARNING)
43
43
 
44
44
 
45
45
  @click.group()
46
+ @click.version_option(version=__version__, prog_name="recce-cloud")
46
47
  def cloud_cli():
47
48
  """
48
49
  Recce Cloud CLI - Manage Recce Cloud sessions and state files.
@@ -158,11 +159,11 @@ def logout():
158
159
  @cloud_cli.command()
159
160
  @click.option(
160
161
  "--org",
161
- help="Organization name or slug to bind to",
162
+ help="Organization ID, name, or slug to bind to",
162
163
  )
163
164
  @click.option(
164
165
  "--project",
165
- help="Project name or slug to bind to",
166
+ help="Project ID, name, or slug to bind to",
166
167
  )
167
168
  @click.option(
168
169
  "--status",
@@ -257,13 +258,15 @@ def init(org, project, status, clear):
257
258
  api = RecceCloudClient(token)
258
259
  org_obj = api.get_organization(org)
259
260
  if not org_obj:
260
- console.print(f"[red]Error:[/red] Organization '{org}' not found")
261
+ console.print(f"[red]Error:[/red] Organization '{org}' not found or you don't have access")
261
262
  sys.exit(1)
262
263
 
263
264
  # Use org ID for project lookup (API requires ID)
264
265
  project_obj = api.get_project(org_obj.get("id"), project)
265
266
  if not project_obj:
266
- console.print(f"[red]Error:[/red] Project '{project}' not found in organization '{org}'")
267
+ console.print(
268
+ f"[red]Error:[/red] Project '{project}' not found in organization '{org}' or you don't have access"
269
+ )
267
270
  sys.exit(1)
268
271
 
269
272
  # Store IDs (immutable) instead of slugs (can be renamed)
@@ -276,13 +279,7 @@ def init(org, project, status, clear):
276
279
  )
277
280
  console.print(f" Config saved to {get_config_path()}")
278
281
 
279
- # Offer to add to .gitignore
280
- if click.confirm("Add .recce/ to .gitignore?", default=True):
281
- if add_to_gitignore():
282
- console.print("[green]✓[/green] Added .recce/ to .gitignore")
283
- else:
284
- console.print(" .recce/ already in .gitignore")
285
-
282
+ # Skip gitignore prompt in explicit mode (scripted/CI usage)
286
283
  sys.exit(0)
287
284
 
288
285
  except RecceCloudException as e:
@@ -363,8 +360,8 @@ def init(org, project, status, clear):
363
360
  )
364
361
  console.print(f" Config saved to {get_config_path()}")
365
362
 
366
- # Offer to add to .gitignore
367
- if click.confirm("Add .recce/ to .gitignore?", default=True):
363
+ # Offer to add to .gitignore (default: No, since .recce/config should typically be committed)
364
+ if click.confirm("Add .recce/ to .gitignore?", default=False):
368
365
  if add_to_gitignore():
369
366
  console.print("[green]✓[/green] Added .recce/ to .gitignore")
370
367
  else:
@@ -0,0 +1,397 @@
1
+ Metadata-Version: 2.4
2
+ Name: recce-cloud
3
+ Version: 1.35.0
4
+ Summary: Lightweight CLI for Recce Cloud operations
5
+ Project-URL: Homepage, https://cloud.reccehq.com
6
+ Project-URL: Documentation, https://docs.reccehq.com
7
+ Project-URL: Repository, https://github.com/DataRecce/recce
8
+ Project-URL: Bug Tracker, https://github.com/DataRecce/recce/issues
9
+ Project-URL: Changelog, https://github.com/DataRecce/recce/releases
10
+ Author-email: InfuseAI Dev Team <dev@infuseai.io>
11
+ License: Apache-2.0
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Requires-Python: >=3.9
21
+ Requires-Dist: click>=7.1
22
+ Requires-Dist: cryptography>=3.4
23
+ Requires-Dist: pyyaml>=6.0
24
+ Requires-Dist: requests>=2.28.1
25
+ Requires-Dist: rich>=12.0.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: flake8>=7.2.0; extra == 'dev'
28
+ Requires-Dist: pytest>=4.6; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # Recce Cloud CLI
32
+
33
+ Lightweight command-line tool for managing dbt artifacts with Recce Cloud in
34
+ CI/CD environments.
35
+
36
+ ## Overview
37
+
38
+ The Recce Cloud CLI (`recce-cloud`) is a standalone tool designed for CI/CD
39
+ pipelines that need to upload and download dbt artifacts (manifest.json and
40
+ catalog.json) to/from Recce Cloud without the full `recce` package dependencies.
41
+
42
+ **Key Features:**
43
+
44
+ - Lightweight - minimal dependencies for fast CI/CD execution
45
+ - Auto-detection - automatically detects CI platform, repository, and PR/MR
46
+ context
47
+ - Upload/Download - push and pull dbt artifacts to/from Recce Cloud sessions
48
+ - Flexible authentication - browser-based login, token-based auth, or CI tokens
49
+ - Platform-specific - optimized for GitHub Actions and GitLab CI
50
+
51
+ ## Installation
52
+
53
+ ### Quick Run (no install needed)
54
+
55
+ Using [uv](https://github.com/astral-sh/uv), you can run `recce-cloud` directly
56
+ without installation:
57
+
58
+ ```bash
59
+ # Run with uvx (creates temporary isolated environment)
60
+ uvx recce-cloud upload --type prod
61
+ uvx recce-cloud download --prod --target-path target-base
62
+
63
+ # Short alias also available
64
+ uvx --from recce-cloud rcc upload --type prod
65
+ ```
66
+
67
+ ### Permanent Install
68
+
69
+ ```bash
70
+ # With uv (recommended)
71
+ uv tool install recce-cloud
72
+
73
+ # With pip
74
+ pip install recce-cloud
75
+
76
+ # With pipx
77
+ pipx install recce-cloud
78
+ ```
79
+
80
+ ## Quick Start
81
+
82
+ ### Local Development
83
+
84
+ ```bash
85
+ # Login to Recce Cloud (opens browser for authentication)
86
+ recce-cloud login
87
+
88
+ # Initialize project binding (interactive)
89
+ recce-cloud init
90
+
91
+ # Check current status
92
+ recce-cloud init --status
93
+
94
+ # Logout
95
+ recce-cloud logout
96
+ ```
97
+
98
+ ### GitHub Actions
99
+
100
+ ```yaml
101
+ - name: Upload to Recce Cloud
102
+ run: recce-cloud upload
103
+ env:
104
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105
+
106
+ - name: Download from Recce Cloud
107
+ run: recce-cloud download --prod --target-path target-base
108
+ env:
109
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110
+ ```
111
+
112
+ ### GitLab CI
113
+
114
+ ```yaml
115
+ recce-upload:
116
+ script:
117
+ - recce-cloud upload
118
+
119
+ recce-download:
120
+ script:
121
+ - recce-cloud download --prod --target-path target-base
122
+ ```
123
+
124
+ ## CI/CD Workflows
125
+
126
+ ### Upload Workflow
127
+
128
+ The `recce-cloud upload` command automatically creates sessions in supported CI
129
+ environments.
130
+
131
+ ```bash
132
+ # Basic upload (auto-detects CI context)
133
+ recce-cloud upload
134
+
135
+ # Custom target path
136
+ recce-cloud upload --target-path custom-target
137
+
138
+ # Override PR number or session type
139
+ recce-cloud upload --pr 123 --type pr
140
+
141
+ # Generic workflow with session name (for other CI platforms)
142
+ recce-cloud upload --session-name "PR-123" --yes
143
+ ```
144
+
145
+ **Options:**
146
+
147
+ | Option | Description |
148
+ | ---------------- | ------------------------------------------------ |
149
+ | `--target-path` | Path to dbt target directory (default: `target`) |
150
+ | `--session-id` | Session ID for generic workflow |
151
+ | `--session-name` | Session name for human-readable workflow |
152
+ | `--pr` | Override PR/MR number |
153
+ | `--type` | Override session type: `pr`, `prod`, `dev` |
154
+ | `--yes` | Auto-confirm session creation |
155
+ | `--dry-run` | Preview without uploading |
156
+
157
+ ### Download Workflow
158
+
159
+ The `recce-cloud download` command retrieves artifacts from Recce Cloud
160
+ sessions.
161
+
162
+ ```bash
163
+ # Download current PR/MR session
164
+ recce-cloud download
165
+
166
+ # Download production/base session
167
+ recce-cloud download --prod
168
+
169
+ # Download to custom path
170
+ recce-cloud download --prod --target-path target-base
171
+
172
+ # Force overwrite existing files
173
+ recce-cloud download --force
174
+
175
+ # Generic workflow with session ID
176
+ recce-cloud download --session-id abc123
177
+ ```
178
+
179
+ **Options:**
180
+
181
+ | Option | Description |
182
+ | --------------- | ---------------------------------------- |
183
+ | `--target-path` | Download destination (default: `target`) |
184
+ | `--session-id` | Session ID for generic workflow |
185
+ | `--prod` | Download production/base session |
186
+ | `--force`, `-f` | Overwrite existing files |
187
+ | `--dry-run` | Preview without downloading |
188
+
189
+ ## Authentication
190
+
191
+ The CLI supports multiple authentication methods (in priority order):
192
+
193
+ 1. **RECCE_API_TOKEN** - Environment variable (recommended for CI)
194
+ 2. **GITHUB_TOKEN** - GitHub Actions (must be explicitly set)
195
+ 3. **CI_JOB_TOKEN** - GitLab CI (auto-detected)
196
+ 4. **Stored credentials** - From `recce-cloud login`
197
+
198
+ ### Getting API Tokens
199
+
200
+ **Recce Cloud API Token:**
201
+
202
+ 1. Log in to [Recce Cloud](https://cloud.datarecce.io)
203
+ 2. Go to Settings → API Tokens
204
+
205
+ ## CI/CD Integration Examples
206
+
207
+ ### GitHub Actions - Complete Workflow
208
+
209
+ ```yaml
210
+ name: Recce CI
211
+
212
+ on:
213
+ pull_request:
214
+ branches: [main]
215
+
216
+ jobs:
217
+ recce:
218
+ runs-on: ubuntu-latest
219
+ steps:
220
+ - uses: actions/checkout@v4
221
+
222
+ - name: Setup Python
223
+ uses: actions/setup-python@v4
224
+ with:
225
+ python-version: "3.11"
226
+
227
+ - name: Install dependencies
228
+ run: pip install dbt-core dbt-snowflake recce-cloud
229
+
230
+ # Download production artifacts for comparison
231
+ - name: Download base artifacts
232
+ run: recce-cloud download --prod --target-path target-base
233
+ env:
234
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
235
+
236
+ # Build current PR
237
+ - name: Build dbt project
238
+ run: |
239
+ dbt deps
240
+ dbt build
241
+ dbt docs generate
242
+
243
+ # Upload current PR artifacts
244
+ - name: Upload to Recce Cloud
245
+ run: recce-cloud upload
246
+ env:
247
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
248
+ ```
249
+
250
+ ### GitLab CI - Complete Workflow
251
+
252
+ ```yaml
253
+ stages:
254
+ - download
255
+ - build
256
+ - upload
257
+
258
+ recce-download-base:
259
+ stage: download
260
+ image: python:3.11-slim
261
+ script:
262
+ - pip install recce-cloud
263
+ - recce-cloud download --prod --target-path target-base
264
+ artifacts:
265
+ paths:
266
+ - target-base/
267
+ only:
268
+ - merge_requests
269
+
270
+ dbt-build:
271
+ stage: build
272
+ image: python:3.11-slim
273
+ script:
274
+ - pip install dbt-core dbt-snowflake
275
+ - dbt deps
276
+ - dbt build
277
+ - dbt docs generate
278
+ artifacts:
279
+ paths:
280
+ - target/
281
+ only:
282
+ - merge_requests
283
+
284
+ recce-upload:
285
+ stage: upload
286
+ image: python:3.11-slim
287
+ script:
288
+ - pip install recce-cloud
289
+ - recce-cloud upload
290
+ dependencies:
291
+ - dbt-build
292
+ only:
293
+ - merge_requests
294
+ ```
295
+
296
+ ### Generic CI Platform
297
+
298
+ For other CI platforms, use session name workflow with your PR/MR number:
299
+
300
+ ```bash
301
+ export RECCE_API_TOKEN=your_token_here
302
+
303
+ # Upload PR artifacts (creates session if not exists)
304
+ recce-cloud upload --session-name "PR-${PR_NUMBER}" --yes
305
+
306
+ # Upload production artifacts (in CD pipeline after merge)
307
+ recce-cloud upload --type prod --yes
308
+ ```
309
+
310
+ The `--session-name` option creates a human-readable session that's easy to
311
+ track. Use `--yes` to auto-confirm session creation in CI environments.
312
+
313
+ ## Environment Variables
314
+
315
+ | Variable | Description |
316
+ | ------------------ | ---------------------------------------- |
317
+ | `RECCE_API_TOKEN` | Recce Cloud API token |
318
+ | `RECCE_SESSION_ID` | Default session ID for generic workflows |
319
+ | `GITHUB_TOKEN` | GitHub authentication (Actions) |
320
+ | `CI_JOB_TOKEN` | GitLab CI job token (auto-detected) |
321
+
322
+ ## Additional Commands
323
+
324
+ Beyond upload and download, the CLI provides:
325
+
326
+ ```bash
327
+ # List sessions in your project
328
+ recce-cloud list
329
+
330
+ # Delete a session
331
+ recce-cloud delete --session-id abc123
332
+
333
+ # Generate AI review for a session
334
+ recce-cloud review --session-id abc123
335
+
336
+ # Generate PR metrics report
337
+ recce-cloud report --since 30d
338
+
339
+ # Diagnose setup issues
340
+ recce-cloud doctor
341
+
342
+ # Show version
343
+ recce-cloud version
344
+ ```
345
+
346
+ Run `recce-cloud <command> --help` for detailed options.
347
+
348
+ ## Troubleshooting
349
+
350
+ ### Quick Diagnosis
351
+
352
+ ```bash
353
+ recce-cloud doctor
354
+ ```
355
+
356
+ This validates login status, project binding, and session availability.
357
+
358
+ ### Common Issues
359
+
360
+ **Missing dbt artifacts:**
361
+
362
+ ```bash
363
+ dbt build
364
+ dbt docs generate # Required before upload
365
+ recce-cloud upload
366
+ ```
367
+
368
+ **Authentication failed:**
369
+
370
+ - For GitHub Actions: Set `GITHUB_TOKEN` in env
371
+ - For GitLab CI: `CI_JOB_TOKEN` is auto-detected
372
+ - For generic CI: Set `RECCE_API_TOKEN`
373
+
374
+ **Platform not supported:**
375
+
376
+ ```bash
377
+ # Use session name workflow for unsupported CI platforms
378
+ recce-cloud upload --session-name "PR-${PR_NUMBER}" --yes
379
+ ```
380
+
381
+ ### Debug Mode
382
+
383
+ ```bash
384
+ export RECCE_LOG_LEVEL=DEBUG
385
+ recce-cloud upload
386
+ ```
387
+
388
+ ## Support
389
+
390
+ - **Documentation:** [docs.reccehq.com](https://docs.reccehq.com)
391
+ - **Issues:** [GitHub Issues](https://github.com/DataRecce/recce/issues)
392
+ - **Community:** [Recce Slack](https://getdbt.slack.com/archives/C05C28V7CPP)
393
+ - **Email:** <support@reccehq.com>
394
+
395
+ ## License
396
+
397
+ Apache License 2.0 - See [LICENSE](../LICENSE) file for details.
@@ -1,7 +1,7 @@
1
- recce_cloud/VERSION,sha256=xBVSUVA8aWplLFRKB0ZS35rrhaZQwe68qZ7iCifdheg,7
1
+ recce_cloud/VERSION,sha256=w00ZuN3Pb5FuTkM1TToiBY3LWEqVfWKslnBS7HuzpCQ,7
2
2
  recce_cloud/__init__.py,sha256=2Zlm9V1IBJ9DxovzHIUJB0QDl6ergO5ktY09baQ-Kxc,907
3
3
  recce_cloud/artifact.py,sha256=C6q1i8d0JdTIVLcJY1ZEmJJ0uBz-0g3zVZD8ss0K1iI,1458
4
- recce_cloud/cli.py,sha256=eFS4WQkL-1K7gdSe4Cc9g6y-8QbcTc-5CgaKJMFGfe4,56652
4
+ recce_cloud/cli.py,sha256=aLOmimn3S9HLL8OI-b6HD1tlx-D5WS009BCqsD0M9zo,56627
5
5
  recce_cloud/delete.py,sha256=sZSJkCLcTkiI2qVRUZwV5vqqV3BRzzuRUKdTLlVZfr0,3751
6
6
  recce_cloud/download.py,sha256=bNBkh2tKLdFoQIuZNXG_wcP46VPCO_WlVszSmHAseGE,8482
7
7
  recce_cloud/report.py,sha256=MRlT-CGV-SBzzYepp1zzoFuHqomC2vhpn7s5ACoNyyQ,10214
@@ -32,7 +32,7 @@ recce_cloud/config/project_config.py,sha256=sfToZjP1TZNnSr31x0pwpLc_2DBZywrcqNpY
32
32
  recce_cloud/config/resolver.py,sha256=EYsWX0dwKHVKYf6kftekrbWd17vrALMUMl-T26up4VM,4712
33
33
  recce_cloud/services/__init__.py,sha256=GMxN0Wtf166qvSSMGmU5jwqfly5b3K0vsIe8PkX7AKo,36
34
34
  recce_cloud/services/diagnostic_service.py,sha256=X3YBHFTkB31WRIH9MCKpZxbl4drw9evD6bBiD8cDIkw,13049
35
- recce_cloud-1.34.0.dist-info/METADATA,sha256=4TjurNAzv-MoZrNEVnzMS1JPm4juK9EqzaL_ZavJdjo,22589
36
- recce_cloud-1.34.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
37
- recce_cloud-1.34.0.dist-info/entry_points.txt,sha256=MVzgsEDWaQ4fWf33zlyPF83wg5Rgg5Axq2hlLEf0Yxg,58
38
- recce_cloud-1.34.0.dist-info/RECORD,,
35
+ recce_cloud-1.35.0.dist-info/METADATA,sha256=ps18ZQ1kVOS3rFgSBsiuCkbuz-qy_bFQZYGfEb8l7tg,9872
36
+ recce_cloud-1.35.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
37
+ recce_cloud-1.35.0.dist-info/entry_points.txt,sha256=_1wH_y7frAGRQPL8CDFUKhgYERZl9md_soULvqZfU3k,90
38
+ recce_cloud-1.35.0.dist-info/RECORD,,
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
+ rcc = recce_cloud.cli:cloud_cli
2
3
  recce-cloud = recce_cloud.cli:cloud_cli
@@ -1,914 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: recce-cloud
3
- Version: 1.34.0
4
- Summary: Lightweight CLI for Recce Cloud operations
5
- Project-URL: Bug Tracker, https://github.com/InfuseAI/recce/issues
6
- Author-email: InfuseAI Dev Team <dev@infuseai.io>
7
- License: Apache-2.0
8
- Classifier: Development Status :: 4 - Beta
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Requires-Python: >=3.9
17
- Requires-Dist: click>=7.1
18
- Requires-Dist: cryptography>=3.4
19
- Requires-Dist: pyyaml>=6.0
20
- Requires-Dist: requests>=2.28.1
21
- Requires-Dist: rich>=12.0.0
22
- Provides-Extra: dev
23
- Requires-Dist: flake8>=7.2.0; extra == 'dev'
24
- Requires-Dist: pytest>=4.6; extra == 'dev'
25
- Description-Content-Type: text/markdown
26
-
27
- # Recce Cloud CLI
28
-
29
- Lightweight command-line tool for managing dbt artifacts with Recce Cloud in CI/CD environments.
30
-
31
- ## Overview
32
-
33
- The Recce Cloud CLI (`recce-cloud`) is a standalone tool designed for CI/CD pipelines that need to upload and download dbt artifacts (manifest.json and catalog.json) to/from Recce Cloud without the full `recce` package dependencies.
34
-
35
- **Key Features:**
36
-
37
- - 🚀 Lightweight - minimal dependencies for fast CI/CD execution
38
- - 🤖 Auto-detection - automatically detects CI platform, repository, and PR/MR context
39
- - ⬆️ Upload - push dbt artifacts to Recce Cloud sessions
40
- - ⬇️ Download - pull dbt artifacts from Recce Cloud sessions
41
- - 🔐 Flexible authentication - browser-based login, token-based auth, or CI tokens
42
- - 🔗 Project binding - link local projects to Recce Cloud organizations
43
- - ✅ Platform-specific - optimized for GitHub Actions and GitLab CI
44
-
45
- ## Installation
46
-
47
- ```bash
48
- pip install recce-cloud
49
- ```
50
-
51
- Or in your CI/CD workflow:
52
-
53
- ```yaml
54
- # GitHub Actions
55
- - name: Install recce-cloud
56
- run: pip install recce-cloud
57
-
58
- # GitLab CI
59
- install:
60
- script:
61
- - pip install recce-cloud
62
- ```
63
-
64
- ## Quick Start
65
-
66
- ### Local Development
67
-
68
- **Login to Recce Cloud:**
69
-
70
- ```bash
71
- # Browser-based login (recommended)
72
- recce-cloud login
73
-
74
- # Token-based login (for headless environments)
75
- recce-cloud login --token <your-api-token>
76
- ```
77
-
78
- **Initialize project binding:**
79
-
80
- ```bash
81
- # Interactive project selection
82
- recce-cloud init
83
-
84
- # Check current status
85
- recce-cloud status
86
- ```
87
-
88
- **Logout:**
89
-
90
- ```bash
91
- recce-cloud logout
92
- ```
93
-
94
- ### GitHub Actions
95
-
96
- **Upload artifacts:**
97
-
98
- ```yaml
99
- - name: Upload to Recce Cloud
100
- run: recce-cloud upload
101
- env:
102
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103
- ```
104
-
105
- **Download artifacts:**
106
-
107
- ```yaml
108
- - name: Download from Recce Cloud
109
- run: recce-cloud download --prod --target-path target-base
110
- env:
111
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112
- ```
113
-
114
- ### GitLab CI
115
-
116
- **Upload artifacts:**
117
-
118
- ```yaml
119
- recce-upload:
120
- script:
121
- - recce-cloud upload
122
- ```
123
-
124
- **Download artifacts:**
125
-
126
- ```yaml
127
- recce-download:
128
- script:
129
- - recce-cloud download --prod --target-path target-base
130
- ```
131
-
132
- ## Upload Workflows
133
-
134
- The `recce-cloud upload` command supports two workflows:
135
-
136
- ### 1. Platform-Specific Workflow (Recommended)
137
-
138
- **For GitHub Actions and GitLab CI**
139
-
140
- Automatically creates Recce Cloud sessions using platform-specific APIs. No session ID required.
141
-
142
- **Features:**
143
-
144
- - ✅ Auto-creates session with `touch-recce-session` API
145
- - ✅ Auto-detects PR/MR context and links session
146
- - ✅ Notifies upload completion
147
- - ✅ Works with CI-provided tokens (GITHUB_TOKEN, CI_JOB_TOKEN)
148
-
149
- **Usage:**
150
-
151
- ```bash
152
- # GitHub Actions
153
- recce-cloud upload
154
-
155
- # GitLab CI
156
- recce-cloud upload
157
-
158
- # With custom target path
159
- recce-cloud upload --target-path custom-target
160
-
161
- # With manual overrides
162
- recce-cloud upload --pr 123 --type pr
163
- ```
164
-
165
- **Requirements:**
166
-
167
- - Running in GitHub Actions or GitLab CI environment
168
- - RECCE_API_TOKEN or CI-provided token (GITHUB_TOKEN/CI_JOB_TOKEN)
169
- - dbt artifacts in target directory
170
-
171
- ### 2. Generic Workflow
172
-
173
- **For other CI platforms or existing sessions**
174
-
175
- Uploads to a pre-existing Recce Cloud session using session ID.
176
-
177
- **Usage:**
178
-
179
- ```bash
180
- # With session ID parameter
181
- recce-cloud upload --session-id abc123
182
-
183
- # With environment variable
184
- export RECCE_SESSION_ID=abc123
185
- recce-cloud upload
186
-
187
- # With custom target path
188
- recce-cloud upload --session-id abc123 --target-path my-target
189
- ```
190
-
191
- **Requirements:**
192
-
193
- - Pre-created session ID (from Recce Cloud web app or API)
194
- - RECCE_API_TOKEN
195
- - dbt artifacts in target directory
196
-
197
- ## Download Workflows
198
-
199
- The `recce-cloud download` command supports two workflows:
200
-
201
- ### 1. Platform-Specific Workflow (Recommended)
202
-
203
- **For GitHub Actions and GitLab CI**
204
-
205
- Automatically finds and downloads artifacts from Recce Cloud sessions using platform-specific APIs. No session ID required.
206
-
207
- **Features:**
208
-
209
- - ✅ Auto-detects PR/MR context
210
- - ✅ Supports downloading production/base session with `--prod` flag
211
- - ✅ Works with CI-provided tokens (GITHUB_TOKEN, CI_JOB_TOKEN)
212
-
213
- **Usage:**
214
-
215
- ```bash
216
- # GitHub Actions - Download current PR session
217
- recce-cloud download
218
-
219
- # GitLab CI - Download current MR session
220
- recce-cloud download
221
-
222
- # Download production/base session
223
- recce-cloud download --prod
224
-
225
- # Download to custom target path
226
- recce-cloud download --target-path target-base
227
-
228
- # Force overwrite existing files
229
- recce-cloud download --force
230
- ```
231
-
232
- **Requirements:**
233
-
234
- - Running in GitHub Actions or GitLab CI environment
235
- - CI-provided token (GITHUB_TOKEN/CI_JOB_TOKEN)
236
- - Session must exist in Recce Cloud
237
-
238
- ### 2. Generic Workflow
239
-
240
- **For other CI platforms or specific sessions**
241
-
242
- Downloads from a specific Recce Cloud session using session ID.
243
-
244
- **Usage:**
245
-
246
- ```bash
247
- # With session ID parameter
248
- recce-cloud download --session-id abc123
249
-
250
- # With environment variable
251
- export RECCE_SESSION_ID=abc123
252
- recce-cloud download
253
-
254
- # With custom target path
255
- recce-cloud download --session-id abc123 --target-path my-target
256
-
257
- # Force overwrite
258
- recce-cloud download --session-id abc123 --force
259
- ```
260
-
261
- **Requirements:**
262
-
263
- - Session ID (from Recce Cloud web app or API)
264
- - RECCE_API_TOKEN
265
- - Session must exist in Recce Cloud
266
-
267
- ## Command Reference
268
-
269
- ### `recce-cloud login`
270
-
271
- Authenticate with Recce Cloud.
272
-
273
- **Options:**
274
-
275
- | Option | Type | Default | Description |
276
- | --------- | ------ | ------- | ------------------------------------------------ |
277
- | `--token` | string | - | API token for direct authentication (optional) |
278
-
279
- **Usage:**
280
-
281
- ```bash
282
- # Browser-based login (opens browser for OAuth)
283
- recce-cloud login
284
-
285
- # Direct token authentication (for CI/headless environments)
286
- recce-cloud login --token <your-api-token>
287
- ```
288
-
289
- **Notes:**
290
-
291
- - Browser login opens Recce Cloud in your default browser for secure OAuth authentication
292
- - If the browser doesn't open automatically, the URL is displayed for manual access
293
- - Token-based login is useful for CI/CD environments or when browser access is unavailable
294
- - Credentials are saved to `~/.recce/profile.yml`
295
-
296
- ### `recce-cloud logout`
297
-
298
- Clear stored Recce Cloud credentials.
299
-
300
- **Usage:**
301
-
302
- ```bash
303
- recce-cloud logout
304
- ```
305
-
306
- ### `recce-cloud init`
307
-
308
- Initialize project binding to link a local project with a Recce Cloud organization and project.
309
-
310
- **Usage:**
311
-
312
- ```bash
313
- recce-cloud init
314
- ```
315
-
316
- **Workflow:**
317
-
318
- 1. Verifies you are logged in (prompts for login if not)
319
- 2. Lists available organizations (shows display names)
320
- 3. Prompts you to select an organization
321
- 4. Lists available projects in selected organization (excludes archived projects)
322
- 5. Prompts you to select a project
323
- 6. Saves binding to `.recce/config`
324
- 7. Optionally adds `.recce/` to `.gitignore`
325
-
326
- **Notes:**
327
-
328
- - Requires authentication (run `recce-cloud login` first)
329
- - Creates `.recce/config` file in current directory
330
- - Binding can be overridden with environment variables (`RECCE_ORG`, `RECCE_PROJECT`)
331
-
332
- ### `recce-cloud status`
333
-
334
- Display current authentication and project binding status.
335
-
336
- **Usage:**
337
-
338
- ```bash
339
- recce-cloud status
340
- ```
341
-
342
- **Output:**
343
-
344
- - Shows logged-in user email (or "Not logged in")
345
- - Shows current project binding (organization/project or "Not bound")
346
- - Indicates configuration source (CLI flags, environment variables, or local config)
347
-
348
- ### `recce-cloud upload`
349
-
350
- Upload dbt artifacts to Recce Cloud session.
351
-
352
- **Options:**
353
-
354
- | Option | Type | Default | Description |
355
- | --------------- | ------- | -------- | --------------------------------------------- |
356
- | `--target-path` | path | `target` | Path to dbt target directory |
357
- | `--session-id` | string | - | Session ID for generic workflow (optional) |
358
- | `--pr` | integer | - | Override PR/MR number |
359
- | `--type` | choice | - | Override session type: `pr`, `prod`, `dev` |
360
- | `--dry-run` | flag | false | Show what would be uploaded without uploading |
361
-
362
- **Environment Variables:**
363
-
364
- | Variable | Required | Description |
365
- | ------------------ | ------------- | ------------------------------- |
366
- | `RECCE_API_TOKEN` | Recommended | Recce Cloud API token |
367
- | `RECCE_SESSION_ID` | Optional | Session ID for generic workflow |
368
- | `GITHUB_TOKEN` | Explicit set | GitHub authentication (Actions) |
369
- | `CI_JOB_TOKEN` | Auto-detected | GitLab authentication (CI) |
370
-
371
- **Exit Codes:**
372
-
373
- | Code | Description |
374
- | ---- | --------------------------------------------------- |
375
- | 0 | Success |
376
- | 1 | Platform not supported (platform-specific workflow) |
377
- | 2 | Authentication error |
378
- | 3 | File validation error |
379
- | 4 | Upload error |
380
-
381
- ### `recce-cloud download`
382
-
383
- Download dbt artifacts (manifest.json, catalog.json) from Recce Cloud session.
384
-
385
- **Options:**
386
-
387
- | Option | Type | Default | Description |
388
- | --------------- | ------ | -------- | ---------------------------------------------------- |
389
- | `--target-path` | path | `target` | Path to directory where artifacts will be downloaded |
390
- | `--session-id` | string | - | Session ID for generic workflow (optional) |
391
- | `--prod` | flag | false | Download production/base session |
392
- | `--dry-run` | flag | false | Show what would be downloaded without downloading |
393
- | `--force`, `-f` | flag | false | Overwrite existing files without prompting |
394
-
395
- **Environment Variables:**
396
-
397
- | Variable | Required | Description |
398
- | ------------------ | ------------- | ------------------------------- |
399
- | `RECCE_API_TOKEN` | Recommended | Recce Cloud API token |
400
- | `RECCE_SESSION_ID` | Optional | Session ID for generic workflow |
401
- | `GITHUB_TOKEN` | Explicit set | GitHub authentication (Actions) |
402
- | `CI_JOB_TOKEN` | Auto-detected | GitLab authentication (CI) |
403
-
404
- **Exit Codes:**
405
-
406
- | Code | Description |
407
- | ---- | --------------------------------------------------- |
408
- | 0 | Success |
409
- | 1 | Platform not supported (platform-specific workflow) |
410
- | 2 | Authentication error |
411
- | 3 | File validation error |
412
- | 4 | Download error |
413
-
414
- **Common Examples:**
415
-
416
- ```bash
417
- # Auto-find and download current PR/MR session
418
- recce-cloud download
419
-
420
- # Download project's production/base session
421
- recce-cloud download --prod
422
-
423
- # Download from specific session ID
424
- recce-cloud download --session-id abc123
425
-
426
- # Download prod session to target-base
427
- recce-cloud download --prod --target-path target-base
428
-
429
- # Force overwrite existing files
430
- recce-cloud download --force
431
-
432
- # Dry run - preview what would be downloaded
433
- recce-cloud download --dry-run
434
- ```
435
-
436
- ### `recce-cloud version`
437
-
438
- Display the version of recce-cloud.
439
-
440
- ```bash
441
- recce-cloud version
442
- ```
443
-
444
- ## Authentication
445
-
446
- The CLI supports multiple authentication methods with the following priority:
447
-
448
- 1. **RECCE_API_TOKEN** (explicit token) - Recommended for production
449
- 2. **CI-provided tokens** - GITHUB_TOKEN (Actions) or CI_JOB_TOKEN (GitLab CI)
450
- 3. Error if no token available
451
-
452
- ### Getting API Tokens
453
-
454
- **Recce Cloud API Token:**
455
-
456
- 1. Log in to [Recce Cloud](https://cloud.datarecce.io)
457
- 2. Go to Settings → API Tokens
458
- 3. Create a new token
459
- 4. Add to CI/CD secrets as `RECCE_API_TOKEN`
460
-
461
- **GitHub Token:**
462
-
463
- - Available as `${{ secrets.GITHUB_TOKEN }}` in Actions
464
- - Must be explicitly set in `env:` section of your workflow
465
-
466
- **GitLab Token:**
467
-
468
- - Automatically available as `$CI_JOB_TOKEN` in GitLab CI
469
- - No additional configuration needed
470
-
471
- ## Auto-Detection
472
-
473
- The CLI automatically detects your CI environment:
474
-
475
- ### Detected Information
476
-
477
- | Information | GitHub Actions | GitLab CI |
478
- | ------------- | --------------------- | ---------------------------------------- |
479
- | Platform | ✅ `github-actions` | ✅ `gitlab-ci` |
480
- | Repository | ✅ `owner/repo` | ✅ `group/project` |
481
- | PR/MR Number | ✅ From event payload | ✅ From `CI_MERGE_REQUEST_IID` |
482
- | PR/MR URL | ✅ Constructed | ✅ Constructed (self-hosted support) |
483
- | Commit SHA | ✅ `GITHUB_SHA` | ✅ `CI_COMMIT_SHA` |
484
- | Source Branch | ✅ `GITHUB_HEAD_REF` | ✅ `CI_MERGE_REQUEST_SOURCE_BRANCH_NAME` |
485
- | Base Branch | ✅ `GITHUB_BASE_REF` | ✅ `CI_MERGE_REQUEST_TARGET_BRANCH_NAME` |
486
- | Session Type | ✅ Auto-determined | ✅ Auto-determined |
487
- | Access Token | ✅ `GITHUB_TOKEN` | ✅ `CI_JOB_TOKEN` |
488
-
489
- ### Manual Overrides
490
-
491
- You can override auto-detected values:
492
-
493
- ```bash
494
- # Override PR/MR number
495
- recce-cloud upload --pr 456
496
-
497
- # Override session type
498
- recce-cloud upload --type prod
499
-
500
- # Multiple overrides
501
- recce-cloud upload --pr 789 --type pr
502
-
503
- # Dry run - preview what would be uploaded
504
- recce-cloud upload --dry-run
505
- ```
506
-
507
- ## CI/CD Integration Examples
508
-
509
- ### GitHub Actions - Upload Workflow
510
-
511
- ```yaml
512
- name: Recce CI - Upload
513
-
514
- on:
515
- pull_request:
516
- branches: [main]
517
-
518
- jobs:
519
- recce:
520
- runs-on: ubuntu-latest
521
- steps:
522
- - uses: actions/checkout@v4
523
-
524
- - name: Setup Python
525
- uses: actions/setup-python@v4
526
- with:
527
- python-version: "3.11"
528
-
529
- - name: Install dependencies
530
- run: |
531
- pip install dbt-core dbt-postgres recce-cloud
532
-
533
- - name: Build dbt project
534
- run: |
535
- dbt deps
536
- dbt build
537
- dbt docs generate
538
-
539
- - name: Upload to Recce Cloud
540
- run: recce-cloud upload
541
- env:
542
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
543
- ```
544
-
545
- ### GitHub Actions - Download Workflow
546
-
547
- ```yaml
548
- name: Recce CI - Download
549
-
550
- on:
551
- pull_request:
552
- branches: [main]
553
-
554
- jobs:
555
- recce:
556
- runs-on: ubuntu-latest
557
- steps:
558
- - uses: actions/checkout@v4
559
-
560
- - name: Setup Python
561
- uses: actions/setup-python@v4
562
- with:
563
- python-version: "3.11"
564
-
565
- - name: Install dependencies
566
- run: |
567
- pip install dbt-core dbt-postgres recce-cloud
568
-
569
- # Download production/base artifacts
570
- - name: Download base artifacts from Recce Cloud
571
- run: recce-cloud download --prod --target-path target-base
572
- env:
573
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
574
-
575
- # Build current PR version
576
- - name: Build dbt project (current)
577
- run: |
578
- dbt deps
579
- dbt build
580
- dbt docs generate
581
-
582
- # Upload current PR artifacts
583
- - name: Upload to Recce Cloud
584
- run: recce-cloud upload
585
- env:
586
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
587
- ```
588
-
589
- ### GitLab CI - Upload Workflow
590
-
591
- ```yaml
592
- stages:
593
- - build
594
- - upload
595
-
596
- dbt-build:
597
- stage: build
598
- image: python:3.11-slim
599
- script:
600
- - pip install dbt-core dbt-postgres
601
- - dbt deps
602
- - dbt build
603
- - dbt docs generate
604
- artifacts:
605
- paths:
606
- - target/
607
-
608
- recce-upload:
609
- stage: upload
610
- image: python:3.11-slim
611
- script:
612
- - pip install recce-cloud
613
- - recce-cloud upload
614
- dependencies:
615
- - dbt-build
616
- only:
617
- - merge_requests
618
- - main
619
- ```
620
-
621
- ### GitLab CI - Download Workflow
622
-
623
- ```yaml
624
- stages:
625
- - download
626
- - build
627
- - upload
628
-
629
- recce-download-base:
630
- stage: download
631
- image: python:3.11-slim
632
- script:
633
- - pip install recce-cloud
634
- - recce-cloud download --prod --target-path target-base
635
- artifacts:
636
- paths:
637
- - target-base/
638
- only:
639
- - merge_requests
640
-
641
- dbt-build:
642
- stage: build
643
- image: python:3.11-slim
644
- script:
645
- - pip install dbt-core dbt-postgres
646
- - dbt deps
647
- - dbt build
648
- - dbt docs generate
649
- artifacts:
650
- paths:
651
- - target/
652
- only:
653
- - merge_requests
654
-
655
- recce-upload:
656
- stage: upload
657
- image: python:3.11-slim
658
- script:
659
- - pip install recce-cloud
660
- - recce-cloud upload
661
- dependencies:
662
- - dbt-build
663
- only:
664
- - merge_requests
665
- ```
666
-
667
- ### Generic CI Platform
668
-
669
- For other CI platforms, use the generic workflow with session ID:
670
-
671
- ```yaml
672
- # Upload
673
- - name: Upload to Recce Cloud
674
- script:
675
- - pip install recce-cloud
676
- - recce-cloud upload --session-id ${SESSION_ID}
677
- environment:
678
- RECCE_API_TOKEN: ${RECCE_API_TOKEN}
679
- SESSION_ID: ${SESSION_ID}
680
-
681
- # Download
682
- - name: Download from Recce Cloud
683
- script:
684
- - pip install recce-cloud
685
- - recce-cloud download --session-id ${SESSION_ID}
686
- environment:
687
- RECCE_API_TOKEN: ${RECCE_API_TOKEN}
688
- SESSION_ID: ${SESSION_ID}
689
- ```
690
-
691
- ## Troubleshooting
692
-
693
- ### Common Issues
694
-
695
- **1. Missing dbt artifacts**
696
-
697
- ```
698
- Error: Invalid target path: target
699
- Please provide a valid target path containing manifest.json and catalog.json.
700
- ```
701
-
702
- **Solution:** Ensure `dbt docs generate` has been run successfully before upload.
703
-
704
- ```bash
705
- dbt build
706
- dbt docs generate # Required!
707
- recce-cloud upload
708
- ```
709
-
710
- **2. Authentication failed**
711
-
712
- ```
713
- Error: No authentication token provided
714
- Set RECCE_API_TOKEN environment variable or ensure CI token is available
715
- ```
716
-
717
- **Solution:** Token requirements depend on your workflow type:
718
-
719
- **For Generic Workflow (with `--session-id`):**
720
- - Always requires explicit `RECCE_API_TOKEN`
721
-
722
- ```bash
723
- # Set token and use session ID
724
- export RECCE_API_TOKEN=your_token_here
725
- recce-cloud upload --session-id abc123
726
- recce-cloud download --session-id abc123
727
- ```
728
-
729
- **For Platform-Specific Workflow:**
730
-
731
- _GitHub CI_
732
- - Use `GITHUB_TOKEN` (explicitly set)
733
-
734
- ```yaml
735
- env:
736
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
737
- ```
738
-
739
- **3. Platform not supported**
740
-
741
- ```
742
- Error: Platform-specific upload requires GitHub Actions or GitLab CI environment
743
- Detected platform: unknown
744
- ```
745
-
746
- **Solution:** Use generic workflow with session ID, or run in supported CI platform.
747
-
748
- ```bash
749
- recce-cloud upload --session-id abc123
750
- ```
751
-
752
- **4. Session not found**
753
-
754
- ```
755
- Error: Session ID abc123 does not belong to any organization.
756
- ```
757
-
758
- **Solution:** Verify session ID is correct and accessible with your API token.
759
-
760
- **5. GitLab self-hosted instance**
761
-
762
- The CLI automatically detects self-hosted GitLab instances using `CI_SERVER_URL`.
763
-
764
- ```yaml
765
- # No additional configuration needed
766
- recce-upload:
767
- script:
768
- - recce-cloud upload
769
- ```
770
-
771
- **6. Target path already exists (download)**
772
-
773
- ```
774
- Error: Target path already exists: target
775
- Use --force to overwrite existing directory
776
- ```
777
-
778
- **Solution:** Use `--force` flag to overwrite existing files, or choose a different target path.
779
-
780
- ```bash
781
- recce-cloud download --force
782
- # OR
783
- recce-cloud download --target-path target-new
784
- ```
785
-
786
- **7. No production session available**
787
-
788
- ```
789
- Error: No production session found for this project
790
- ```
791
-
792
- **Solution:** Upload a production session first, or use a specific session ID.
793
-
794
- ```bash
795
- # Upload production session (on main branch)
796
- recce-cloud upload --type prod
797
-
798
- # Or download from specific session
799
- recce-cloud download --session-id abc123
800
- ```
801
-
802
- ### Debug Mode
803
-
804
- Enable verbose logging for troubleshooting:
805
-
806
- ```bash
807
- # Set log level to DEBUG
808
- export RECCE_LOG_LEVEL=DEBUG
809
- recce-cloud upload
810
- ```
811
-
812
- ## Architecture
813
-
814
- ### Platform-Specific APIs
815
-
816
- The CLI uses platform-specific API endpoints for auto-session creation:
817
-
818
- **GitHub Actions:**
819
-
820
- - `POST /api/v2/github/{repository}/touch-recce-session`
821
- - `POST /api/v2/github/{repository}/upload-completed`
822
-
823
- **GitLab CI:**
824
-
825
- - `POST /api/v2/gitlab/{project_path}/touch-recce-session`
826
- - `POST /api/v2/gitlab/{project_path}/upload-completed`
827
-
828
- ### Upload Process
829
-
830
- **Platform-Specific Workflow:**
831
-
832
- 1. Detect CI platform and extract context
833
- 2. Validate dbt artifacts
834
- 3. Extract adapter type from manifest
835
- 4. Authenticate with Recce Cloud API
836
- 5. Call `touch-recce-session` (creates or updates session)
837
- 6. Upload manifest.json to presigned S3 URL
838
- 7. Upload catalog.json to presigned S3 URL
839
- 8. Call `upload-completed` (notifies Recce Cloud)
840
-
841
- **Generic Workflow:**
842
-
843
- 1. Detect CI platform (optional)
844
- 2. Validate dbt artifacts
845
- 3. Extract adapter type from manifest
846
- 4. Authenticate with Recce Cloud API
847
- 5. Get session info (org_id, project_id)
848
- 6. Get presigned upload URLs
849
- 7. Upload manifest.json to S3
850
- 8. Upload catalog.json to S3
851
- 9. Update session metadata
852
-
853
- ### Download Process
854
-
855
- **Platform-Specific Workflow:**
856
-
857
- 1. Detect CI platform and extract context
858
- 2. Authenticate with Recce Cloud API
859
- 3. Call download API with PR/MR context
860
- 4. Get presigned download URLs and session ID
861
- 5. Create target directory (if needed)
862
- 6. Download manifest.json from S3
863
- 7. Download catalog.json from S3
864
-
865
- **Generic Workflow (Session ID):**
866
-
867
- 1. Authenticate with Recce Cloud API
868
- 2. Get session info (org_id, project_id)
869
- 3. Get presigned download URLs by session ID
870
- 4. Create target directory (if needed)
871
- 5. Download manifest.json from S3
872
- 6. Download catalog.json from S3
873
-
874
- ## Development
875
-
876
- ### Running Tests
877
-
878
- ```bash
879
- # Install development dependencies
880
- pip install -e .[dev]
881
-
882
- # Run tests
883
- pytest tests/recce_cloud/
884
-
885
- # Run with coverage
886
- pytest --cov=recce_cloud --cov-report=html tests/recce_cloud/
887
-
888
- # Run specific test file
889
- pytest tests/recce_cloud/test_platform_clients.py
890
- ```
891
-
892
- ### Code Quality
893
-
894
- ```bash
895
- # Format code
896
- make format
897
-
898
- # Run quality checks
899
- make check
900
-
901
- # Run all checks and tests
902
- make test
903
- ```
904
-
905
- ## Support
906
-
907
- - **Documentation:** [docs.reccehq.com](https://docs.reccehq.com)
908
- - **Issues:** [GitHub Issues](https://github.com/DataRecce/recce/issues)
909
- - **Community:** [Recce Slack](https://getdbt.slack.com/archives/C05C28V7CPP)
910
- - **Email:** <support@reccehq.com>
911
-
912
- ## License
913
-
914
- Apache License 2.0 - See [LICENSE](../LICENSE) file for details.