|
1 | 1 | --- |
2 | 2 | name: insforge-cli |
3 | 3 | description: >- |
4 | | - Use this skill when managing InsForge infrastructure with the CLI: projects, SQL, migrations, RLS policies, functions, storage buckets, frontend deployments, compute services, secrets/env vars, Stripe payment keys/catalog/products/prices/webhooks, schedules, logs, diagnostics, import/export, or **managing backend branches** (creating a branch project to test risky schema/auth/RLS changes, merging a branch back to prod, resolving merge conflicts). For app code with @insforge/sdk, use the insforge skill instead. |
| 4 | + Use this skill when managing InsForge infrastructure with the CLI: projects, SQL, migrations, RLS policies, functions, storage buckets, frontend deployments, compute services, secrets/env vars, Stripe payment keys/catalog/products/prices/webhooks, schedules, logs, diagnostics, import/export, **declarative auth redirect URLs via `insforge.toml`** (applied with `config apply`), or **managing backend branches** (creating a branch project to test risky schema/auth/RLS changes, merging a branch back to prod, resolving merge conflicts). For app code with @insforge/sdk, use the insforge skill instead. |
5 | 5 | license: MIT |
6 | 6 | metadata: |
7 | 7 | author: insforge |
8 | | - version: "1.4.0" |
| 8 | + version: "1.5.0" |
9 | 9 | organization: InsForge |
10 | 10 | date: May 2026 |
11 | 11 | --- |
@@ -173,6 +173,22 @@ For frontend hosting see **Frontend Deployments** above. |
173 | 173 | - `npx @insforge/cli secrets update <key> [--value] [--active] [--reserved] [--expires]` — update secret |
174 | 174 | - `npx @insforge/cli secrets delete <key>` — **soft delete** (marks inactive; restore with `--active true`) |
175 | 175 |
|
| 176 | +### Configuration — `npx @insforge/cli config` |
| 177 | + |
| 178 | +Manage `auth.allowed_redirect_urls` declaratively via `insforge.toml` (project root). For changing redirect URLs, prefer this over `PUT /api/auth/config` — the CLI gates on backend version and surfaces a clean skip if the backend predates the field, where the raw PUT may 200-and-silently-drop. |
| 179 | + |
| 180 | +- `npx @insforge/cli config export [--out insforge.toml] [--force]` — pull live config into TOML. Sections the backend doesn't expose are omitted. |
| 181 | +- `npx @insforge/cli config plan [--file insforge.toml]` — diff TOML vs. live state; shows which changes will apply vs. be skipped on the connected backend. |
| 182 | +- `npx @insforge/cli config apply [--file insforge.toml] [--dry-run] [--auto-approve]` — apply the TOML. Per-change capability gate: supported changes apply; unsupported go to `skipped[]` with an upgrade message and **no PUT is issued for them**. `--json` returns `{ plan, applied[], skipped[] }`. |
| 183 | + |
| 184 | +> **If `apply` returns `skipped: [...]`, surface verbatim.** The user's backend predates this section. Tell them which sections were skipped and to upgrade; do not retry, do not bypass with `curl` (silent drop). Sample message: _"I tried to set `auth.allowed_redirect_urls` but your backend is on an older version that doesn't support it yet. Upgrade your backend and re-run `npx @insforge/cli config apply`."_ |
| 185 | +
|
| 186 | +> **TOML is for knobs only — never embed programs.** SQL → `db migrations`. Function code → `functions deploy`. Compute → `compute deploy`. Frontend → `deployments deploy`. TOML carries booleans, strings, and arrays — anything bigger lives in its own file managed by a dedicated CLI command. |
| 187 | +
|
| 188 | +**Scope today:** only `auth.allowed_redirect_urls`. Password policy, SMTP, OAuth providers, custom subdomain, and similar will land in TOML later. For other `auth.config` fields today, use the dashboard. |
| 189 | + |
| 190 | +See [references/config.md](references/config.md) for output shapes and a common-mistakes table. |
| 191 | + |
176 | 192 | ### Schedules — `npx @insforge/cli schedules` |
177 | 193 | - `npx @insforge/cli schedules list` — list all scheduled tasks (shows ID, name, cron, URL, method, active, next run) |
178 | 194 | - `npx @insforge/cli schedules get <id>` — get schedule details |
@@ -278,10 +294,29 @@ Run with no subcommand for a full health report across all checks. |
278 | 294 |
|
279 | 295 | **Payments use Stripe as source of truth**: use `payments config set` for Stripe keys, `payments sync` before relying on existing catalog data, and create a new Stripe price instead of editing amount/currency. Runtime checkout and customer portal integration belongs in the `insforge` SDK skill. |
280 | 296 |
|
| 297 | +**`config apply` is version-aware**: per-project backends drift in version. The CLI probes `/api/metadata` and gates `auth.allowed_redirect_urls` on whether the backend exposes it; if not, the change lands in `skipped[]` with an upgrade message and **no PUT is issued**. Never bypass with `curl` to "force" a skipped field — older backends may 200-and-silently-drop. Surface skips to the user and ask them to upgrade. |
| 298 | + |
281 | 299 | --- |
282 | 300 |
|
283 | 301 | ## Common Workflows |
284 | 302 |
|
| 303 | +### Configure auth redirect URLs (insforge.toml) |
| 304 | + |
| 305 | +```bash |
| 306 | +# 1. Pull current config to insforge.toml (writes in project root) |
| 307 | +npx @insforge/cli --json config export |
| 308 | + |
| 309 | +# 2. Edit insforge.toml — add/remove entries under [auth] allowed_redirect_urls |
| 310 | + |
| 311 | +# 3. Preview the diff |
| 312 | +npx @insforge/cli --json config plan |
| 313 | + |
| 314 | +# 4. Apply (use --yes for non-interactive — required in --json mode) |
| 315 | +npx @insforge/cli --json --yes config apply |
| 316 | +``` |
| 317 | + |
| 318 | +If `apply` returns a non-empty `skipped[]`, the user's backend predates this section — surface the entries verbatim with the upgrade ask. Don't retry, don't fall back to `curl` (older backends may 200-and-silently-drop). See [references/config.md](references/config.md). |
| 319 | + |
285 | 320 | ### Set up database schema with migrations |
286 | 321 |
|
287 | 322 | ```bash |
|
0 commit comments