Skip to content

CLI: source-directory deploy · compute custom domains · auto-install skills - #6

Merged
jwfing merged 7 commits into
mainfrom
devel
Jul 3, 2026
Merged

jwfing merged 7 commits into
mainfrom
devel

Conversation

@jwfing

@jwfing jwfing commented Jul 3, 2026 •

Copy link
Copy Markdown
Member

insta deploy <dir> — source-directory deploy

Deploy a source directory (needs a Dockerfile) built remotely on Fly's builder, in addition to the existing --image <url>. The platform mints a short-lived, app-scoped Fly deploy token, so the CLI never holds a standing Fly credential; the pushed image is pinned to its digest.

insta compute set-domain — developer custom domains

insta compute set-domain / check-domain / remove-domain <host>: attach a bring-your-own domain to a branch's compute service. Fly issues the cert + routes; the CLI prints the DNS records to set in your own registrar.

Auto-install agent skills on link

insta project create/link now install the related agent skills (insta, neon-postgres, tigris, better-auth) via npx skills add, fully non-interactively.

Tests: flyctl build/push helper + skills-install. All green.

🤖 Generated with Claude Code


Summary by cubic

Adds source-directory deploys, compute custom domains, and auto-install of agent skills, plus clearer usage reporting. Preps for public release and publishes the CLI as the insta npm package; keeps --image deploys with digest pinning and no long‑lived Fly creds.

  • New Features

    • Deploy from source: insta deploy <dir> builds remotely with flyctl, pushes with a short‑lived app token, and pins by digest. Requires a Dockerfile. Exactly one of <dir> or --image. Respects --branch|--group|--port. Auto‑installs flyctl on macOS if missing (best‑effort).
    • Compute custom domains: insta compute set-domain|check-domain|remove-domain <host> attaches BYO domains to a branch service. Prints DNS records and cert status.
    • Auto-install agent skills: insta project create|link runs npx skills add for insta, neon-postgres, tigris, and better-auth non‑interactively.
    • Usage: shows cpu/memory/volume/egress/storage with a total; maps ram → memory; labels the window as billing cycle <start> → <end-1d>. Defaults to org usage with a per‑project breakdown; use --proj [id] for a single project.
  • Dependencies

    • Publish as insta on npm: rename package, engines node>=18, public publish, and narrow files to dist/**/*.js. --version now reads the installed package.json for npm builds; the standalone binary still uses INSTA_CLI_VERSION. License switched to Apache‑2.0 (adds LICENSE). README fully translated to English. Version bumped to 0.0.3.

Written for commit 5681a64. Summary will update on new commits.

Review in cubic

jwfing and others added 2 commits July 2, 2026 21:15
deploy now takes either a prebuilt --image (unchanged) or a source directory
(positional <dir>). Source mode: mint a short-lived app-scoped Fly deploy token
from the platform (POST /deploy-token), build+push <dir> with flyctl's remote
builder (`flyctl deploy --build-only --push`, token via FLY_API_TOKEN env),
pin the pushed image to its digest, then deploy it through the normal path.
Requires a Dockerfile; writes a throwaway fly.toml stub only if the dir has none.

Adds flyctl-build.ts (build/push helper + ensureFlyctl) + tests. The CLI never
holds a standing Fly credential — the platform mints a scoped, expiring one.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`insta compute set-domain <host>` attaches a bring-your-own domain to a branch's
compute service and prints the DNS records to set in your own registrar;
`check-domain` re-checks cert status, `remove-domain` detaches. Fly issues the
cert + routes — the CLI just relays the platform's records/status.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/commands/deploy.ts">

<violation number="1" location="src/commands/deploy.ts:39">
P2: Approval-gated source deploys now emit an extra error line and fail the command after the standard approval prompt, which diverges from the existing governance flow. This comes from calling `die(...)` after `handleApproval(tok)` instead of stopping cleanly once the approval message is printed.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/commands/deploy.ts
const port = opts.port ? Number(opts.port) : 8080

const tok = await api.rawRequest('POST', `/projects/${projectId}/deploy-token`, { branch, group: opts.group })
if (handleApproval(tok)) die('deploy requires approval — get it approved, then re-run')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Approval-gated source deploys now emit an extra error line and fail the command after the standard approval prompt, which diverges from the existing governance flow. This comes from calling die(...) after handleApproval(tok) instead of stopping cleanly once the approval message is printed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/commands/deploy.ts, line 39:

<comment>Approval-gated source deploys now emit an extra error line and fail the command after the standard approval prompt, which diverges from the existing governance flow. This comes from calling `die(...)` after `handleApproval(tok)` instead of stopping cleanly once the approval message is printed.</comment>

<file context>
@@ -1,16 +1,46 @@
+  const port = opts.port ? Number(opts.port) : 8080
+
+  const tok = await api.rawRequest('POST', `/projects/${projectId}/deploy-token`, { branch, group: opts.group })
+  if (handleApproval(tok)) die('deploy requires approval — get it approved, then re-run')
+  const { token, flyApp } = tok.body
+
</file context>
Suggested change
if (handleApproval(tok)) die('deploy requires approval — get it approved, then re-run')
if (handleApproval(tok)) process.exit(0)

jwfing and others added 3 commits July 3, 2026 10:50
Render the customer-facing dimensions (cpu/memory/volume/egress/storage) the
platform now returns, with ram labelled 'memory'. Follows the platform
/projects/:id/usage change to a { dimensions, totalCostUsd } response.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The usage window now defaults to the current billing cycle; show it as
'billing cycle <start> → <end-1d>' (to is the exclusive next-cycle start).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Default `insta usage` to whole-org usage (org of the linked project) with a
per-project cost breakdown; `--proj [id]` shows one project — the linked one,
or a given project id. Both over the current billing cycle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/commands/metrics.ts">

<violation number="1" location="src/commands/metrics.ts:50">
P2: `insta usage --proj <id>` still requires a linked project and exits before using the provided id. This happens because `requireProject()` runs unconditionally at function start; resolving the linked project only when `--proj` is omitted (or used without an id) would preserve the new explicit-id workflow.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread src/commands/metrics.ts
// [id] for a single project (the linked one, or a given id). Billed dimensions, not raw fly/neon meters.
export async function usage(opts: { from?: string; to?: string; json?: boolean; proj?: string | boolean }): Promise<void> {
const api = await ApiClient.load()
const p = await requireProject()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: insta usage --proj <id> still requires a linked project and exits before using the provided id. This happens because requireProject() runs unconditionally at function start; resolving the linked project only when --proj is omitted (or used without an id) would preserve the new explicit-id workflow.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/commands/metrics.ts, line 50:

<comment>`insta usage --proj <id>` still requires a linked project and exits before using the provided id. This happens because `requireProject()` runs unconditionally at function start; resolving the linked project only when `--proj` is omitted (or used without an id) would preserve the new explicit-id workflow.</comment>

<file context>
@@ -25,24 +25,51 @@ export async function metrics(component: string, group: string | undefined, opts
+// [id] for a single project (the linked one, or a given id). Billed dimensions, not raw fly/neon meters.
+export async function usage(opts: { from?: string; to?: string; json?: boolean; proj?: string | boolean }): Promise<void> {
+  const api = await ApiClient.load()
+  const p = await requireProject()
+
+  if (opts.proj !== undefined && opts.proj !== false) {
</file context>

jwfing and others added 2 commits July 3, 2026 11:17
- name insta-cli → insta; drop private:true (was blocking publish)
- files → dist/**/*.js so the ~440MB bun binaries in dist/bin are not shipped
- add engines(node>=18), prepublishOnly build, repo/homepage/bugs/keywords,
  publishConfig.access=public, license
- --version now reads the installed package.json (npm/node) instead of
  reporting 0.0.0; standalone binary still uses INSTA_CLI_VERSION

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Translate README fully to English (public-facing package)
- Bump version 0.0.2 -> 0.0.3
- Switch license MIT -> Apache-2.0, add LICENSE file

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="README.md">

<violation number="1" location="README.md:73">
P2: The README command reference is out of sync with the new CLI features introduced in this PR. The `deploy` command now supports a source directory (`insta deploy <dir>` for remote Fly builds), but the table still lists only `insta deploy --image <url>`. The new `insta compute set-domain/check-domain/remove-domain` commands are entirely absent. Additionally, the closing note says `"image building will come later"`, which is now stale because source-directory deploy is implemented. Updating the README keeps the CLI contract discoverable for users and avoids contradiction between docs and code.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread README.md
| `insta branch list [--json]` / `switch <name>` / `delete <name>` | Branch management |
| `insta secrets [--branch -o --print --json]` | Secret seam: write credentials to `.env` |
| `insta secrets list [--branch]` | List secret names only |
| `insta deploy --image <url> [--branch --group --port]` | Deploy an image |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The README command reference is out of sync with the new CLI features introduced in this PR. The deploy command now supports a source directory (insta deploy <dir> for remote Fly builds), but the table still lists only insta deploy --image <url>. The new insta compute set-domain/check-domain/remove-domain commands are entirely absent. Additionally, the closing note says "image building will come later", which is now stale because source-directory deploy is implemented. Updating the README keeps the CLI contract discoverable for users and avoids contradiction between docs and code.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At README.md, line 73:

<comment>The README command reference is out of sync with the new CLI features introduced in this PR. The `deploy` command now supports a source directory (`insta deploy <dir>` for remote Fly builds), but the table still lists only `insta deploy --image <url>`. The new `insta compute set-domain/check-domain/remove-domain` commands are entirely absent. Additionally, the closing note says `"image building will come later"`, which is now stale because source-directory deploy is implemented. Updating the README keeps the CLI contract discoverable for users and avoids contradiction between docs and code.</comment>

<file context>
@@ -1,117 +1,118 @@
+| `insta branch list [--json]` / `switch <name>` / `delete <name>` | Branch management |
+| `insta secrets [--branch -o --print --json]` | Secret seam: write credentials to `.env` |
+| `insta secrets list [--branch]` | List secret names only |
+| `insta deploy --image <url> [--branch --group --port]` | Deploy an image |
+| `insta manifest [--json]` | Agent-readable environment manifest |
+| `insta metrics <db\|compute> [group] [--branch --from --to --step --json]` | Resource metrics (compute=Fly; db limited) |
</file context>

@Fermionic-Lyu Fermionic-Lyu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Approved.

@jwfing
jwfing merged commit 3243be6 into main Jul 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants