gipity 1.1.42 → 1.1.44
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/changelog.js +107 -0
- package/dist/commands/brand.js +4 -4
- package/dist/commands/changelog.js +74 -0
- package/dist/commands/email.js +3 -3
- package/dist/commands/key.js +7 -13
- package/dist/commands/notify.js +19 -20
- package/dist/commands/secrets.js +5 -5
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/project.js +9 -0
- package/dist/index.js +278 -134
- package/dist/knowledge.js +2 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7005,6 +7005,8 @@ Gipity ships first-party services for what apps usually pull from third parties
|
|
|
7005
7005
|
|
|
7006
7006
|
When a user asks about Gipity itself - how to install it, what it costs, what's shipped, how a command or flag works - answer from an authoritative source, not memory, and don't hedge with "I don't want to guess." Check in this order: (1) \`gipity skill read <name>\` / \`gipity skill list\` - install and account basics live in \`getting-started\`; (2) \`gipity <command> --help\` for command syntax; (3) if it's genuinely not in the skills or CLI help, fetch the live site at \`https://gipity.ai\` (or web search) and cite what you found. A wrong or vague answer about the product is worse than spending one tool call to get the current, correct one.
|
|
7007
7007
|
|
|
7008
|
+
What's new since your docs were written: \`gipity changelog --newer --json\` lists the features and breaking changes shipped since you last looked, with the command and skill for each.
|
|
7009
|
+
|
|
7008
7010
|
## Plans, limits & upgrading - unblock the user
|
|
7009
7011
|
|
|
7010
7012
|
Gipity runs on **credits** (the one consumable) and **plans** (Free / Gipity Pro) that set limits and the monthly credit grant. When a metered action fails with a limit error - "limit reached", "on your plan", "Pro only", or "Insufficient credits" - that's your cue to help them upgrade, not just report the error. The play: name what they hit, run \`gipity credits list\` to compare plans, surface what Pro unlocks for *their* task, then run \`gipity credits buy\` and hand them the checkout link (it only prints a link - Stripe takes payment; nothing is charged until they click and pay). Do it proactively and once - don't nag. \`gipity credits\` shows their current plan, balance, and full limits. Load the \`plans\` skill for the full model and honest positioning vs other platforms; never quote a price or limit from memory - read it live.
|
|
@@ -9401,9 +9403,9 @@ async function publicRequest(method, path5, body, extraHeaders, timeoutMs = REQU
|
|
|
9401
9403
|
function publicPost(path5, body, extraHeaders) {
|
|
9402
9404
|
return publicRequest("POST", path5, body, extraHeaders);
|
|
9403
9405
|
}
|
|
9404
|
-
async function mintAppToken(
|
|
9406
|
+
async function mintAppToken(projectGuid) {
|
|
9405
9407
|
try {
|
|
9406
|
-
const minted = await publicPost("/api/token", { app:
|
|
9408
|
+
const minted = await publicPost("/api/token", { app: projectGuid });
|
|
9407
9409
|
return { "X-App-Token": minted.data.token };
|
|
9408
9410
|
} catch {
|
|
9409
9411
|
return void 0;
|
|
@@ -34370,7 +34372,7 @@ var {
|
|
|
34370
34372
|
init_config();
|
|
34371
34373
|
init_setup();
|
|
34372
34374
|
init_utils();
|
|
34373
|
-
import { readFileSync as
|
|
34375
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
34374
34376
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
34375
34377
|
import { dirname as dirname17, resolve as resolve20 } from "path";
|
|
34376
34378
|
|
|
@@ -34850,7 +34852,7 @@ var UploadConflictError = class extends Error {
|
|
|
34850
34852
|
currentServerVersion;
|
|
34851
34853
|
path;
|
|
34852
34854
|
};
|
|
34853
|
-
async function uploadOneFile(
|
|
34855
|
+
async function uploadOneFile(projectGuid, localPath, virtualPath, opts = {}) {
|
|
34854
34856
|
const { sha256: sha2562, size } = await hashFile(localPath);
|
|
34855
34857
|
const mime = opts.mime ?? guessMime(virtualPath);
|
|
34856
34858
|
const initBody = { path: virtualPath, size, sha256: sha2562, mime };
|
|
@@ -34860,7 +34862,7 @@ async function uploadOneFile(projectGuid2, localPath, virtualPath, opts = {}) {
|
|
|
34860
34862
|
let init;
|
|
34861
34863
|
try {
|
|
34862
34864
|
init = await post(
|
|
34863
|
-
`/projects/${
|
|
34865
|
+
`/projects/${projectGuid}/files/upload-init`,
|
|
34864
34866
|
initBody
|
|
34865
34867
|
);
|
|
34866
34868
|
} catch (err) {
|
|
@@ -34882,7 +34884,7 @@ async function uploadOneFile(projectGuid2, localPath, virtualPath, opts = {}) {
|
|
|
34882
34884
|
}
|
|
34883
34885
|
let comp;
|
|
34884
34886
|
try {
|
|
34885
|
-
comp = await post(`/projects/${
|
|
34887
|
+
comp = await post(`/projects/${projectGuid}/files/upload-complete`, completeBody);
|
|
34886
34888
|
} catch (err) {
|
|
34887
34889
|
if (err instanceof ApiError && err.statusCode === 409) {
|
|
34888
34890
|
const current = typeof err.data?.current_server_version === "number" ? err.data.current_server_version : null;
|
|
@@ -34964,16 +34966,16 @@ async function transferToS3(localPath, size, mime, data, opts = {}) {
|
|
|
34964
34966
|
completed.sort((a, b7) => a.part_number - b7.part_number);
|
|
34965
34967
|
return { parts: completed };
|
|
34966
34968
|
}
|
|
34967
|
-
async function uploadInitBatch(
|
|
34969
|
+
async function uploadInitBatch(projectGuid, files) {
|
|
34968
34970
|
const res = await post(
|
|
34969
|
-
`/projects/${
|
|
34971
|
+
`/projects/${projectGuid}/files/upload-init-batch`,
|
|
34970
34972
|
{ files }
|
|
34971
34973
|
);
|
|
34972
34974
|
return res.data.results;
|
|
34973
34975
|
}
|
|
34974
|
-
async function uploadCompleteBatch(
|
|
34976
|
+
async function uploadCompleteBatch(projectGuid, items) {
|
|
34975
34977
|
const res = await post(
|
|
34976
|
-
`/projects/${
|
|
34978
|
+
`/projects/${projectGuid}/files/upload-complete-batch`,
|
|
34977
34979
|
{ items }
|
|
34978
34980
|
);
|
|
34979
34981
|
return res.data.results;
|
|
@@ -35074,23 +35076,23 @@ async function acquireLock(progress) {
|
|
|
35074
35076
|
}
|
|
35075
35077
|
}
|
|
35076
35078
|
}
|
|
35077
|
-
function readBaseline(
|
|
35079
|
+
function readBaseline(projectGuid) {
|
|
35078
35080
|
const path5 = syncStatePath();
|
|
35079
|
-
if (!existsSync8(path5)) return { projectGuid
|
|
35081
|
+
if (!existsSync8(path5)) return { projectGuid, files: {}, lastFullSync: null };
|
|
35080
35082
|
try {
|
|
35081
35083
|
const parsed = JSON.parse(readFileSync8(path5, "utf-8"));
|
|
35082
|
-
if (parsed.projectGuid !==
|
|
35083
|
-
return { projectGuid
|
|
35084
|
+
if (parsed.projectGuid !== projectGuid) {
|
|
35085
|
+
return { projectGuid, files: {}, lastFullSync: null };
|
|
35084
35086
|
}
|
|
35085
35087
|
return {
|
|
35086
|
-
projectGuid
|
|
35088
|
+
projectGuid,
|
|
35087
35089
|
files: parsed.files ?? {},
|
|
35088
35090
|
lastFullSync: parsed.lastFullSync ?? null,
|
|
35089
35091
|
...parsed.deletesSkippedStreak ? { deletesSkippedStreak: parsed.deletesSkippedStreak } : {},
|
|
35090
35092
|
...parsed.appUploads?.length ? { appUploads: parsed.appUploads } : {}
|
|
35091
35093
|
};
|
|
35092
35094
|
} catch {
|
|
35093
|
-
return { projectGuid
|
|
35095
|
+
return { projectGuid, files: {}, lastFullSync: null };
|
|
35094
35096
|
}
|
|
35095
35097
|
}
|
|
35096
35098
|
function writeBaseline(b7) {
|
|
@@ -35191,8 +35193,8 @@ function resolveInRoot(root, relPath) {
|
|
|
35191
35193
|
}
|
|
35192
35194
|
return full;
|
|
35193
35195
|
}
|
|
35194
|
-
async function fetchRemote(
|
|
35195
|
-
const res = await get(`/projects/${
|
|
35196
|
+
async function fetchRemote(projectGuid) {
|
|
35197
|
+
const res = await get(`/projects/${projectGuid}/files/tree`);
|
|
35196
35198
|
const out = /* @__PURE__ */ new Map();
|
|
35197
35199
|
const appUploads = new Set((res.appUploads ?? []).map(normalizeTreePath));
|
|
35198
35200
|
for (const f of res.data) {
|
|
@@ -35254,14 +35256,14 @@ function extractTarToMap(stream, idleMs, onBytes, keep) {
|
|
|
35254
35256
|
stream.pipe(extract3);
|
|
35255
35257
|
});
|
|
35256
35258
|
}
|
|
35257
|
-
async function downloadAll(
|
|
35258
|
-
const stream = await downloadStream(`/projects/${
|
|
35259
|
+
async function downloadAll(projectGuid, onBytes) {
|
|
35260
|
+
const stream = await downloadStream(`/projects/${projectGuid}/files/tree?content=tar`);
|
|
35259
35261
|
return extractTarToMap(stream, DOWNLOAD_IDLE_MS, onBytes);
|
|
35260
35262
|
}
|
|
35261
|
-
async function fetchOneOutcome(
|
|
35263
|
+
async function fetchOneOutcome(projectGuid, path5, expectedSha) {
|
|
35262
35264
|
try {
|
|
35263
35265
|
const stream = await downloadStream(
|
|
35264
|
-
`/projects/${
|
|
35266
|
+
`/projects/${projectGuid}/files/tree?content=tar&path=${encodeURIComponent(path5)}`
|
|
35265
35267
|
);
|
|
35266
35268
|
const want = normalizeTreePath(path5);
|
|
35267
35269
|
const files = await extractTarToMap(stream, DOWNLOAD_IDLE_MS, void 0, (p) => p === want);
|
|
@@ -35277,8 +35279,8 @@ async function fetchOneOutcome(projectGuid2, path5, expectedSha) {
|
|
|
35277
35279
|
return { kind: "transient" };
|
|
35278
35280
|
}
|
|
35279
35281
|
}
|
|
35280
|
-
async function fetchOne(
|
|
35281
|
-
const out = await fetchOneOutcome(
|
|
35282
|
+
async function fetchOne(projectGuid, path5, expectedSha) {
|
|
35283
|
+
const out = await fetchOneOutcome(projectGuid, path5, expectedSha);
|
|
35282
35284
|
return out.kind === "ok" ? out.buf : null;
|
|
35283
35285
|
}
|
|
35284
35286
|
function classifyLocal(info2, base) {
|
|
@@ -35547,14 +35549,14 @@ async function sync(opts = {}) {
|
|
|
35547
35549
|
releaseLock();
|
|
35548
35550
|
}
|
|
35549
35551
|
}
|
|
35550
|
-
async function syncInner(
|
|
35551
|
-
const config = { projectGuid
|
|
35552
|
+
async function syncInner(projectGuid, root, ignore2, opts, interactive) {
|
|
35553
|
+
const config = { projectGuid, ignore: ignore2 };
|
|
35552
35554
|
const p = opts.progress;
|
|
35553
|
-
const baseline = readBaseline(
|
|
35555
|
+
const baseline = readBaseline(projectGuid);
|
|
35554
35556
|
p?.phase("Scanning local files...");
|
|
35555
35557
|
const local = walkLocal(root, ignore2, baseline.files);
|
|
35556
35558
|
p?.phase("Checking Gipity for changes...");
|
|
35557
|
-
const { files: remote, appUploads } = await fetchRemote(
|
|
35559
|
+
const { files: remote, appUploads } = await fetchRemote(projectGuid);
|
|
35558
35560
|
const appUploadsLeftLocal = [];
|
|
35559
35561
|
const knownUploads = /* @__PURE__ */ new Set([...appUploads, ...(baseline.appUploads ?? []).filter((p7) => local.has(p7))]);
|
|
35560
35562
|
for (const path5 of knownUploads) {
|
|
@@ -36422,6 +36424,14 @@ function parseDuration(raw, unit) {
|
|
|
36422
36424
|
return { value, hadSuffix: true };
|
|
36423
36425
|
}
|
|
36424
36426
|
|
|
36427
|
+
// src/helpers/project.ts
|
|
36428
|
+
init_config();
|
|
36429
|
+
var PROJECT_OPTION = ["--project <guid-or-slug>", "Target a specific project instead of cwd / Home"];
|
|
36430
|
+
async function projectGuidFor(opts) {
|
|
36431
|
+
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
36432
|
+
return config.projectGuid;
|
|
36433
|
+
}
|
|
36434
|
+
|
|
36425
36435
|
// src/commands/token.ts
|
|
36426
36436
|
var tokenCommand = new Command("token").description("Manage API tokens").addHelpText("after", `
|
|
36427
36437
|
Long-lived agent API tokens (gip_at_*) for headless agents and CI - they drive
|
|
@@ -36475,7 +36485,6 @@ tokenCommand.command("revoke <short_guid>").alias("rm").description("Revoke an a
|
|
|
36475
36485
|
|
|
36476
36486
|
// src/commands/key.ts
|
|
36477
36487
|
init_api();
|
|
36478
|
-
init_config();
|
|
36479
36488
|
init_colors();
|
|
36480
36489
|
var keyCommand = new Command("key").description("Manage project API keys for scripts and agents (X-Api-Key)").addHelpText("after", `
|
|
36481
36490
|
Give a script, cron, or agent write access to your app without a login:
|
|
@@ -36542,12 +36551,7 @@ function describeScopes(scopes) {
|
|
|
36542
36551
|
if (scopes.ip) parts.push(`ip: ${scopes.ip.join(",")}`);
|
|
36543
36552
|
return parts.join(" ");
|
|
36544
36553
|
}
|
|
36545
|
-
|
|
36546
|
-
async function projectGuid(opts) {
|
|
36547
|
-
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
36548
|
-
return config.projectGuid;
|
|
36549
|
-
}
|
|
36550
|
-
keyCommand.command("create <name>").description("Mint a project API key (shown once). Give it a name you will recognize later").addOption(new Option("--role <role>", "Access role for the key").choices(["viewer", "editor", "owner"]).default("viewer")).option("--expires-days <n>", "Days until the key expires (default: never)").option("--functions <names>", "Scope: only these functions (comma-separated)").option("--tables <list>", "Scope: only these Records tables, e.g. commands:write,logs:read").addOption(new Option("--files <access>", "Scope: app files access").choices(["read", "write"])).addOption(new Option("--approvals <access>", "Scope: read and consume passkey approvals").choices(["read"])).option("--ip <list>", "Scope: only from these IPs / CIDR ranges (comma-separated)").option(...projectOpt).option("--json", "Output as JSON").action((name, opts) => run("Create", async () => {
|
|
36554
|
+
keyCommand.command("create <name>").description("Mint a project API key (shown once). Give it a name you will recognize later").addOption(new Option("--role <role>", "Access role for the key").choices(["viewer", "editor", "owner"]).default("viewer")).option("--expires-days <n>", "Days until the key expires (default: never)").option("--functions <names>", "Scope: only these functions (comma-separated)").option("--tables <list>", "Scope: only these Records tables, e.g. commands:write,logs:read").addOption(new Option("--files <access>", "Scope: app files access").choices(["read", "write"])).addOption(new Option("--approvals <access>", "Scope: read and consume passkey approvals").choices(["read"])).option("--ip <list>", "Scope: only from these IPs / CIDR ranges (comma-separated)").option(...PROJECT_OPTION).option("--json", "Output as JSON").action((name, opts) => run("Create", async () => {
|
|
36551
36555
|
const body = { name, role: opts.role };
|
|
36552
36556
|
const scopes = scopesFromFlags(opts);
|
|
36553
36557
|
if (scopes) body.scopes = scopes;
|
|
@@ -36557,7 +36561,7 @@ keyCommand.command("create <name>").description("Mint a project API key (shown o
|
|
|
36557
36561
|
body.expires_in_days = days;
|
|
36558
36562
|
}
|
|
36559
36563
|
const res = await post(
|
|
36560
|
-
`/projects/${await
|
|
36564
|
+
`/projects/${await projectGuidFor(opts)}/api-keys`,
|
|
36561
36565
|
body
|
|
36562
36566
|
);
|
|
36563
36567
|
const k7 = res.data;
|
|
@@ -36577,8 +36581,8 @@ keyCommand.command("create <name>").description("Mint a project API key (shown o
|
|
|
36577
36581
|
console.log("");
|
|
36578
36582
|
console.log(warning("Copy it now - it will not be shown again."));
|
|
36579
36583
|
}));
|
|
36580
|
-
keyCommand.command("list").alias("ls").description("List this project's API keys (values are never shown again)").option(...
|
|
36581
|
-
const res = await get(`/projects/${await
|
|
36584
|
+
keyCommand.command("list").alias("ls").description("List this project's API keys (values are never shown again)").option(...PROJECT_OPTION).option("--json", "Output as JSON").action((opts) => run("List", async () => {
|
|
36585
|
+
const res = await get(`/projects/${await projectGuidFor(opts)}/api-keys`);
|
|
36582
36586
|
printList(
|
|
36583
36587
|
res.data,
|
|
36584
36588
|
opts,
|
|
@@ -36586,8 +36590,8 @@ keyCommand.command("list").alias("ls").description("List this project's API keys
|
|
|
36586
36590
|
(k7) => `${bold(k7.short_guid)} ${k7.name} ${muted(`${k7.role} ${describeScopes(k7.scopes)} ${k7.prefix}... last used ${fmtDate2(k7.last_used_at)} expires ${fmtDate2(k7.expires_at)}`)}`
|
|
36587
36591
|
);
|
|
36588
36592
|
}));
|
|
36589
|
-
keyCommand.command("revoke <short_guid>").alias("rm").description("Revoke a project API key (instant, irreversible)").option(...
|
|
36590
|
-
await del(`/projects/${await
|
|
36593
|
+
keyCommand.command("revoke <short_guid>").alias("rm").description("Revoke a project API key (instant, irreversible)").option(...PROJECT_OPTION).option("--json", "Output as JSON").action((shortGuid, opts) => run("Revoke", async () => {
|
|
36594
|
+
await del(`/projects/${await projectGuidFor(opts)}/api-keys/${encodeURIComponent(shortGuid)}`);
|
|
36591
36595
|
if (opts.json) {
|
|
36592
36596
|
console.log(JSON.stringify({ short_guid: shortGuid, revoked: true }));
|
|
36593
36597
|
return;
|
|
@@ -37778,26 +37782,26 @@ init_config();
|
|
|
37778
37782
|
|
|
37779
37783
|
// src/db-checkpoint.ts
|
|
37780
37784
|
init_api();
|
|
37781
|
-
async function resolveDatabase(
|
|
37785
|
+
async function resolveDatabase(projectGuid, explicit) {
|
|
37782
37786
|
if (explicit) return explicit;
|
|
37783
|
-
const res = await get(`/projects/${
|
|
37787
|
+
const res = await get(`/projects/${projectGuid}/databases`);
|
|
37784
37788
|
return res.data.length > 0 ? res.data[0].friendlyName : null;
|
|
37785
37789
|
}
|
|
37786
|
-
async function checkpoint(
|
|
37790
|
+
async function checkpoint(projectGuid, database, action, keep) {
|
|
37787
37791
|
const res = await post(
|
|
37788
|
-
`/projects/${
|
|
37792
|
+
`/projects/${projectGuid}/db/checkpoint`,
|
|
37789
37793
|
{ database, action, ...keep ? { keep } : {} }
|
|
37790
37794
|
);
|
|
37791
37795
|
return res.data;
|
|
37792
37796
|
}
|
|
37793
|
-
function createCheckpoint(
|
|
37794
|
-
return checkpoint(
|
|
37797
|
+
function createCheckpoint(projectGuid, database) {
|
|
37798
|
+
return checkpoint(projectGuid, database, "create");
|
|
37795
37799
|
}
|
|
37796
|
-
function restoreCheckpoint(
|
|
37797
|
-
return checkpoint(
|
|
37800
|
+
function restoreCheckpoint(projectGuid, database, opts = {}) {
|
|
37801
|
+
return checkpoint(projectGuid, database, "restore", opts.keep);
|
|
37798
37802
|
}
|
|
37799
|
-
function dropCheckpoint(
|
|
37800
|
-
return checkpoint(
|
|
37803
|
+
function dropCheckpoint(projectGuid, database) {
|
|
37804
|
+
return checkpoint(projectGuid, database, "drop");
|
|
37801
37805
|
}
|
|
37802
37806
|
|
|
37803
37807
|
// src/page-fixtures.ts
|
|
@@ -37842,13 +37846,13 @@ Nothing named "${basename4(localPath)}" under ${root} either. Generate a frame w
|
|
|
37842
37846
|
`${flag} ${localPath}: no such file. Looked for ${abs} (relative paths resolve against the current directory, ${process.cwd()}).${found}`
|
|
37843
37847
|
);
|
|
37844
37848
|
}
|
|
37845
|
-
async function uploadPublicFixture(
|
|
37849
|
+
async function uploadPublicFixture(projectGuid, localPath, flag = "--fixture") {
|
|
37846
37850
|
assertLocalAsset(flag, localPath);
|
|
37847
37851
|
const name = basename4(localPath);
|
|
37848
37852
|
const size = statSync5(localPath).size;
|
|
37849
37853
|
const contentType = guessMime(localPath);
|
|
37850
37854
|
const init = await post(
|
|
37851
|
-
`/api/${
|
|
37855
|
+
`/api/${projectGuid}/uploads/init`,
|
|
37852
37856
|
{ filename: name, content_type: contentType, size, public: true }
|
|
37853
37857
|
);
|
|
37854
37858
|
if (init.data.method !== "PUT" || !init.data.url) {
|
|
@@ -37863,13 +37867,13 @@ async function uploadPublicFixture(projectGuid2, localPath, flag = "--fixture")
|
|
|
37863
37867
|
throw new Error(`upload of fixture "${name}" failed: ${res.status} ${res.statusText}`);
|
|
37864
37868
|
}
|
|
37865
37869
|
const done = await post(
|
|
37866
|
-
`/api/${
|
|
37870
|
+
`/api/${projectGuid}/uploads/complete`,
|
|
37867
37871
|
{ upload_guid: init.data.upload_guid }
|
|
37868
37872
|
);
|
|
37869
37873
|
return { guid: done.data.guid, url: done.data.url, name, localPath };
|
|
37870
37874
|
}
|
|
37871
|
-
async function deleteFixture(
|
|
37872
|
-
await del(`/api/${
|
|
37875
|
+
async function deleteFixture(projectGuid, guid) {
|
|
37876
|
+
await del(`/api/${projectGuid}/uploads/${guid}`);
|
|
37873
37877
|
}
|
|
37874
37878
|
var CAMERA_EXTS = [".png", ".jpg", ".jpeg", ".webp", ".mp4", ".webm", ".y4m", ".mjpeg"];
|
|
37875
37879
|
function assertCameraFile(localPath) {
|
|
@@ -37882,9 +37886,9 @@ A still image is played as a looping single-frame feed, which is what a gesture/
|
|
|
37882
37886
|
No frame to hand? Generate one: gipity generate image "a hand making a closed fist, palm to camera, plain background"`
|
|
37883
37887
|
);
|
|
37884
37888
|
}
|
|
37885
|
-
async function uploadCameraFeed(
|
|
37889
|
+
async function uploadCameraFeed(projectGuid, localPath) {
|
|
37886
37890
|
assertCameraFile(localPath);
|
|
37887
|
-
return uploadPublicFixture(
|
|
37891
|
+
return uploadPublicFixture(projectGuid, localPath, "--camera");
|
|
37888
37892
|
}
|
|
37889
37893
|
|
|
37890
37894
|
// src/commands/page-eval.ts
|
|
@@ -38192,7 +38196,7 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38192
38196
|
const fixturePaths = opts.fixture ?? [];
|
|
38193
38197
|
const hosted = [];
|
|
38194
38198
|
let camera;
|
|
38195
|
-
let
|
|
38199
|
+
let projectGuid;
|
|
38196
38200
|
let sentExpr = expr;
|
|
38197
38201
|
let sentSteps = steps;
|
|
38198
38202
|
if (opts.camera) assertCameraFile(opts.camera);
|
|
@@ -38200,7 +38204,7 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38200
38204
|
try {
|
|
38201
38205
|
if (opts.restoreDb) {
|
|
38202
38206
|
const { config } = await resolveProjectContext({});
|
|
38203
|
-
|
|
38207
|
+
projectGuid = config.projectGuid;
|
|
38204
38208
|
const database = await resolveDatabase(config.projectGuid);
|
|
38205
38209
|
if (!database) {
|
|
38206
38210
|
console.error(muted("--restore-db: this project has no database - nothing to roll back."));
|
|
@@ -38212,17 +38216,17 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38212
38216
|
}
|
|
38213
38217
|
if (fixturePaths.length || opts.camera) {
|
|
38214
38218
|
const { config } = await resolveProjectContext({});
|
|
38215
|
-
|
|
38219
|
+
projectGuid = config.projectGuid;
|
|
38216
38220
|
}
|
|
38217
38221
|
const hostStart = Date.now();
|
|
38218
38222
|
if (opts.camera) {
|
|
38219
38223
|
console.log(muted(`Hosting camera feed ${opts.camera}...`));
|
|
38220
|
-
camera = await uploadCameraFeed(
|
|
38224
|
+
camera = await uploadCameraFeed(projectGuid, opts.camera);
|
|
38221
38225
|
}
|
|
38222
38226
|
if (fixturePaths.length) {
|
|
38223
38227
|
for (const p of fixturePaths) {
|
|
38224
38228
|
console.log(muted(`Hosting fixture ${p}...`));
|
|
38225
|
-
hosted.push(await uploadPublicFixture(
|
|
38229
|
+
hosted.push(await uploadPublicFixture(projectGuid, p));
|
|
38226
38230
|
}
|
|
38227
38231
|
const map = {};
|
|
38228
38232
|
for (const h of hosted) map[h.name] = h.url;
|
|
@@ -38359,7 +38363,7 @@ ${bold("After reload")} ${muted("(page reloaded in place: storage preserved)")}`
|
|
|
38359
38363
|
}
|
|
38360
38364
|
for (const h of [...hosted, ...camera ? [camera] : []]) {
|
|
38361
38365
|
try {
|
|
38362
|
-
await deleteFixture(
|
|
38366
|
+
await deleteFixture(projectGuid, h.guid);
|
|
38363
38367
|
} catch (err) {
|
|
38364
38368
|
console.error(warning(`\u26A0 Could not auto-delete fixture "${h.name}" (${h.guid}): still hosted at ${h.url}: ${err.message}`));
|
|
38365
38369
|
}
|
|
@@ -38686,14 +38690,14 @@ var pageScreenshotCommand = new Command("screenshot").description("Screenshot a
|
|
|
38686
38690
|
const ts2 = timestampSlug();
|
|
38687
38691
|
const shotName = (vp2) => defaultFilename(slug, ts2, vp2 && userSpecifiedViewports ? dimSuffix(vp2) : void 0);
|
|
38688
38692
|
const names = userSpecifiedViewports ? customViewports.map(shotName) : [shotName()];
|
|
38689
|
-
const
|
|
38693
|
+
const projectGuid = getConfig()?.projectGuid;
|
|
38690
38694
|
const outputArg = opts.output ?? OUTPUT_ALIAS_FLAGS.map((f) => opts[f.slice(2)]).find(Boolean);
|
|
38691
38695
|
let camera;
|
|
38692
38696
|
if (opts.camera) {
|
|
38693
38697
|
assertCameraFile(opts.camera);
|
|
38694
|
-
if (!
|
|
38698
|
+
if (!projectGuid) throw new Error("--camera needs a linked project (the frame is hosted for the browser to fetch): run `gipity link` first.");
|
|
38695
38699
|
console.log(muted(`Hosting camera feed ${opts.camera}...`));
|
|
38696
|
-
camera = await uploadCameraFeed(
|
|
38700
|
+
camera = await uploadCameraFeed(projectGuid, opts.camera);
|
|
38697
38701
|
}
|
|
38698
38702
|
const preCapture = [
|
|
38699
38703
|
opts.waitFor ? buildWaitForGate(opts.waitFor, waitForTimeoutMs) : "",
|
|
@@ -38723,7 +38727,7 @@ var pageScreenshotCommand = new Command("screenshot").description("Screenshot a
|
|
|
38723
38727
|
} finally {
|
|
38724
38728
|
if (camera) {
|
|
38725
38729
|
try {
|
|
38726
|
-
await deleteFixture(
|
|
38730
|
+
await deleteFixture(projectGuid, camera.guid);
|
|
38727
38731
|
} catch (err) {
|
|
38728
38732
|
console.error(warning(`\u26A0 Could not auto-delete camera feed "${camera.name}" (${camera.guid}): still hosted at ${camera.url}: ${err.message}`));
|
|
38729
38733
|
}
|
|
@@ -39194,9 +39198,9 @@ function pageAccessLabel(mode) {
|
|
|
39194
39198
|
}
|
|
39195
39199
|
|
|
39196
39200
|
// src/commands/status.ts
|
|
39197
|
-
async function probePageAccess(
|
|
39201
|
+
async function probePageAccess(projectGuid) {
|
|
39198
39202
|
const timeout = new Promise((res) => setTimeout(() => res(null), 5e3).unref?.());
|
|
39199
|
-
const call = get(`/projects/${
|
|
39203
|
+
const call = get(`/projects/${projectGuid}`).then(
|
|
39200
39204
|
(res) => res.data?.page_access ?? null,
|
|
39201
39205
|
() => null
|
|
39202
39206
|
);
|
|
@@ -39668,10 +39672,10 @@ dbCommand.command("list").description("List databases").option("--all", "List da
|
|
|
39668
39672
|
grouped.get(key).push(db2);
|
|
39669
39673
|
}
|
|
39670
39674
|
let first = true;
|
|
39671
|
-
for (const [
|
|
39675
|
+
for (const [projectGuid, dbs] of grouped) {
|
|
39672
39676
|
if (!first) console.log("");
|
|
39673
39677
|
first = false;
|
|
39674
|
-
const label2 = dbs[0].projectSlug || dbs[0].projectName ||
|
|
39678
|
+
const label2 = dbs[0].projectSlug || dbs[0].projectName || projectGuid;
|
|
39675
39679
|
console.log(label2);
|
|
39676
39680
|
for (const db2 of dbs) {
|
|
39677
39681
|
console.log(`${db2.friendlyName}`);
|
|
@@ -41736,20 +41740,20 @@ function truncLine(title, items, maxW, labelW) {
|
|
|
41736
41740
|
const prefix = bold(title) + ": " + padding;
|
|
41737
41741
|
const budget = maxW - prefixLen;
|
|
41738
41742
|
if (budget <= 3) return prefix;
|
|
41739
|
-
let
|
|
41743
|
+
let plain2 = "";
|
|
41740
41744
|
let display2 = "";
|
|
41741
41745
|
for (let i = 0; i < items.length; i++) {
|
|
41742
41746
|
const joiner = i === 0 ? "" : " \xB7 ";
|
|
41743
41747
|
const candidate = joiner + items[i];
|
|
41744
|
-
if (
|
|
41745
|
-
if (
|
|
41748
|
+
if (plain2.length + candidate.length > budget) {
|
|
41749
|
+
if (plain2.length + joiner.length + 3 <= budget) {
|
|
41746
41750
|
display2 += joiner + "...";
|
|
41747
41751
|
} else {
|
|
41748
41752
|
display2 = display2.substring(0, Math.max(0, budget - 3)) + "...";
|
|
41749
41753
|
}
|
|
41750
41754
|
return prefix + display2;
|
|
41751
41755
|
}
|
|
41752
|
-
|
|
41756
|
+
plain2 += candidate;
|
|
41753
41757
|
display2 += candidate;
|
|
41754
41758
|
}
|
|
41755
41759
|
return prefix + display2;
|
|
@@ -41902,10 +41906,10 @@ function reportSyncResult(result) {
|
|
|
41902
41906
|
console.log(` ${muted("Nothing was deleted. Re-run `gipity sync` to finish the pull.")}`);
|
|
41903
41907
|
}
|
|
41904
41908
|
}
|
|
41905
|
-
async function fetchProjectStats(
|
|
41906
|
-
if (
|
|
41909
|
+
async function fetchProjectStats(projectGuid, cwd) {
|
|
41910
|
+
if (projectGuid) {
|
|
41907
41911
|
try {
|
|
41908
|
-
const res = await get(`/projects/${encodeURIComponent(
|
|
41912
|
+
const res = await get(`/projects/${encodeURIComponent(projectGuid)}/files/stats`);
|
|
41909
41913
|
const d = res.data;
|
|
41910
41914
|
const topLevelNames = d.top_level.map((e) => e.type === "directory" ? `${e.name}/` : e.name);
|
|
41911
41915
|
return {
|
|
@@ -43128,7 +43132,7 @@ Examples:
|
|
|
43128
43132
|
|
|
43129
43133
|
Assets are generated server-side into src/images/ (+ src/manifest.webmanifest)
|
|
43130
43134
|
and are versioned like any other file - rollback restores previous ones.`);
|
|
43131
|
-
brandCommand.command("show", { isDefault: true }).description("Show the stored brand and the resolved render spec").option(
|
|
43135
|
+
brandCommand.command("show", { isDefault: true }).description("Show the stored brand and the resolved render spec").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Brand", async () => {
|
|
43132
43136
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
43133
43137
|
const res = await get(`/projects/${config.projectGuid}/brand`);
|
|
43134
43138
|
if (opts.json) {
|
|
@@ -43140,7 +43144,7 @@ brandCommand.command("show", { isDefault: true }).description("Show the stored b
|
|
|
43140
43144
|
Assets: ${(res.data.assets ?? []).join(", ")}`));
|
|
43141
43145
|
console.log(muted(`Change it: gipity brand set --emoji \u{1F3A8} | --glyph A | --color "#RRGGBB" | --tagline "..."`));
|
|
43142
43146
|
}));
|
|
43143
|
-
brandCommand.command("set").description("Change brand fields and regenerate all assets").option("--emoji <emoji>", "Emoji glyph for the icon + share card (e.g. \u{1F98D})").option("--glyph <char>", "Letter/digit glyph (alias of --emoji, any single character)").option("--color <hex>", "Accent color, #RRGGBB").option("--name <name>", "Display name override (og/share title stays the page title)").option("--tagline <text>", "One-line subtitle on the share card (max 120 chars)").option("--fix-head", "Also splice the share/SEO head block into src/index.html (for apps installed before templates shipped it)").option("--no-regenerate", "Store the fields without re-rendering assets").option(
|
|
43147
|
+
brandCommand.command("set").description("Change brand fields and regenerate all assets").option("--emoji <emoji>", "Emoji glyph for the icon + share card (e.g. \u{1F98D})").option("--glyph <char>", "Letter/digit glyph (alias of --emoji, any single character)").option("--color <hex>", "Accent color, #RRGGBB").option("--name <name>", "Display name override (og/share title stays the page title)").option("--tagline <text>", "One-line subtitle on the share card (max 120 chars)").option("--fix-head", "Also splice the share/SEO head block into src/index.html (for apps installed before templates shipped it)").option("--no-regenerate", "Store the fields without re-rendering assets").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Brand", async () => {
|
|
43144
43148
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
43145
43149
|
const body = {};
|
|
43146
43150
|
const glyph = opts.emoji ?? opts.glyph;
|
|
@@ -43164,7 +43168,7 @@ brandCommand.command("set").description("Change brand fields and regenerate all
|
|
|
43164
43168
|
printBrand(res.data);
|
|
43165
43169
|
reportFiles(res.data.files ?? []);
|
|
43166
43170
|
}));
|
|
43167
|
-
brandCommand.command("apply").description("Re-render all brand assets from the stored brand (no field changes)").option("--fix-head", "Also splice the share/SEO head block into src/index.html (for apps installed before templates shipped it)").option(
|
|
43171
|
+
brandCommand.command("apply").description("Re-render all brand assets from the stored brand (no field changes)").option("--fix-head", "Also splice the share/SEO head block into src/index.html (for apps installed before templates shipped it)").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Brand", async () => {
|
|
43168
43172
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
43169
43173
|
const body = opts.fixHead ? { fix_head: true } : {};
|
|
43170
43174
|
const res = await post(`/projects/${config.projectGuid}/brand`, body);
|
|
@@ -44400,11 +44404,11 @@ ${error(`error: ${log3.error_message}`)}`;
|
|
|
44400
44404
|
return line;
|
|
44401
44405
|
});
|
|
44402
44406
|
}));
|
|
44403
|
-
async function callAnon(
|
|
44407
|
+
async function callAnon(projectGuid, name, body) {
|
|
44404
44408
|
return publicPost(
|
|
44405
|
-
`/api/${
|
|
44409
|
+
`/api/${projectGuid}/fn/${encodeURIComponent(name)}`,
|
|
44406
44410
|
body,
|
|
44407
|
-
await mintAppToken(
|
|
44411
|
+
await mintAppToken(projectGuid)
|
|
44408
44412
|
);
|
|
44409
44413
|
}
|
|
44410
44414
|
fnCommand.command("call <name> [body]").description("Call a function").option("-d, --data <json>", "JSON request body: inline JSON, @file to read a file, or @- / - for stdin").option("--file <field=@path>", "Attach a file as { data, media_type } under <field> (the vision/media service shape), repeatable, e.g. --file image=@receipt.png", (v7, acc) => (acc || []).concat(v7)).option("--anon", "Call as an anonymous visitor (the public path a signed-out user hits) instead of as your signed-in account").option("--field <path>", "Print only this field of the result (dot path, e.g. items.0.short_guid)").option("--json", "Output as JSON").action((name, bodyArg, opts) => run("Call", async () => {
|
|
@@ -44540,7 +44544,7 @@ async function scopeQuery(opts) {
|
|
|
44540
44544
|
return `scope=project&app_guid=${config.projectGuid}`;
|
|
44541
44545
|
}
|
|
44542
44546
|
var secretsCommand = new Command("secrets").description("Manage app secrets").addHelpText("after", '\nEncrypted API keys and tokens for your app, read in functions via secrets.get("NAME").\nValues are write-only: no command prints a stored value back.');
|
|
44543
|
-
secretsCommand.command("list").alias("ls").description("List secret names (never values). Project secrets by default; --account for account-wide").option("--account", "Account-wide secrets shared across all your projects").option(
|
|
44547
|
+
secretsCommand.command("list").alias("ls").description("List secret names (never values). Project secrets by default; --account for account-wide").option("--account", "Account-wide secrets shared across all your projects").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Secrets", async () => {
|
|
44544
44548
|
const res = await get(`/secrets?${await scopeQuery(opts)}`);
|
|
44545
44549
|
if (opts.json) {
|
|
44546
44550
|
console.log(JSON.stringify(res.data));
|
|
@@ -44557,7 +44561,7 @@ secretsCommand.command("list").alias("ls").description("List secret names (never
|
|
|
44557
44561
|
console.log(` ${s.name} ${masked} ${muted(`updated ${new Date(s.updated_at).toLocaleDateString()}`)}`);
|
|
44558
44562
|
}
|
|
44559
44563
|
}));
|
|
44560
|
-
secretsCommand.command("get <name>").description("Secret values are write-only: confirms the secret exists, never prints its value").option("--account", "Look in account-wide secrets").option(
|
|
44564
|
+
secretsCommand.command("get <name>").description("Secret values are write-only: confirms the secret exists, never prints its value").option("--account", "Look in account-wide secrets").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((name, opts) => run("Secrets", async () => {
|
|
44561
44565
|
const res = await get(`/secrets?${await scopeQuery(opts)}`);
|
|
44562
44566
|
const scope = opts.account ? "account-wide" : "project";
|
|
44563
44567
|
const found = res.data.find((s) => s.name === name);
|
|
@@ -44567,7 +44571,7 @@ secretsCommand.command("get <name>").description("Secret values are write-only:
|
|
|
44567
44571
|
`secret values are write-only and are never shown. '${name}' exists${ends}; only a deployed function can read it, with secrets.get('${name}'). To hand a value to another service too, generate it yourself, keep it, then store it: TOK=$(openssl rand -hex 24); gipity secrets set ${name} "$TOK"; echo "$TOK". Setting it again replaces the live value.`
|
|
44568
44572
|
);
|
|
44569
44573
|
}));
|
|
44570
|
-
secretsCommand.command("set <name> <value>").description("Create or update a secret (UPPER_SNAKE_CASE name). Encrypted at rest; never echoed back").option("--account", "Store account-wide (shared across all your projects)").option(
|
|
44574
|
+
secretsCommand.command("set <name> <value>").description("Create or update a secret (UPPER_SNAKE_CASE name). Encrypted at rest; never echoed back").option("--account", "Store account-wide (shared across all your projects)").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((name, value, opts) => run("Secrets", async () => {
|
|
44571
44575
|
const res = await put(`/secrets?${await scopeQuery(opts)}`, { name, value });
|
|
44572
44576
|
if (opts.json) {
|
|
44573
44577
|
console.log(JSON.stringify(res.data));
|
|
@@ -44576,7 +44580,7 @@ secretsCommand.command("set <name> <value>").description("Create or update a sec
|
|
|
44576
44580
|
const scope = opts.account ? "account-wide" : "project";
|
|
44577
44581
|
console.log(success(`\u2713 Secret '${res.data.name}' saved (encrypted, ${scope}). Read it in a function with secrets.get('${res.data.name}').`));
|
|
44578
44582
|
}));
|
|
44579
|
-
secretsCommand.command("rm <name>").alias("delete").description("Delete a secret").option("--account", "Delete from account-wide secrets").option(
|
|
44583
|
+
secretsCommand.command("rm <name>").alias("delete").description("Delete a secret").option("--account", "Delete from account-wide secrets").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((name, opts) => run("Secrets", async () => {
|
|
44580
44584
|
const res = await del(`/secrets/${encodeURIComponent(name)}?${await scopeQuery(opts)}`);
|
|
44581
44585
|
if (opts.json) {
|
|
44582
44586
|
console.log(JSON.stringify(res.data));
|
|
@@ -44588,17 +44592,16 @@ secretsCommand.command("rm <name>").alias("delete").description("Delete a secret
|
|
|
44588
44592
|
|
|
44589
44593
|
// src/commands/notify.ts
|
|
44590
44594
|
init_api();
|
|
44591
|
-
init_config();
|
|
44592
44595
|
init_colors();
|
|
44593
44596
|
import { readFileSync as readFileSync22 } from "fs";
|
|
44594
44597
|
var notifyCommand = new Command("notify").description("Push notifications (web and native iOS)").addHelpText("after", "\nGipity Notify: send a test notification, inspect subscriptions, or set up iOS push (notify apns).");
|
|
44595
|
-
notifyCommand.command("test").description("Send a test push notification (web and iOS devices) to a user or everyone").option("--to <who>", "Recipient: a user guid, comma-separated guids, or 'all'", "all").option("--title <text>", "Notification title", "Test notification").option("--body <text>", "Notification body", "Hello from Gipity Notify \u{1F44B}").option("--url <url>", "URL to open when the notification is clicked").option(
|
|
44596
|
-
const
|
|
44598
|
+
notifyCommand.command("test").description("Send a test push notification (web and iOS devices) to a user or everyone").option("--to <who>", "Recipient: a user guid, comma-separated guids, or 'all'", "all").option("--title <text>", "Notification title", "Test notification").option("--body <text>", "Notification body", "Hello from Gipity Notify \u{1F44B}").option("--url <url>", "URL to open when the notification is clicked").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Notify", async () => {
|
|
44599
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44597
44600
|
const to2 = opts.to === "all" ? "all" : opts.to.includes(",") ? opts.to.split(",").map((s) => s.trim()) : opts.to;
|
|
44598
44601
|
const notification = { title: opts.title, body: opts.body };
|
|
44599
44602
|
if (opts.url) notification.url = opts.url;
|
|
44600
44603
|
const res = await post(
|
|
44601
|
-
`/api/${
|
|
44604
|
+
`/api/${projectGuid}/services/notify/send`,
|
|
44602
44605
|
{ to: to2, notification }
|
|
44603
44606
|
);
|
|
44604
44607
|
if (opts.json) {
|
|
@@ -44622,10 +44625,10 @@ notifyCommand.command("test").description("Send a test push notification (web an
|
|
|
44622
44625
|
}
|
|
44623
44626
|
}
|
|
44624
44627
|
}));
|
|
44625
|
-
notifyCommand.command("subs").description("Show how many push subscriptions this app has, per user").option(
|
|
44626
|
-
const
|
|
44628
|
+
notifyCommand.command("subs").description("Show how many push subscriptions this app has, per user").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Notify", async () => {
|
|
44629
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44627
44630
|
const res = await get(
|
|
44628
|
-
`/api/${
|
|
44631
|
+
`/api/${projectGuid}/services/notify/subs`
|
|
44629
44632
|
);
|
|
44630
44633
|
if (opts.json) {
|
|
44631
44634
|
console.log(JSON.stringify(res.data));
|
|
@@ -44638,10 +44641,10 @@ notifyCommand.command("subs").description("Show how many push subscriptions this
|
|
|
44638
44641
|
console.log(` ${r.user_guid} ${muted(`${r.count} device${r.count === 1 ? "" : "s"}${split}`)}`);
|
|
44639
44642
|
}
|
|
44640
44643
|
}));
|
|
44641
|
-
notifyCommand.command("rm").description("Remove a user's push subscriptions and iOS devices (e.g. on account deletion)").requiredOption("--user <guid>", "User guid whose subscriptions to remove").option(
|
|
44642
|
-
const
|
|
44644
|
+
notifyCommand.command("rm").description("Remove a user's push subscriptions and iOS devices (e.g. on account deletion)").requiredOption("--user <guid>", "User guid whose subscriptions to remove").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Notify", async () => {
|
|
44645
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44643
44646
|
const res = await post(
|
|
44644
|
-
`/api/${
|
|
44647
|
+
`/api/${projectGuid}/services/notify/remove`,
|
|
44645
44648
|
{ user_guid: opts.user }
|
|
44646
44649
|
);
|
|
44647
44650
|
if (opts.json) {
|
|
@@ -44670,15 +44673,15 @@ AuthKey_<KEYID>.p8 file, then:
|
|
|
44670
44673
|
|
|
44671
44674
|
The key is stored encrypted and never shown again. Your app registers each
|
|
44672
44675
|
device with POST /api/<app-guid>/notify/devices; notify() then reaches it.`);
|
|
44673
|
-
apnsCommand.command("set").description("Store the APNs key for this app (all environments use it)").requiredOption("--team-id <id>", "Your 10-character Apple Team ID").requiredOption("--key-id <id>", "The 10-character Key ID of the APNs key").requiredOption("--p8 <file>", "Path to the AuthKey_<KEYID>.p8 file").requiredOption("--bundle-id <id>", "Your app bundle id, e.g. com.example.myapp").option("--sandbox", "Devices that register without an environment use the sandbox (development builds)").option(
|
|
44674
|
-
const
|
|
44676
|
+
apnsCommand.command("set").description("Store the APNs key for this app (all environments use it)").requiredOption("--team-id <id>", "Your 10-character Apple Team ID").requiredOption("--key-id <id>", "The 10-character Key ID of the APNs key").requiredOption("--p8 <file>", "Path to the AuthKey_<KEYID>.p8 file").requiredOption("--bundle-id <id>", "Your app bundle id, e.g. com.example.myapp").option("--sandbox", "Devices that register without an environment use the sandbox (development builds)").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Notify", async () => {
|
|
44677
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44675
44678
|
let p8;
|
|
44676
44679
|
try {
|
|
44677
44680
|
p8 = readFileSync22(opts.p8, "utf-8");
|
|
44678
44681
|
} catch {
|
|
44679
44682
|
throw new Error(`Can't read ${opts.p8}. Pass the path to the AuthKey_<KEYID>.p8 file from Apple.`);
|
|
44680
44683
|
}
|
|
44681
|
-
const res = await put(`/api/${
|
|
44684
|
+
const res = await put(`/api/${projectGuid}/services/notify/apns`, {
|
|
44682
44685
|
team_id: opts.teamId,
|
|
44683
44686
|
key_id: opts.keyId,
|
|
44684
44687
|
bundle_id: opts.bundleId,
|
|
@@ -44692,18 +44695,18 @@ apnsCommand.command("set").description("Store the APNs key for this app (all env
|
|
|
44692
44695
|
console.log(success("\u2713 iOS push is set up."));
|
|
44693
44696
|
printApns(res.data);
|
|
44694
44697
|
}));
|
|
44695
|
-
apnsCommand.command("show").description("Show the APNs setup for this app (never the key itself)").option(
|
|
44696
|
-
const
|
|
44697
|
-
const res = await get(`/api/${
|
|
44698
|
+
apnsCommand.command("show").description("Show the APNs setup for this app (never the key itself)").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Notify", async () => {
|
|
44699
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44700
|
+
const res = await get(`/api/${projectGuid}/services/notify/apns`);
|
|
44698
44701
|
if (opts.json) {
|
|
44699
44702
|
console.log(JSON.stringify(res.data));
|
|
44700
44703
|
return;
|
|
44701
44704
|
}
|
|
44702
44705
|
printApns(res.data);
|
|
44703
44706
|
}));
|
|
44704
|
-
apnsCommand.command("rm").description("Remove the APNs key (iOS devices stop receiving notifications)").option(
|
|
44705
|
-
const
|
|
44706
|
-
const res = await del(`/api/${
|
|
44707
|
+
apnsCommand.command("rm").description("Remove the APNs key (iOS devices stop receiving notifications)").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Notify", async () => {
|
|
44708
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44709
|
+
const res = await del(`/api/${projectGuid}/services/notify/apns`);
|
|
44707
44710
|
if (opts.json) {
|
|
44708
44711
|
console.log(JSON.stringify(res.data));
|
|
44709
44712
|
return;
|
|
@@ -45126,11 +45129,11 @@ jobCommand.command("cancel <runGuid>").description("Cancel a queued or running j
|
|
|
45126
45129
|
}
|
|
45127
45130
|
}));
|
|
45128
45131
|
jobCommand.command("run-local <name>").description("Run the job in a local Docker container against your local filesystem (no platform round-trip)").option("--image <image>", "Docker image to run inside", "easyclaw/sandbox:latest").option("--no-deps", "Skip pip/npm install even if a deps file is present").option("--json", "Capture the job's output and print one JSON result (exitCode, stdout, stderr) instead of streaming it").action(async (name, opts) => {
|
|
45129
|
-
const { existsSync:
|
|
45130
|
-
const { resolve: resolve21, join:
|
|
45132
|
+
const { existsSync: existsSync29, statSync: statSync12 } = await import("node:fs");
|
|
45133
|
+
const { resolve: resolve21, join: join35 } = await import("node:path");
|
|
45131
45134
|
const { spawnCommand: spawnCommand2, spawnSyncCommand: spawnSyncCommand2 } = await Promise.resolve().then(() => (init_platform(), platform_exports));
|
|
45132
45135
|
const jobDir = resolve21(process.cwd(), "jobs", name);
|
|
45133
|
-
if (!
|
|
45136
|
+
if (!existsSync29(jobDir) || !statSync12(jobDir).isDirectory()) {
|
|
45134
45137
|
console.error(error(`jobs/${name}/ not found in current directory`));
|
|
45135
45138
|
process.exit(1);
|
|
45136
45139
|
}
|
|
@@ -45151,7 +45154,7 @@ jobCommand.command("run-local <name>").description("Run the job in a local Docke
|
|
|
45151
45154
|
},
|
|
45152
45155
|
{ file: "main.sh", runtime: "bash", entry: "bash" }
|
|
45153
45156
|
];
|
|
45154
|
-
const picked = variants.find((v7) =>
|
|
45157
|
+
const picked = variants.find((v7) => existsSync29(join35(jobDir, v7.file)));
|
|
45155
45158
|
if (!picked) {
|
|
45156
45159
|
console.error(error(`No main.py / main.js / main.sh found under jobs/${name}/`));
|
|
45157
45160
|
process.exit(1);
|
|
@@ -45176,7 +45179,7 @@ jobCommand.command("run-local <name>").description("Run the job in a local Docke
|
|
|
45176
45179
|
"-v",
|
|
45177
45180
|
`${jobDir}:/work`
|
|
45178
45181
|
];
|
|
45179
|
-
const needsDeps = opts.deps !== false && picked.depsFile && picked.installCmd &&
|
|
45182
|
+
const needsDeps = opts.deps !== false && picked.depsFile && picked.installCmd && existsSync29(join35(jobDir, picked.depsFile));
|
|
45180
45183
|
const handlerCmd = `${picked.entry} /work/${picked.file}`;
|
|
45181
45184
|
let shellCmd;
|
|
45182
45185
|
if (needsDeps && picked.installCmd) {
|
|
@@ -45301,7 +45304,7 @@ init_api();
|
|
|
45301
45304
|
init_config();
|
|
45302
45305
|
init_colors();
|
|
45303
45306
|
var emailCommand = new Command("email").description("Test and inspect a deployed app's email() sends");
|
|
45304
|
-
emailCommand.command("test").description("Send a test email through your app's email() path (owner-billed)").argument("<to>", "Recipient address, or 'owner' for the app owner's own account email").option("--subject <text>", "Subject", "Test email from Gipity").option("--text <text>", "Body text", "This is a test email sent through your app's email() service. \u2709\uFE0F").option("--reply-to <email>", "Reply-To address").option("--from-name <name>", "Sender display name (address stays gipity@gipity.ai)").option(
|
|
45307
|
+
emailCommand.command("test").description("Send a test email through your app's email() path (owner-billed)").argument("<to>", "Recipient address, or 'owner' for the app owner's own account email").option("--subject <text>", "Subject", "Test email from Gipity").option("--text <text>", "Body text", "This is a test email sent through your app's email() service. \u2709\uFE0F").option("--reply-to <email>", "Reply-To address").option("--from-name <name>", "Sender display name (address stays gipity@gipity.ai)").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((to2, opts) => run("Email", async () => {
|
|
45305
45308
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
45306
45309
|
const payload = { to: to2, subject: opts.subject, text: opts.text };
|
|
45307
45310
|
if (opts.replyTo) payload.replyTo = opts.replyTo;
|
|
@@ -45321,7 +45324,7 @@ emailCommand.command("test").description("Send a test email through your app's e
|
|
|
45321
45324
|
console.log(muted(` ${r.to} - ${r.status}${r.reason ? `: ${r.reason}` : ""}`));
|
|
45322
45325
|
}
|
|
45323
45326
|
}));
|
|
45324
|
-
emailCommand.command("log").description("Recent email() sends and skipped attempts from your app").addOption(new Option("--range <range>", "Time range").choices(["1h", "24h", "7d", "30d", "1y"]).default("7d")).option("--limit <n>", "Max rows", "50").option(
|
|
45327
|
+
emailCommand.command("log").description("Recent email() sends and skipped attempts from your app").addOption(new Option("--range <range>", "Time range").choices(["1h", "24h", "7d", "30d", "1y"]).default("7d")).option("--limit <n>", "Max rows", "50").option(...PROJECT_OPTION).option("--json", "Output raw JSON").action((opts) => run("Email", async () => {
|
|
45325
45328
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
45326
45329
|
const res = await get(
|
|
45327
45330
|
`/account/logs/credits?operations=email_send,email_skip&app_guid=${config.projectGuid}&range=${encodeURIComponent(opts.range)}&limit=${encodeURIComponent(opts.limit)}`
|
|
@@ -45400,12 +45403,12 @@ function statusText(g) {
|
|
|
45400
45403
|
return "expired: it waited too long in the queue (not charged)";
|
|
45401
45404
|
}
|
|
45402
45405
|
}
|
|
45403
|
-
async function submitGenerations(
|
|
45404
|
-
const res = await post(gensPath(
|
|
45406
|
+
async function submitGenerations(projectGuid, body) {
|
|
45407
|
+
const res = await post(gensPath(projectGuid), body);
|
|
45405
45408
|
return res.data;
|
|
45406
45409
|
}
|
|
45407
|
-
async function fetchGenerations(
|
|
45408
|
-
const res = await get(`${gensPath(
|
|
45410
|
+
async function fetchGenerations(projectGuid, ids) {
|
|
45411
|
+
const res = await get(`${gensPath(projectGuid)}?ids=${ids.map(encodeURIComponent).join(",")}`);
|
|
45409
45412
|
return res.data;
|
|
45410
45413
|
}
|
|
45411
45414
|
function combinedText(gens) {
|
|
@@ -45414,7 +45417,7 @@ function combinedText(gens) {
|
|
|
45414
45417
|
const live = gens.find((g) => !TERMINAL.has(g.status));
|
|
45415
45418
|
return `${done}/${gens.length} finished${live ? `; ${statusText(live)}` : ""}`;
|
|
45416
45419
|
}
|
|
45417
|
-
async function waitForGenerations(
|
|
45420
|
+
async function waitForGenerations(projectGuid, initial, opts = {}) {
|
|
45418
45421
|
const ids = initial.map((g) => g.id);
|
|
45419
45422
|
const tty = !!process.stdout.isTTY && !opts.json;
|
|
45420
45423
|
const say = (line) => opts.json ? console.error(line) : console.log(line);
|
|
@@ -45446,7 +45449,7 @@ async function waitForGenerations(projectGuid2, initial, opts = {}) {
|
|
|
45446
45449
|
while (!gens.every((g) => TERMINAL.has(g.status))) {
|
|
45447
45450
|
await sleepUnlessInterrupted(pollMs(), () => interrupted);
|
|
45448
45451
|
if (interrupted) break;
|
|
45449
|
-
gens = await fetchGenerations(
|
|
45452
|
+
gens = await fetchGenerations(projectGuid, ids);
|
|
45450
45453
|
draw(combinedText(gens));
|
|
45451
45454
|
}
|
|
45452
45455
|
} finally {
|
|
@@ -45456,7 +45459,7 @@ async function waitForGenerations(projectGuid2, initial, opts = {}) {
|
|
|
45456
45459
|
if (interrupted) {
|
|
45457
45460
|
const open = gens.filter((g) => !TERMINAL.has(g.status)).map((g) => g.id);
|
|
45458
45461
|
if (process.stdin.isTTY && await confirm(`Cancel ${open.length === 1 ? "the generation" : `${open.length} generations`}? No leaves ${open.length === 1 ? "it" : "them"} queued`, { default: "no", headless: "no" })) {
|
|
45459
|
-
for (const id2 of open) await post(`${gensPath(
|
|
45462
|
+
for (const id2 of open) await post(`${gensPath(projectGuid)}/${encodeURIComponent(id2)}/cancel`);
|
|
45460
45463
|
console.log(muted(`Cancelled ${open.join(" ")} (not charged).`));
|
|
45461
45464
|
} else {
|
|
45462
45465
|
console.error(muted(`Left queued. Check later with: gipity generate status ${open.join(" ")}`));
|
|
@@ -45813,13 +45816,13 @@ function numberedPath(base, i, n) {
|
|
|
45813
45816
|
const slash = Math.max(base.lastIndexOf("/"), base.lastIndexOf("\\"));
|
|
45814
45817
|
return dot > slash ? `${base.slice(0, dot)}-${i + 1}${base.slice(dot)}` : `${base}-${i + 1}`;
|
|
45815
45818
|
}
|
|
45816
|
-
async function generateQueued(
|
|
45819
|
+
async function generateQueued(projectGuid, prompt2, opts) {
|
|
45817
45820
|
if (opts.input) throw new Error("--input editing is not available on queued generations; drop --input or pick a cloud model.");
|
|
45818
45821
|
if (!opts.model || !String(opts.model).startsWith("gipity-")) {
|
|
45819
45822
|
throw new Error("--no-wait is for Gipity GPU models (--model gipity-...; see `gipity generate models`). Cloud models render right away: drop --no-wait.");
|
|
45820
45823
|
}
|
|
45821
45824
|
const started = Date.now();
|
|
45822
|
-
const submitted = await submitGenerations(
|
|
45825
|
+
const submitted = await submitGenerations(projectGuid, {
|
|
45823
45826
|
model: opts.model,
|
|
45824
45827
|
prompt: prompt2,
|
|
45825
45828
|
avoid: opts.avoid,
|
|
@@ -45841,7 +45844,7 @@ async function generateQueued(projectGuid2, prompt2, opts) {
|
|
|
45841
45844
|
return;
|
|
45842
45845
|
}
|
|
45843
45846
|
if (!opts.json) console.log(muted(`Queued ${submitted.length === 1 ? submitted[0].id : submitted.map((g) => g.id).join(", ")} on ${opts.model}`));
|
|
45844
|
-
const done = await waitForGenerations(
|
|
45847
|
+
const done = await waitForGenerations(projectGuid, submitted, { json: !!opts.json });
|
|
45845
45848
|
const elapsed = (Date.now() - started) / 1e3;
|
|
45846
45849
|
const saved = [];
|
|
45847
45850
|
for (let i = 0; i < done.length; i++) {
|
|
@@ -46649,7 +46652,7 @@ function undeployedFunctionsFromFailures(results) {
|
|
|
46649
46652
|
return [...names];
|
|
46650
46653
|
}
|
|
46651
46654
|
var LONG_RUN_MS = 6e4;
|
|
46652
|
-
async function pollTestStatus(
|
|
46655
|
+
async function pollTestStatus(projectGuid, runGuid, opts) {
|
|
46653
46656
|
const startTime = Date.now();
|
|
46654
46657
|
const getPollInterval = () => {
|
|
46655
46658
|
const elapsed = Date.now() - startTime;
|
|
@@ -46671,7 +46674,7 @@ async function pollTestStatus(projectGuid2, runGuid, opts) {
|
|
|
46671
46674
|
if (Date.now() - startTime > POLL_HARD_CAP_MS) {
|
|
46672
46675
|
throw new Error(`Test run ${runGuid} still not finished after ${Math.round(POLL_HARD_CAP_MS / 6e4)} minutes - giving up on the poll. Check it later with \`gipity test status ${runGuid}\` or re-run.`);
|
|
46673
46676
|
}
|
|
46674
|
-
const res = await get(`/projects/${
|
|
46677
|
+
const res = await get(`/projects/${projectGuid}/test/status/${runGuid}`);
|
|
46675
46678
|
const data = res.data;
|
|
46676
46679
|
if (!opts.json && data.results.length > lastResultCount) {
|
|
46677
46680
|
const newResults = data.results.slice(lastResultCount);
|
|
@@ -51387,6 +51390,137 @@ textCommand.action(() => {
|
|
|
51387
51390
|
textCommand.help();
|
|
51388
51391
|
});
|
|
51389
51392
|
|
|
51393
|
+
// src/commands/changelog.ts
|
|
51394
|
+
import { readFileSync as readFileSync35 } from "fs";
|
|
51395
|
+
import { join as join33 } from "path";
|
|
51396
|
+
init_colors();
|
|
51397
|
+
|
|
51398
|
+
// src/changelog.ts
|
|
51399
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync20, readFileSync as readFileSync34, writeFileSync as writeFileSync22 } from "fs";
|
|
51400
|
+
import { join as join32 } from "path";
|
|
51401
|
+
init_api();
|
|
51402
|
+
init_colors();
|
|
51403
|
+
var STATE_FILE2 = () => join32(GIPITY_DIR, "changelog.json");
|
|
51404
|
+
function readChangelogState() {
|
|
51405
|
+
if (!existsSync28(STATE_FILE2())) return null;
|
|
51406
|
+
try {
|
|
51407
|
+
const parsed = JSON.parse(readFileSync34(STATE_FILE2(), "utf-8"));
|
|
51408
|
+
return parsed && typeof parsed === "object" ? parsed : null;
|
|
51409
|
+
} catch {
|
|
51410
|
+
return null;
|
|
51411
|
+
}
|
|
51412
|
+
}
|
|
51413
|
+
function writeChangelogState(state) {
|
|
51414
|
+
mkdirSync20(GIPITY_DIR, { recursive: true });
|
|
51415
|
+
writeFileSync22(STATE_FILE2(), JSON.stringify(state, null, 2) + "\n");
|
|
51416
|
+
}
|
|
51417
|
+
function ensureChangelogState(currentCli) {
|
|
51418
|
+
const existing = readChangelogState();
|
|
51419
|
+
if (existing) return existing;
|
|
51420
|
+
const fresh = { baselineCli: currentCli, noticedCli: currentCli };
|
|
51421
|
+
writeChangelogState(fresh);
|
|
51422
|
+
return fresh;
|
|
51423
|
+
}
|
|
51424
|
+
async function fetchChangelog(query, timeoutMs) {
|
|
51425
|
+
const params = new URLSearchParams();
|
|
51426
|
+
if (query.since) params.set("since", query.since);
|
|
51427
|
+
if (query.last !== void 0) params.set("last", String(query.last));
|
|
51428
|
+
const res = await publicRequest(
|
|
51429
|
+
"GET",
|
|
51430
|
+
`/changelog?${params}`,
|
|
51431
|
+
void 0,
|
|
51432
|
+
void 0,
|
|
51433
|
+
timeoutMs
|
|
51434
|
+
);
|
|
51435
|
+
return res.data.entries;
|
|
51436
|
+
}
|
|
51437
|
+
async function fetchNewer(state, currentCli, timeoutMs) {
|
|
51438
|
+
if (state.seenEntry && state.seenDate) {
|
|
51439
|
+
const entries = await fetchChangelog({ since: state.seenDate }, timeoutMs);
|
|
51440
|
+
const at2 = entries.findIndex((e) => e.id === state.seenEntry);
|
|
51441
|
+
return at2 === -1 ? entries.filter((e) => e.date > state.seenDate) : entries.slice(0, at2);
|
|
51442
|
+
}
|
|
51443
|
+
return fetchChangelog({ since: `cli:${state.baselineCli ?? currentCli}` }, timeoutMs);
|
|
51444
|
+
}
|
|
51445
|
+
function markSeen(state, shown) {
|
|
51446
|
+
if (shown.length === 0) return state;
|
|
51447
|
+
const next = { ...state, seenEntry: shown[0].id, seenDate: shown[0].date };
|
|
51448
|
+
writeChangelogState(next);
|
|
51449
|
+
return next;
|
|
51450
|
+
}
|
|
51451
|
+
function updateNoticeLine(count) {
|
|
51452
|
+
if (count <= 0) return null;
|
|
51453
|
+
return `${muted(`${count} update${count === 1 ? "" : "s"} since you last looked:`)} ${brand("gipity changelog --newer")}`;
|
|
51454
|
+
}
|
|
51455
|
+
async function maybePrintUpdateNotice(currentCli, opts) {
|
|
51456
|
+
const state = ensureChangelogState(currentCli);
|
|
51457
|
+
if (!opts.interactive) return;
|
|
51458
|
+
if (state.noticedCli && compareSemver(currentCli, state.noticedCli) <= 0) return;
|
|
51459
|
+
writeChangelogState({ ...state, noticedCli: currentCli });
|
|
51460
|
+
let count;
|
|
51461
|
+
try {
|
|
51462
|
+
count = (await fetchNewer(state, currentCli, opts.timeoutMs ?? 2e3)).length;
|
|
51463
|
+
} catch {
|
|
51464
|
+
return;
|
|
51465
|
+
}
|
|
51466
|
+
const line = updateNoticeLine(count);
|
|
51467
|
+
if (line) (opts.print ?? console.log)(line);
|
|
51468
|
+
}
|
|
51469
|
+
|
|
51470
|
+
// src/commands/changelog.ts
|
|
51471
|
+
var DEFAULT_LAST = 10;
|
|
51472
|
+
function cliVersion2() {
|
|
51473
|
+
return JSON.parse(readFileSync35(join33(PKG_ROOT, "package.json"), "utf-8")).version;
|
|
51474
|
+
}
|
|
51475
|
+
var plain = (s) => s.replace(/`([^`]+)`/g, "$1");
|
|
51476
|
+
function formatEntries(entries) {
|
|
51477
|
+
const blocks = entries.map((e) => {
|
|
51478
|
+
const versions = [e.server ? `server ${e.server}` : "", e.cli ? `CLI ${e.cli}` : ""].filter(Boolean);
|
|
51479
|
+
const lines = [
|
|
51480
|
+
brand(bold(e.title)),
|
|
51481
|
+
muted([e.date, ...versions].join(", ")),
|
|
51482
|
+
...e.bullets.map((b7) => `- ${plain(b7)}`)
|
|
51483
|
+
];
|
|
51484
|
+
if (e.breaking.length) {
|
|
51485
|
+
lines.push(warning("Breaking:"));
|
|
51486
|
+
lines.push(...e.breaking.map((b7) => `- ${plain(b7)}`));
|
|
51487
|
+
}
|
|
51488
|
+
if (e.skills.length) {
|
|
51489
|
+
lines.push(muted(`Docs: ${e.skills.map((s) => `gipity skill read ${s}`).join(", ")}`));
|
|
51490
|
+
}
|
|
51491
|
+
return lines.join("\n");
|
|
51492
|
+
});
|
|
51493
|
+
return blocks.join("\n\n");
|
|
51494
|
+
}
|
|
51495
|
+
var changelogCommand = new Command("changelog").description("What's new in Gipity (--newer: since you last looked)").option("--newer", "Only what shipped since you (or your agent) last looked").option("--since <date|version>", "What shipped since a date (yyyy-mm-dd, that day included) or after a version (1.1.40, cli:1.1.40, server:9.14.781)").option("--last <n>", `Only the newest n entries (default ${DEFAULT_LAST} without --newer or --since)`).option("--json", "Output the entries as JSON").addHelpText("after", "\nAgents: run `gipity changelog --newer --json` to pull what changed since your docs into context.\n").action((opts) => run("Changelog", async () => {
|
|
51496
|
+
if (opts.newer && opts.since) throw new Error("use --newer or --since, not both");
|
|
51497
|
+
let last;
|
|
51498
|
+
if (opts.last !== void 0) {
|
|
51499
|
+
last = Number(opts.last);
|
|
51500
|
+
if (!Number.isInteger(last) || last < 1) throw new Error("--last must be a whole number of 1 or more");
|
|
51501
|
+
}
|
|
51502
|
+
const current = cliVersion2();
|
|
51503
|
+
const state = ensureChangelogState(current);
|
|
51504
|
+
let entries;
|
|
51505
|
+
if (opts.newer) {
|
|
51506
|
+
entries = await fetchNewer(state, current);
|
|
51507
|
+
if (last !== void 0) entries = entries.slice(0, last);
|
|
51508
|
+
} else {
|
|
51509
|
+
entries = await fetchChangelog({ since: opts.since, last: last ?? (opts.since ? void 0 : DEFAULT_LAST) });
|
|
51510
|
+
}
|
|
51511
|
+
markSeen(state, entries);
|
|
51512
|
+
if (opts.json) {
|
|
51513
|
+
console.log(JSON.stringify({ entries }, null, 2));
|
|
51514
|
+
return;
|
|
51515
|
+
}
|
|
51516
|
+
if (entries.length === 0) {
|
|
51517
|
+
console.log(opts.newer ? "Nothing new since you last looked." : "No changelog entries match.");
|
|
51518
|
+
return;
|
|
51519
|
+
}
|
|
51520
|
+
if (opts.newer) console.log(muted(`${entries.length} update${entries.length === 1 ? "" : "s"} since you last looked`) + "\n");
|
|
51521
|
+
console.log(formatEntries(entries));
|
|
51522
|
+
}));
|
|
51523
|
+
|
|
51390
51524
|
// src/help-skills.ts
|
|
51391
51525
|
init_api();
|
|
51392
51526
|
init_config();
|
|
@@ -51520,8 +51654,8 @@ function resolveTarget(argv2, program3) {
|
|
|
51520
51654
|
}
|
|
51521
51655
|
|
|
51522
51656
|
// src/trace.ts
|
|
51523
|
-
import { openSync as openSync5, writeSync, mkdirSync as
|
|
51524
|
-
import { join as
|
|
51657
|
+
import { openSync as openSync5, writeSync, mkdirSync as mkdirSync21 } from "fs";
|
|
51658
|
+
import { join as join34 } from "path";
|
|
51525
51659
|
import { homedir as homedir21 } from "os";
|
|
51526
51660
|
var TRACE_KEY = /* @__PURE__ */ Symbol.for("gipity.traceOutput");
|
|
51527
51661
|
function installOutputTrace(label2) {
|
|
@@ -51533,10 +51667,10 @@ function installOutputTrace(label2) {
|
|
|
51533
51667
|
existing.emit({ event: "reenter", label: label2 });
|
|
51534
51668
|
return;
|
|
51535
51669
|
}
|
|
51536
|
-
const dir =
|
|
51537
|
-
|
|
51670
|
+
const dir = join34(process.env.GIPITY_DIR || join34(homedir21(), ".gipity"), "trace");
|
|
51671
|
+
mkdirSync21(dir, { recursive: true });
|
|
51538
51672
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", "_").replace(/:/g, "-");
|
|
51539
|
-
const fd2 = openSync5(
|
|
51673
|
+
const fd2 = openSync5(join34(dir, `${stamp}-pid${process.pid}.jsonl`), "a");
|
|
51540
51674
|
const emit = (rec) => {
|
|
51541
51675
|
try {
|
|
51542
51676
|
writeSync(fd2, JSON.stringify({ t: (/* @__PURE__ */ new Date()).toISOString(), ...rec }) + "\n");
|
|
@@ -51573,11 +51707,11 @@ function installOutputTrace(label2) {
|
|
|
51573
51707
|
installOutputTrace("index");
|
|
51574
51708
|
var __dirname = dirname17(fileURLToPath5(import.meta.url));
|
|
51575
51709
|
installNetworking();
|
|
51576
|
-
var pkg = JSON.parse(
|
|
51710
|
+
var pkg = JSON.parse(readFileSync36(resolve20(__dirname, "../package.json"), "utf-8"));
|
|
51577
51711
|
function versionLabel() {
|
|
51578
51712
|
const base = `v${pkg.version}`;
|
|
51579
51713
|
try {
|
|
51580
|
-
const info2 = JSON.parse(
|
|
51714
|
+
const info2 = JSON.parse(readFileSync36(resolve20(__dirname, "build-info.json"), "utf-8"));
|
|
51581
51715
|
if (info2?.sha) return `${base} (dev ${info2.sha}${info2.dirty ? ", modified" : ""})`;
|
|
51582
51716
|
} catch {
|
|
51583
51717
|
}
|
|
@@ -51612,7 +51746,7 @@ function configureHelp(cmd) {
|
|
|
51612
51746
|
}
|
|
51613
51747
|
var program2 = new Command();
|
|
51614
51748
|
program2.enablePositionalOptions();
|
|
51615
|
-
var startGroup = [statusCommand, initCommand, skillCommand, projectCommand];
|
|
51749
|
+
var startGroup = [statusCommand, initCommand, skillCommand, changelogCommand, projectCommand];
|
|
51616
51750
|
var buildGroup = [addCommand, removeCommand, brandCommand, saveCommand, loadCommand, deployCommand, envCommand, pageCommand, testCommand];
|
|
51617
51751
|
var backendGroup = [dbCommand, fnCommand, secretsCommand, keyCommand, logsCommand, jobCommand, workflowCommand, approvalCommand, memoryCommand];
|
|
51618
51752
|
var servicesGroup = [serviceCommand, generateCommand, askCommand, notifyCommand, paymentsCommand, realtimeCommand, recordsCommand, rbacCommand, auditCommand, domainCommand, tokenCommand];
|
|
@@ -51707,6 +51841,16 @@ function rejectBlankIdArgs(cmd) {
|
|
|
51707
51841
|
});
|
|
51708
51842
|
}
|
|
51709
51843
|
installOutputFrame(program2);
|
|
51844
|
+
program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
51845
|
+
let top = actionCommand;
|
|
51846
|
+
while (top.parent && top.parent !== program2) top = top.parent;
|
|
51847
|
+
if (top.name() === "changelog") return;
|
|
51848
|
+
const opts = actionCommand.optsWithGlobals ? actionCommand.optsWithGlobals() : actionCommand.opts();
|
|
51849
|
+
await maybePrintUpdateNotice(pkg.version, {
|
|
51850
|
+
interactive: Boolean(process.stdout.isTTY) && !opts.json,
|
|
51851
|
+
print: (line) => console.log(line + "\n")
|
|
51852
|
+
});
|
|
51853
|
+
});
|
|
51710
51854
|
program2.configureHelp({
|
|
51711
51855
|
formatHelp(cmd, helper) {
|
|
51712
51856
|
const cmdColWidth = Math.max(
|