-
Notifications
You must be signed in to change notification settings - Fork 0
Fix provider contracts, upload concurrency, and local server reliability #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
93b8778
950e2a3
d70ef56
5a2fe56
bbe38f0
d83f137
1bf7844
7e9da49
0633e8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| # DevCLI Setup & Secrets Guide | ||
|
|
||
| A complete reference for setting up prerequisites, generating provider tokens, saving local credentials, configuring GitHub repository secrets, and running verification tests. | ||
|
|
||
| --- | ||
|
|
||
| ## Step 1: Install prerequisites | ||
|
|
||
| ```powershell | ||
| # Node.js (if not already installed) | ||
| winget install OpenJS.NodeJS.LTS | ||
|
|
||
| # GitHub CLI (for setting repository secrets) | ||
| winget install GitHub.cli | ||
| gh auth login | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Step 2: Clone and set up the repo | ||
|
|
||
| ```powershell | ||
| git clone https://github.com/MR-1124/deploy-cli.git | ||
| cd deploy-cli | ||
| npm install | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Step 3: Get your tokens | ||
|
|
||
| ### Netlify | ||
| 1. Go to [Netlify Personal Access Tokens](https://app.netlify.com/user/applications#personal-access-tokens). | ||
| 2. Click **New access token** → name it `deploy-cli` → **Generate token** → copy it. | ||
|
|
||
| ### Vercel | ||
| 1. Go to [Vercel Account Tokens](https://vercel.com/account/tokens). | ||
| 2. Click **Create** → name it `deploy-cli` → copy it. | ||
| 3. Also grab your **Team ID** from https://vercel.com/dashboard → Settings → General → Team ID (if using a team). | ||
|
|
||
| ### Cloudflare | ||
| 1. Go to [Cloudflare API Tokens](https://dash.cloudflare.com/profile/api-tokens) → **Create Token** → **Custom token**. | ||
| 2. Permission: `Cloudflare Pages` → `Edit`. | ||
| 3. Account Resources: Include → **All accounts**. | ||
| 4. Zone Resources: default (`All zones`). | ||
| 5. Create → copy token. | ||
| 6. Account ID: located in the right sidebar of any dashboard page, or via: | ||
| ```bash | ||
| curl -s "https://api.cloudflare.com/client/v4/accounts" -H "Authorization: Bearer <TOKEN>" | ||
| ``` | ||
|
Comment on lines
+47
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift Do not pass credentials in command arguments. The guide places bearer tokens, provider tokens, S3 secret keys, and npm tokens in command-line arguments. Shell history and process inspection can retain these values. Use interactive input, standard input, or a documented environment-variable flow. The Also applies to: 77-92, 133-141 🤖 Prompt for AI Agents |
||
| Copy the `id` field from your account in the response. | ||
|
|
||
| ### AWS S3 | ||
| 1. IAM → Users → Create user (e.g. `deploy-cli`) → Attach inline policy: | ||
| ```json | ||
| { | ||
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
| { "Effect": "Allow", "Action": ["s3:PutObject", "s3:GetObject"], "Resource": "arn:aws:s3:::YOUR-BUCKET/*" }, | ||
| { "Effect": "Allow", "Action": ["s3:ListBucket"], "Resource": "arn:aws:s3:::YOUR-BUCKET" } | ||
| ] | ||
| } | ||
| ``` | ||
| 2. User → Security credentials → Create access key → copy **Access key ID** + **Secret access key**. | ||
| 3. S3 → Create bucket → note the **region** (e.g. `us-east-1`). | ||
| 4. Bucket → Permissions → Block public access → uncheck all → Save. | ||
| 5. Bucket policy: | ||
| ```json | ||
| { | ||
| "Version": "2012-10-17", | ||
| "Statement": [{ "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::YOUR-BUCKET/*" }] | ||
| } | ||
| ``` | ||
|
Comment on lines
+66
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Do not make the S3 bucket public by default. These instructions disable all public-access protections and grant 🤖 Prompt for AI Agents |
||
|
|
||
| --- | ||
|
|
||
| ## Step 4: Save credentials locally | ||
|
|
||
| ```powershell | ||
| # Netlify | ||
| node cli.js login --provider netlify --token <YOUR_NETLIFY_TOKEN> | ||
|
|
||
| # Vercel (without or with team) | ||
| node cli.js login --provider vercel --token <YOUR_VERCEL_TOKEN> | ||
| node cli.js login --provider vercel --token <YOUR_VERCEL_TOKEN> --team <TEAM_ID> | ||
|
|
||
| # Cloudflare | ||
| node cli.js login --provider cloudflare --token <YOUR_CF_TOKEN> --account <YOUR_ACCOUNT_ID> | ||
|
|
||
| # S3 | ||
| node cli.js login --provider s3 --access-key <AK> --secret-key <SK> --bucket <BUCKET_NAME> --region us-east-1 | ||
| ``` | ||
|
|
||
| Verify everything: | ||
| ```powershell | ||
| node cli.js doctor | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Step 5: Set GitHub repo secrets | ||
|
|
||
| ```powershell | ||
| # If not already authenticated: | ||
| gh auth login | ||
|
|
||
| # One by one (each prompts for the value — paste, don't type): | ||
| gh secret set NPM_TOKEN -R MR-1124/deploy-cli | ||
| gh secret set NETLIFY_AUTH_TOKEN -R MR-1124/deploy-cli | ||
| gh secret set VERCEL_TOKEN -R MR-1124/deploy-cli | ||
| gh secret set CLOUDFLARE_API_TOKEN -R MR-1124/deploy-cli | ||
| gh secret set CLOUDFLARE_ACCOUNT_ID -R MR-1124/deploy-cli | ||
| gh secret set AWS_ACCESS_KEY_ID -R MR-1124/deploy-cli | ||
| gh secret set AWS_SECRET_ACCESS_KEY -R MR-1124/deploy-cli | ||
| gh secret set SMOKE_S3_BUCKET -R MR-1124/deploy-cli | ||
| gh secret set AWS_REGION -R MR-1124/deploy-cli | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Step 6: Verify everything works | ||
|
|
||
| ```powershell | ||
| # Local smoke test (uses saved credentials from deploy login) | ||
| npm run smoke | ||
|
|
||
| # Full health check | ||
| node cli.js doctor | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Token Reference | ||
|
|
||
| | Provider | Env var (GitHub Actions) | Also via `deploy login` | | ||
| |---|---|---| | ||
| | Netlify | `NETLIFY_AUTH_TOKEN` | `--provider netlify --token` | | ||
| | Vercel | `VERCEL_TOKEN` | `--provider vercel --token` | | ||
| | Cloudflare | `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` | `--provider cloudflare --token --account` | | ||
| | AWS | `AWS_ACCESS_KEY_ID` + `AWS_SECRET_ACCESS_KEY` + `SMOKE_S3_BUCKET` + `AWS_REGION` | `--provider s3 --access-key --secret-key --bucket --region` | | ||
| | npm | `NPM_TOKEN` | manual: `npm config set //registry.npmjs.org/:_authToken=<token>` | | ||
|
|
||
| > [!NOTE] | ||
| > `deploy login` commands save to `~/.deploy-cli/config.json`, so after a reset you only run them once and every future `npm run smoke` or `deploy up` works from any shell. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Restrict the Cloudflare token scope.
Set Account Resources to the deployment account instead of All accounts. Set Zone Resources to none or to the specific required zones instead of All zones. A compromised token created from this guide would otherwise expose unrelated accounts and zones.
🤖 Prompt for AI Agents