-
Notifications
You must be signed in to change notification settings - Fork 0
feat(env): first-class staging environment + agents.staging.instacloud.com one-liner #66
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
4c73aff
9729b6b
b30429d
97f2e53
f4aff4a
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 |
|---|---|---|
|
|
@@ -16,6 +16,26 @@ curl -fsSL https://raw.githubusercontent.com/InsForge/insta-cli/main/install.sh | |
| # Windows: download insta-windows-x64.exe from the releases page. | ||
| ``` | ||
|
|
||
| **Agent one-liner** (CLI + agent skills + MCP registration, non-interactive): | ||
|
|
||
| ```bash | ||
| curl -fsSL agents.instacloud.com | sh # production | ||
| curl -fsSL agents.staging.instacloud.com | sh # staging | ||
|
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. P2: The one-liner Prompt for AI agents |
||
| ``` | ||
|
|
||
| Each installs a complete stack for its environment — CLI build, control plane, MCP registration and | ||
| skill text all match. See [Environments](#environments). | ||
|
|
||
| > The staging host serves this repo's `agents-staging.sh` from `main`, so it returns 404 until that | ||
| > file is on `main`. Equivalent, and works regardless: | ||
| > | ||
| > ```bash | ||
| > curl -fsSL https://raw.githubusercontent.com/InsForge/insta-cli/main/install.sh | sh -s -- --agents --staging -y | ||
| > ``` | ||
| > | ||
| > If the environment can't be applied (a CLI predating `insta env`), the installer exits non-zero | ||
| > rather than silently leaving you on production. | ||
|
|
||
| **Build from source (requires node):** | ||
|
|
||
| ```bash | ||
|
|
@@ -52,11 +72,48 @@ insta deploy --image <registry/img> # deploy a container image to the current b | |
| insta status # login state + linked project/branch | ||
| ``` | ||
|
|
||
| ## Environments | ||
|
|
||
| `prod` and `staging` are **separate deployments** — different regions, different databases, | ||
| different auth. A session from one cannot authenticate against the other, so switching drops the | ||
| stored session and you log in again. | ||
|
|
||
| | | `prod` (default) | `staging` | | ||
| |---|---|---| | ||
| | control plane | `api.instacloud.com` (us-east-2) | `api.staging.instacloud.com` (us-west-1) | | ||
| | MCP server | `mcp.instacloud.com/mcp` | `mcp.staging.instacloud.com/mcp` | | ||
| | registers as | `insta-cloud` | `insta-cloud-staging` | | ||
| | agent skills | `InsForge/insta-skills` | `InsForge/insta-skills@devel` | | ||
| | CLI channel | latest stable release | newest prerelease (`v*-rc.N`), else stable | | ||
|
|
||
| ```bash | ||
| insta env # show the current environment and everything derived from it | ||
| insta env use staging # switch (persisted to ~/.insta/config.json) | ||
| insta login --env staging --oauth github | ||
| ``` | ||
|
|
||
| Control plane, MCP host **and** skill source are all resolved from one switch, so a machine can | ||
| never end up with its CLI on staging while its agents talk to prod and read prod's skill text. | ||
| Distinct MCP registration names mean both environments can be installed side by side. | ||
|
|
||
| Resolution order, most specific first: | ||
|
|
||
| 1. `INSTA_API_URL` — a literal URL. The only way to reach a host no environment name covers | ||
| (`insta-oss` on localhost, a preview deployment). `INSTA_MCP_URL` and `INSTA_SKILLS_REPO` do the | ||
| same for the MCP host and the skill source. | ||
| 2. `INSTA_ENV` — `prod` | `staging`. An unrecognised value is an error, never a silent fallback. | ||
| 3. the persisted `apiUrl` in `~/.insta/config.json`. | ||
| 4. `prod`. | ||
|
|
||
| Prereleases never take the `latest` GitHub release or the `latest` npm dist-tag — they publish with | ||
| `--prerelease` and under npm's `next` tag — so a staging build can't reach production installers. | ||
|
|
||
| ## Commands | ||
|
|
||
| | Command | Description | | ||
| |------|------| | ||
| | `insta login [--email --password --api-url]` | Log in (email/password; tokens auto-refresh) | | ||
| | `insta login [--email --password --api-url --env]` | Log in (email/password; tokens auto-refresh) | | ||
| | `insta env [--json]` / `insta env use <prod\|staging>` | Show or switch deployment environment | | ||
| | `insta login --oauth <github\|google>` | Browser OAuth login (starts a local loopback port; the token is carried back automatically after browser authorization) | | ||
| | `insta logout` / `insta status [--json]` | Log out / show status | | ||
| | `insta org list [--json]` / `org create <name>` | Organizations (each user may own only one free org) | | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env sh | ||
| # | ||
| # InstaCloud agent setup installer, STAGING — the one-liner for coding agents: | ||
| # | ||
| # curl -fsSL agents.staging.instacloud.com | sh | ||
| # | ||
| # (agents.staging.instacloud.com is a CloudFront edge cache of this file, the staging sibling of | ||
| # agents.instacloud.com → agents.sh. The raw fallback also works: | ||
| # curl -fsSL https://raw.githubusercontent.com/InsForge/insta-cli/main/agents-staging.sh | sh) | ||
| # | ||
| # Identical to agents.sh except that everything it installs points at staging: | ||
| # | ||
| # CLI the newest PRERELEASE build (v*-rc.N), falling back to the latest stable if none | ||
| # exists yet. INSTA_VERSION pins an exact tag and overrides this. | ||
| # API api.staging.instacloud.com (us-west-1, a separate deployment from prod) | ||
| # MCP mcp.staging.instacloud.com, registered as `insta-cloud-staging` so it can coexist | ||
| # with a production registration on the same machine | ||
| # skills the staging ref of InsForge/insta-skills, so the agent reads skill text that | ||
| # describes the staging control plane | ||
| # | ||
| # One command, and every piece is staging. This script itself ships from `main` (same as | ||
| # agents.sh) — it is the installer, not the thing being staged. | ||
| # | ||
| # --staging is passed to install.sh (rather than exporting INSTA_ENV around it) so the choice is | ||
| # PERSISTED into ~/.insta/config.json. A piped `curl … | sh` cannot export into the parent shell, | ||
| # so an env var would evaporate before the `insta project create` the user runs next. | ||
| set -eu | ||
|
|
||
| # Download to a file and check curl's status BEFORE running it, rather than piping straight into sh. | ||
| # A piped `curl … | sh` that fails to fetch hands sh an EMPTY stream, and sh exits 0 — so the | ||
| # one-liner reports success while installing nothing. That matters most for automation, which has | ||
| # only the exit code to go on. | ||
| tmp="$(mktemp)" | ||
| trap 'rm -f "$tmp"' EXIT | ||
| if ! curl -fsSL https://raw.githubusercontent.com/InsForge/insta-cli/main/install.sh -o "$tmp"; then | ||
| echo "error: could not download install.sh (network, or GitHub raw unavailable)" >&2 | ||
| exit 1 | ||
| fi | ||
| [ -s "$tmp" ] || { echo "error: downloaded install.sh is empty" >&2; exit 1; } | ||
| sh "$tmp" --agents --staging -y "$@" |
Uh oh!
There was an error while loading. Please reload this page.