gipity 1.1.22 → 1.1.23
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/dist/adopt-cwd.js +2 -2
- package/dist/commands/brand.js +1 -1
- package/dist/commands/deploy.js +57 -16
- package/dist/commands/env.js +168 -0
- package/dist/commands/fn.js +1 -1
- package/dist/commands/load.js +1 -1
- package/dist/commands/service.js +2 -2
- package/dist/commands/status.js +3 -0
- package/dist/commands/test.js +6 -6
- package/dist/config.js +34 -3
- package/dist/index.js +305 -43
- package/dist/knowledge.js +10 -8
- package/dist/prompts.js +2 -2
- package/dist/setup.js +52 -7
- package/dist/sync.js +2 -2
- package/dist/template-vars.js +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -6965,7 +6965,7 @@ Templates:
|
|
|
6965
6965
|
- \`karaoke-captions\` - Forced-alignment app - karaoke captions, subtitle timing, language learning, dubbing alignment
|
|
6966
6966
|
- \`paid-app\` - App that charges users money - SaaS subscription, paid membership, digital product store, "Pro" upgrade, paywalled content (Stripe one-time + subscriptions)
|
|
6967
6967
|
- \`notify-demo\` - App that sends push notifications / alerts / reminders to users' phones or desktops - web push, PWA notifications, "notify me when..." features
|
|
6968
|
-
When unsure, default to \`web-simple\`. After adding the template, edit the generated files, then \`gipity deploy
|
|
6968
|
+
When unsure, default to \`web-simple\`. After adding the template, edit the generated files, then \`gipity deploy\`.
|
|
6969
6969
|
Only skip this on a build request if the user explicitly says not to.
|
|
6970
6970
|
|
|
6971
6971
|
Hidden types (do NOT suggest unsolicited - use only when the user explicitly asks for that domain):
|
|
@@ -7027,15 +7027,17 @@ The other exception is app-level libraries the user imports into their own \`src
|
|
|
7027
7027
|
|
|
7028
7028
|
## Build loop
|
|
7029
7029
|
|
|
7030
|
-
Prefer a live Gipity URL over an ephemeral artifact. When you'd otherwise reach for a Claude Code Artifact (or any host's built-in page preview) to show the user something, build it as a Gipity app and \`gipity deploy
|
|
7030
|
+
Prefer a live Gipity URL over an ephemeral artifact. When you'd otherwise reach for a Claude Code Artifact (or any host's built-in page preview) to show the user something, build it as a Gipity app and \`gipity deploy\` it instead - the result is a real, shareable URL on their own project, not a throwaway.
|
|
7031
7031
|
|
|
7032
7032
|
The full "when to add a template" rule and the definition of done are spelled out in the two sections at the end of this document. In short: if the user wants something deployable (web app, game, API), \`gipity add <template>\` first (default \`web-simple\`); for a one-off task (analysis, PDFs, data work), use \`gipity sandbox run\` instead; to add a reusable building block to an existing app (e.g. multiplayer), \`gipity add <kit>\`.
|
|
7033
7033
|
|
|
7034
|
-
Build loop: \`gipity add\` \u2192 edit files \u2192 \`gipity deploy
|
|
7034
|
+
Build loop: \`gipity add\` \u2192 edit files \u2192 \`gipity deploy --inspect\` \u2192 fix any errors \u2192 repeat until the definition of done is met. \`deploy --inspect\` deploys and then runs the page-inspect report on the live URL in one command; use a standalone \`gipity page inspect <url>\` only when re-checking without deploying.
|
|
7035
|
+
|
|
7036
|
+
Where a deploy goes: a new app is just **prod**, and a bare \`gipity deploy\` deploys it (\`app.gipity.ai/<account>/<slug>/\`). An app can also have **environments** - isolated copies with their own database, functions and URL (\`gipity deploy dev\` creates \`dev\` at \`dev.gipity.ai/<account>/<slug>/\` on first use). Once an app has any, a bare \`gipity deploy\` is refused until you name one: iterate on \`dev\`, and deploy \`prod\` when the user wants it live. Every other command takes \`--env <name>\` to act on an environment (\`gipity db query "..." --env dev\`). If you're changing an app that real users already rely on and it has no environments yet, prefer \`gipity deploy dev\` over prod. Load the \`deploy\` skill for the details.
|
|
7035
7037
|
|
|
7036
7038
|
\`add\` writes real files to disk - Read a scaffolded file with the Read tool before your first Write/Edit to it, or the call fails \`"File has not been read yet"\` (viewing it with \`cat\`/\`head\` in Bash does not count - the harness only tracks the Read tool). Don't rewrite from memory of the template.
|
|
7037
7039
|
|
|
7038
|
-
Make your file changes and verify they landed, then run \`gipity deploy
|
|
7040
|
+
Make your file changes and verify they landed, then run \`gipity deploy\` once. \`0 uploaded, N unchanged\` means nothing changed on disk - fix the files, don't re-run deploy or probe the environment.
|
|
7039
7041
|
|
|
7040
7042
|
Before telling the user the app is online, verify the source tree is consistent: no files named like \`* (conflict from *)*\`, and every package directory has its expected canonical entry file. If a conflict artifact exists, resolve it (keep one copy), re-deploy, and re-inspect before reporting done.
|
|
7041
7043
|
|
|
@@ -7047,11 +7049,11 @@ If you're pointed at a project that already exists on Gipity but has no local co
|
|
|
7047
7049
|
mkdir -p ~/GipityProjects/<slug> && cd ~/GipityProjects/<slug> && gipity init <slug>
|
|
7048
7050
|
\`\`\`
|
|
7049
7051
|
|
|
7050
|
-
\`init\` matches the existing remote project by slug, links this directory to it, and syncs its files down (you'll see \`Found existing project ...\` and \`Synced N changes\`). There's no separate \`clone\`/\`pull\` - \`init\` against a matching slug *is* the pull. After it finishes, the files are in cwd; edit and \`gipity deploy
|
|
7052
|
+
\`init\` matches the existing remote project by slug, links this directory to it, and syncs its files down (you'll see \`Found existing project ...\` and \`Synced N changes\`). There's no separate \`clone\`/\`pull\` - \`init\` against a matching slug *is* the pull. After it finishes, the files are in cwd; edit and \`gipity deploy\` as usual. (Already linked to a different project in this dir? Switch and pull instead: \`gipity project <slug>\` then \`gipity sync\`. List your projects with \`gipity project --json\`.)
|
|
7051
7053
|
|
|
7052
7054
|
## CLI quick reference
|
|
7053
7055
|
|
|
7054
|
-
Key commands: \`gipity add <template|kit>\`, \`gipity brand set --emoji <e>|--color <hex>\` (regenerate the app's icons + social share card), \`gipity deploy
|
|
7056
|
+
Key commands: \`gipity add <template|kit>\`, \`gipity brand set --emoji <e>|--color <hex>\` (regenerate the app's icons + social share card), \`gipity deploy [prod|<env>]\`, \`gipity env\` (list/create/delete environments), \`gipity sandbox run\`, \`gipity page inspect <url>\`, \`gipity page screenshot <url>\`, \`gipity db query "SQL"\`, \`gipity fn call <name>\`, \`gipity logs fn <name>\`, \`gipity secrets set <NAME> <value> [--account]\` (store an API key/token encrypted; read in functions via \`secrets.get('NAME')\` - never hardcode keys), \`gipity skill read <name>\`.
|
|
7055
7057
|
Rename for findability: \`gipity project rename <name>\` renames the current project's display name (the slug and deployed URLs never change); it's the label users scan in Monitor and \`gipity project\`, so keep it SHORT: 2-4 words, at most 40 characters, no trailing punctuation (e.g. "Stripe checkout", "Tetris game").
|
|
7056
7058
|
Pull an existing remote project local (given its URL/slug): \`mkdir -p ~/GipityProjects/<slug> && cd ~/GipityProjects/<slug> && gipity init <slug>\` (adopts the matching project and syncs files down - this is the "clone").
|
|
7057
7059
|
Move whole apps in/out: \`gipity save\` (export this project as a portable \`.gip\` bundle), \`gipity load <file.gip | github:owner/repo>\` (import as a NEW project; \`--inspect\` to preview), \`gipity github connect\` (1-2 click GitHub access for imports). Porting a Vercel/Replit/Lovable app? Load the \`app-import\` skill first.
|
|
@@ -7149,8 +7151,8 @@ Other key skills:
|
|
|
7149
7151
|
- \`email\` - sending email from a deployed app with the email() service or a workflow notify step (no setup/keys), gipity email test/log, HTML formatting, images
|
|
7150
7152
|
- \`sandbox-tools\` - cloud sandbox capabilities and pre-installed tools`;
|
|
7151
7153
|
DEFINITION_OF_DONE = `## Definition of done (build tasks)
|
|
7152
|
-
1. \`gipity deploy
|
|
7153
|
-
2. \`gipity page inspect <url>\` returns no console errors and the page loads (HTTP 200, no blank screen). (\`gipity deploy
|
|
7154
|
+
1. \`gipity deploy\` succeeds and you have a live URL.
|
|
7155
|
+
2. \`gipity page inspect <url>\` returns no console errors and the page loads (HTTP 200, no blank screen). (\`gipity deploy --inspect\` covers 1 and 2 in one command.)
|
|
7154
7156
|
3. For apps with functions: \`gipity test\` passes.
|
|
7155
7157
|
4. Non-rendered files the task called for (\`llms.txt\`, \`AGENTS.md\`, \`SKILL.md\`, \`robots.txt\`, served JSON, etc.): \`page inspect\` only sees rendered HTML, so verify them with \`gipity page fetch <url> <files...>\`. It flags any that 404 or come back as the static-host shell (a missing file is served as \`index.html\` with a 200, so a bare status check would pass) and checks each \`content-type\`.
|
|
7156
7158
|
5. You told the user the live URL.
|
|
@@ -7299,10 +7301,18 @@ var init_opencode_setup = __esm({
|
|
|
7299
7301
|
import { resolve, join as join6, dirname as dirname3 } from "path";
|
|
7300
7302
|
import { homedir as homedir4, tmpdir } from "os";
|
|
7301
7303
|
import { existsSync as existsSync5, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3, readFileSync as readFileSync4, mkdtempSync, rmSync, cpSync, readdirSync as readdirSync2 } from "fs";
|
|
7302
|
-
function
|
|
7304
|
+
function primerIgnorePatterns() {
|
|
7305
|
+
return [...new Set(Object.values(PRIMER_FILES))].map((p) => `/${p}`);
|
|
7306
|
+
}
|
|
7307
|
+
function anchorPrimerPatterns(patterns) {
|
|
7308
|
+
const primers = new Set(Object.values(PRIMER_FILES));
|
|
7309
|
+
return patterns.map((p) => primers.has(p) ? `/${p}` : p);
|
|
7310
|
+
}
|
|
7311
|
+
function isSyncIgnored(name, opts = {}) {
|
|
7303
7312
|
if (name.startsWith(".")) return true;
|
|
7304
7313
|
if (DEFAULT_SYNC_IGNORE.includes(name)) return true;
|
|
7305
7314
|
if (DEFAULT_SYNC_IGNORE.includes(`${name}/`)) return true;
|
|
7315
|
+
if (!opts.nested && DEFAULT_SYNC_IGNORE.includes(`/${name}`)) return true;
|
|
7306
7316
|
return false;
|
|
7307
7317
|
}
|
|
7308
7318
|
function isGipityManagedHookCommand(command) {
|
|
@@ -7729,6 +7739,21 @@ function writeSkillsFile(relPath, wrap) {
|
|
|
7729
7739
|
const next = wrap && existing === null ? wrap(baseNext) : baseNext;
|
|
7730
7740
|
if (next !== existing) writeFileSync3(path5, next);
|
|
7731
7741
|
}
|
|
7742
|
+
function refreshExistingPrimers(projectRoot) {
|
|
7743
|
+
const written = [];
|
|
7744
|
+
for (const rel2 of new Set(Object.values(PRIMER_FILES))) {
|
|
7745
|
+
const path5 = resolve(projectRoot, rel2);
|
|
7746
|
+
if (!existsSync5(path5)) continue;
|
|
7747
|
+
const existing = readFileSync4(path5, "utf-8");
|
|
7748
|
+
if (!existing.includes(GIPITY_BLOCK_BEGIN) && !existing.includes("# Gipity Integration")) continue;
|
|
7749
|
+
const next = applySkillsBlock(existing, resolveApiBase());
|
|
7750
|
+
if (next !== existing) {
|
|
7751
|
+
writeFileSync3(path5, next);
|
|
7752
|
+
written.push(rel2);
|
|
7753
|
+
}
|
|
7754
|
+
}
|
|
7755
|
+
return written;
|
|
7756
|
+
}
|
|
7732
7757
|
function setupClaudeMd() {
|
|
7733
7758
|
writeSkillsFile(PRIMER_FILES.claude);
|
|
7734
7759
|
}
|
|
@@ -7886,7 +7911,7 @@ var init_setup = __esm({
|
|
|
7886
7911
|
".bash_history",
|
|
7887
7912
|
".bash_logout",
|
|
7888
7913
|
...SCRATCH_IGNORE,
|
|
7889
|
-
...
|
|
7914
|
+
...primerIgnorePatterns()
|
|
7890
7915
|
];
|
|
7891
7916
|
PERMISSIONS_SETTINGS = {
|
|
7892
7917
|
permissions: {
|
|
@@ -7896,7 +7921,8 @@ var init_setup = __esm({
|
|
|
7896
7921
|
"Bash(gipity push *)",
|
|
7897
7922
|
"Bash(gipity test *)",
|
|
7898
7923
|
"Bash(gipity add *)",
|
|
7899
|
-
"Bash(gipity deploy
|
|
7924
|
+
"Bash(gipity deploy *)",
|
|
7925
|
+
"Bash(gipity env list *)",
|
|
7900
7926
|
"Bash(gipity domain *)",
|
|
7901
7927
|
"Bash(gipity db query *)",
|
|
7902
7928
|
"Bash(gipity db list *)",
|
|
@@ -9408,11 +9434,14 @@ var init_api = __esm({
|
|
|
9408
9434
|
var config_exports = {};
|
|
9409
9435
|
__export(config_exports, {
|
|
9410
9436
|
DEFAULT_API_BASE: () => DEFAULT_API_BASE,
|
|
9437
|
+
PROD_ENV: () => PROD_ENV,
|
|
9438
|
+
applyEnvOverride: () => applyEnvOverride,
|
|
9411
9439
|
captureEnabled: () => captureEnabled,
|
|
9412
9440
|
clearConfigCache: () => clearConfigCache,
|
|
9413
9441
|
getApiBaseOverride: () => getApiBaseOverride,
|
|
9414
9442
|
getConfig: () => getConfig,
|
|
9415
9443
|
getConfigPath: () => getConfigPath,
|
|
9444
|
+
getEnvOption: () => getEnvOption,
|
|
9416
9445
|
getProjectRoot: () => getProjectRoot,
|
|
9417
9446
|
isAllowedApiHost: () => isAllowedApiHost,
|
|
9418
9447
|
liveUrl: () => liveUrl,
|
|
@@ -9422,10 +9451,22 @@ __export(config_exports, {
|
|
|
9422
9451
|
saveConfig: () => saveConfig2,
|
|
9423
9452
|
saveConfigAt: () => saveConfigAt,
|
|
9424
9453
|
setApiBaseOverride: () => setApiBaseOverride,
|
|
9454
|
+
setEnvOption: () => setEnvOption,
|
|
9425
9455
|
shouldIgnore: () => shouldIgnore
|
|
9426
9456
|
});
|
|
9427
9457
|
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, existsSync as existsSync6 } from "fs";
|
|
9428
9458
|
import { dirname as dirname5, resolve as resolve3 } from "path";
|
|
9459
|
+
function setEnvOption(name) {
|
|
9460
|
+
envOption = name;
|
|
9461
|
+
}
|
|
9462
|
+
function getEnvOption() {
|
|
9463
|
+
return envOption;
|
|
9464
|
+
}
|
|
9465
|
+
function applyEnvOverride(env) {
|
|
9466
|
+
const base = getConfig();
|
|
9467
|
+
if (!base) throw new Error("--env needs a Gipity project directory");
|
|
9468
|
+
cached3 = { ...base, projectGuid: env.projectGuid, projectSlug: env.projectSlug, env: { name: env.name, appSlug: base.projectSlug } };
|
|
9469
|
+
}
|
|
9429
9470
|
function setApiBaseOverride(url) {
|
|
9430
9471
|
apiBaseOverride = url;
|
|
9431
9472
|
}
|
|
@@ -9552,15 +9593,20 @@ async function resolveProjectContext(opts) {
|
|
|
9552
9593
|
oneOff: true
|
|
9553
9594
|
};
|
|
9554
9595
|
}
|
|
9555
|
-
function liveUrl(config,
|
|
9556
|
-
const
|
|
9557
|
-
return `https
|
|
9596
|
+
function liveUrl(config, env = config.env?.name ?? PROD_ENV) {
|
|
9597
|
+
const appSlug = config.env?.appSlug ?? config.projectSlug;
|
|
9598
|
+
if (env === PROD_ENV) return `https://app.gipity.ai/${config.accountSlug}/${appSlug}/`;
|
|
9599
|
+
const segment = env === "dev" ? appSlug : `${appSlug}--${env}`;
|
|
9600
|
+
return `https://dev.gipity.ai/${config.accountSlug}/${segment}/`;
|
|
9558
9601
|
}
|
|
9559
9602
|
function clearConfigCache() {
|
|
9560
9603
|
cached3 = null;
|
|
9561
9604
|
cachedPath = null;
|
|
9562
9605
|
}
|
|
9563
9606
|
function saveConfig2(data) {
|
|
9607
|
+
if (cached3?.env || data.env) {
|
|
9608
|
+
throw new Error("Can't change the linked project while --env is set: run it without --env.");
|
|
9609
|
+
}
|
|
9564
9610
|
const path5 = getConfigPath();
|
|
9565
9611
|
if (!path5) {
|
|
9566
9612
|
throw new Error(
|
|
@@ -9595,12 +9641,13 @@ function shouldIgnore(filePath, ignorePatterns) {
|
|
|
9595
9641
|
if (!rel2 || rel2 === ".") return false;
|
|
9596
9642
|
return matcher.ignores(rel2);
|
|
9597
9643
|
}
|
|
9598
|
-
var import_ignore, CONFIG_FILE, DEFAULT_API_BASE, cached3, cachedPath, apiBaseOverride, warnedHosts, ignoreMatcherCache;
|
|
9644
|
+
var import_ignore, CONFIG_FILE, PROD_ENV, DEFAULT_API_BASE, cached3, cachedPath, envOption, apiBaseOverride, warnedHosts, ignoreMatcherCache;
|
|
9599
9645
|
var init_config = __esm({
|
|
9600
9646
|
"src/config.ts"() {
|
|
9601
9647
|
"use strict";
|
|
9602
9648
|
import_ignore = __toESM(require_ignore(), 1);
|
|
9603
9649
|
CONFIG_FILE = ".gipity.json";
|
|
9650
|
+
PROD_ENV = "prod";
|
|
9604
9651
|
DEFAULT_API_BASE = "https://a.gipity.ai";
|
|
9605
9652
|
cached3 = null;
|
|
9606
9653
|
cachedPath = null;
|
|
@@ -34313,6 +34360,7 @@ var {
|
|
|
34313
34360
|
|
|
34314
34361
|
// src/index.ts
|
|
34315
34362
|
init_config();
|
|
34363
|
+
init_setup();
|
|
34316
34364
|
init_utils();
|
|
34317
34365
|
import { readFileSync as readFileSync30 } from "fs";
|
|
34318
34366
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
@@ -35373,7 +35421,7 @@ function readGipityIgnore(root) {
|
|
|
35373
35421
|
return readFileSync8(path5, "utf8").split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map((line) => line.replace(/^\.\//, "").replace(/^\//, ""));
|
|
35374
35422
|
}
|
|
35375
35423
|
function effectiveIgnore(root, configIgnore) {
|
|
35376
|
-
const base = configIgnore && configIgnore.length ? configIgnore : DEFAULT_SYNC_IGNORE;
|
|
35424
|
+
const base = anchorPrimerPatterns(configIgnore && configIgnore.length ? configIgnore : DEFAULT_SYNC_IGNORE);
|
|
35377
35425
|
const merged = [...base, GIPITY_IGNORE_FILE, ...readGipityIgnore(root)];
|
|
35378
35426
|
return [...merged, ...SCRATCH_IGNORE.filter((p) => !merged.includes(p))];
|
|
35379
35427
|
}
|
|
@@ -36531,7 +36579,7 @@ function* walkTextFiles(root) {
|
|
|
36531
36579
|
continue;
|
|
36532
36580
|
}
|
|
36533
36581
|
for (const entry of entries) {
|
|
36534
|
-
if (isSyncIgnored(entry.name)) continue;
|
|
36582
|
+
if (isSyncIgnored(entry.name, { nested: dir !== root })) continue;
|
|
36535
36583
|
const full = join11(dir, entry.name);
|
|
36536
36584
|
if (entry.isDirectory()) {
|
|
36537
36585
|
stack.push(full);
|
|
@@ -36659,7 +36707,7 @@ function scanForAdoption(cwd) {
|
|
|
36659
36707
|
}
|
|
36660
36708
|
for (const name of entries) {
|
|
36661
36709
|
if (truncated) return;
|
|
36662
|
-
if (isSyncIgnored(name)) continue;
|
|
36710
|
+
if (isSyncIgnored(name, { nested: dir !== cwd })) continue;
|
|
36663
36711
|
const full = join13(dir, name);
|
|
36664
36712
|
let st2;
|
|
36665
36713
|
try {
|
|
@@ -36693,7 +36741,7 @@ function isLikelyEmpty(cwd) {
|
|
|
36693
36741
|
} catch {
|
|
36694
36742
|
return true;
|
|
36695
36743
|
}
|
|
36696
|
-
return entries.every(isSyncIgnored);
|
|
36744
|
+
return entries.every((name) => isSyncIgnored(name));
|
|
36697
36745
|
}
|
|
36698
36746
|
function canAdoptCwd(cwd) {
|
|
36699
36747
|
const norm = resolve6(cwd);
|
|
@@ -37529,7 +37577,8 @@ var statusCommand = new Command("status").alias("whoami").description("Show proj
|
|
|
37529
37577
|
account: config.accountSlug,
|
|
37530
37578
|
apiBase: config.apiBase,
|
|
37531
37579
|
apiBaseInUse,
|
|
37532
|
-
url: liveUrl(config)
|
|
37580
|
+
url: liveUrl(config),
|
|
37581
|
+
...config.env ? { env: config.env.name } : {}
|
|
37533
37582
|
} : null,
|
|
37534
37583
|
// `valid` reflects the refresh token (the real session) - access
|
|
37535
37584
|
// tokens auto-renew, so their expiry must not read as "invalid".
|
|
@@ -37553,6 +37602,7 @@ var statusCommand = new Command("status").alias("whoami").description("Show proj
|
|
|
37553
37602
|
} else {
|
|
37554
37603
|
console.log(`${muted("Project:")} ${brand(config.projectSlug)} ${muted(`(${config.projectGuid})`)}`);
|
|
37555
37604
|
console.log(`${muted("Account:")} ${config.accountSlug}`);
|
|
37605
|
+
if (config.env) console.log(`${muted("Env:")} ${config.env.name}`);
|
|
37556
37606
|
console.log(`${muted("Live:")} ${liveUrl(config)}`);
|
|
37557
37607
|
console.log(`${muted("API:")} ${config.apiBase}`);
|
|
37558
37608
|
if (apiBaseInUse !== config.apiBase) {
|
|
@@ -38982,10 +39032,35 @@ function statusIcon(status) {
|
|
|
38982
39032
|
if (status === "warning") return warning("\u26A0");
|
|
38983
39033
|
return muted("\u2192");
|
|
38984
39034
|
}
|
|
38985
|
-
|
|
38986
|
-
|
|
38987
|
-
|
|
38988
|
-
|
|
39035
|
+
async function printPlan(appGuid2, env, json) {
|
|
39036
|
+
const res = await get(`/projects/${appGuid2}/envs/${encodeURIComponent(env)}/plan`);
|
|
39037
|
+
const p = res.data;
|
|
39038
|
+
if (json) {
|
|
39039
|
+
console.log(JSON.stringify(p));
|
|
39040
|
+
return;
|
|
39041
|
+
}
|
|
39042
|
+
console.log(brand(bold(`Deploy plan for ${p.env}`)));
|
|
39043
|
+
console.log(muted("\u2500".repeat(40)));
|
|
39044
|
+
if (p.pending.length === 0) {
|
|
39045
|
+
console.log(success(`\u2713 No pending migrations: ${p.env}'s database is up to date.`));
|
|
39046
|
+
return;
|
|
39047
|
+
}
|
|
39048
|
+
for (const m of p.pending) {
|
|
39049
|
+
const where = m.ranOn.length ? muted(`ran on ${m.ranOn.map((r) => `${r.env} ${new Date(r.appliedAt).toLocaleDateString()}`).join(", ")}`) : warning("has not run anywhere yet");
|
|
39050
|
+
const edited = p.changed.includes(m.file) ? muted(" (edited since it ran here; runs again)") : "";
|
|
39051
|
+
console.log(`${m.destructive.length ? error("!") : muted("\u2192")} ${bold(m.file)} ${where}${edited}`);
|
|
39052
|
+
for (const d of m.destructive) console.log(` ${error(d)}`);
|
|
39053
|
+
}
|
|
39054
|
+
if (p.env === "prod" && p.pending.some((m) => m.destructive.length)) {
|
|
39055
|
+
console.log("");
|
|
39056
|
+
console.log(warning("A prod deploy stops on the destructive statements above until you pass --yes-destructive."));
|
|
39057
|
+
}
|
|
39058
|
+
}
|
|
39059
|
+
var deployCommand = new Command("deploy").description("Deploy the app to prod, or to an environment (created on first deploy)").argument("[env]", "prod, or an environment name (dev, staging, ...). Omitted: prod while the app has no environments; once it has any, name one").option("--yes-destructive", "Allow pending prod migrations that destroy data (DROP TABLE/COLUMN, TRUNCATE, DELETE without WHERE, column type changes)").option("--plan", "Show the pending migrations this deploy would run (and where each already ran), without deploying").option("--source-dir <dir>", "Source directory to deploy from").option("--only <phases>", "Run only specific phases, comma-separated, matched by gipity.yaml phase name or type: files/static, database/sql, functions, workflows, services, jobs, records, realtime, env, auth_branding").option("--force", "Re-run all phases (ignore checksums) and bypass the sync bulk-deletion guard").option("--no-sync", "Skip sync-up before deploy").option("--optimize", "Force Vite build optimization on (default for prod; use this to optimize a dev deploy too)").option("--no-optimize", 'Skip build optimization and upload files as-is - the escape hatch for plain-HTML apps whose <script src> tags are not type="module"').option("--json", "Output as JSON").option("--inspect [path]", "After a successful deploy, run `page inspect` on the deployed URL (or URL + path) in the same command - one build-loop step instead of two. With --json, emits two JSON lines: deploy, then inspect.").option("--wait <ms>", "With --inspect: sleep this many ms before capturing (max 30000)").option("--wait-for <selector>", "With --inspect: wait until this CSS selector appears before capturing (deterministic; the app's own ready signal)").option("--wait-timeout <ms>", "With --inspect: max ms to wait for --wait-for before giving up", "5000").action((envArg, opts) => run("Deploy", async () => {
|
|
39060
|
+
const env = envArg ?? getEnvOption();
|
|
39061
|
+
if (opts.plan) {
|
|
39062
|
+
await printPlan(requireConfig2().projectGuid, env ?? "prod", !!opts.json);
|
|
39063
|
+
return;
|
|
38989
39064
|
}
|
|
38990
39065
|
if (!opts.inspect && (opts.waitFor || deployCommand.getOptionValueSource("wait") !== void 0)) {
|
|
38991
39066
|
opts.inspect = true;
|
|
@@ -38993,14 +39068,16 @@ var deployCommand = new Command("deploy").description("Deploy to dev or prod").a
|
|
|
38993
39068
|
const config = requireConfig2();
|
|
38994
39069
|
await syncBeforeAction(opts);
|
|
38995
39070
|
const doDeploy = () => post(`/projects/${config.projectGuid}/deploy`, {
|
|
38996
|
-
|
|
39071
|
+
...env ? { env } : {},
|
|
39072
|
+
...opts.yesDestructive ? { yesDestructive: true } : {},
|
|
38997
39073
|
sourceDir: opts.sourceDir,
|
|
38998
39074
|
optimize: opts.optimize,
|
|
38999
39075
|
force: opts.force,
|
|
39000
39076
|
only: opts.only?.split(",").map((s) => s.trim())
|
|
39001
39077
|
});
|
|
39002
|
-
const res = opts.json ? await doDeploy() : await withSpinner(`Deploying to ${
|
|
39078
|
+
const res = opts.json ? await doDeploy() : await withSpinner(env ? `Deploying to ${env}...` : "Deploying...", doDeploy, { done: null });
|
|
39003
39079
|
const d = res.data;
|
|
39080
|
+
const where = d.env ?? d.target;
|
|
39004
39081
|
const inspectAfter = async () => {
|
|
39005
39082
|
if (!opts.inspect) return;
|
|
39006
39083
|
if (!d.url) {
|
|
@@ -39023,11 +39100,12 @@ var deployCommand = new Command("deploy").description("Deploy to dev or prod").a
|
|
|
39023
39100
|
if (opts.json) {
|
|
39024
39101
|
console.log(JSON.stringify(d));
|
|
39025
39102
|
const failedJson = d.phases?.some((p) => p.status === "failed");
|
|
39026
|
-
if (
|
|
39103
|
+
if (failedJson) process.exit(1);
|
|
39104
|
+
await inspectAfter();
|
|
39027
39105
|
return;
|
|
39028
39106
|
}
|
|
39029
39107
|
const batchLabel = d.batch ? muted(` (batch ${d.batch})`) : "";
|
|
39030
|
-
console.log(brand(bold(`Deploy to ${
|
|
39108
|
+
console.log(brand(bold(`Deploy to ${where}`)) + batchLabel + (d.created ? muted(" (new environment)") : ""));
|
|
39031
39109
|
console.log(muted("\u2500".repeat(40)));
|
|
39032
39110
|
if (d.phases && d.phases.length > 0) {
|
|
39033
39111
|
for (const phase of d.phases) {
|
|
@@ -39063,16 +39141,157 @@ var deployCommand = new Command("deploy").description("Deploy to dev or prod").a
|
|
|
39063
39141
|
console.log(error(`Deploy failed`) + muted(` (${d.elapsedMs}ms)`));
|
|
39064
39142
|
process.exit(1);
|
|
39065
39143
|
} else {
|
|
39066
|
-
console.log(success(`\u2713 Deployed to ${
|
|
39144
|
+
console.log(success(`\u2713 Deployed to ${where}`) + muted(` (${d.elapsedMs}ms)`));
|
|
39067
39145
|
if (d.url) console.log(`${muted("Live:")} ${brand(d.url)}`);
|
|
39068
39146
|
if (d.phases?.some((p) => p.name === "functions")) {
|
|
39069
|
-
console.log(`${muted("Functions:")} POST ${brand(`${resolveApiBase()}/api/${config.projectGuid}/fn/<name>`)}`);
|
|
39070
|
-
|
|
39147
|
+
console.log(`${muted("Functions:")} POST ${brand(`${resolveApiBase()}/api/${d.appGuid ?? config.projectGuid}/fn/<name>`)}`);
|
|
39148
|
+
const envFlag = d.env && d.env !== "prod" ? ` --env ${d.env}` : "";
|
|
39149
|
+
console.log(muted(` (names: gipity fn list${envFlag}; verify the public path: gipity fn call <name>${envFlag} --anon)`));
|
|
39071
39150
|
}
|
|
39151
|
+
for (const hint of d.hints ?? []) console.log(muted(hint));
|
|
39072
39152
|
await inspectAfter();
|
|
39073
39153
|
}
|
|
39074
39154
|
}));
|
|
39075
39155
|
|
|
39156
|
+
// src/commands/env.ts
|
|
39157
|
+
init_api();
|
|
39158
|
+
init_config();
|
|
39159
|
+
init_utils();
|
|
39160
|
+
init_colors();
|
|
39161
|
+
init_utils();
|
|
39162
|
+
function appGuid() {
|
|
39163
|
+
return requireConfig2().projectGuid;
|
|
39164
|
+
}
|
|
39165
|
+
var envCommand = new Command("env").description("App environments: prod plus any number of isolated copies (dev, staging, ...), each with its own database, functions and URL").addHelpText("after", `
|
|
39166
|
+
An environment is created the first time you deploy to it:
|
|
39167
|
+
gipity deploy dev # creates "dev" (own DB from migrations, own functions), deploys
|
|
39168
|
+
gipity deploy prod # the live app
|
|
39169
|
+
|
|
39170
|
+
Run any project command against one with --env:
|
|
39171
|
+
gipity db query "SELECT count(*) FROM orders" --env dev
|
|
39172
|
+
gipity fn call checkout --env staging
|
|
39173
|
+
gipity logs fn checkout --env dev
|
|
39174
|
+
|
|
39175
|
+
Envs share the app's secrets (an env can override one: gipity secrets set NAME value --env staging),
|
|
39176
|
+
members and players. Cron workflows are off in an env until: gipity env set <name> --schedules on.
|
|
39177
|
+
Email from an env reaches only the app owner and members; payments run in prod only.`);
|
|
39178
|
+
envCommand.command("list", { isDefault: true }).description("List the app's environments").option("--json", "Output as JSON").action((opts) => run("Env", async () => {
|
|
39179
|
+
const res = await get(`/projects/${appGuid()}/envs`);
|
|
39180
|
+
const d = res.data;
|
|
39181
|
+
if (opts.json) {
|
|
39182
|
+
console.log(JSON.stringify(d));
|
|
39183
|
+
return;
|
|
39184
|
+
}
|
|
39185
|
+
console.log(`${bold("prod")} ${brand(d.prod.url)}`);
|
|
39186
|
+
if (d.envs.length === 0) {
|
|
39187
|
+
console.log(muted("No environments yet. `gipity deploy dev` creates one."));
|
|
39188
|
+
return;
|
|
39189
|
+
}
|
|
39190
|
+
for (const e of d.envs) {
|
|
39191
|
+
const deployed = e.lastDeploy ? `deployed ${new Date(e.lastDeploy).toLocaleString()}` : "never deployed";
|
|
39192
|
+
const parts = [deployed, `DB ${formatSize(e.dbBytes)}`, e.schedules ? "schedules on" : "schedules off"];
|
|
39193
|
+
if (e.customDomains.length) parts.push(e.customDomains.join(", "));
|
|
39194
|
+
console.log(`${bold(e.name)} ${brand(e.url)} ${muted(parts.join(" \xB7 "))}`);
|
|
39195
|
+
}
|
|
39196
|
+
}));
|
|
39197
|
+
function printCopy(copy) {
|
|
39198
|
+
if (!copy) return;
|
|
39199
|
+
for (const d of copy.databases) {
|
|
39200
|
+
console.log(muted(`Copied ${d.rows} rows (${d.tables} tables) from ${copy.from}'s ${d.database} database`));
|
|
39201
|
+
}
|
|
39202
|
+
}
|
|
39203
|
+
envCommand.command("create <name>").description("Create an environment and deploy the app to it (`gipity deploy <name>` does the same, without --data)").option("--data", "Copy the rows of prod (or --from) into it, to try a change against real data").option("--from <env>", "With --data: the environment to copy from (default prod)").option("--json", "Output as JSON").action((name, opts) => run("Env", async () => {
|
|
39204
|
+
if (name === PROD_ENV) {
|
|
39205
|
+
console.error(error("prod is the app itself. Deploy it with: gipity deploy prod"));
|
|
39206
|
+
process.exit(1);
|
|
39207
|
+
}
|
|
39208
|
+
if (opts.from && !opts.data) {
|
|
39209
|
+
console.error(error("--from goes with --data"));
|
|
39210
|
+
process.exit(1);
|
|
39211
|
+
}
|
|
39212
|
+
const create = () => post(
|
|
39213
|
+
`/projects/${appGuid()}/envs`,
|
|
39214
|
+
{ name, ...opts.data ? { data: true } : {}, ...opts.from ? { from: opts.from } : {} }
|
|
39215
|
+
);
|
|
39216
|
+
const res = opts.json ? await create() : await withSpinner(`Creating ${name}...`, create, { done: null });
|
|
39217
|
+
if (opts.json) {
|
|
39218
|
+
console.log(JSON.stringify(res.data));
|
|
39219
|
+
return;
|
|
39220
|
+
}
|
|
39221
|
+
const failed = res.data.phases.filter((p) => p.status === "failed");
|
|
39222
|
+
for (const p of failed) console.log(`${error("\u2717")} ${bold(p.name)}: ${p.summary}`);
|
|
39223
|
+
if (failed.length > 0) {
|
|
39224
|
+
console.log(error(`Created ${name}, but its first deploy failed. Fix it and run: gipity deploy ${name}`));
|
|
39225
|
+
process.exit(1);
|
|
39226
|
+
}
|
|
39227
|
+
console.log(success(`\u2713 Created ${name}`));
|
|
39228
|
+
printCopy(res.data.data);
|
|
39229
|
+
console.log(`${muted("Live:")} ${brand(res.data.url)}`);
|
|
39230
|
+
}));
|
|
39231
|
+
envCommand.command("reset <name>").description("Start an environment over: drop its database, rerun every migration from zero, redeploy").option("--data", "Then copy the rows of prod (or --from) into it").option("--from <env>", "With --data: the environment to copy from (default prod)").option("--json", "Output as JSON").action((name, opts) => run("Env", async () => {
|
|
39232
|
+
if (name === PROD_ENV) {
|
|
39233
|
+
console.error(error("prod can't be reset."));
|
|
39234
|
+
process.exit(1);
|
|
39235
|
+
}
|
|
39236
|
+
if (opts.from && !opts.data) {
|
|
39237
|
+
console.error(error("--from goes with --data"));
|
|
39238
|
+
process.exit(1);
|
|
39239
|
+
}
|
|
39240
|
+
const ok = await confirm(`Reset ${bold(name)}? Its database is dropped and rebuilt${opts.data ? ` from ${opts.from ?? "prod"}'s data` : " empty"}.`, { default: "no" });
|
|
39241
|
+
if (!ok) {
|
|
39242
|
+
console.log(muted("Aborted."));
|
|
39243
|
+
process.exit(1);
|
|
39244
|
+
}
|
|
39245
|
+
const reset = () => post(
|
|
39246
|
+
`/projects/${appGuid()}/envs/${encodeURIComponent(name)}/reset`,
|
|
39247
|
+
{ ...opts.data ? { data: true } : {}, ...opts.from ? { from: opts.from } : {} }
|
|
39248
|
+
);
|
|
39249
|
+
const res = opts.json ? await reset() : await withSpinner(`Resetting ${name}...`, reset, { done: null });
|
|
39250
|
+
if (opts.json) {
|
|
39251
|
+
console.log(JSON.stringify(res.data));
|
|
39252
|
+
return;
|
|
39253
|
+
}
|
|
39254
|
+
const failed = res.data.phases.filter((p) => p.status === "failed");
|
|
39255
|
+
for (const p of failed) console.log(`${error("\u2717")} ${bold(p.name)}: ${p.summary}`);
|
|
39256
|
+
if (failed.length > 0) {
|
|
39257
|
+
console.log(error(`Reset ${name}, but its deploy failed.`));
|
|
39258
|
+
process.exit(1);
|
|
39259
|
+
}
|
|
39260
|
+
console.log(success(`\u2713 Reset ${name}`));
|
|
39261
|
+
printCopy(res.data.data);
|
|
39262
|
+
if (res.data.url) console.log(`${muted("Live:")} ${brand(res.data.url)}`);
|
|
39263
|
+
}));
|
|
39264
|
+
envCommand.command("set <name>").description("Change an environment's settings").requiredOption("--schedules <on|off>", "Turn the environment's cron workflows on or off").option("--json", "Output as JSON").action((name, opts) => run("Env", async () => {
|
|
39265
|
+
const value = String(opts.schedules).toLowerCase();
|
|
39266
|
+
if (value !== "on" && value !== "off") {
|
|
39267
|
+
console.error(error("--schedules takes on or off"));
|
|
39268
|
+
process.exit(1);
|
|
39269
|
+
}
|
|
39270
|
+
const res = await patch(`/projects/${appGuid()}/envs/${encodeURIComponent(name)}`, { schedules: value === "on" });
|
|
39271
|
+
if (opts.json) {
|
|
39272
|
+
console.log(JSON.stringify(res.data));
|
|
39273
|
+
return;
|
|
39274
|
+
}
|
|
39275
|
+
console.log(success(`\u2713 Schedules ${value} in ${name}`));
|
|
39276
|
+
}));
|
|
39277
|
+
envCommand.command("delete <name>").description("Delete an environment: its database, functions, files and custom domains (never prod)").option("--json", "Output as JSON").action((name, opts) => run("Env", async () => {
|
|
39278
|
+
if (name === PROD_ENV) {
|
|
39279
|
+
console.error(error("prod is the app itself and can't be deleted as an environment."));
|
|
39280
|
+
process.exit(1);
|
|
39281
|
+
}
|
|
39282
|
+
const ok = await confirm(`Delete the ${bold(name)} environment and its database?`, { default: "no" });
|
|
39283
|
+
if (!ok) {
|
|
39284
|
+
console.log(muted("Aborted."));
|
|
39285
|
+
process.exit(1);
|
|
39286
|
+
}
|
|
39287
|
+
const res = await del(`/projects/${appGuid()}/envs/${encodeURIComponent(name)}`);
|
|
39288
|
+
if (opts.json) {
|
|
39289
|
+
console.log(JSON.stringify(res.data));
|
|
39290
|
+
return;
|
|
39291
|
+
}
|
|
39292
|
+
console.log(success(`\u2713 Deleted ${name}`));
|
|
39293
|
+
}));
|
|
39294
|
+
|
|
39076
39295
|
// src/commands/db.ts
|
|
39077
39296
|
init_api();
|
|
39078
39297
|
init_config();
|
|
@@ -40626,7 +40845,7 @@ function humanBytes(n) {
|
|
|
40626
40845
|
return `${(n / 1024 / 1024 / 1024).toFixed(2)} GB`;
|
|
40627
40846
|
}
|
|
40628
40847
|
function buildHeader(opts) {
|
|
40629
|
-
const deployUrl = opts.accountSlug ? `https://
|
|
40848
|
+
const deployUrl = opts.accountSlug ? `https://app.gipity.ai/${opts.accountSlug}/${opts.projectSlug}/` : "(not yet deployed)";
|
|
40630
40849
|
const filesLine = opts.fileCount === 0 ? `- Files: empty (no files yet)` : `- Files: ${opts.fileCount} file${opts.fileCount === 1 ? "" : "s"} in ${opts.folderCount} folder${opts.folderCount === 1 ? "" : "s"} (${humanBytes(opts.totalBytes)}) - ${opts.topLevel}`;
|
|
40631
40850
|
return [
|
|
40632
40851
|
`## Gipity project`,
|
|
@@ -40678,7 +40897,7 @@ var USER_MSG_OPEN = "<gipity-user-message>";
|
|
|
40678
40897
|
var USER_MSG_CLOSE = "</gipity-user-message>";
|
|
40679
40898
|
var RESPONSE_DIRECTIVE = `Respond to the user message below. Don't greet or reintroduce yourself.`;
|
|
40680
40899
|
function buildResumeWrap(opts, userMsg) {
|
|
40681
|
-
const deployUrl = opts.accountSlug ? `https://
|
|
40900
|
+
const deployUrl = opts.accountSlug ? `https://app.gipity.ai/${opts.accountSlug}/${opts.projectSlug}/` : "(not yet deployed)";
|
|
40682
40901
|
return [
|
|
40683
40902
|
`Project: ${opts.projectName} (\`${opts.projectGuid}\`) - ${deployUrl}`,
|
|
40684
40903
|
PLATFORM_REMINDER,
|
|
@@ -42226,7 +42445,7 @@ function printBrand(d) {
|
|
|
42226
42445
|
if (d.branding.app_name) console.log(`${bold("Name:")} ${d.branding.app_name}`);
|
|
42227
42446
|
if (d.branding.tagline) console.log(`${bold("Tagline:")} ${d.branding.tagline}`);
|
|
42228
42447
|
}
|
|
42229
|
-
var DEPLOY_HINT = "Deploy to publish the new assets: gipity deploy
|
|
42448
|
+
var DEPLOY_HINT = "Deploy to publish the new assets: gipity deploy";
|
|
42230
42449
|
var brandCommand = new Command("brand").description("The app's generated icons + share card (favicons, iOS icon, og-image)").addHelpText("after", `
|
|
42231
42450
|
Examples:
|
|
42232
42451
|
gipity brand Show the current brand
|
|
@@ -42550,7 +42769,7 @@ var loadCommand = new Command("load").description("Create a new app from a .gip
|
|
|
42550
42769
|
console.warn(warning("The project was still created and linked; the files above are missing from it."));
|
|
42551
42770
|
}
|
|
42552
42771
|
console.log("");
|
|
42553
|
-
console.log(`${muted("Next:")} cd ${dir} && ${brand("gipity deploy
|
|
42772
|
+
console.log(`${muted("Next:")} cd ${dir} && ${brand("gipity deploy")}`);
|
|
42554
42773
|
}));
|
|
42555
42774
|
|
|
42556
42775
|
// src/commands/logs.ts
|
|
@@ -43326,7 +43545,7 @@ fnCommand.command("list").description("List functions").option("--json", "Output
|
|
|
43326
43545
|
${muted(f.description)}` : line;
|
|
43327
43546
|
});
|
|
43328
43547
|
if (!opts.json && res.data.length > 0) {
|
|
43329
|
-
console.log(muted(`Endpoint: POST ${resolveApiBase()}/api/${config.projectGuid}/fn/<name> (
|
|
43548
|
+
console.log(muted(`Endpoint: POST ${resolveApiBase()}/api/${config.projectGuid}/fn/<name> (this is ${config.env ? `the ${config.env.name} environment` : "prod"}; each environment has its own address, see --env; public path: gipity fn call <name> --anon)`));
|
|
43330
43549
|
}
|
|
43331
43550
|
}));
|
|
43332
43551
|
fnCommand.command("logs <name>").description("Show recent logs").option("--limit <n>", "Max entries", "20").option("--json", "Output as JSON").action((name, opts) => run("Logs", async () => {
|
|
@@ -43439,7 +43658,7 @@ function anonBillingHint(name, err) {
|
|
|
43439
43658
|
service_definitions:
|
|
43440
43659
|
- service: ${service}
|
|
43441
43660
|
billing_mode: owner_pays
|
|
43442
|
-
gipity deploy
|
|
43661
|
+
gipity deploy --only services`;
|
|
43443
43662
|
}
|
|
43444
43663
|
serviceCommand.command("call <name> [body]").description("Call an app service by name (e.g. llm, image, music). Uses your logged-in session - no token wrangling; --anon calls it as a signed-out visitor instead.").option("-d, --data <json>", "JSON request body: inline JSON, @file to read a file, or @- / - for stdin (alternative to the positional [body])").option("--file <field=@path>", "Attach a file as { data, media_type } under <field> in the JSON body (the shape image/vision services expect), repeatable, e.g. --file image=@receipt.png", (v7, acc) => (acc || []).concat(v7)).option("--form <field=value>", "Send multipart/form-data instead of JSON, curl -F style: field=@path attaches a file, field=value a text field. Repeatable. For upload endpoints like transcribe: --form audio=@talk.mp3 --form language=en", (v7, acc) => (acc || []).concat(v7)).option("--anon", "Call as an anonymous visitor (the public path a signed-out user of your deployed app hits) instead of as your signed-in account").option("--get", "Issue a GET (for listing endpoints like llm/models, tts/voices)").option("--field <path>", "Print only this field of the result (dot path, e.g. choices.0.message.content)").option("--json", "Output compact JSON").action((name, bodyArg, opts) => run("Call", async () => {
|
|
43445
43664
|
const config = requireConfig2();
|
|
@@ -43462,7 +43681,7 @@ serviceCommand.command("call <name> [body]").description("Call an app service by
|
|
|
43462
43681
|
const headers = await mintAppToken(config.projectGuid);
|
|
43463
43682
|
if (!headers) {
|
|
43464
43683
|
throw new Error(
|
|
43465
|
-
`Could not mint a visitor token for this project, so there is no anonymous path to call. That means the app is not deployed on this API base yet: run \`gipity deploy
|
|
43684
|
+
`Could not mint a visitor token for this project, so there is no anonymous path to call. That means the app is not deployed on this API base yet: run \`gipity deploy\` first, then re-run this command.`
|
|
43466
43685
|
);
|
|
43467
43686
|
}
|
|
43468
43687
|
res = await publicRequest(opts.get ? "GET" : "POST", url, opts.get ? void 0 : body, headers, LONG_REQUEST_TIMEOUT_MS);
|
|
@@ -45325,9 +45544,9 @@ var testCommand = new Command("test").description("Run tests").argument("[path]"
|
|
|
45325
45544
|
if (undeployed.length > 0) {
|
|
45326
45545
|
const list = undeployed.map((n) => `'${n}'`).join(", ");
|
|
45327
45546
|
console.log(warning(
|
|
45328
|
-
`${undeployed.length === 1 ? "Function" : "Functions"} ${list} 404'd:
|
|
45547
|
+
`${undeployed.length === 1 ? "Function" : "Functions"} ${list} 404'd: \`gipity test\` registers every file in functions/ before the run, so ${undeployed.length === 1 ? "that name has" : "those names have"} no function file, or failed to register.`
|
|
45329
45548
|
));
|
|
45330
|
-
console.log(muted("
|
|
45549
|
+
console.log(muted("Check the name against functions/<name>.js (or functions/<name>/index.js) and gipity.yaml."));
|
|
45331
45550
|
console.log("");
|
|
45332
45551
|
}
|
|
45333
45552
|
const parts = [];
|
|
@@ -49924,7 +50143,7 @@ function configureHelp(cmd) {
|
|
|
49924
50143
|
var program2 = new Command();
|
|
49925
50144
|
program2.enablePositionalOptions();
|
|
49926
50145
|
var startGroup = [statusCommand, initCommand, skillCommand, projectCommand];
|
|
49927
|
-
var buildGroup = [addCommand, removeCommand, brandCommand, saveCommand, loadCommand, deployCommand, pageCommand, testCommand];
|
|
50146
|
+
var buildGroup = [addCommand, removeCommand, brandCommand, saveCommand, loadCommand, deployCommand, envCommand, pageCommand, testCommand];
|
|
49928
50147
|
var backendGroup = [dbCommand, fnCommand, secretsCommand, keyCommand, logsCommand, jobCommand, workflowCommand, approvalCommand, memoryCommand];
|
|
49929
50148
|
var servicesGroup = [serviceCommand, generateCommand, askCommand, notifyCommand, paymentsCommand, realtimeCommand, recordsCommand, rbacCommand, auditCommand, domainCommand, tokenCommand];
|
|
49930
50149
|
var filesGroup = [syncCommand, fileCommand, pushCommand, uploadCommand, storageCommand];
|
|
@@ -49965,13 +50184,46 @@ var SKILL_DOCS = {
|
|
|
49965
50184
|
};
|
|
49966
50185
|
program2.name("gipity").description(`${brand(bold("Gipity CLI"))} ${dim("-")} ${GIPITY_TAGLINE.replace(/\.$/, "")}
|
|
49967
50186
|
|
|
49968
|
-
${dim("Hosting, databases, deploys, workflows, code execution, and monitoring - one place, agent-tuned. Pair with Claude Code or use standalone.")}`).version(pkg.version, "-v, --version").addOption(new Option("--api-base <url>", "API base URL").hideHelp()).option("-y, --yes", "Skip confirmation prompts");
|
|
49969
|
-
|
|
50187
|
+
${dim("Hosting, databases, deploys, workflows, code execution, and monitoring - one place, agent-tuned. Pair with Claude Code or use standalone.")}`).version(pkg.version, "-v, --version").addOption(new Option("--api-base <url>", "API base URL").hideHelp()).option("-y, --yes", "Skip confirmation prompts").option("--env <name>", "Act on an app environment (dev, staging, ...) instead of prod");
|
|
50188
|
+
var SELF_ENV_COMMANDS = /* @__PURE__ */ new Set(["deploy", "env"]);
|
|
50189
|
+
program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
49970
50190
|
const globalOpts = program2.opts();
|
|
49971
50191
|
if (globalOpts.apiBase) setApiBaseOverride(globalOpts.apiBase);
|
|
50192
|
+
const envName = actionCommand.opts().env ?? globalOpts.env;
|
|
50193
|
+
setEnvOption(envName);
|
|
50194
|
+
let top = actionCommand;
|
|
50195
|
+
while (top.parent && top.parent !== program2) top = top.parent;
|
|
50196
|
+
if (envName && !SELF_ENV_COMMANDS.has(top.name())) await resolveEnvOverride(envName);
|
|
50197
|
+
refreshPrimersQuietly();
|
|
49972
50198
|
if (globalOpts.yes || actionCommand.opts().yes) setAutoConfirm(true);
|
|
49973
50199
|
rejectBlankIdArgs(actionCommand);
|
|
49974
50200
|
});
|
|
50201
|
+
function refreshPrimersQuietly() {
|
|
50202
|
+
const root = getProjectRoot();
|
|
50203
|
+
if (!root) return;
|
|
50204
|
+
try {
|
|
50205
|
+
refreshExistingPrimers(root);
|
|
50206
|
+
} catch (err) {
|
|
50207
|
+
console.error(`Could not refresh this project's Gipity docs block: ${err.message}`);
|
|
50208
|
+
}
|
|
50209
|
+
}
|
|
50210
|
+
async function resolveEnvOverride(name) {
|
|
50211
|
+
const config = getConfig();
|
|
50212
|
+
if (!config) {
|
|
50213
|
+
console.error("--env needs a Gipity project directory (run it where .gipity.json is).");
|
|
50214
|
+
process.exit(1);
|
|
50215
|
+
}
|
|
50216
|
+
const { get: get3 } = await Promise.resolve().then(() => (init_api(), api_exports));
|
|
50217
|
+
try {
|
|
50218
|
+
const res = await get3(
|
|
50219
|
+
`/projects/${config.projectGuid}/envs/${encodeURIComponent(name)}`
|
|
50220
|
+
);
|
|
50221
|
+
applyEnvOverride({ name, projectGuid: res.data.guid, projectSlug: res.data.slug });
|
|
50222
|
+
} catch (err) {
|
|
50223
|
+
console.error(err.message);
|
|
50224
|
+
process.exit(1);
|
|
50225
|
+
}
|
|
50226
|
+
}
|
|
49975
50227
|
var ID_ARG = /(guid|id)$/i;
|
|
49976
50228
|
function rejectBlankIdArgs(cmd) {
|
|
49977
50229
|
cmd.registeredArguments.forEach((arg, i) => {
|
|
@@ -50145,6 +50397,16 @@ function enableYesEverywhere(cmd) {
|
|
|
50145
50397
|
if (!hasYes) cmd.addOption(new Option("-y, --yes", "Skip confirmation prompts").hideHelp());
|
|
50146
50398
|
}
|
|
50147
50399
|
enableYesEverywhere(program2);
|
|
50400
|
+
function enableEnvEverywhere(cmd) {
|
|
50401
|
+
if (cmd.commands.length > 0) {
|
|
50402
|
+
for (const sub of cmd.commands) enableEnvEverywhere(sub);
|
|
50403
|
+
return;
|
|
50404
|
+
}
|
|
50405
|
+
if (!cmd.options.some((o) => o.long === "--env")) {
|
|
50406
|
+
cmd.addOption(new Option("--env <name>", "Act on an app environment (dev, staging, ...) instead of prod").hideHelp());
|
|
50407
|
+
}
|
|
50408
|
+
}
|
|
50409
|
+
enableEnvEverywhere(program2);
|
|
50148
50410
|
{
|
|
50149
50411
|
const target = resolveTarget(process.argv, program2);
|
|
50150
50412
|
const helpAsked = process.argv.slice(2).some((a) => a === "--help" || a === "-h");
|