gipity 1.1.25 → 1.1.26
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/api.js +4 -1
- package/dist/commands/page-eval.js +12 -2
- package/dist/commands/page-inspect.js +3 -1
- package/dist/commands/test.js +14 -5
- package/dist/helpers/command.js +5 -0
- package/dist/helpers/sync.js +9 -0
- package/dist/index.js +32 -11
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -418,7 +418,10 @@ export async function putToPresignedUrl(url, body, contentLength, contentType) {
|
|
|
418
418
|
}
|
|
419
419
|
if (!res.ok) {
|
|
420
420
|
const text = await res.text().catch(() => res.statusText);
|
|
421
|
-
|
|
421
|
+
// The storage host answers in provider XML; keep only its error code so the
|
|
422
|
+
// message stays one readable line and doesn't name the provider.
|
|
423
|
+
const code = /<Code>([^<]+)<\/Code>/.exec(text)?.[1];
|
|
424
|
+
throw new ApiError(res.status, 'S3_UPLOAD', `Gipity Storage upload failed: HTTP ${res.status}${code ? ` (${code})` : ''}`);
|
|
422
425
|
}
|
|
423
426
|
const etag = (res.headers.get('etag') ?? '').replace(/^"|"$/g, '');
|
|
424
427
|
return etag;
|
|
@@ -118,6 +118,9 @@ export function summarizeExpr(expr) {
|
|
|
118
118
|
return `${head} ${shape}`;
|
|
119
119
|
}
|
|
120
120
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
121
|
+
/** Shown whenever the server cut the result at its cap. */
|
|
122
|
+
export const EVAL_TRUNCATED_NOTE = '⚠ Result cut at 16 KB: the value above is incomplete. Return something smaller (a count, a hash, a summary). '
|
|
123
|
+
+ 'To check a rendered image, use `gipity page screenshot` instead of returning its data.';
|
|
121
124
|
// A single browser session is held open synchronously for the whole --wait, so
|
|
122
125
|
// the server caps it at the gateway idle timeout. Longer is impossible in one
|
|
123
126
|
// shot; watching an app past 30s means several windows, not one big wait.
|
|
@@ -673,6 +676,10 @@ export const pageEvalCommand = new Command('eval')
|
|
|
673
676
|
// raise --timeout" is guaranteed-wasted advice against a looped still.
|
|
674
677
|
const emptyHint = camera ? EVAL_CAMERA_EMPTY_HINT : EVAL_EMPTY_STATE_HINT;
|
|
675
678
|
if (opts.json) {
|
|
679
|
+
// A cut value inside the JSON is easy to miss (a base64 image decodes to
|
|
680
|
+
// exactly 12288 bytes and looks like a corrupt file), so say it on stderr.
|
|
681
|
+
if (d.truncated)
|
|
682
|
+
console.error(warning(EVAL_TRUNCATED_NOTE));
|
|
676
683
|
console.log(JSON.stringify({
|
|
677
684
|
...d, result,
|
|
678
685
|
...(stepOut.length ? { stepResults: stepOut.map((s) => s.result) } : {}),
|
|
@@ -733,7 +740,7 @@ export const pageEvalCommand = new Command('eval')
|
|
|
733
740
|
if (emptyState)
|
|
734
741
|
console.log(muted(`\n${emptyHint}`));
|
|
735
742
|
if (d.truncated)
|
|
736
|
-
console.log(
|
|
743
|
+
console.log(warning(`\n${EVAL_TRUNCATED_NOTE}`));
|
|
737
744
|
for (let i = 0; i < stepOut.length; i++) {
|
|
738
745
|
const s = stepOut[i];
|
|
739
746
|
console.log(`\n${bold(`Step ${i + 1}`)} ${muted(summarizeExpr(s.expr))} ${muted('(same page load)')}`);
|
|
@@ -754,7 +761,10 @@ export const pageEvalCommand = new Command('eval')
|
|
|
754
761
|
if (restoreDb) {
|
|
755
762
|
try {
|
|
756
763
|
const r = await restoreCheckpoint(restoreDb.projectGuid, restoreDb.database);
|
|
757
|
-
|
|
764
|
+
// The app tables are restored; Records change history lives in the
|
|
765
|
+
// platform audit log and is not part of the checkpoint, so don't
|
|
766
|
+
// promise that nothing survives.
|
|
767
|
+
console.error(muted(`Rolled ${r.tables.length} table(s) back to the checkpoint (${r.rows} row(s)). Not rolled back: Records change history (gipity records history) and id sequences, so rows this eval created can still show there.`));
|
|
758
768
|
}
|
|
759
769
|
catch (err) {
|
|
760
770
|
console.error(warning(`⚠ Could not roll back the database - the checkpoint is still there, retry with: gipity db restore (${err.message})`));
|
|
@@ -191,7 +191,9 @@ export async function inspectPage(url, opts = {}) {
|
|
|
191
191
|
: `${warning('Auth: session NOT established')}${b.auth.detail ? `: ${b.auth.detail}` : ''} ${muted('(this is the anonymous view)')}`);
|
|
192
192
|
}
|
|
193
193
|
else {
|
|
194
|
-
|
|
194
|
+
// A full command, not "pass --auth": this also prints under
|
|
195
|
+
// `deploy --inspect`, and deploy has no --auth flag.
|
|
196
|
+
console.log(muted(`Auth: anonymous visitor (signed out). Signed-in view: gipity page inspect ${url} --auth`));
|
|
195
197
|
}
|
|
196
198
|
console.log(`${muted('Title:')} ${b.title || '(none)'}`);
|
|
197
199
|
console.log(`${muted('Elements:')} ${b.elementCount || 0}`);
|
package/dist/commands/test.js
CHANGED
|
@@ -211,16 +211,25 @@ export const testCommand = new Command('test')
|
|
|
211
211
|
// subdirectory must not read this as "the project has no tests" for
|
|
212
212
|
// the wrong reason (cli#120).
|
|
213
213
|
const root = getProjectRoot();
|
|
214
|
+
let listing = {};
|
|
215
|
+
try {
|
|
216
|
+
listing = (await get(`/projects/${config.projectGuid}/test/list`)).data;
|
|
217
|
+
}
|
|
218
|
+
catch { /* advisory - fall through to the generic message */ }
|
|
219
|
+
const files = listing.files ?? [];
|
|
220
|
+
if (files.length > 0) {
|
|
221
|
+
// Files exist but registered nothing: almost always a file that
|
|
222
|
+
// exports its tests instead of calling the harness's global test().
|
|
223
|
+
console.log(clrError(`No tests ran - found ${files.length} test file(s) but none registered a test: ${files.map(f => f.path).join(', ')}`));
|
|
224
|
+
console.log(muted("Each file must call the global test('name', async (ctx) => { ... }) at top level. Exported tests (export default { tests }) are not run, and test/assert must not be imported."));
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
214
227
|
console.log(muted(`No tests ran - no tests/*.test.js files under the project root${root ? ` (${root})` : ''}.`));
|
|
215
228
|
console.log(muted('gipity test runs server-function tests only; a frontend-only app (no functions/) has nothing here to run.'));
|
|
216
229
|
console.log(muted('Verify a frontend app by driving the live page: gipity page inspect <url> (or gipity page eval).'));
|
|
217
230
|
// Enumerate test-looking files the runner deliberately skips (kit
|
|
218
231
|
// tests, .spec.*) so this answer never contradicts what's on disk.
|
|
219
|
-
|
|
220
|
-
const listRes = await get(`/projects/${config.projectGuid}/test/list`);
|
|
221
|
-
printSkippedCandidates(listRes.data.skipped ?? []);
|
|
222
|
-
}
|
|
223
|
-
catch { /* the skipped list is advisory - never fail the run over it */ }
|
|
232
|
+
printSkippedCandidates(listing.skipped ?? []);
|
|
224
233
|
return;
|
|
225
234
|
}
|
|
226
235
|
if (data.status === 'failed' && data.errorMessage) {
|
package/dist/helpers/command.js
CHANGED
|
@@ -36,6 +36,11 @@ export function printCommandError(label, err) {
|
|
|
36
36
|
export function run(label, action) {
|
|
37
37
|
return action().catch((err) => {
|
|
38
38
|
printCommandError(label, err);
|
|
39
|
+
// A --json caller parses stdout: give it a JSON error too, or its parser
|
|
40
|
+
// crashes on the plain-text failure and the real reason is lost.
|
|
41
|
+
if (process.argv.includes('--json')) {
|
|
42
|
+
console.log(JSON.stringify({ error: { code: err?.code ?? 'ERROR', message: `${label} failed: ${err?.message ?? String(err)}` } }));
|
|
43
|
+
}
|
|
39
44
|
process.exit(1);
|
|
40
45
|
});
|
|
41
46
|
}
|
package/dist/helpers/sync.js
CHANGED
|
@@ -40,6 +40,15 @@ export async function syncBeforeAction(opts) {
|
|
|
40
40
|
for (const e of result.errors)
|
|
41
41
|
console.error(clrError(`[sync] ${e}`));
|
|
42
42
|
}
|
|
43
|
+
// A conflict means the server copy won the real path and the local edit was
|
|
44
|
+
// moved aside. Carrying on would run the action on code the caller never
|
|
45
|
+
// wrote (a GipRunner build deployed every function public this way), so stop.
|
|
46
|
+
const conflicts = result.plan.actions.filter(a => a.kind === 'conflict');
|
|
47
|
+
if (conflicts.length > 0) {
|
|
48
|
+
const lines = conflicts.map(a => ` ${a.path}: the server copy changed too; your local edit was saved as "${a.renamedLocalTo ?? '(conflict copy)'}"`);
|
|
49
|
+
throw new Error(`Stopped before running: local edits conflicted with newer server copies.\n${lines.join('\n')}\n`
|
|
50
|
+
+ 'Nothing was run against the server. Put the version you want at the real path (often: re-apply your edit on top of the server copy), delete the conflict copy, then run the command again.');
|
|
51
|
+
}
|
|
43
52
|
}
|
|
44
53
|
/**
|
|
45
54
|
* Pull down files the action itself wrote on the server. A deploy can rewrite
|
package/dist/index.js
CHANGED
|
@@ -9367,7 +9367,8 @@ async function putToPresignedUrl(url, body, contentLength, contentType) {
|
|
|
9367
9367
|
}
|
|
9368
9368
|
if (!res.ok) {
|
|
9369
9369
|
const text = await res.text().catch(() => res.statusText);
|
|
9370
|
-
|
|
9370
|
+
const code = /<Code>([^<]+)<\/Code>/.exec(text)?.[1];
|
|
9371
|
+
throw new ApiError(res.status, "S3_UPLOAD", `Gipity Storage upload failed: HTTP ${res.status}${code ? ` (${code})` : ""}`);
|
|
9371
9372
|
}
|
|
9372
9373
|
const etag = (res.headers.get("etag") ?? "").replace(/^"|"$/g, "");
|
|
9373
9374
|
return etag;
|
|
@@ -34719,6 +34720,9 @@ function printCommandError(label2, err) {
|
|
|
34719
34720
|
function run(label2, action) {
|
|
34720
34721
|
return action().catch((err) => {
|
|
34721
34722
|
printCommandError(label2, err);
|
|
34723
|
+
if (process.argv.includes("--json")) {
|
|
34724
|
+
console.log(JSON.stringify({ error: { code: err?.code ?? "ERROR", message: `${label2} failed: ${err?.message ?? String(err)}` } }));
|
|
34725
|
+
}
|
|
34722
34726
|
process.exit(1);
|
|
34723
34727
|
});
|
|
34724
34728
|
}
|
|
@@ -36223,6 +36227,15 @@ async function syncBeforeAction(opts) {
|
|
|
36223
36227
|
if (result.errors.length > 0 && !opts.json) {
|
|
36224
36228
|
for (const e of result.errors) console.error(error(`[sync] ${e}`));
|
|
36225
36229
|
}
|
|
36230
|
+
const conflicts = result.plan.actions.filter((a) => a.kind === "conflict");
|
|
36231
|
+
if (conflicts.length > 0) {
|
|
36232
|
+
const lines = conflicts.map((a) => ` ${a.path}: the server copy changed too; your local edit was saved as "${a.renamedLocalTo ?? "(conflict copy)"}"`);
|
|
36233
|
+
throw new Error(
|
|
36234
|
+
`Stopped before running: local edits conflicted with newer server copies.
|
|
36235
|
+
${lines.join("\n")}
|
|
36236
|
+
Nothing was run against the server. Put the version you want at the real path (often: re-apply your edit on top of the server copy), delete the conflict copy, then run the command again.`
|
|
36237
|
+
);
|
|
36238
|
+
}
|
|
36226
36239
|
}
|
|
36227
36240
|
async function syncAfterAction(opts) {
|
|
36228
36241
|
if (opts.sync === false) return;
|
|
@@ -38057,6 +38070,7 @@ function summarizeExpr(expr) {
|
|
|
38057
38070
|
return `${head} ${shape}`;
|
|
38058
38071
|
}
|
|
38059
38072
|
var sleep = (ms2) => new Promise((r) => setTimeout(r, ms2));
|
|
38073
|
+
var EVAL_TRUNCATED_NOTE = "\u26A0 Result cut at 16 KB: the value above is incomplete. Return something smaller (a count, a hash, a summary). To check a rendered image, use `gipity page screenshot` instead of returning its data.";
|
|
38060
38074
|
var MAX_WAIT_MS = 3e4;
|
|
38061
38075
|
function capWaitMs(rawWait, url) {
|
|
38062
38076
|
const parsed = parseInt(rawWait, 10);
|
|
@@ -38367,6 +38381,7 @@ ${hint}`);
|
|
|
38367
38381
|
const emptyState2 = !noValue && isEmptyStateResult(result);
|
|
38368
38382
|
const emptyHint = camera ? EVAL_CAMERA_EMPTY_HINT : EVAL_EMPTY_STATE_HINT;
|
|
38369
38383
|
if (opts.json) {
|
|
38384
|
+
if (d.truncated) console.error(warning(EVAL_TRUNCATED_NOTE));
|
|
38370
38385
|
console.log(JSON.stringify({
|
|
38371
38386
|
...d,
|
|
38372
38387
|
result,
|
|
@@ -38405,7 +38420,8 @@ ${result.trim() ? result : muted("(empty result)")}`);
|
|
|
38405
38420
|
${EVAL_NO_VALUE_HINT}`));
|
|
38406
38421
|
if (emptyState2) console.log(muted(`
|
|
38407
38422
|
${emptyHint}`));
|
|
38408
|
-
if (d.truncated) console.log(
|
|
38423
|
+
if (d.truncated) console.log(warning(`
|
|
38424
|
+
${EVAL_TRUNCATED_NOTE}`));
|
|
38409
38425
|
for (let i = 0; i < stepOut.length; i++) {
|
|
38410
38426
|
const s = stepOut[i];
|
|
38411
38427
|
console.log(`
|
|
@@ -38424,7 +38440,7 @@ ${bold("After reload")} ${muted("(page reloaded in place: storage preserved)")}`
|
|
|
38424
38440
|
if (restoreDb) {
|
|
38425
38441
|
try {
|
|
38426
38442
|
const r = await restoreCheckpoint(restoreDb.projectGuid, restoreDb.database);
|
|
38427
|
-
console.error(muted(`Rolled ${r.tables.length} table(s) back to the checkpoint (${r.rows} row(s))
|
|
38443
|
+
console.error(muted(`Rolled ${r.tables.length} table(s) back to the checkpoint (${r.rows} row(s)). Not rolled back: Records change history (gipity records history) and id sequences, so rows this eval created can still show there.`));
|
|
38428
38444
|
} catch (err) {
|
|
38429
38445
|
console.error(warning(`\u26A0 Could not roll back the database - the checkpoint is still there, retry with: gipity db restore (${err.message})`));
|
|
38430
38446
|
}
|
|
@@ -39025,7 +39041,7 @@ async function inspectPage(url, opts = {}) {
|
|
|
39025
39041
|
const who = getAuth()?.email;
|
|
39026
39042
|
console.log(b7.auth.established ? `${muted("Auth:")} ${success("session established")}${who ? muted(` as ${who}`) : ""} ${muted("(what the page renders with it is app-defined)")}` : `${warning("Auth: session NOT established")}${b7.auth.detail ? `: ${b7.auth.detail}` : ""} ${muted("(this is the anonymous view)")}`);
|
|
39027
39043
|
} else {
|
|
39028
|
-
console.log(muted(
|
|
39044
|
+
console.log(muted(`Auth: anonymous visitor (signed out). Signed-in view: gipity page inspect ${url} --auth`));
|
|
39029
39045
|
}
|
|
39030
39046
|
console.log(`${muted("Title:")} ${b7.title || "(none)"}`);
|
|
39031
39047
|
console.log(`${muted("Elements:")} ${b7.elementCount || 0}`);
|
|
@@ -45653,16 +45669,21 @@ var testCommand = new Command("test").description("Run tests").argument("[path]"
|
|
|
45653
45669
|
}
|
|
45654
45670
|
if (!filterPath && data.total === 0 && data.results.length === 0) {
|
|
45655
45671
|
const root = getProjectRoot();
|
|
45656
|
-
|
|
45657
|
-
console.log(muted("gipity test runs server-function tests only; a frontend-only app (no functions/) has nothing here to run."));
|
|
45658
|
-
console.log(muted("Verify a frontend app by driving the live page: gipity page inspect <url> (or gipity page eval)."));
|
|
45672
|
+
let listing = {};
|
|
45659
45673
|
try {
|
|
45660
|
-
|
|
45661
|
-
`/projects/${config.projectGuid}/test/list`
|
|
45662
|
-
);
|
|
45663
|
-
printSkippedCandidates(listRes.data.skipped ?? []);
|
|
45674
|
+
listing = (await get(`/projects/${config.projectGuid}/test/list`)).data;
|
|
45664
45675
|
} catch {
|
|
45665
45676
|
}
|
|
45677
|
+
const files = listing.files ?? [];
|
|
45678
|
+
if (files.length > 0) {
|
|
45679
|
+
console.log(error(`No tests ran - found ${files.length} test file(s) but none registered a test: ${files.map((f) => f.path).join(", ")}`));
|
|
45680
|
+
console.log(muted("Each file must call the global test('name', async (ctx) => { ... }) at top level. Exported tests (export default { tests }) are not run, and test/assert must not be imported."));
|
|
45681
|
+
process.exit(1);
|
|
45682
|
+
}
|
|
45683
|
+
console.log(muted(`No tests ran - no tests/*.test.js files under the project root${root ? ` (${root})` : ""}.`));
|
|
45684
|
+
console.log(muted("gipity test runs server-function tests only; a frontend-only app (no functions/) has nothing here to run."));
|
|
45685
|
+
console.log(muted("Verify a frontend app by driving the live page: gipity page inspect <url> (or gipity page eval)."));
|
|
45686
|
+
printSkippedCandidates(listing.skipped ?? []);
|
|
45666
45687
|
return;
|
|
45667
45688
|
}
|
|
45668
45689
|
if (data.status === "failed" && data.errorMessage) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.26",
|
|
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",
|