gipity 1.1.42 → 1.1.43
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/commands/brand.js +4 -4
- 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 +117 -116
- package/package.json +1 -1
package/dist/commands/brand.js
CHANGED
|
@@ -16,7 +16,7 @@ import { resolveProjectContext, getConfigPath } from '../config.js';
|
|
|
16
16
|
import { sync } from '../sync.js';
|
|
17
17
|
import { createProgressReporter } from '../progress.js';
|
|
18
18
|
import { bold, muted, success } from '../colors.js';
|
|
19
|
-
import { run } from '../helpers/index.js';
|
|
19
|
+
import { run, PROJECT_OPTION } from '../helpers/index.js';
|
|
20
20
|
const ACCENT_SOURCE_LABEL = {
|
|
21
21
|
theme: " (from the app's own theme --primary)",
|
|
22
22
|
derived: ' (derived from project)',
|
|
@@ -47,7 +47,7 @@ and are versioned like any other file - rollback restores previous ones.`);
|
|
|
47
47
|
brandCommand
|
|
48
48
|
.command('show', { isDefault: true })
|
|
49
49
|
.description('Show the stored brand and the resolved render spec')
|
|
50
|
-
.option(
|
|
50
|
+
.option(...PROJECT_OPTION)
|
|
51
51
|
.option('--json', 'Output raw JSON')
|
|
52
52
|
.action((opts) => run('Brand', async () => {
|
|
53
53
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
@@ -70,7 +70,7 @@ brandCommand
|
|
|
70
70
|
.option('--tagline <text>', 'One-line subtitle on the share card (max 120 chars)')
|
|
71
71
|
.option('--fix-head', 'Also splice the share/SEO head block into src/index.html (for apps installed before templates shipped it)')
|
|
72
72
|
.option('--no-regenerate', 'Store the fields without re-rendering assets')
|
|
73
|
-
.option(
|
|
73
|
+
.option(...PROJECT_OPTION)
|
|
74
74
|
.option('--json', 'Output raw JSON')
|
|
75
75
|
.action((opts) => run('Brand', async () => {
|
|
76
76
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
@@ -106,7 +106,7 @@ brandCommand
|
|
|
106
106
|
.command('apply')
|
|
107
107
|
.description('Re-render all brand assets from the stored brand (no field changes)')
|
|
108
108
|
.option('--fix-head', 'Also splice the share/SEO head block into src/index.html (for apps installed before templates shipped it)')
|
|
109
|
-
.option(
|
|
109
|
+
.option(...PROJECT_OPTION)
|
|
110
110
|
.option('--json', 'Output raw JSON')
|
|
111
111
|
.action((opts) => run('Brand', async () => {
|
|
112
112
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
package/dist/commands/email.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Command, Option } from 'commander';
|
|
|
2
2
|
import { get, post } from '../api.js';
|
|
3
3
|
import { resolveProjectContext } from '../config.js';
|
|
4
4
|
import { success, bold, muted, warning } from '../colors.js';
|
|
5
|
-
import { run } from '../helpers/index.js';
|
|
5
|
+
import { run, PROJECT_OPTION } from '../helpers/index.js';
|
|
6
6
|
// `email` is a command GROUP for the deployed app's email() service:
|
|
7
7
|
// `email test` sends through it, `email log` lists recent sends.
|
|
8
8
|
export const emailCommand = new Command('email')
|
|
@@ -18,7 +18,7 @@ emailCommand
|
|
|
18
18
|
.option('--text <text>', 'Body text', 'This is a test email sent through your app\'s email() service. ✉️')
|
|
19
19
|
.option('--reply-to <email>', 'Reply-To address')
|
|
20
20
|
.option('--from-name <name>', 'Sender display name (address stays gipity@gipity.ai)')
|
|
21
|
-
.option(
|
|
21
|
+
.option(...PROJECT_OPTION)
|
|
22
22
|
.option('--json', 'Output raw JSON')
|
|
23
23
|
.action((to, opts) => run('Email', async () => {
|
|
24
24
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
@@ -50,7 +50,7 @@ emailCommand
|
|
|
50
50
|
.description('Recent email() sends and skipped attempts from your app')
|
|
51
51
|
.addOption(new Option('--range <range>', 'Time range').choices(['1h', '24h', '7d', '30d', '1y']).default('7d'))
|
|
52
52
|
.option('--limit <n>', 'Max rows', '50')
|
|
53
|
-
.option(
|
|
53
|
+
.option(...PROJECT_OPTION)
|
|
54
54
|
.option('--json', 'Output raw JSON')
|
|
55
55
|
.action((opts) => run('Email', async () => {
|
|
56
56
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
package/dist/commands/key.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
2
|
import { get, post, del } from '../api.js';
|
|
3
|
-
import { resolveProjectContext } from '../config.js';
|
|
4
3
|
import { bold, muted, success, warning } from '../colors.js';
|
|
5
|
-
import { run, printList } from '../helpers/index.js';
|
|
4
|
+
import { run, printList, PROJECT_OPTION, projectGuidFor } from '../helpers/index.js';
|
|
6
5
|
/**
|
|
7
6
|
* Project API keys - the revocable secret a script, cron, or agent sends as
|
|
8
7
|
* `X-Api-Key` (or `Authorization: Bearer`) to write to YOUR app without a
|
|
@@ -95,11 +94,6 @@ export function describeScopes(scopes) {
|
|
|
95
94
|
parts.push(`ip: ${scopes.ip.join(',')}`);
|
|
96
95
|
return parts.join(' ');
|
|
97
96
|
}
|
|
98
|
-
const projectOpt = ['--project <guid-or-slug>', 'Target a specific project instead of cwd / Home'];
|
|
99
|
-
async function projectGuid(opts) {
|
|
100
|
-
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
101
|
-
return config.projectGuid;
|
|
102
|
-
}
|
|
103
97
|
keyCommand
|
|
104
98
|
.command('create <name>')
|
|
105
99
|
.description('Mint a project API key (shown once). Give it a name you will recognize later')
|
|
@@ -110,7 +104,7 @@ keyCommand
|
|
|
110
104
|
.addOption(new Option('--files <access>', 'Scope: app files access').choices(['read', 'write']))
|
|
111
105
|
.addOption(new Option('--approvals <access>', 'Scope: read and consume passkey approvals').choices(['read']))
|
|
112
106
|
.option('--ip <list>', 'Scope: only from these IPs / CIDR ranges (comma-separated)')
|
|
113
|
-
.option(...
|
|
107
|
+
.option(...PROJECT_OPTION)
|
|
114
108
|
.option('--json', 'Output as JSON')
|
|
115
109
|
.action((name, opts) => run('Create', async () => {
|
|
116
110
|
const body = { name, role: opts.role };
|
|
@@ -123,7 +117,7 @@ keyCommand
|
|
|
123
117
|
throw new Error('--expires-days must be a positive number of days');
|
|
124
118
|
body.expires_in_days = days;
|
|
125
119
|
}
|
|
126
|
-
const res = await post(`/projects/${await
|
|
120
|
+
const res = await post(`/projects/${await projectGuidFor(opts)}/api-keys`, body);
|
|
127
121
|
const k = res.data;
|
|
128
122
|
if (opts.json) {
|
|
129
123
|
console.log(JSON.stringify(k));
|
|
@@ -146,20 +140,20 @@ keyCommand
|
|
|
146
140
|
.command('list')
|
|
147
141
|
.alias('ls')
|
|
148
142
|
.description('List this project\'s API keys (values are never shown again)')
|
|
149
|
-
.option(...
|
|
143
|
+
.option(...PROJECT_OPTION)
|
|
150
144
|
.option('--json', 'Output as JSON')
|
|
151
145
|
.action((opts) => run('List', async () => {
|
|
152
|
-
const res = await get(`/projects/${await
|
|
146
|
+
const res = await get(`/projects/${await projectGuidFor(opts)}/api-keys`);
|
|
153
147
|
printList(res.data, opts, 'No API keys. Mint one with: gipity key create "my script" --role editor', (k) => `${bold(k.short_guid)} ${k.name} ${muted(`${k.role} ${describeScopes(k.scopes)} ${k.prefix}... last used ${fmtDate(k.last_used_at)} expires ${fmtDate(k.expires_at)}`)}`);
|
|
154
148
|
}));
|
|
155
149
|
keyCommand
|
|
156
150
|
.command('revoke <short_guid>')
|
|
157
151
|
.alias('rm')
|
|
158
152
|
.description('Revoke a project API key (instant, irreversible)')
|
|
159
|
-
.option(...
|
|
153
|
+
.option(...PROJECT_OPTION)
|
|
160
154
|
.option('--json', 'Output as JSON')
|
|
161
155
|
.action((shortGuid, opts) => run('Revoke', async () => {
|
|
162
|
-
await del(`/projects/${await
|
|
156
|
+
await del(`/projects/${await projectGuidFor(opts)}/api-keys/${encodeURIComponent(shortGuid)}`);
|
|
163
157
|
if (opts.json) {
|
|
164
158
|
console.log(JSON.stringify({ short_guid: shortGuid, revoked: true }));
|
|
165
159
|
return;
|
package/dist/commands/notify.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { readFileSync } from 'fs';
|
|
3
3
|
import { get, post, put, del } from '../api.js';
|
|
4
|
-
import { resolveProjectContext } from '../config.js';
|
|
5
4
|
import { bold, muted, success, warning } from '../colors.js';
|
|
6
|
-
import { run } from '../helpers/index.js';
|
|
5
|
+
import { run, PROJECT_OPTION, projectGuidFor } from '../helpers/index.js';
|
|
7
6
|
export const notifyCommand = new Command('notify')
|
|
8
7
|
.description('Push notifications (web and native iOS)')
|
|
9
8
|
.addHelpText('after', '\nGipity Notify: send a test notification, inspect subscriptions, or set up iOS push (notify apns).');
|
|
@@ -14,15 +13,15 @@ notifyCommand
|
|
|
14
13
|
.option('--title <text>', 'Notification title', 'Test notification')
|
|
15
14
|
.option('--body <text>', 'Notification body', 'Hello from Gipity Notify 👋')
|
|
16
15
|
.option('--url <url>', 'URL to open when the notification is clicked')
|
|
17
|
-
.option(
|
|
16
|
+
.option(...PROJECT_OPTION)
|
|
18
17
|
.option('--json', 'Output raw JSON')
|
|
19
18
|
.action((opts) => run('Notify', async () => {
|
|
20
|
-
const
|
|
19
|
+
const projectGuid = await projectGuidFor(opts);
|
|
21
20
|
const to = opts.to === 'all' ? 'all' : (opts.to.includes(',') ? opts.to.split(',').map((s) => s.trim()) : opts.to);
|
|
22
21
|
const notification = { title: opts.title, body: opts.body };
|
|
23
22
|
if (opts.url)
|
|
24
23
|
notification.url = opts.url;
|
|
25
|
-
const res = await post(`/api/${
|
|
24
|
+
const res = await post(`/api/${projectGuid}/services/notify/send`, { to, notification });
|
|
26
25
|
if (opts.json) {
|
|
27
26
|
console.log(JSON.stringify(res.data));
|
|
28
27
|
return;
|
|
@@ -50,11 +49,11 @@ notifyCommand
|
|
|
50
49
|
notifyCommand
|
|
51
50
|
.command('subs')
|
|
52
51
|
.description('Show how many push subscriptions this app has, per user')
|
|
53
|
-
.option(
|
|
52
|
+
.option(...PROJECT_OPTION)
|
|
54
53
|
.option('--json', 'Output raw JSON')
|
|
55
54
|
.action((opts) => run('Notify', async () => {
|
|
56
|
-
const
|
|
57
|
-
const res = await get(`/api/${
|
|
55
|
+
const projectGuid = await projectGuidFor(opts);
|
|
56
|
+
const res = await get(`/api/${projectGuid}/services/notify/subs`);
|
|
58
57
|
if (opts.json) {
|
|
59
58
|
console.log(JSON.stringify(res.data));
|
|
60
59
|
return;
|
|
@@ -70,11 +69,11 @@ notifyCommand
|
|
|
70
69
|
.command('rm')
|
|
71
70
|
.description("Remove a user's push subscriptions and iOS devices (e.g. on account deletion)")
|
|
72
71
|
.requiredOption('--user <guid>', 'User guid whose subscriptions to remove')
|
|
73
|
-
.option(
|
|
72
|
+
.option(...PROJECT_OPTION)
|
|
74
73
|
.option('--json', 'Output raw JSON')
|
|
75
74
|
.action((opts) => run('Notify', async () => {
|
|
76
|
-
const
|
|
77
|
-
const res = await post(`/api/${
|
|
75
|
+
const projectGuid = await projectGuidFor(opts);
|
|
76
|
+
const res = await post(`/api/${projectGuid}/services/notify/remove`, { user_guid: opts.user });
|
|
78
77
|
if (opts.json) {
|
|
79
78
|
console.log(JSON.stringify(res.data));
|
|
80
79
|
return;
|
|
@@ -111,10 +110,10 @@ apnsCommand
|
|
|
111
110
|
.requiredOption('--p8 <file>', 'Path to the AuthKey_<KEYID>.p8 file')
|
|
112
111
|
.requiredOption('--bundle-id <id>', 'Your app bundle id, e.g. com.example.myapp')
|
|
113
112
|
.option('--sandbox', 'Devices that register without an environment use the sandbox (development builds)')
|
|
114
|
-
.option(
|
|
113
|
+
.option(...PROJECT_OPTION)
|
|
115
114
|
.option('--json', 'Output raw JSON')
|
|
116
115
|
.action((opts) => run('Notify', async () => {
|
|
117
|
-
const
|
|
116
|
+
const projectGuid = await projectGuidFor(opts);
|
|
118
117
|
let p8;
|
|
119
118
|
try {
|
|
120
119
|
p8 = readFileSync(opts.p8, 'utf-8');
|
|
@@ -122,7 +121,7 @@ apnsCommand
|
|
|
122
121
|
catch {
|
|
123
122
|
throw new Error(`Can't read ${opts.p8}. Pass the path to the AuthKey_<KEYID>.p8 file from Apple.`);
|
|
124
123
|
}
|
|
125
|
-
const res = await put(`/api/${
|
|
124
|
+
const res = await put(`/api/${projectGuid}/services/notify/apns`, {
|
|
126
125
|
team_id: opts.teamId, key_id: opts.keyId, bundle_id: opts.bundleId, p8, sandbox: !!opts.sandbox,
|
|
127
126
|
});
|
|
128
127
|
if (opts.json) {
|
|
@@ -135,11 +134,11 @@ apnsCommand
|
|
|
135
134
|
apnsCommand
|
|
136
135
|
.command('show')
|
|
137
136
|
.description('Show the APNs setup for this app (never the key itself)')
|
|
138
|
-
.option(
|
|
137
|
+
.option(...PROJECT_OPTION)
|
|
139
138
|
.option('--json', 'Output raw JSON')
|
|
140
139
|
.action((opts) => run('Notify', async () => {
|
|
141
|
-
const
|
|
142
|
-
const res = await get(`/api/${
|
|
140
|
+
const projectGuid = await projectGuidFor(opts);
|
|
141
|
+
const res = await get(`/api/${projectGuid}/services/notify/apns`);
|
|
143
142
|
if (opts.json) {
|
|
144
143
|
console.log(JSON.stringify(res.data));
|
|
145
144
|
return;
|
|
@@ -149,11 +148,11 @@ apnsCommand
|
|
|
149
148
|
apnsCommand
|
|
150
149
|
.command('rm')
|
|
151
150
|
.description('Remove the APNs key (iOS devices stop receiving notifications)')
|
|
152
|
-
.option(
|
|
151
|
+
.option(...PROJECT_OPTION)
|
|
153
152
|
.option('--json', 'Output raw JSON')
|
|
154
153
|
.action((opts) => run('Notify', async () => {
|
|
155
|
-
const
|
|
156
|
-
const res = await del(`/api/${
|
|
154
|
+
const projectGuid = await projectGuidFor(opts);
|
|
155
|
+
const res = await del(`/api/${projectGuid}/services/notify/apns`);
|
|
157
156
|
if (opts.json) {
|
|
158
157
|
console.log(JSON.stringify(res.data));
|
|
159
158
|
return;
|
package/dist/commands/secrets.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Command } from 'commander';
|
|
|
2
2
|
import { get, put, del } from '../api.js';
|
|
3
3
|
import { resolveProjectContext } from '../config.js';
|
|
4
4
|
import { bold, muted, success } from '../colors.js';
|
|
5
|
-
import { run } from '../helpers/index.js';
|
|
5
|
+
import { run, PROJECT_OPTION } from '../helpers/index.js';
|
|
6
6
|
/** Build the query string for a scope. Account scope is project-independent;
|
|
7
7
|
* project scope needs the linked app's guid. */
|
|
8
8
|
async function scopeQuery(opts) {
|
|
@@ -19,7 +19,7 @@ secretsCommand
|
|
|
19
19
|
.alias('ls')
|
|
20
20
|
.description('List secret names (never values). Project secrets by default; --account for account-wide')
|
|
21
21
|
.option('--account', 'Account-wide secrets shared across all your projects')
|
|
22
|
-
.option(
|
|
22
|
+
.option(...PROJECT_OPTION)
|
|
23
23
|
.option('--json', 'Output raw JSON')
|
|
24
24
|
.action((opts) => run('Secrets', async () => {
|
|
25
25
|
const res = await get(`/secrets?${await scopeQuery(opts)}`);
|
|
@@ -46,7 +46,7 @@ secretsCommand
|
|
|
46
46
|
.command('get <name>')
|
|
47
47
|
.description('Secret values are write-only: confirms the secret exists, never prints its value')
|
|
48
48
|
.option('--account', 'Look in account-wide secrets')
|
|
49
|
-
.option(
|
|
49
|
+
.option(...PROJECT_OPTION)
|
|
50
50
|
.option('--json', 'Output raw JSON')
|
|
51
51
|
.action((name, opts) => run('Secrets', async () => {
|
|
52
52
|
const res = await get(`/secrets?${await scopeQuery(opts)}`);
|
|
@@ -63,7 +63,7 @@ secretsCommand
|
|
|
63
63
|
.command('set <name> <value>')
|
|
64
64
|
.description('Create or update a secret (UPPER_SNAKE_CASE name). Encrypted at rest; never echoed back')
|
|
65
65
|
.option('--account', 'Store account-wide (shared across all your projects)')
|
|
66
|
-
.option(
|
|
66
|
+
.option(...PROJECT_OPTION)
|
|
67
67
|
.option('--json', 'Output raw JSON')
|
|
68
68
|
.action((name, value, opts) => run('Secrets', async () => {
|
|
69
69
|
const res = await put(`/secrets?${await scopeQuery(opts)}`, { name, value });
|
|
@@ -79,7 +79,7 @@ secretsCommand
|
|
|
79
79
|
.alias('delete')
|
|
80
80
|
.description('Delete a secret')
|
|
81
81
|
.option('--account', 'Delete from account-wide secrets')
|
|
82
|
-
.option(
|
|
82
|
+
.option(...PROJECT_OPTION)
|
|
83
83
|
.option('--json', 'Output raw JSON')
|
|
84
84
|
.action((name, opts) => run('Secrets', async () => {
|
|
85
85
|
const res = await del(`/secrets/${encodeURIComponent(name)}?${await scopeQuery(opts)}`);
|
package/dist/helpers/index.js
CHANGED
|
@@ -6,4 +6,5 @@ export { printOutput, printList, printResult, pluckField, emitField } from './ou
|
|
|
6
6
|
export { syncBeforeAction, syncAfterAction } from './sync.js';
|
|
7
7
|
export { resolveJsonBody, resolveBody, resolveFormBody } from './body.js';
|
|
8
8
|
export { parseDuration } from './duration.js';
|
|
9
|
+
export { PROJECT_OPTION, projectGuidFor } from './project.js';
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { resolveProjectContext } from '../config.js';
|
|
2
|
+
/** The `--project` option every project-scoped command takes: `.option(...PROJECT_OPTION)`. */
|
|
3
|
+
export const PROJECT_OPTION = ['--project <guid-or-slug>', 'Target a specific project instead of cwd / Home'];
|
|
4
|
+
/** The project guid a command acts on: `--project`, else the linked cwd / Home. */
|
|
5
|
+
export async function projectGuidFor(opts) {
|
|
6
|
+
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
7
|
+
return config.projectGuid;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=project.js.map
|
package/dist/index.js
CHANGED
|
@@ -9401,9 +9401,9 @@ async function publicRequest(method, path5, body, extraHeaders, timeoutMs = REQU
|
|
|
9401
9401
|
function publicPost(path5, body, extraHeaders) {
|
|
9402
9402
|
return publicRequest("POST", path5, body, extraHeaders);
|
|
9403
9403
|
}
|
|
9404
|
-
async function mintAppToken(
|
|
9404
|
+
async function mintAppToken(projectGuid) {
|
|
9405
9405
|
try {
|
|
9406
|
-
const minted = await publicPost("/api/token", { app:
|
|
9406
|
+
const minted = await publicPost("/api/token", { app: projectGuid });
|
|
9407
9407
|
return { "X-App-Token": minted.data.token };
|
|
9408
9408
|
} catch {
|
|
9409
9409
|
return void 0;
|
|
@@ -34850,7 +34850,7 @@ var UploadConflictError = class extends Error {
|
|
|
34850
34850
|
currentServerVersion;
|
|
34851
34851
|
path;
|
|
34852
34852
|
};
|
|
34853
|
-
async function uploadOneFile(
|
|
34853
|
+
async function uploadOneFile(projectGuid, localPath, virtualPath, opts = {}) {
|
|
34854
34854
|
const { sha256: sha2562, size } = await hashFile(localPath);
|
|
34855
34855
|
const mime = opts.mime ?? guessMime(virtualPath);
|
|
34856
34856
|
const initBody = { path: virtualPath, size, sha256: sha2562, mime };
|
|
@@ -34860,7 +34860,7 @@ async function uploadOneFile(projectGuid2, localPath, virtualPath, opts = {}) {
|
|
|
34860
34860
|
let init;
|
|
34861
34861
|
try {
|
|
34862
34862
|
init = await post(
|
|
34863
|
-
`/projects/${
|
|
34863
|
+
`/projects/${projectGuid}/files/upload-init`,
|
|
34864
34864
|
initBody
|
|
34865
34865
|
);
|
|
34866
34866
|
} catch (err) {
|
|
@@ -34882,7 +34882,7 @@ async function uploadOneFile(projectGuid2, localPath, virtualPath, opts = {}) {
|
|
|
34882
34882
|
}
|
|
34883
34883
|
let comp;
|
|
34884
34884
|
try {
|
|
34885
|
-
comp = await post(`/projects/${
|
|
34885
|
+
comp = await post(`/projects/${projectGuid}/files/upload-complete`, completeBody);
|
|
34886
34886
|
} catch (err) {
|
|
34887
34887
|
if (err instanceof ApiError && err.statusCode === 409) {
|
|
34888
34888
|
const current = typeof err.data?.current_server_version === "number" ? err.data.current_server_version : null;
|
|
@@ -34964,16 +34964,16 @@ async function transferToS3(localPath, size, mime, data, opts = {}) {
|
|
|
34964
34964
|
completed.sort((a, b7) => a.part_number - b7.part_number);
|
|
34965
34965
|
return { parts: completed };
|
|
34966
34966
|
}
|
|
34967
|
-
async function uploadInitBatch(
|
|
34967
|
+
async function uploadInitBatch(projectGuid, files) {
|
|
34968
34968
|
const res = await post(
|
|
34969
|
-
`/projects/${
|
|
34969
|
+
`/projects/${projectGuid}/files/upload-init-batch`,
|
|
34970
34970
|
{ files }
|
|
34971
34971
|
);
|
|
34972
34972
|
return res.data.results;
|
|
34973
34973
|
}
|
|
34974
|
-
async function uploadCompleteBatch(
|
|
34974
|
+
async function uploadCompleteBatch(projectGuid, items) {
|
|
34975
34975
|
const res = await post(
|
|
34976
|
-
`/projects/${
|
|
34976
|
+
`/projects/${projectGuid}/files/upload-complete-batch`,
|
|
34977
34977
|
{ items }
|
|
34978
34978
|
);
|
|
34979
34979
|
return res.data.results;
|
|
@@ -35074,23 +35074,23 @@ async function acquireLock(progress) {
|
|
|
35074
35074
|
}
|
|
35075
35075
|
}
|
|
35076
35076
|
}
|
|
35077
|
-
function readBaseline(
|
|
35077
|
+
function readBaseline(projectGuid) {
|
|
35078
35078
|
const path5 = syncStatePath();
|
|
35079
|
-
if (!existsSync8(path5)) return { projectGuid
|
|
35079
|
+
if (!existsSync8(path5)) return { projectGuid, files: {}, lastFullSync: null };
|
|
35080
35080
|
try {
|
|
35081
35081
|
const parsed = JSON.parse(readFileSync8(path5, "utf-8"));
|
|
35082
|
-
if (parsed.projectGuid !==
|
|
35083
|
-
return { projectGuid
|
|
35082
|
+
if (parsed.projectGuid !== projectGuid) {
|
|
35083
|
+
return { projectGuid, files: {}, lastFullSync: null };
|
|
35084
35084
|
}
|
|
35085
35085
|
return {
|
|
35086
|
-
projectGuid
|
|
35086
|
+
projectGuid,
|
|
35087
35087
|
files: parsed.files ?? {},
|
|
35088
35088
|
lastFullSync: parsed.lastFullSync ?? null,
|
|
35089
35089
|
...parsed.deletesSkippedStreak ? { deletesSkippedStreak: parsed.deletesSkippedStreak } : {},
|
|
35090
35090
|
...parsed.appUploads?.length ? { appUploads: parsed.appUploads } : {}
|
|
35091
35091
|
};
|
|
35092
35092
|
} catch {
|
|
35093
|
-
return { projectGuid
|
|
35093
|
+
return { projectGuid, files: {}, lastFullSync: null };
|
|
35094
35094
|
}
|
|
35095
35095
|
}
|
|
35096
35096
|
function writeBaseline(b7) {
|
|
@@ -35191,8 +35191,8 @@ function resolveInRoot(root, relPath) {
|
|
|
35191
35191
|
}
|
|
35192
35192
|
return full;
|
|
35193
35193
|
}
|
|
35194
|
-
async function fetchRemote(
|
|
35195
|
-
const res = await get(`/projects/${
|
|
35194
|
+
async function fetchRemote(projectGuid) {
|
|
35195
|
+
const res = await get(`/projects/${projectGuid}/files/tree`);
|
|
35196
35196
|
const out = /* @__PURE__ */ new Map();
|
|
35197
35197
|
const appUploads = new Set((res.appUploads ?? []).map(normalizeTreePath));
|
|
35198
35198
|
for (const f of res.data) {
|
|
@@ -35254,14 +35254,14 @@ function extractTarToMap(stream, idleMs, onBytes, keep) {
|
|
|
35254
35254
|
stream.pipe(extract3);
|
|
35255
35255
|
});
|
|
35256
35256
|
}
|
|
35257
|
-
async function downloadAll(
|
|
35258
|
-
const stream = await downloadStream(`/projects/${
|
|
35257
|
+
async function downloadAll(projectGuid, onBytes) {
|
|
35258
|
+
const stream = await downloadStream(`/projects/${projectGuid}/files/tree?content=tar`);
|
|
35259
35259
|
return extractTarToMap(stream, DOWNLOAD_IDLE_MS, onBytes);
|
|
35260
35260
|
}
|
|
35261
|
-
async function fetchOneOutcome(
|
|
35261
|
+
async function fetchOneOutcome(projectGuid, path5, expectedSha) {
|
|
35262
35262
|
try {
|
|
35263
35263
|
const stream = await downloadStream(
|
|
35264
|
-
`/projects/${
|
|
35264
|
+
`/projects/${projectGuid}/files/tree?content=tar&path=${encodeURIComponent(path5)}`
|
|
35265
35265
|
);
|
|
35266
35266
|
const want = normalizeTreePath(path5);
|
|
35267
35267
|
const files = await extractTarToMap(stream, DOWNLOAD_IDLE_MS, void 0, (p) => p === want);
|
|
@@ -35277,8 +35277,8 @@ async function fetchOneOutcome(projectGuid2, path5, expectedSha) {
|
|
|
35277
35277
|
return { kind: "transient" };
|
|
35278
35278
|
}
|
|
35279
35279
|
}
|
|
35280
|
-
async function fetchOne(
|
|
35281
|
-
const out = await fetchOneOutcome(
|
|
35280
|
+
async function fetchOne(projectGuid, path5, expectedSha) {
|
|
35281
|
+
const out = await fetchOneOutcome(projectGuid, path5, expectedSha);
|
|
35282
35282
|
return out.kind === "ok" ? out.buf : null;
|
|
35283
35283
|
}
|
|
35284
35284
|
function classifyLocal(info2, base) {
|
|
@@ -35547,14 +35547,14 @@ async function sync(opts = {}) {
|
|
|
35547
35547
|
releaseLock();
|
|
35548
35548
|
}
|
|
35549
35549
|
}
|
|
35550
|
-
async function syncInner(
|
|
35551
|
-
const config = { projectGuid
|
|
35550
|
+
async function syncInner(projectGuid, root, ignore2, opts, interactive) {
|
|
35551
|
+
const config = { projectGuid, ignore: ignore2 };
|
|
35552
35552
|
const p = opts.progress;
|
|
35553
|
-
const baseline = readBaseline(
|
|
35553
|
+
const baseline = readBaseline(projectGuid);
|
|
35554
35554
|
p?.phase("Scanning local files...");
|
|
35555
35555
|
const local = walkLocal(root, ignore2, baseline.files);
|
|
35556
35556
|
p?.phase("Checking Gipity for changes...");
|
|
35557
|
-
const { files: remote, appUploads } = await fetchRemote(
|
|
35557
|
+
const { files: remote, appUploads } = await fetchRemote(projectGuid);
|
|
35558
35558
|
const appUploadsLeftLocal = [];
|
|
35559
35559
|
const knownUploads = /* @__PURE__ */ new Set([...appUploads, ...(baseline.appUploads ?? []).filter((p7) => local.has(p7))]);
|
|
35560
35560
|
for (const path5 of knownUploads) {
|
|
@@ -36422,6 +36422,14 @@ function parseDuration(raw, unit) {
|
|
|
36422
36422
|
return { value, hadSuffix: true };
|
|
36423
36423
|
}
|
|
36424
36424
|
|
|
36425
|
+
// src/helpers/project.ts
|
|
36426
|
+
init_config();
|
|
36427
|
+
var PROJECT_OPTION = ["--project <guid-or-slug>", "Target a specific project instead of cwd / Home"];
|
|
36428
|
+
async function projectGuidFor(opts) {
|
|
36429
|
+
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
36430
|
+
return config.projectGuid;
|
|
36431
|
+
}
|
|
36432
|
+
|
|
36425
36433
|
// src/commands/token.ts
|
|
36426
36434
|
var tokenCommand = new Command("token").description("Manage API tokens").addHelpText("after", `
|
|
36427
36435
|
Long-lived agent API tokens (gip_at_*) for headless agents and CI - they drive
|
|
@@ -36475,7 +36483,6 @@ tokenCommand.command("revoke <short_guid>").alias("rm").description("Revoke an a
|
|
|
36475
36483
|
|
|
36476
36484
|
// src/commands/key.ts
|
|
36477
36485
|
init_api();
|
|
36478
|
-
init_config();
|
|
36479
36486
|
init_colors();
|
|
36480
36487
|
var keyCommand = new Command("key").description("Manage project API keys for scripts and agents (X-Api-Key)").addHelpText("after", `
|
|
36481
36488
|
Give a script, cron, or agent write access to your app without a login:
|
|
@@ -36542,12 +36549,7 @@ function describeScopes(scopes) {
|
|
|
36542
36549
|
if (scopes.ip) parts.push(`ip: ${scopes.ip.join(",")}`);
|
|
36543
36550
|
return parts.join(" ");
|
|
36544
36551
|
}
|
|
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 () => {
|
|
36552
|
+
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
36553
|
const body = { name, role: opts.role };
|
|
36552
36554
|
const scopes = scopesFromFlags(opts);
|
|
36553
36555
|
if (scopes) body.scopes = scopes;
|
|
@@ -36557,7 +36559,7 @@ keyCommand.command("create <name>").description("Mint a project API key (shown o
|
|
|
36557
36559
|
body.expires_in_days = days;
|
|
36558
36560
|
}
|
|
36559
36561
|
const res = await post(
|
|
36560
|
-
`/projects/${await
|
|
36562
|
+
`/projects/${await projectGuidFor(opts)}/api-keys`,
|
|
36561
36563
|
body
|
|
36562
36564
|
);
|
|
36563
36565
|
const k7 = res.data;
|
|
@@ -36577,8 +36579,8 @@ keyCommand.command("create <name>").description("Mint a project API key (shown o
|
|
|
36577
36579
|
console.log("");
|
|
36578
36580
|
console.log(warning("Copy it now - it will not be shown again."));
|
|
36579
36581
|
}));
|
|
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
|
|
36582
|
+
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 () => {
|
|
36583
|
+
const res = await get(`/projects/${await projectGuidFor(opts)}/api-keys`);
|
|
36582
36584
|
printList(
|
|
36583
36585
|
res.data,
|
|
36584
36586
|
opts,
|
|
@@ -36586,8 +36588,8 @@ keyCommand.command("list").alias("ls").description("List this project's API keys
|
|
|
36586
36588
|
(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
36589
|
);
|
|
36588
36590
|
}));
|
|
36589
|
-
keyCommand.command("revoke <short_guid>").alias("rm").description("Revoke a project API key (instant, irreversible)").option(...
|
|
36590
|
-
await del(`/projects/${await
|
|
36591
|
+
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 () => {
|
|
36592
|
+
await del(`/projects/${await projectGuidFor(opts)}/api-keys/${encodeURIComponent(shortGuid)}`);
|
|
36591
36593
|
if (opts.json) {
|
|
36592
36594
|
console.log(JSON.stringify({ short_guid: shortGuid, revoked: true }));
|
|
36593
36595
|
return;
|
|
@@ -37778,26 +37780,26 @@ init_config();
|
|
|
37778
37780
|
|
|
37779
37781
|
// src/db-checkpoint.ts
|
|
37780
37782
|
init_api();
|
|
37781
|
-
async function resolveDatabase(
|
|
37783
|
+
async function resolveDatabase(projectGuid, explicit) {
|
|
37782
37784
|
if (explicit) return explicit;
|
|
37783
|
-
const res = await get(`/projects/${
|
|
37785
|
+
const res = await get(`/projects/${projectGuid}/databases`);
|
|
37784
37786
|
return res.data.length > 0 ? res.data[0].friendlyName : null;
|
|
37785
37787
|
}
|
|
37786
|
-
async function checkpoint(
|
|
37788
|
+
async function checkpoint(projectGuid, database, action, keep) {
|
|
37787
37789
|
const res = await post(
|
|
37788
|
-
`/projects/${
|
|
37790
|
+
`/projects/${projectGuid}/db/checkpoint`,
|
|
37789
37791
|
{ database, action, ...keep ? { keep } : {} }
|
|
37790
37792
|
);
|
|
37791
37793
|
return res.data;
|
|
37792
37794
|
}
|
|
37793
|
-
function createCheckpoint(
|
|
37794
|
-
return checkpoint(
|
|
37795
|
+
function createCheckpoint(projectGuid, database) {
|
|
37796
|
+
return checkpoint(projectGuid, database, "create");
|
|
37795
37797
|
}
|
|
37796
|
-
function restoreCheckpoint(
|
|
37797
|
-
return checkpoint(
|
|
37798
|
+
function restoreCheckpoint(projectGuid, database, opts = {}) {
|
|
37799
|
+
return checkpoint(projectGuid, database, "restore", opts.keep);
|
|
37798
37800
|
}
|
|
37799
|
-
function dropCheckpoint(
|
|
37800
|
-
return checkpoint(
|
|
37801
|
+
function dropCheckpoint(projectGuid, database) {
|
|
37802
|
+
return checkpoint(projectGuid, database, "drop");
|
|
37801
37803
|
}
|
|
37802
37804
|
|
|
37803
37805
|
// src/page-fixtures.ts
|
|
@@ -37842,13 +37844,13 @@ Nothing named "${basename4(localPath)}" under ${root} either. Generate a frame w
|
|
|
37842
37844
|
`${flag} ${localPath}: no such file. Looked for ${abs} (relative paths resolve against the current directory, ${process.cwd()}).${found}`
|
|
37843
37845
|
);
|
|
37844
37846
|
}
|
|
37845
|
-
async function uploadPublicFixture(
|
|
37847
|
+
async function uploadPublicFixture(projectGuid, localPath, flag = "--fixture") {
|
|
37846
37848
|
assertLocalAsset(flag, localPath);
|
|
37847
37849
|
const name = basename4(localPath);
|
|
37848
37850
|
const size = statSync5(localPath).size;
|
|
37849
37851
|
const contentType = guessMime(localPath);
|
|
37850
37852
|
const init = await post(
|
|
37851
|
-
`/api/${
|
|
37853
|
+
`/api/${projectGuid}/uploads/init`,
|
|
37852
37854
|
{ filename: name, content_type: contentType, size, public: true }
|
|
37853
37855
|
);
|
|
37854
37856
|
if (init.data.method !== "PUT" || !init.data.url) {
|
|
@@ -37863,13 +37865,13 @@ async function uploadPublicFixture(projectGuid2, localPath, flag = "--fixture")
|
|
|
37863
37865
|
throw new Error(`upload of fixture "${name}" failed: ${res.status} ${res.statusText}`);
|
|
37864
37866
|
}
|
|
37865
37867
|
const done = await post(
|
|
37866
|
-
`/api/${
|
|
37868
|
+
`/api/${projectGuid}/uploads/complete`,
|
|
37867
37869
|
{ upload_guid: init.data.upload_guid }
|
|
37868
37870
|
);
|
|
37869
37871
|
return { guid: done.data.guid, url: done.data.url, name, localPath };
|
|
37870
37872
|
}
|
|
37871
|
-
async function deleteFixture(
|
|
37872
|
-
await del(`/api/${
|
|
37873
|
+
async function deleteFixture(projectGuid, guid) {
|
|
37874
|
+
await del(`/api/${projectGuid}/uploads/${guid}`);
|
|
37873
37875
|
}
|
|
37874
37876
|
var CAMERA_EXTS = [".png", ".jpg", ".jpeg", ".webp", ".mp4", ".webm", ".y4m", ".mjpeg"];
|
|
37875
37877
|
function assertCameraFile(localPath) {
|
|
@@ -37882,9 +37884,9 @@ A still image is played as a looping single-frame feed, which is what a gesture/
|
|
|
37882
37884
|
No frame to hand? Generate one: gipity generate image "a hand making a closed fist, palm to camera, plain background"`
|
|
37883
37885
|
);
|
|
37884
37886
|
}
|
|
37885
|
-
async function uploadCameraFeed(
|
|
37887
|
+
async function uploadCameraFeed(projectGuid, localPath) {
|
|
37886
37888
|
assertCameraFile(localPath);
|
|
37887
|
-
return uploadPublicFixture(
|
|
37889
|
+
return uploadPublicFixture(projectGuid, localPath, "--camera");
|
|
37888
37890
|
}
|
|
37889
37891
|
|
|
37890
37892
|
// src/commands/page-eval.ts
|
|
@@ -38192,7 +38194,7 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38192
38194
|
const fixturePaths = opts.fixture ?? [];
|
|
38193
38195
|
const hosted = [];
|
|
38194
38196
|
let camera;
|
|
38195
|
-
let
|
|
38197
|
+
let projectGuid;
|
|
38196
38198
|
let sentExpr = expr;
|
|
38197
38199
|
let sentSteps = steps;
|
|
38198
38200
|
if (opts.camera) assertCameraFile(opts.camera);
|
|
@@ -38200,7 +38202,7 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38200
38202
|
try {
|
|
38201
38203
|
if (opts.restoreDb) {
|
|
38202
38204
|
const { config } = await resolveProjectContext({});
|
|
38203
|
-
|
|
38205
|
+
projectGuid = config.projectGuid;
|
|
38204
38206
|
const database = await resolveDatabase(config.projectGuid);
|
|
38205
38207
|
if (!database) {
|
|
38206
38208
|
console.error(muted("--restore-db: this project has no database - nothing to roll back."));
|
|
@@ -38212,17 +38214,17 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38212
38214
|
}
|
|
38213
38215
|
if (fixturePaths.length || opts.camera) {
|
|
38214
38216
|
const { config } = await resolveProjectContext({});
|
|
38215
|
-
|
|
38217
|
+
projectGuid = config.projectGuid;
|
|
38216
38218
|
}
|
|
38217
38219
|
const hostStart = Date.now();
|
|
38218
38220
|
if (opts.camera) {
|
|
38219
38221
|
console.log(muted(`Hosting camera feed ${opts.camera}...`));
|
|
38220
|
-
camera = await uploadCameraFeed(
|
|
38222
|
+
camera = await uploadCameraFeed(projectGuid, opts.camera);
|
|
38221
38223
|
}
|
|
38222
38224
|
if (fixturePaths.length) {
|
|
38223
38225
|
for (const p of fixturePaths) {
|
|
38224
38226
|
console.log(muted(`Hosting fixture ${p}...`));
|
|
38225
|
-
hosted.push(await uploadPublicFixture(
|
|
38227
|
+
hosted.push(await uploadPublicFixture(projectGuid, p));
|
|
38226
38228
|
}
|
|
38227
38229
|
const map = {};
|
|
38228
38230
|
for (const h of hosted) map[h.name] = h.url;
|
|
@@ -38359,7 +38361,7 @@ ${bold("After reload")} ${muted("(page reloaded in place: storage preserved)")}`
|
|
|
38359
38361
|
}
|
|
38360
38362
|
for (const h of [...hosted, ...camera ? [camera] : []]) {
|
|
38361
38363
|
try {
|
|
38362
|
-
await deleteFixture(
|
|
38364
|
+
await deleteFixture(projectGuid, h.guid);
|
|
38363
38365
|
} catch (err) {
|
|
38364
38366
|
console.error(warning(`\u26A0 Could not auto-delete fixture "${h.name}" (${h.guid}): still hosted at ${h.url}: ${err.message}`));
|
|
38365
38367
|
}
|
|
@@ -38686,14 +38688,14 @@ var pageScreenshotCommand = new Command("screenshot").description("Screenshot a
|
|
|
38686
38688
|
const ts2 = timestampSlug();
|
|
38687
38689
|
const shotName = (vp2) => defaultFilename(slug, ts2, vp2 && userSpecifiedViewports ? dimSuffix(vp2) : void 0);
|
|
38688
38690
|
const names = userSpecifiedViewports ? customViewports.map(shotName) : [shotName()];
|
|
38689
|
-
const
|
|
38691
|
+
const projectGuid = getConfig()?.projectGuid;
|
|
38690
38692
|
const outputArg = opts.output ?? OUTPUT_ALIAS_FLAGS.map((f) => opts[f.slice(2)]).find(Boolean);
|
|
38691
38693
|
let camera;
|
|
38692
38694
|
if (opts.camera) {
|
|
38693
38695
|
assertCameraFile(opts.camera);
|
|
38694
|
-
if (!
|
|
38696
|
+
if (!projectGuid) throw new Error("--camera needs a linked project (the frame is hosted for the browser to fetch): run `gipity link` first.");
|
|
38695
38697
|
console.log(muted(`Hosting camera feed ${opts.camera}...`));
|
|
38696
|
-
camera = await uploadCameraFeed(
|
|
38698
|
+
camera = await uploadCameraFeed(projectGuid, opts.camera);
|
|
38697
38699
|
}
|
|
38698
38700
|
const preCapture = [
|
|
38699
38701
|
opts.waitFor ? buildWaitForGate(opts.waitFor, waitForTimeoutMs) : "",
|
|
@@ -38723,7 +38725,7 @@ var pageScreenshotCommand = new Command("screenshot").description("Screenshot a
|
|
|
38723
38725
|
} finally {
|
|
38724
38726
|
if (camera) {
|
|
38725
38727
|
try {
|
|
38726
|
-
await deleteFixture(
|
|
38728
|
+
await deleteFixture(projectGuid, camera.guid);
|
|
38727
38729
|
} catch (err) {
|
|
38728
38730
|
console.error(warning(`\u26A0 Could not auto-delete camera feed "${camera.name}" (${camera.guid}): still hosted at ${camera.url}: ${err.message}`));
|
|
38729
38731
|
}
|
|
@@ -39194,9 +39196,9 @@ function pageAccessLabel(mode) {
|
|
|
39194
39196
|
}
|
|
39195
39197
|
|
|
39196
39198
|
// src/commands/status.ts
|
|
39197
|
-
async function probePageAccess(
|
|
39199
|
+
async function probePageAccess(projectGuid) {
|
|
39198
39200
|
const timeout = new Promise((res) => setTimeout(() => res(null), 5e3).unref?.());
|
|
39199
|
-
const call = get(`/projects/${
|
|
39201
|
+
const call = get(`/projects/${projectGuid}`).then(
|
|
39200
39202
|
(res) => res.data?.page_access ?? null,
|
|
39201
39203
|
() => null
|
|
39202
39204
|
);
|
|
@@ -39668,10 +39670,10 @@ dbCommand.command("list").description("List databases").option("--all", "List da
|
|
|
39668
39670
|
grouped.get(key).push(db2);
|
|
39669
39671
|
}
|
|
39670
39672
|
let first = true;
|
|
39671
|
-
for (const [
|
|
39673
|
+
for (const [projectGuid, dbs] of grouped) {
|
|
39672
39674
|
if (!first) console.log("");
|
|
39673
39675
|
first = false;
|
|
39674
|
-
const label2 = dbs[0].projectSlug || dbs[0].projectName ||
|
|
39676
|
+
const label2 = dbs[0].projectSlug || dbs[0].projectName || projectGuid;
|
|
39675
39677
|
console.log(label2);
|
|
39676
39678
|
for (const db2 of dbs) {
|
|
39677
39679
|
console.log(`${db2.friendlyName}`);
|
|
@@ -41902,10 +41904,10 @@ function reportSyncResult(result) {
|
|
|
41902
41904
|
console.log(` ${muted("Nothing was deleted. Re-run `gipity sync` to finish the pull.")}`);
|
|
41903
41905
|
}
|
|
41904
41906
|
}
|
|
41905
|
-
async function fetchProjectStats(
|
|
41906
|
-
if (
|
|
41907
|
+
async function fetchProjectStats(projectGuid, cwd) {
|
|
41908
|
+
if (projectGuid) {
|
|
41907
41909
|
try {
|
|
41908
|
-
const res = await get(`/projects/${encodeURIComponent(
|
|
41910
|
+
const res = await get(`/projects/${encodeURIComponent(projectGuid)}/files/stats`);
|
|
41909
41911
|
const d = res.data;
|
|
41910
41912
|
const topLevelNames = d.top_level.map((e) => e.type === "directory" ? `${e.name}/` : e.name);
|
|
41911
41913
|
return {
|
|
@@ -43128,7 +43130,7 @@ Examples:
|
|
|
43128
43130
|
|
|
43129
43131
|
Assets are generated server-side into src/images/ (+ src/manifest.webmanifest)
|
|
43130
43132
|
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(
|
|
43133
|
+
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
43134
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
43133
43135
|
const res = await get(`/projects/${config.projectGuid}/brand`);
|
|
43134
43136
|
if (opts.json) {
|
|
@@ -43140,7 +43142,7 @@ brandCommand.command("show", { isDefault: true }).description("Show the stored b
|
|
|
43140
43142
|
Assets: ${(res.data.assets ?? []).join(", ")}`));
|
|
43141
43143
|
console.log(muted(`Change it: gipity brand set --emoji \u{1F3A8} | --glyph A | --color "#RRGGBB" | --tagline "..."`));
|
|
43142
43144
|
}));
|
|
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(
|
|
43145
|
+
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
43146
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
43145
43147
|
const body = {};
|
|
43146
43148
|
const glyph = opts.emoji ?? opts.glyph;
|
|
@@ -43164,7 +43166,7 @@ brandCommand.command("set").description("Change brand fields and regenerate all
|
|
|
43164
43166
|
printBrand(res.data);
|
|
43165
43167
|
reportFiles(res.data.files ?? []);
|
|
43166
43168
|
}));
|
|
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(
|
|
43169
|
+
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
43170
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
43169
43171
|
const body = opts.fixHead ? { fix_head: true } : {};
|
|
43170
43172
|
const res = await post(`/projects/${config.projectGuid}/brand`, body);
|
|
@@ -44400,11 +44402,11 @@ ${error(`error: ${log3.error_message}`)}`;
|
|
|
44400
44402
|
return line;
|
|
44401
44403
|
});
|
|
44402
44404
|
}));
|
|
44403
|
-
async function callAnon(
|
|
44405
|
+
async function callAnon(projectGuid, name, body) {
|
|
44404
44406
|
return publicPost(
|
|
44405
|
-
`/api/${
|
|
44407
|
+
`/api/${projectGuid}/fn/${encodeURIComponent(name)}`,
|
|
44406
44408
|
body,
|
|
44407
|
-
await mintAppToken(
|
|
44409
|
+
await mintAppToken(projectGuid)
|
|
44408
44410
|
);
|
|
44409
44411
|
}
|
|
44410
44412
|
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 +44542,7 @@ async function scopeQuery(opts) {
|
|
|
44540
44542
|
return `scope=project&app_guid=${config.projectGuid}`;
|
|
44541
44543
|
}
|
|
44542
44544
|
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(
|
|
44545
|
+
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
44546
|
const res = await get(`/secrets?${await scopeQuery(opts)}`);
|
|
44545
44547
|
if (opts.json) {
|
|
44546
44548
|
console.log(JSON.stringify(res.data));
|
|
@@ -44557,7 +44559,7 @@ secretsCommand.command("list").alias("ls").description("List secret names (never
|
|
|
44557
44559
|
console.log(` ${s.name} ${masked} ${muted(`updated ${new Date(s.updated_at).toLocaleDateString()}`)}`);
|
|
44558
44560
|
}
|
|
44559
44561
|
}));
|
|
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(
|
|
44562
|
+
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
44563
|
const res = await get(`/secrets?${await scopeQuery(opts)}`);
|
|
44562
44564
|
const scope = opts.account ? "account-wide" : "project";
|
|
44563
44565
|
const found = res.data.find((s) => s.name === name);
|
|
@@ -44567,7 +44569,7 @@ secretsCommand.command("get <name>").description("Secret values are write-only:
|
|
|
44567
44569
|
`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
44570
|
);
|
|
44569
44571
|
}));
|
|
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(
|
|
44572
|
+
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
44573
|
const res = await put(`/secrets?${await scopeQuery(opts)}`, { name, value });
|
|
44572
44574
|
if (opts.json) {
|
|
44573
44575
|
console.log(JSON.stringify(res.data));
|
|
@@ -44576,7 +44578,7 @@ secretsCommand.command("set <name> <value>").description("Create or update a sec
|
|
|
44576
44578
|
const scope = opts.account ? "account-wide" : "project";
|
|
44577
44579
|
console.log(success(`\u2713 Secret '${res.data.name}' saved (encrypted, ${scope}). Read it in a function with secrets.get('${res.data.name}').`));
|
|
44578
44580
|
}));
|
|
44579
|
-
secretsCommand.command("rm <name>").alias("delete").description("Delete a secret").option("--account", "Delete from account-wide secrets").option(
|
|
44581
|
+
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
44582
|
const res = await del(`/secrets/${encodeURIComponent(name)}?${await scopeQuery(opts)}`);
|
|
44581
44583
|
if (opts.json) {
|
|
44582
44584
|
console.log(JSON.stringify(res.data));
|
|
@@ -44588,17 +44590,16 @@ secretsCommand.command("rm <name>").alias("delete").description("Delete a secret
|
|
|
44588
44590
|
|
|
44589
44591
|
// src/commands/notify.ts
|
|
44590
44592
|
init_api();
|
|
44591
|
-
init_config();
|
|
44592
44593
|
init_colors();
|
|
44593
44594
|
import { readFileSync as readFileSync22 } from "fs";
|
|
44594
44595
|
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
|
|
44596
|
+
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 () => {
|
|
44597
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44597
44598
|
const to2 = opts.to === "all" ? "all" : opts.to.includes(",") ? opts.to.split(",").map((s) => s.trim()) : opts.to;
|
|
44598
44599
|
const notification = { title: opts.title, body: opts.body };
|
|
44599
44600
|
if (opts.url) notification.url = opts.url;
|
|
44600
44601
|
const res = await post(
|
|
44601
|
-
`/api/${
|
|
44602
|
+
`/api/${projectGuid}/services/notify/send`,
|
|
44602
44603
|
{ to: to2, notification }
|
|
44603
44604
|
);
|
|
44604
44605
|
if (opts.json) {
|
|
@@ -44622,10 +44623,10 @@ notifyCommand.command("test").description("Send a test push notification (web an
|
|
|
44622
44623
|
}
|
|
44623
44624
|
}
|
|
44624
44625
|
}));
|
|
44625
|
-
notifyCommand.command("subs").description("Show how many push subscriptions this app has, per user").option(
|
|
44626
|
-
const
|
|
44626
|
+
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 () => {
|
|
44627
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44627
44628
|
const res = await get(
|
|
44628
|
-
`/api/${
|
|
44629
|
+
`/api/${projectGuid}/services/notify/subs`
|
|
44629
44630
|
);
|
|
44630
44631
|
if (opts.json) {
|
|
44631
44632
|
console.log(JSON.stringify(res.data));
|
|
@@ -44638,10 +44639,10 @@ notifyCommand.command("subs").description("Show how many push subscriptions this
|
|
|
44638
44639
|
console.log(` ${r.user_guid} ${muted(`${r.count} device${r.count === 1 ? "" : "s"}${split}`)}`);
|
|
44639
44640
|
}
|
|
44640
44641
|
}));
|
|
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
|
|
44642
|
+
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 () => {
|
|
44643
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44643
44644
|
const res = await post(
|
|
44644
|
-
`/api/${
|
|
44645
|
+
`/api/${projectGuid}/services/notify/remove`,
|
|
44645
44646
|
{ user_guid: opts.user }
|
|
44646
44647
|
);
|
|
44647
44648
|
if (opts.json) {
|
|
@@ -44670,15 +44671,15 @@ AuthKey_<KEYID>.p8 file, then:
|
|
|
44670
44671
|
|
|
44671
44672
|
The key is stored encrypted and never shown again. Your app registers each
|
|
44672
44673
|
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
|
|
44674
|
+
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 () => {
|
|
44675
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44675
44676
|
let p8;
|
|
44676
44677
|
try {
|
|
44677
44678
|
p8 = readFileSync22(opts.p8, "utf-8");
|
|
44678
44679
|
} catch {
|
|
44679
44680
|
throw new Error(`Can't read ${opts.p8}. Pass the path to the AuthKey_<KEYID>.p8 file from Apple.`);
|
|
44680
44681
|
}
|
|
44681
|
-
const res = await put(`/api/${
|
|
44682
|
+
const res = await put(`/api/${projectGuid}/services/notify/apns`, {
|
|
44682
44683
|
team_id: opts.teamId,
|
|
44683
44684
|
key_id: opts.keyId,
|
|
44684
44685
|
bundle_id: opts.bundleId,
|
|
@@ -44692,18 +44693,18 @@ apnsCommand.command("set").description("Store the APNs key for this app (all env
|
|
|
44692
44693
|
console.log(success("\u2713 iOS push is set up."));
|
|
44693
44694
|
printApns(res.data);
|
|
44694
44695
|
}));
|
|
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/${
|
|
44696
|
+
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 () => {
|
|
44697
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44698
|
+
const res = await get(`/api/${projectGuid}/services/notify/apns`);
|
|
44698
44699
|
if (opts.json) {
|
|
44699
44700
|
console.log(JSON.stringify(res.data));
|
|
44700
44701
|
return;
|
|
44701
44702
|
}
|
|
44702
44703
|
printApns(res.data);
|
|
44703
44704
|
}));
|
|
44704
|
-
apnsCommand.command("rm").description("Remove the APNs key (iOS devices stop receiving notifications)").option(
|
|
44705
|
-
const
|
|
44706
|
-
const res = await del(`/api/${
|
|
44705
|
+
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 () => {
|
|
44706
|
+
const projectGuid = await projectGuidFor(opts);
|
|
44707
|
+
const res = await del(`/api/${projectGuid}/services/notify/apns`);
|
|
44707
44708
|
if (opts.json) {
|
|
44708
44709
|
console.log(JSON.stringify(res.data));
|
|
44709
44710
|
return;
|
|
@@ -45301,7 +45302,7 @@ init_api();
|
|
|
45301
45302
|
init_config();
|
|
45302
45303
|
init_colors();
|
|
45303
45304
|
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(
|
|
45305
|
+
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
45306
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
45306
45307
|
const payload = { to: to2, subject: opts.subject, text: opts.text };
|
|
45307
45308
|
if (opts.replyTo) payload.replyTo = opts.replyTo;
|
|
@@ -45321,7 +45322,7 @@ emailCommand.command("test").description("Send a test email through your app's e
|
|
|
45321
45322
|
console.log(muted(` ${r.to} - ${r.status}${r.reason ? `: ${r.reason}` : ""}`));
|
|
45322
45323
|
}
|
|
45323
45324
|
}));
|
|
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(
|
|
45325
|
+
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
45326
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
45326
45327
|
const res = await get(
|
|
45327
45328
|
`/account/logs/credits?operations=email_send,email_skip&app_guid=${config.projectGuid}&range=${encodeURIComponent(opts.range)}&limit=${encodeURIComponent(opts.limit)}`
|
|
@@ -45400,12 +45401,12 @@ function statusText(g) {
|
|
|
45400
45401
|
return "expired: it waited too long in the queue (not charged)";
|
|
45401
45402
|
}
|
|
45402
45403
|
}
|
|
45403
|
-
async function submitGenerations(
|
|
45404
|
-
const res = await post(gensPath(
|
|
45404
|
+
async function submitGenerations(projectGuid, body) {
|
|
45405
|
+
const res = await post(gensPath(projectGuid), body);
|
|
45405
45406
|
return res.data;
|
|
45406
45407
|
}
|
|
45407
|
-
async function fetchGenerations(
|
|
45408
|
-
const res = await get(`${gensPath(
|
|
45408
|
+
async function fetchGenerations(projectGuid, ids) {
|
|
45409
|
+
const res = await get(`${gensPath(projectGuid)}?ids=${ids.map(encodeURIComponent).join(",")}`);
|
|
45409
45410
|
return res.data;
|
|
45410
45411
|
}
|
|
45411
45412
|
function combinedText(gens) {
|
|
@@ -45414,7 +45415,7 @@ function combinedText(gens) {
|
|
|
45414
45415
|
const live = gens.find((g) => !TERMINAL.has(g.status));
|
|
45415
45416
|
return `${done}/${gens.length} finished${live ? `; ${statusText(live)}` : ""}`;
|
|
45416
45417
|
}
|
|
45417
|
-
async function waitForGenerations(
|
|
45418
|
+
async function waitForGenerations(projectGuid, initial, opts = {}) {
|
|
45418
45419
|
const ids = initial.map((g) => g.id);
|
|
45419
45420
|
const tty = !!process.stdout.isTTY && !opts.json;
|
|
45420
45421
|
const say = (line) => opts.json ? console.error(line) : console.log(line);
|
|
@@ -45446,7 +45447,7 @@ async function waitForGenerations(projectGuid2, initial, opts = {}) {
|
|
|
45446
45447
|
while (!gens.every((g) => TERMINAL.has(g.status))) {
|
|
45447
45448
|
await sleepUnlessInterrupted(pollMs(), () => interrupted);
|
|
45448
45449
|
if (interrupted) break;
|
|
45449
|
-
gens = await fetchGenerations(
|
|
45450
|
+
gens = await fetchGenerations(projectGuid, ids);
|
|
45450
45451
|
draw(combinedText(gens));
|
|
45451
45452
|
}
|
|
45452
45453
|
} finally {
|
|
@@ -45456,7 +45457,7 @@ async function waitForGenerations(projectGuid2, initial, opts = {}) {
|
|
|
45456
45457
|
if (interrupted) {
|
|
45457
45458
|
const open = gens.filter((g) => !TERMINAL.has(g.status)).map((g) => g.id);
|
|
45458
45459
|
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(
|
|
45460
|
+
for (const id2 of open) await post(`${gensPath(projectGuid)}/${encodeURIComponent(id2)}/cancel`);
|
|
45460
45461
|
console.log(muted(`Cancelled ${open.join(" ")} (not charged).`));
|
|
45461
45462
|
} else {
|
|
45462
45463
|
console.error(muted(`Left queued. Check later with: gipity generate status ${open.join(" ")}`));
|
|
@@ -45813,13 +45814,13 @@ function numberedPath(base, i, n) {
|
|
|
45813
45814
|
const slash = Math.max(base.lastIndexOf("/"), base.lastIndexOf("\\"));
|
|
45814
45815
|
return dot > slash ? `${base.slice(0, dot)}-${i + 1}${base.slice(dot)}` : `${base}-${i + 1}`;
|
|
45815
45816
|
}
|
|
45816
|
-
async function generateQueued(
|
|
45817
|
+
async function generateQueued(projectGuid, prompt2, opts) {
|
|
45817
45818
|
if (opts.input) throw new Error("--input editing is not available on queued generations; drop --input or pick a cloud model.");
|
|
45818
45819
|
if (!opts.model || !String(opts.model).startsWith("gipity-")) {
|
|
45819
45820
|
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
45821
|
}
|
|
45821
45822
|
const started = Date.now();
|
|
45822
|
-
const submitted = await submitGenerations(
|
|
45823
|
+
const submitted = await submitGenerations(projectGuid, {
|
|
45823
45824
|
model: opts.model,
|
|
45824
45825
|
prompt: prompt2,
|
|
45825
45826
|
avoid: opts.avoid,
|
|
@@ -45841,7 +45842,7 @@ async function generateQueued(projectGuid2, prompt2, opts) {
|
|
|
45841
45842
|
return;
|
|
45842
45843
|
}
|
|
45843
45844
|
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(
|
|
45845
|
+
const done = await waitForGenerations(projectGuid, submitted, { json: !!opts.json });
|
|
45845
45846
|
const elapsed = (Date.now() - started) / 1e3;
|
|
45846
45847
|
const saved = [];
|
|
45847
45848
|
for (let i = 0; i < done.length; i++) {
|
|
@@ -46649,7 +46650,7 @@ function undeployedFunctionsFromFailures(results) {
|
|
|
46649
46650
|
return [...names];
|
|
46650
46651
|
}
|
|
46651
46652
|
var LONG_RUN_MS = 6e4;
|
|
46652
|
-
async function pollTestStatus(
|
|
46653
|
+
async function pollTestStatus(projectGuid, runGuid, opts) {
|
|
46653
46654
|
const startTime = Date.now();
|
|
46654
46655
|
const getPollInterval = () => {
|
|
46655
46656
|
const elapsed = Date.now() - startTime;
|
|
@@ -46671,7 +46672,7 @@ async function pollTestStatus(projectGuid2, runGuid, opts) {
|
|
|
46671
46672
|
if (Date.now() - startTime > POLL_HARD_CAP_MS) {
|
|
46672
46673
|
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
46674
|
}
|
|
46674
|
-
const res = await get(`/projects/${
|
|
46675
|
+
const res = await get(`/projects/${projectGuid}/test/status/${runGuid}`);
|
|
46675
46676
|
const data = res.data;
|
|
46676
46677
|
if (!opts.json && data.results.length > lastResultCount) {
|
|
46677
46678
|
const newResults = data.results.slice(lastResultCount);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.43",
|
|
4
4
|
"description": "The full-stack platform tuned for AI agents. Database, storage, auth, functions, deploy, and drop-in kits - all agent-tuned. Pair with Claude Code or use standalone.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gipity": "dist/updater/shim.js",
|