gipity 1.1.23 → 1.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@ The cloud backend for your coding agent.
4
4
 
5
5
  [Gipity](https://gipity.ai) is the backend your coding agent gets by installing one CLI and one skill: hosting, databases, serverless functions, file storage, a code sandbox, CPU/GPU jobs, AI models and media services, workflows, and a quick LLM call (`gipity ask`), plus templates and kits that give you a running start.
6
6
 
7
- This CLI connects your coding agent ([Claude Code](https://claude.ai/claude-code), Codex, Grok, or opencode) to Gipity: deploy, query the database, call functions, test pages in a real browser, generate images and audio, and keep your local files in sync with your Gipity project.
7
+ This CLI connects your coding agent ([Claude Code](https://claude.ai/claude-code), Codex, Grok, Antigravity, or opencode) to Gipity: deploy, query the database, call functions, test pages in a real browser, generate images and audio, and keep your local files in sync with your Gipity project.
8
8
 
9
9
  ## Getting Started
10
10
 
@@ -23,11 +23,11 @@ irm https://gipity.ai/install.ps1 | iex
23
23
  | You want to... | Run |
24
24
  |----------------|-----|
25
25
  | Start building right now, from anywhere | `gipity build` |
26
- | Use your own workflow in your own directory | `gipity init`, then `claude` / `codex` / `grok` / `opencode` |
26
+ | Use your own workflow in your own directory | `gipity init`, then `claude` / `codex` / `grok` / `agy` / `opencode` |
27
27
 
28
28
  ### `gipity build` - start from anywhere
29
29
 
30
- One command does everything: logs you in (6-digit email code), lets you pick or create a project, lets you pick your coding agent (Claude Code, Codex, or Grok - it installs the agent if needed), and launches it with the whole Gipity stack wired up.
30
+ One command does everything: logs you in (6-digit email code), lets you pick or create a project, lets you pick your coding agent (Claude Code, Codex, Grok, Antigravity, or opencode - it installs the agent where it can), and launches it with the whole Gipity stack wired up.
31
31
 
32
32
  ```bash
33
33
  gipity build
@@ -39,10 +39,10 @@ Prefer launching your agent yourself? From any project directory:
39
39
 
40
40
  ```bash
41
41
  gipity init
42
- claude # or codex, grok, or opencode - whatever you use
42
+ claude # or codex, grok, agy, or opencode - whatever you use
43
43
  ```
44
44
 
45
- `init` links the directory to a Gipity project, writes CLAUDE.md/AGENTS.md primers so your agent understands Gipity, and installs the Gipity skills + file-sync hooks into the agent CLIs found on your machine (Claude Code, Codex, Grok; Cursor and Gemini get primer files too).
45
+ `init` links the directory to a Gipity project, writes CLAUDE.md/AGENTS.md primers so your agent understands Gipity, and installs the Gipity skills + file-sync hooks into the agent CLIs found on your machine (Claude Code, Codex, Grok, Antigravity, opencode; Cursor, Gemini CLI and GitHub Copilot get primer files too).
46
46
 
47
47
  ### Prefer npm
48
48
 
@@ -90,6 +90,8 @@ To opt out: `export DISABLE_AUTOUPDATER=1` (matches Claude Code), or set `{ "aut
90
90
  1. Claude Code (Anthropic)
91
91
  2. Codex (OpenAI)
92
92
  3. Grok (xAI)
93
+ 4. Antigravity (Google)
94
+ 5. opencode (Anomaly)
93
95
 
94
96
  Launching Claude Code, powered by Gipity.
95
97
  ```
@@ -115,12 +117,12 @@ gipity login --email you@example.com
115
117
  gipity login --code 123456
116
118
  cd my-project
117
119
  gipity init
118
- claude # or codex, grok, or opencode
120
+ claude # or codex, grok, agy, or opencode
119
121
  ```
120
122
 
121
123
  ## Coding Agent Integration
122
124
 
123
- This is the good part. When you run `gipity init` (or `gipity build`) in a project, it wires two hooks into your agent (Claude Code, Codex, and Grok all get them):
125
+ This is the good part. When you run `gipity init` (or `gipity build`) in a project, it wires two hooks into your agent (Claude Code, Codex, Grok, Antigravity, and opencode all get them):
124
126
 
125
127
  **Auto-push** - Every time your agent writes or edits a file, it gets pushed to Gipity in the background. No extra steps.
126
128
 
@@ -133,7 +135,7 @@ Session recording is off by default. To keep your Claude Code sessions in your G
133
135
  ```
134
136
  .gipity.json # Project config (which project)
135
137
  .gipity/ # Local sync state (gitignored)
136
- .claude/settings.json # Hooks for auto-push and auto-pull (per-agent equivalents for Codex/Grok)
138
+ .claude/settings.json # Hooks for auto-push and auto-pull (per-agent equivalents for the other agents)
137
139
  CLAUDE.md / AGENTS.md # Gipity commands reference for your agent
138
140
  ```
139
141
 
@@ -158,13 +160,20 @@ gipity push <file> # Push one or more files
158
160
  | `gipity skill list` / `skill read <name>` | Task docs: read the matching skill before building |
159
161
  | `gipity project` | List, create, switch, rename, or delete projects |
160
162
  | `gipity add <template\|kit>` | Add a template (web-simple, web-fullstack, api, 2d-game, 3d-world, ...) or a kit (realtime, stripe, i18n, ...) |
161
- | `gipity deploy [dev\|prod]` | Deploy your project to the web |
163
+ | `gipity remove <kit>` | Remove a kit |
164
+ | `gipity brand` | Show or set the app's icon, accent color, and share card |
165
+ | `gipity save` / `gipity load` | Export the app as a portable `.gip` bundle / create a new app from a bundle or GitHub repo |
166
+ | `gipity github` | Connect GitHub for repo imports |
167
+ | `gipity deploy [prod\|<env>]` | Deploy to prod, or to an isolated environment like `dev` |
168
+ | `gipity env` | List, create, reset, or delete app environments |
162
169
  | `gipity page inspect\|eval\|screenshot <url>` | Check a page in a real browser: console errors, failed resources, DOM, screenshots |
163
170
  | `gipity test` | Run project tests in sandboxed containers |
164
171
  | `gipity db` | Query, list, create, or drop project databases |
165
172
  | `gipity fn` | List, call, and delete serverless functions |
166
173
  | `gipity logs fn <name>` / `logs app` | Function logs / recent app activity and errors |
167
174
  | `gipity secrets` | Manage app secrets (encrypted, never echoed back) |
175
+ | `gipity key` | Project API keys for scripts and agents (`X-Api-Key`) |
176
+ | `gipity token` | Agent API tokens for headless/CI use (`GIPITY_TOKEN`) |
168
177
  | `gipity job` | Run long CPU/GPU jobs |
169
178
  | `gipity workflow` | Create, run, and schedule workflows |
170
179
  | `gipity approval` | List, create, answer, or cancel pending approvals |
@@ -172,29 +181,38 @@ gipity push <file> # Push one or more files
172
181
  | `gipity ask "<question>"` | Ask a model one question and print the answer |
173
182
  | `gipity generate` | Generate images, video, speech, sound effects, or music |
174
183
  | `gipity service` | Call an app service (llm, tts, image, transcribe, ...) |
184
+ | `gipity notify` | Send a test web push notification, count or remove subscriptions |
185
+ | `gipity payments` | Connect Stripe to charge your users |
186
+ | `gipity realtime` | Manage realtime rooms, benchmark a room |
187
+ | `gipity location` | IP geolocation and reverse geocoding (`<ip>`, `<lat> <lng>`) |
188
+ | `gipity gmail` | Search, read, send, and reply with your own Gmail |
189
+ | `gipity text analyze` | Deterministic letter/word counts and lookups (local, no network) |
175
190
  | `gipity sandbox run` | Execute code in a sandboxed container |
176
191
  | `gipity records` | Query and manage Records API tables |
177
192
  | `gipity rbac` / `gipity audit` | Access policies / audit logs |
178
193
  | `gipity file` | Browse remote files, versions, and rollbacks |
179
194
  | `gipity sync` / `gipity push` | Sync files between local and Gipity |
180
195
  | `gipity upload <file>` | Upload a file and print a durable public URL |
196
+ | `gipity storage` | Storage usage and version-retention settings |
181
197
  | `gipity domain` | Manage custom domains for deployed apps |
182
198
  | `gipity email` | Test and inspect your app's `email()` sends (`email test`, `email log`) |
183
199
  | `gipity credits` | Check your plan, balance, and usage |
184
200
  | `gipity doctor` | Check install + environment health |
201
+ | `gipity bug` | Report Gipity platform bugs or friction, list or retract reports |
202
+ | `gipity update` / `gipity uninstall` | Update the CLI now / remove Gipity |
185
203
 
186
204
  Run `gipity --help` for the full list, and `gipity <command> --help` for details.
187
205
 
188
- Every command supports `--json` for scripted/programmatic use.
206
+ All commands support `--json` for scripted/programmatic use, except `gipity build`, which hands the terminal to your coding agent.
189
207
 
190
208
  ### deploy
191
209
 
192
210
  ```bash
193
- gipity deploy # Deploy to dev (dev.gipity.ai)
194
- gipity deploy prod # Deploy to production (app.gipity.ai)
211
+ gipity deploy dev # Deploy the isolated dev environment (created on first use)
212
+ gipity deploy prod # Deploy to production
195
213
  ```
196
214
 
197
- Your project gets a live URL at `https://dev.gipity.ai/{account}/{project}/`.
215
+ Prod lives at `https://app.gipity.ai/{account}/{project}/` and `dev` at `https://dev.gipity.ai/{account}/{project}/`. A new app has only prod, so a bare `gipity deploy` deploys prod; once the app has an environment, name the target every time. Other commands take `--env <name>` to act on an environment.
198
216
 
199
217
  ### ask
200
218
 
@@ -246,7 +264,7 @@ gipity sandbox run --file scripts/report.py
246
264
 
247
265
  ```bash
248
266
  gipity workflow # List workflows
249
- gipity workflow create workflows/daily_report.yaml
267
+ gipity workflow create --from workflows/daily_report.yaml
250
268
  gipity workflow run daily_report # Run now and print each step's output
251
269
  gipity workflow enable daily_report # Turn on its schedule
252
270
  gipity workflow runs daily_report # View recent runs
@@ -269,7 +287,7 @@ Created by `gipity init`. Links your local directory to a Gipity project.
269
287
 
270
288
  ```json
271
289
  {
272
- "projectGuid": "prj-a1b2c3d4",
290
+ "projectGuid": "p_a1b2c3d4",
273
291
  "projectSlug": "my-app",
274
292
  "accountSlug": "steve",
275
293
  "apiBase": "https://a.gipity.ai",
@@ -62,8 +62,12 @@ fileCommand
62
62
  .option('--json', 'Output as JSON')
63
63
  .action((path, opts) => run('Tree', async () => {
64
64
  const { config } = await resolveProjectContext();
65
- const query = path ? `?path=${encodeURIComponent(path)}` : '';
66
- const res = await get(`/projects/${config.projectGuid}/files/tree${query}`);
65
+ // A listing shows everything, app runtime uploads included (sync leaves
66
+ // those out; they stay in Gipity Storage).
67
+ const qs = new URLSearchParams({ include: 'app_uploads' });
68
+ if (path)
69
+ qs.set('path', path);
70
+ const res = await get(`/projects/${config.projectGuid}/files/tree?${qs.toString()}`);
67
71
  printList(res.data, opts, '(empty)', f => {
68
72
  const size = f.type === 'dir' ? '' : ` (${formatSize(Number(f.size))})`;
69
73
  return `${f.path}${size}`;
@@ -2,12 +2,12 @@ import { Command } from 'commander';
2
2
  import { basename, resolve, dirname } from 'path';
3
3
  import { existsSync, readFileSync } from 'fs';
4
4
  import { getAccountSlug } from '../api.js';
5
- import { getConfig, getConfigPath, saveConfigAt } from '../config.js';
5
+ import { getConfig, getConfigPath, saveConfigAt, captureEnabled } from '../config.js';
6
6
  import { getAuth } from '../auth.js';
7
7
  import { slugify, setupProjectTools, SUPPORTED_TOOLS, DEFAULT_TOOLS, DEFAULT_SYNC_IGNORE, resolveProjectTools } from '../setup.js';
8
8
  import { AGENT_ADAPTERS } from '../agents/index.js';
9
9
  import { success, error as clrError, info, muted, bold, brand, warning } from '../colors.js';
10
- import { confirm } from '../utils.js';
10
+ import { confirm, getAutoConfirm, rerunWithYes } from '../utils.js';
11
11
  import { scanForAdoption, adoptCurrentDir, canAdoptCwd, formatBytes, formatCwdLabel, ADOPT_THRESHOLDS, } from '../adopt-cwd.js';
12
12
  import { ensureDevicePaired } from '../relay/setup.js';
13
13
  const TOOL_KEYS = SUPPORTED_TOOLS.map(t => t.key);
@@ -41,12 +41,12 @@ function resolveTools(forFlag) {
41
41
  }
42
42
  /** Recording sessions needs this machine registered as a device. Best-effort:
43
43
  * a failure only means sessions aren't recorded yet, so say so and move on. */
44
- async function pairForCapture() {
44
+ async function pairForCapture(log) {
45
45
  try {
46
46
  await ensureDevicePaired();
47
47
  }
48
48
  catch (err) {
49
- console.log(warning(`Couldn't register this machine for session recording (${err.message}); run \`gipity init --capture\` again to retry.`));
49
+ log(warning(`Couldn't register this machine for session recording (${err.message}); run \`gipity init --capture\` again to retry.`));
50
50
  }
51
51
  }
52
52
  export const initCommand = new Command('init')
@@ -56,6 +56,7 @@ export const initCommand = new Command('init')
56
56
  .option('--capture', 'Record Claude Code sessions in this directory to your Gipity project (sets captureHooks: true in .gipity.json; new projects start with it off)')
57
57
  .option('--no-capture', 'Stop recording sessions in this directory (sets captureHooks: false in .gipity.json)')
58
58
  .option('--for <tools>', `Which AI tool primer files to write (comma-separated). Default: the tools detected on this machine. An explicit --for is remembered in .gipity.json, so later commands don't re-add the others. Choices: ${TOOL_KEYS.join(', ')}, all`)
59
+ .option('--json', 'Output a structured result as JSON (confirmations need -y; notes go to stderr)')
59
60
  .addHelpText('after', `
60
61
  Examples:
61
62
  $ gipity init Link cwd as a new project (slug = dir name);
@@ -79,6 +80,22 @@ Working with an existing Gipity project:
79
80
  $ gipity sync Pull the project's files down.
80
81
  `)
81
82
  .action(async (name, opts) => {
83
+ // JSON mode: stdout carries only the final result object. Human progress
84
+ // lines are dropped, warnings go to stderr, and the y/N confirmations
85
+ // can't share stdout, so they need -y up front.
86
+ const json = !!opts.json;
87
+ const say = (line) => { if (!json)
88
+ console.log(line); };
89
+ const note = (line) => { (json ? console.error : console.log)(line); };
90
+ const ask = async (question, def) => {
91
+ if (!json)
92
+ return confirm(question, { default: def });
93
+ if (getAutoConfirm())
94
+ return true;
95
+ console.error(clrError(`Confirmation required in --json mode: ${question}`));
96
+ console.error(`Re-run with --yes:\n ${rerunWithYes()}`);
97
+ process.exit(1);
98
+ };
82
99
  // Resolve the requested tool primer set up front so a bad --for value
83
100
  // fails fast with a clear message instead of going through the catch.
84
101
  let tools;
@@ -113,7 +130,7 @@ Working with an existing Gipity project:
113
130
  // shadowed by a parent project's config the way walk-up commands are.
114
131
  if (existsSync(resolve(cwd, '.gipity.json'))) {
115
132
  const existing = getConfig();
116
- console.log(`Already linked to ${info(`"${existing?.projectSlug ?? ''}"`)} ${muted(`(${existing?.projectGuid ?? ''})`)}`);
133
+ say(`Already linked to ${info(`"${existing?.projectSlug ?? ''}"`)} ${muted(`(${existing?.projectGuid ?? ''})`)}`);
117
134
  // Re-run setup in case primers/hooks/skills are missing - each tool's
118
135
  // integration self-gates on its binary and current-version state.
119
136
  setupProjectTools(tools);
@@ -145,13 +162,25 @@ Working with an existing Gipity project:
145
162
  if (changed)
146
163
  saveConfigAt(cwd, existing);
147
164
  }
148
- console.log(success(`Refreshed primer files: ${primerSummary}.`));
165
+ if (json) {
166
+ if (opts.capture)
167
+ await pairForCapture(note);
168
+ console.log(JSON.stringify({
169
+ linked: true, alreadyLinked: true, created: false,
170
+ project: { guid: existing?.projectGuid ?? null, slug: existing?.projectSlug ?? null },
171
+ dir: cwd, synced: 0,
172
+ primers: tools.map(t => t.key), skippedTools: skipped.map(t => t.key),
173
+ captureHooks: captureEnabled(existing ?? null),
174
+ }));
175
+ return;
176
+ }
177
+ say(success(`Refreshed primer files: ${primerSummary}.`));
149
178
  if (skippedNote)
150
- console.log(skippedNote);
179
+ say(skippedNote);
151
180
  if (opts.capture !== undefined) {
152
181
  if (opts.capture)
153
- await pairForCapture();
154
- console.log(success(`Session recording ${opts.capture ? 'enabled' : 'disabled'} for this project (captureHooks: ${opts.capture} in .gipity.json).`));
182
+ await pairForCapture(note);
183
+ say(success(`Session recording ${opts.capture ? 'enabled' : 'disabled'} for this project (captureHooks: ${opts.capture} in .gipity.json).`));
155
184
  }
156
185
  return;
157
186
  }
@@ -165,10 +194,10 @@ Working with an existing Gipity project:
165
194
  // Heads-up if this would create a project nested inside an existing one.
166
195
  const ancestorConfigPath = getConfigPath();
167
196
  if (ancestorConfigPath) {
168
- console.log(muted(`Note: ${formatCwdLabel(dirname(ancestorConfigPath))} is already a Gipity project.`));
169
- const ok = await confirm(`Create a separate nested project at ${bold(formatCwdLabel(cwd))}?`, { default: 'no' });
197
+ note(muted(`Note: ${formatCwdLabel(dirname(ancestorConfigPath))} is already a Gipity project.`));
198
+ const ok = await ask(`Create a separate nested project at ${bold(formatCwdLabel(cwd))}?`, 'no');
170
199
  if (!ok) {
171
- console.log(muted('Aborted.'));
200
+ say(muted('Aborted.'));
172
201
  process.exit(1);
173
202
  }
174
203
  }
@@ -191,9 +220,9 @@ Working with an existing Gipity project:
191
220
  process.exit(1);
192
221
  }
193
222
  if (scan.tier === 'moderate') {
194
- const ok = await confirm(`About to adopt ${bold(String(scan.files))} files (${bold(formatBytes(scan.bytes))}) at ${bold(formatCwdLabel(process.cwd()))}. Continue?`, { default: 'yes' });
223
+ const ok = await ask(`About to adopt ${bold(String(scan.files))} files (${bold(formatBytes(scan.bytes))}) at ${bold(formatCwdLabel(process.cwd()))}. Continue?`, 'yes');
195
224
  if (!ok) {
196
- console.log(muted('Aborted.'));
225
+ say(muted('Aborted.'));
197
226
  process.exit(1);
198
227
  }
199
228
  }
@@ -203,17 +232,19 @@ Working with an existing Gipity project:
203
232
  projectName,
204
233
  projectSlug,
205
234
  accountSlug,
206
- confirmDeletions: true,
235
+ // No y/N on stdout in JSON mode: a non-interactive sync fails safe
236
+ // (aborts rather than deleting) instead of asking.
237
+ confirmDeletions: !json,
207
238
  tools,
208
239
  });
209
240
  if (adopted.isNew) {
210
- console.log(success(`Created project "${adopted.project.name}" (${adopted.project.slug})`));
241
+ say(success(`Created project "${adopted.project.name}" (${adopted.project.slug})`));
211
242
  }
212
243
  else {
213
- console.log(`Found existing project ${info(`"${adopted.project.name}"`)} ${muted(`(${adopted.project.slug})`)}`);
244
+ say(`Found existing project ${info(`"${adopted.project.name}"`)} ${muted(`(${adopted.project.slug})`)}`);
214
245
  }
215
246
  if (adopted.applied > 0)
216
- console.log(`Synced ${adopted.applied} change${adopted.applied > 1 ? 's' : ''} with Gipity.`);
247
+ say(`Synced ${adopted.applied} change${adopted.applied > 1 ? 's' : ''} with Gipity.`);
217
248
  // Session recording choice. Written after adopt so it lands in the
218
249
  // freshly created .gipity.json regardless of how the link happened.
219
250
  const pinnedFresh = pinnedToolKeys(opts.for, tools);
@@ -229,21 +260,32 @@ Working with an existing Gipity project:
229
260
  catch { /* config missing/unreadable - nothing to record */ }
230
261
  }
231
262
  if (opts.capture)
232
- await pairForCapture();
233
- console.log(success(`Wrote primer files: ${primerSummary}.`));
263
+ await pairForCapture(note);
264
+ if (json) {
265
+ const cfg = JSON.parse(readFileSync(resolve(cwd, '.gipity.json'), 'utf-8'));
266
+ console.log(JSON.stringify({
267
+ linked: true, alreadyLinked: false, created: adopted.isNew,
268
+ project: { guid: adopted.project.short_guid, slug: adopted.project.slug, name: adopted.project.name },
269
+ dir: cwd, synced: adopted.applied,
270
+ primers: tools.map(t => t.key), skippedTools: skipped.map(t => t.key),
271
+ captureHooks: captureEnabled(cfg),
272
+ }));
273
+ return;
274
+ }
275
+ say(success(`Wrote primer files: ${primerSummary}.`));
234
276
  if (skippedNote)
235
- console.log(skippedNote);
277
+ say(skippedNote);
236
278
  if (wantsClaude) {
237
- console.log(success(`Ready! Run your coding agent here (${AGENT_ADAPTERS.map(a => a.key).join(', ')}), or \`gipity build\` to launch one with a picker.`));
279
+ say(success(`Ready! Run your coding agent here (${AGENT_ADAPTERS.map(a => a.key).join(', ')}), or \`gipity build\` to launch one with a picker.`));
238
280
  // Say which way session recording is set - consent should be
239
281
  // explicit, not discovered later.
240
282
  const recording = JSON.parse(readFileSync(resolve(cwd, '.gipity.json'), 'utf-8')).captureHooks !== false;
241
- console.log(muted(recording
283
+ say(muted(recording
242
284
  ? 'Claude Code sessions here are recorded to your Gipity project (Chats in your Gipity dashboard). Turn off: gipity init --no-capture.'
243
285
  : 'Claude Code sessions here are not recorded. To keep them in your Gipity project (Chats in your dashboard): gipity init --capture.'));
244
286
  }
245
287
  else {
246
- console.log(success('Ready! Open this directory in your AI coding tool.'));
288
+ say(success('Ready! Open this directory in your AI coding tool.'));
247
289
  }
248
290
  }
249
291
  catch (err) {
@@ -312,6 +312,7 @@ jobCommand
312
312
  .description('Run the job in a local Docker container against your local filesystem (no platform round-trip)')
313
313
  .option('--image <image>', 'Docker image to run inside', 'easyclaw/sandbox:latest')
314
314
  .option('--no-deps', 'Skip pip/npm install even if a deps file is present')
315
+ .option('--json', "Capture the job's output and print one JSON result (exitCode, stdout, stderr) instead of streaming it")
315
316
  .action(async (name, opts) => {
316
317
  const { existsSync, statSync } = await import('node:fs');
317
318
  const { resolve, join } = await import('node:path');
@@ -362,7 +363,13 @@ jobCommand
362
363
  shellCmd = `echo '[run-local] running ${handlerCmd} (${picked.runtime})' >&2 && exec ${handlerCmd}`;
363
364
  }
364
365
  const runArgs = ['run', ...sharedArgs, '--entrypoint', 'sh', opts.image, '-c', shellCmd];
365
- const child = spawnCommand('docker', runArgs, { stdio: 'inherit' });
366
+ const startedAt = Date.now();
367
+ const child = spawnCommand('docker', runArgs, { stdio: opts.json ? ['ignore', 'pipe', 'pipe'] : 'inherit' });
368
+ const captured = { stdout: '', stderr: '' };
369
+ if (opts.json) {
370
+ child.stdout?.on('data', (d) => { captured.stdout += d.toString(); });
371
+ child.stderr?.on('data', (d) => { captured.stderr += d.toString(); });
372
+ }
366
373
  // A missing `docker` binary is reported asynchronously via 'error' (not a
367
374
  // throw), so a try/catch can't stop it - without this handler Node crashes
368
375
  // with a raw stack trace instead of a clear message.
@@ -372,7 +379,16 @@ jobCommand
372
379
  : `Failed to launch docker: ${err.message}`));
373
380
  process.exit(1);
374
381
  });
375
- child.on('exit', (code) => {
382
+ // 'close' (not 'exit') so the captured pipes are fully drained in JSON mode.
383
+ child.on('close', (code) => {
384
+ if (opts.json) {
385
+ console.log(JSON.stringify({
386
+ name, runtime: picked.runtime, image: opts.image,
387
+ exitCode: code, durationMs: Date.now() - startedAt,
388
+ stdout: captured.stdout, stderr: captured.stderr,
389
+ }));
390
+ process.exit(code ?? 1);
391
+ }
376
392
  if (code === 0)
377
393
  console.error(muted(`[run-local] ${success('done')}`));
378
394
  else
@@ -206,6 +206,6 @@ export const loadCommand = new Command('load')
206
206
  console.warn(warning('The project was still created and linked; the files above are missing from it.'));
207
207
  }
208
208
  console.log('');
209
- console.log(`${muted('Next:')} cd ${dir} && ${brand('gipity deploy')}`);
209
+ console.log(`${muted('Next:')} cd ${dir} && ${brand('gipity deploy dev')}`);
210
210
  }));
211
211
  //# sourceMappingURL=load.js.map
@@ -9,27 +9,39 @@ export const loginCommand = new Command('login')
9
9
  .description('Log in or sign up')
10
10
  .option('--email <email>', 'Email address')
11
11
  .option('--code <code>', 'Verification code')
12
+ .option('--json', 'Output as JSON (prompts and warnings go to stderr)')
12
13
  .action(async (opts) => {
14
+ const json = !!opts.json;
15
+ // In JSON mode stdout carries only the final result object; every human
16
+ // line (instructions, prompts, new-account warnings) goes to stderr.
17
+ const say = json ? (line) => console.error(line) : (line) => console.log(line);
18
+ const promptOut = json ? process.stderr : process.stdout;
13
19
  try {
14
20
  let email = opts.email;
15
21
  let code = opts.code;
16
22
  // Both provided → verify immediately (non-interactive, ideal for scripts/CC)
17
23
  if (email && code) {
18
- await verify(email, code);
24
+ await verify(email, code, json, say);
19
25
  return;
20
26
  }
21
27
  // Email only → send code and exit (non-interactive step 1)
22
28
  if (email && !code) {
23
29
  const sendRes = await publicPost('/auth/login', { email });
24
- console.log('Check your email for a 6-digit code.');
25
- console.log(muted(`Then run: gipity login --email ${email} --code <code>`));
26
- warnBeforeCodeIfUnexpectedNewAccount(sendRes.isNewUser, email);
30
+ const next = `gipity login --email ${email} --code <code>`;
31
+ if (json) {
32
+ console.log(JSON.stringify({ codeSent: true, email, newAccount: sendRes.isNewUser === true, next }));
33
+ }
34
+ else {
35
+ console.log('Check your email for a 6-digit code.');
36
+ console.log(muted(`Then run: ${next}`));
37
+ }
38
+ warnBeforeCodeIfUnexpectedNewAccount(sendRes.isNewUser, email, '', say);
27
39
  return;
28
40
  }
29
41
  // Fully interactive flow
30
- console.log('Enter your email to log in or create an account.');
42
+ say('Enter your email to log in or create an account.');
31
43
  const existing = getAuth();
32
- email = await prompt(existing ? `Email [${existing.email}]: ` : 'Email: ');
44
+ email = await prompt(existing ? `Email [${existing.email}]: ` : 'Email: ', promptOut);
33
45
  if (!email && existing)
34
46
  email = existing.email;
35
47
  if (!email) {
@@ -37,18 +49,18 @@ export const loginCommand = new Command('login')
37
49
  process.exit(1);
38
50
  }
39
51
  const sendRes = await publicPost('/auth/login', { email });
40
- console.log('');
41
- console.log('Check your email for a 6-digit code.');
42
- warnBeforeCodeIfUnexpectedNewAccount(sendRes.isNewUser, email);
43
- code = await prompt('Code: ');
44
- await verify(email, code);
52
+ say('');
53
+ say('Check your email for a 6-digit code.');
54
+ warnBeforeCodeIfUnexpectedNewAccount(sendRes.isNewUser, email, '', say);
55
+ code = await prompt('Code: ', promptOut);
56
+ await verify(email, code, json, say);
45
57
  }
46
58
  catch (err) {
47
59
  console.error(clrError(`Login failed: ${err.message}`));
48
60
  process.exit(1);
49
61
  }
50
62
  });
51
- async function verify(email, code) {
63
+ async function verify(email, code, json, say) {
52
64
  const priorAuth = getAuth();
53
65
  const res = await publicPost('/auth/verify', { email, code });
54
66
  const exp = decodeJwtExp(res.accessToken);
@@ -63,11 +75,16 @@ async function verify(email, code) {
63
75
  email,
64
76
  expiresAt,
65
77
  });
66
- console.log(success(`Logged in (${email}).`));
67
- warnIfUnexpectedNewAccount(res.isNewUser, email, priorAuth);
78
+ if (!json)
79
+ console.log(success(`Logged in (${email}).`));
80
+ warnIfUnexpectedNewAccount(res.isNewUser, email, priorAuth, '', say);
68
81
  // A fresh session is the clearest "we're reconnected" signal - clear any bug
69
82
  // reports that got stranded while this account's session was expired/offline.
70
83
  const delivered = await flushBugQueue().catch(() => 0);
84
+ if (json) {
85
+ console.log(JSON.stringify({ loggedIn: true, email, newAccount: res.isNewUser === true, expiresAt, queuedBugReportsDelivered: delivered }));
86
+ return;
87
+ }
71
88
  if (delivered > 0) {
72
89
  console.log(muted(`Delivered ${delivered} queued bug report${delivered === 1 ? '' : 's'}.`));
73
90
  }
@@ -3,14 +3,15 @@ import { getAuth, clearAuth } from '../auth.js';
3
3
  import { success } from '../colors.js';
4
4
  export const logoutCommand = new Command('logout')
5
5
  .description('Log out')
6
- .action(() => {
6
+ .option('--json', 'Output as JSON')
7
+ .action((opts) => {
7
8
  const auth = getAuth();
8
- if (!auth) {
9
- console.log('Not logged in.');
10
- }
11
- else {
9
+ if (auth)
12
10
  clearAuth();
13
- console.log(success(`Logged out (${auth.email}).`));
11
+ if (opts.json) {
12
+ console.log(JSON.stringify({ loggedOut: !!auth, email: auth?.email ?? null }));
13
+ return;
14
14
  }
15
+ console.log(auth ? success(`Logged out (${auth.email}).`) : 'Not logged in.');
15
16
  });
16
17
  //# sourceMappingURL=logout.js.map
@@ -7,6 +7,7 @@ export const pushCommand = new Command('push')
7
7
  .argument('<files...>', 'File path(s) to push')
8
8
  .option('--quiet', 'Suppress output')
9
9
  .option('--background', 'Fork and exit immediately')
10
+ .option('--json', 'Output as JSON')
10
11
  .action(async (files, opts) => {
11
12
  try {
12
13
  const fullPaths = files.map(f => resolve(f));
@@ -22,15 +23,22 @@ export const pushCommand = new Command('push')
22
23
  stdio: 'ignore',
23
24
  });
24
25
  child.unref();
26
+ if (opts.json)
27
+ console.log(JSON.stringify({ background: true, files }));
25
28
  return;
26
29
  }
27
30
  // Sequential on purpose: pushFile takes the per-project sync lock, so
28
31
  // parallel pushes would just contend on it. One process pushing N files
29
32
  // still beats the old N processes × N lock acquisitions.
30
- for (const fullPath of fullPaths) {
31
- await pushFile(fullPath);
33
+ const pushed = [];
34
+ const skipped = [];
35
+ for (let i = 0; i < fullPaths.length; i++) {
36
+ (await pushFile(fullPaths[i]) ? pushed : skipped).push(files[i]);
32
37
  }
33
- if (!opts.quiet) {
38
+ if (opts.json) {
39
+ console.log(JSON.stringify({ pushed, skipped }));
40
+ }
41
+ else if (!opts.quiet) {
34
42
  console.log(success(files.length === 1 ? `Pushed ${files[0]}` : `Pushed ${files.length} files`));
35
43
  }
36
44
  }
@@ -53,6 +53,7 @@ rbacCommand
53
53
  .description('Delete a policy')
54
54
  .requiredOption('--role <role>', 'Role')
55
55
  .requiredOption('--op <operation>', 'Operation')
56
+ .option('--json', 'Output as JSON')
56
57
  .action((table, opts) => run('Delete', async () => {
57
58
  if (!await confirm(`Delete RBAC policy for "${table}"?`)) {
58
59
  console.log('Cancelled.');
@@ -64,6 +65,6 @@ rbacCommand
64
65
  role: opts.role,
65
66
  operation: opts.op,
66
67
  });
67
- printResult('Policy deleted.', { json: false });
68
+ printResult('Policy deleted.', opts, { success: true, table, role: opts.role, operation: opts.op });
68
69
  }));
69
70
  //# sourceMappingURL=rbac.js.map
@@ -29,6 +29,7 @@ const roomCommand = new Command('room')
29
29
  .option('--host-hold <seconds>', 'create: how long the host role waits for a dropped or reloading host (0-600, default 60)')
30
30
  .option('--host-handoff', 'create: move the host role to another player when the host is gone')
31
31
  .option('--host-grace <seconds>', 'create: with handoff, how long the host may be unreachable before the role moves (1-60, default 5)')
32
+ .option('--server-channels <names>', 'create: comma-separated channels only the app\'s functions may publish on (realtime.publish)')
32
33
  .option('--json', 'Output as JSON')
33
34
  .action((action, name, opts) => run('Realtime room', async () => {
34
35
  const config = requireConfig();
@@ -56,6 +57,9 @@ const roomCommand = new Command('room')
56
57
  body.host_handoff = true;
57
58
  if (opts.hostGrace !== undefined)
58
59
  body.host_grace_seconds = Number(opts.hostGrace);
60
+ if (opts.serverChannels !== undefined) {
61
+ body.server_channels = String(opts.serverChannels).split(',').map((c) => c.trim()).filter(Boolean);
62
+ }
59
63
  const res = await post(base, body);
60
64
  if (opts.json) {
61
65
  console.log(JSON.stringify(res.data));
@@ -108,6 +112,8 @@ const roomCommand = new Command('room')
108
112
  console.log(`Max clients: ${room.max_clients}`);
109
113
  console.log(`Seat hold: ${room.config?.seat_hold_seconds ?? 30}s (host ${room.config?.host_hold_seconds ?? 60}s)`);
110
114
  console.log(`Handoff: ${room.config?.host_handoff ? `on, after ${room.config?.host_grace_seconds ?? 5}s` : 'off'}`);
115
+ const serverChannels = Array.isArray(room.config?.server_channels) ? room.config.server_channels : [];
116
+ console.log(`Server-only: ${serverChannels.length ? serverChannels.join(', ') : 'none'}`);
111
117
  console.log(`Live: ${live ? `${live.instances} instance(s), ${live.clients} client(s)` : muted('Gipity Realtime unreachable')}`);
112
118
  }
113
119
  break;