Skip to content

Commit 59de8d0

Browse files
authored
Merge pull request #15 from chipfoundry/feature/cf-push-remote
feat: cf push --remote (HTTPS push via GitHub App) + idempotent cf init
2 parents 9bbec46 + 6dd1a0a commit 59de8d0

5 files changed

Lines changed: 586 additions & 110 deletions

File tree

README.md

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ cf logout
230230

231231
- Removes your stored API key from the local config
232232

233-
### Initialize a New Project
233+
### Initialize or Refresh a Project
234234

235235
```bash
236-
cf init [--project-root DIRECTORY]
236+
cf init [--project-root DIRECTORY] [--shuttle NAME_OR_ID] [--description TEXT]
237237
```
238238

239239
> [!IMPORTANT]
240-
> This command **must be run first** after cloning a repository. It is required before running:
240+
> Run this first after cloning a repository. It is required before running:
241241
> - `cf gpio-config`
242242
> - `cf harden`
243243
> - `cf precheck`
@@ -247,14 +247,17 @@ cf init [--project-root DIRECTORY]
247247
> If you skip this step, other commands will show an error directing you to run `cf init` first.
248248

249249
**What it does:**
250-
- **Smart defaults**: Auto-detects project name from directory and project type from GDS files
251-
- **Interactive prompts**: Shows detected values in prompts for easy acceptance
252-
- **Shuttle selection**: Prompts to select an available shuttle (sorted by nearest deadline)
253-
- **Platform registration**: Creates the project on the platform and links it automatically
254-
- Creates `.cf/project.json` with project metadata
250+
- **Idempotent refresh**: Running `cf init` again on an already-linked project pulls in the current platform values, pre-fills prompts, and only PUTs the differences you confirm. The `platform_project_id` link is preserved.
251+
- **Smart defaults**: Auto-detects project name from directory, project type from GDS files, and GitHub repo URL from your `origin` remote (HTTPS or SSH).
252+
- **Interactive prompts**:
253+
- When a stored value and a detected value match (or only one exists), press Enter to accept it.
254+
- When they **differ** (e.g. a stale `github_repo_url` in `.cf/project.json` vs. your current `git remote`), the prompt shows both and Enter accepts the detected value (ground truth). Type `k` or `keep` to keep the current value instead, type a new value to override, or type `clear` to remove the field entirely.
255+
- **Shuttle selection**: On first init, prompts to select an available shuttle (sorted by nearest deadline).
256+
- **Platform registration**: Creates the project on the platform and links it automatically.
257+
- Setting the GitHub repo URL enables `cf precheck --remote` and `cf push --remote`.
255258

256259
> [!NOTE]
257-
> GDS hash is generated during `push`, not `init`
260+
> GDS hash is generated during `push`, not `init`.
258261

259262
### Link an Existing Project
260263

@@ -564,17 +567,18 @@ cf verify counter_la --dry-run
564567
cf push [OPTIONS]
565568
```
566569

567-
**Prerequisites:** `cf login`, `cf link` (or `cf init`), `cf config`
570+
**Prerequisites:** `cf login`, `cf link` (or `cf init`), `cf config` (SFTP mode only).
568571

569572
**Options:**
570573
- `--project-root`: Specify project directory
571-
- `--force-overwrite`: Overwrite existing files on SFTP
574+
- `--force-overwrite`: Overwrite existing files on SFTP (SFTP mode only)
572575
- `--submit`: Submit the project for review after upload
573576
- `--dry-run`: Preview what would be uploaded
574-
- `--sftp-username`: Override configured username
575-
- `--sftp-key`: Override configured key path
577+
- `--sftp-username`: Override configured username (SFTP mode only)
578+
- `--sftp-key`: Override configured key path (SFTP mode only)
579+
- `--remote`: HTTPS-only upload via the ChipFoundry GitHub App (no SFTP). Use this when port 22 is blocked by your corporate firewall.
576580

577-
**What happens:**
581+
**SFTP mode (default):**
578582
1. Verifies the project is linked to the platform and you are logged in
579583
2. Collects required project files
580584
3. Auto-detects project type from GDS file
@@ -583,6 +587,29 @@ cf push [OPTIONS]
583587
6. Syncs `project.json` data to the platform (GDS hash, version, project ID, slot number)
584588
7. If `--submit` is used, submits the project for admin review
585589

590+
**Remote (HTTPS) mode — `cf push --remote`:**
591+
592+
Firewall friendly: only outbound HTTPS is needed. The CLI never uploads file
593+
contents itself; instead, the platform fetches them from your GitHub repo
594+
via the ChipFoundry GitHub App at your local HEAD commit.
595+
596+
Preconditions:
597+
- Project has a GitHub repo URL (set via `cf init`, shown in the portal).
598+
- The ChipFoundry GitHub App is installed on that repo (prompted in the portal).
599+
- Your local `HEAD` has been pushed to `origin` on some branch (`git push`).
600+
- Push-critical files at `HEAD` are clean: wrapper GDS, `verilog/rtl/user_defines.v` (when not an openframe project), and `.cf/project.json` (when tracked).
601+
602+
What happens:
603+
1. `cf push --remote` resolves your local HEAD SHA and checks it is reachable from a remote ref.
604+
2. Platform uses its GitHub App installation token to read the three push-critical files at that commit and stages them into your SFTP landing zone.
605+
3. `project.json` is synced to the platform, exactly like an SFTP push.
606+
4. `--submit` submits for review on success.
607+
608+
> [!TIP]
609+
> If `cf push` fails to reach `sftp.chipfoundry.io:22` from inside a corporate
610+
> network, run `cf push --remote` instead. No VPN required — just outbound
611+
> HTTPS and a GitHub repo linked to the project.
612+
586613
**GDS File Handling:**
587614
- **Both compressed (`.gz`) and uncompressed (`.gds`) files are supported**
588615
- **No automatic compression** - files are uploaded as-is

0 commit comments

Comments
 (0)