gipity 1.1.32 → 1.1.34
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 +13 -1
- package/dist/commands/file.js +22 -5
- package/dist/hooks/capture-runner.js +37 -2
- package/dist/index.js +22 -5
- package/package.json +1 -1
package/dist/commands/brand.js
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { Command } from 'commander';
|
|
14
14
|
import { get, post } from '../api.js';
|
|
15
|
-
import { resolveProjectContext } from '../config.js';
|
|
15
|
+
import { resolveProjectContext, getConfigPath } from '../config.js';
|
|
16
|
+
import { sync } from '../sync.js';
|
|
17
|
+
import { createProgressReporter } from '../progress.js';
|
|
16
18
|
import { bold, muted, success } from '../colors.js';
|
|
17
19
|
import { run } from '../helpers/index.js';
|
|
18
20
|
const ACCENT_SOURCE_LABEL = {
|
|
@@ -92,6 +94,7 @@ brandCommand
|
|
|
92
94
|
return;
|
|
93
95
|
}
|
|
94
96
|
const res = await post(`/projects/${config.projectGuid}/brand`, body);
|
|
97
|
+
await pullWrittenFiles(res.data.files ?? [], opts);
|
|
95
98
|
if (opts.json) {
|
|
96
99
|
console.log(JSON.stringify(res.data));
|
|
97
100
|
return;
|
|
@@ -109,12 +112,21 @@ brandCommand
|
|
|
109
112
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
110
113
|
const body = opts.fixHead ? { fix_head: true } : {};
|
|
111
114
|
const res = await post(`/projects/${config.projectGuid}/brand`, body);
|
|
115
|
+
await pullWrittenFiles(res.data.files ?? [], opts);
|
|
112
116
|
if (opts.json) {
|
|
113
117
|
console.log(JSON.stringify(res.data));
|
|
114
118
|
return;
|
|
115
119
|
}
|
|
116
120
|
reportFiles(res.data.files ?? []);
|
|
117
121
|
}));
|
|
122
|
+
/** The server writes the regenerated assets (icons, manifest, index.html head)
|
|
123
|
+
* into the project. Pull them now: a local copy left stale gets edited, and
|
|
124
|
+
* the next deploy stops on a sync conflict. Only for the linked project in cwd. */
|
|
125
|
+
async function pullWrittenFiles(files, opts) {
|
|
126
|
+
if (!files.length || opts.project || !getConfigPath())
|
|
127
|
+
return;
|
|
128
|
+
await sync({ interactive: false, progress: opts.json ? undefined : createProgressReporter() });
|
|
129
|
+
}
|
|
118
130
|
function reportFiles(files) {
|
|
119
131
|
if (!files.length) {
|
|
120
132
|
console.log(muted('\nStored (assets not regenerated - run gipity brand apply).'));
|
package/dist/commands/file.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { get, del, post } from '../api.js';
|
|
2
|
+
import { get, del, post, ApiError } from '../api.js';
|
|
3
3
|
import { resolveProjectContext } from '../config.js';
|
|
4
|
-
import { formatSize } from '../utils.js';
|
|
4
|
+
import { formatSize, confirm } from '../utils.js';
|
|
5
5
|
import { info, muted } from '../colors.js';
|
|
6
6
|
import { run, printList, printResult } from '../helpers/index.js';
|
|
7
7
|
export const fileCommand = new Command('file')
|
|
@@ -75,12 +75,29 @@ fileCommand
|
|
|
75
75
|
}));
|
|
76
76
|
fileCommand
|
|
77
77
|
.command('rm <path>')
|
|
78
|
-
.description('Delete a file or folder')
|
|
78
|
+
.description('Delete a file or folder (a folder over 5 files asks first; --yes skips that)')
|
|
79
|
+
.option('--yes', 'Delete a large folder without asking')
|
|
79
80
|
.option('--json', 'Output as JSON')
|
|
80
81
|
.action((path, opts) => run('Delete', async () => {
|
|
81
82
|
const { config } = await resolveProjectContext();
|
|
82
|
-
const
|
|
83
|
-
|
|
83
|
+
const url = (confirmed) => `/projects/${config.projectGuid}/files?path=${encodeURIComponent(path)}${confirmed ? '&confirm=1' : ''}`;
|
|
84
|
+
let res;
|
|
85
|
+
try {
|
|
86
|
+
res = await del(url(!!opts.yes));
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
// The server holds a folder delete over 5 files until it is confirmed.
|
|
90
|
+
if (!(err instanceof ApiError && err.code === 'CONFIRM_REQUIRED'))
|
|
91
|
+
throw err;
|
|
92
|
+
const n = Number(err.data?.file_count ?? 0);
|
|
93
|
+
if (!await confirm(`Delete ${path} and the ${n} files under it?`, { skip: opts.yes })) {
|
|
94
|
+
console.log('Cancelled.');
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
res = await del(url(true));
|
|
98
|
+
}
|
|
99
|
+
const n = res.data?.deleted_files;
|
|
100
|
+
printResult(res.data?.folder ? `Deleted folder: ${path} (${n} file${n === 1 ? '' : 's'})` : `Deleted: ${path}`, opts, res);
|
|
84
101
|
}));
|
|
85
102
|
fileCommand
|
|
86
103
|
.command('versions <path>')
|
|
@@ -317,9 +317,44 @@ async function readStdin() {
|
|
|
317
317
|
process.stdin.on('error', () => resolve(buf));
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
// Per-entry byte caps the ingest route enforces (platform routes/remote-sessions.ts),
|
|
321
|
+
// kept a little under. An entry over them 400s its whole batch, and since the
|
|
322
|
+
// watermark only advances on success, every later flush of the session failed
|
|
323
|
+
// on the same entry: one big screenshot stopped capture for the rest of the run.
|
|
324
|
+
const MAX_TOOL_JSON_BYTES = 190_000;
|
|
325
|
+
const MAX_ASSISTANT_CHARS = 480_000;
|
|
326
|
+
const bytesOf = (v) => {
|
|
327
|
+
try {
|
|
328
|
+
return Buffer.byteLength(JSON.stringify(v ?? null), 'utf-8');
|
|
329
|
+
}
|
|
330
|
+
catch {
|
|
331
|
+
return Infinity;
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
/** Swap a payload the server would reject for a short note saying what was
|
|
335
|
+
* dropped, so the rest of the transcript still lands. Exported for tests. */
|
|
336
|
+
export function fitEntryToCaps(e) {
|
|
337
|
+
const note = (n) => `[omitted from the capture: ${Math.round(n / 1024)} KB, over the size cap]`;
|
|
338
|
+
if (e.kind === 'tool_result') {
|
|
339
|
+
const n = bytesOf(e.content);
|
|
340
|
+
return n > MAX_TOOL_JSON_BYTES ? { ...e, content: note(n) } : e;
|
|
341
|
+
}
|
|
342
|
+
if (e.kind === 'tool_use') {
|
|
343
|
+
const n = bytesOf(e.tool_input);
|
|
344
|
+
return n > MAX_TOOL_JSON_BYTES ? { ...e, tool_input: { omitted: note(n) } } : e;
|
|
345
|
+
}
|
|
346
|
+
if (e.kind === 'assistant') {
|
|
347
|
+
const n = bytesOf(e.blocks);
|
|
348
|
+
if (e.text.length <= MAX_ASSISTANT_CHARS && n <= MAX_ASSISTANT_CHARS)
|
|
349
|
+
return e;
|
|
350
|
+
return { ...e, text: e.text.slice(0, MAX_ASSISTANT_CHARS), blocks: [{ type: 'text', text: note(n) }] };
|
|
351
|
+
}
|
|
352
|
+
return e;
|
|
353
|
+
}
|
|
354
|
+
async function postEntries(convGuid, rawEntries) {
|
|
355
|
+
if (!rawEntries.length)
|
|
322
356
|
return true;
|
|
357
|
+
const entries = rawEntries.map(fitEntryToCaps);
|
|
323
358
|
// Batch into server-cap-safe chunks.
|
|
324
359
|
for (let i = 0; i < entries.length; i += INGEST_BATCH_MAX) {
|
|
325
360
|
const slice = entries.slice(i, i + INGEST_BATCH_MAX);
|
package/dist/index.js
CHANGED
|
@@ -41153,12 +41153,23 @@ fileCommand.command("tree [path]").description("Show the file tree").option("--j
|
|
|
41153
41153
|
return `${f.path}${size}`;
|
|
41154
41154
|
});
|
|
41155
41155
|
}));
|
|
41156
|
-
fileCommand.command("rm <path>").description("Delete a file or folder").option("--json", "Output as JSON").action((path5, opts) => run("Delete", async () => {
|
|
41156
|
+
fileCommand.command("rm <path>").description("Delete a file or folder (a folder over 5 files asks first; --yes skips that)").option("--yes", "Delete a large folder without asking").option("--json", "Output as JSON").action((path5, opts) => run("Delete", async () => {
|
|
41157
41157
|
const { config } = await resolveProjectContext();
|
|
41158
|
-
const
|
|
41159
|
-
|
|
41160
|
-
|
|
41161
|
-
|
|
41158
|
+
const url = (confirmed) => `/projects/${config.projectGuid}/files?path=${encodeURIComponent(path5)}${confirmed ? "&confirm=1" : ""}`;
|
|
41159
|
+
let res;
|
|
41160
|
+
try {
|
|
41161
|
+
res = await del(url(!!opts.yes));
|
|
41162
|
+
} catch (err) {
|
|
41163
|
+
if (!(err instanceof ApiError && err.code === "CONFIRM_REQUIRED")) throw err;
|
|
41164
|
+
const n7 = Number(err.data?.file_count ?? 0);
|
|
41165
|
+
if (!await confirm(`Delete ${path5} and the ${n7} files under it?`, { skip: opts.yes })) {
|
|
41166
|
+
console.log("Cancelled.");
|
|
41167
|
+
return;
|
|
41168
|
+
}
|
|
41169
|
+
res = await del(url(true));
|
|
41170
|
+
}
|
|
41171
|
+
const n = res.data?.deleted_files;
|
|
41172
|
+
printResult(res.data?.folder ? `Deleted folder: ${path5} (${n} file${n === 1 ? "" : "s"})` : `Deleted: ${path5}`, opts, res);
|
|
41162
41173
|
}));
|
|
41163
41174
|
fileCommand.command("versions <path>").description("List file versions").option("--limit <n>", "Max versions to return", "20").option("--json", "Output as JSON").action((path5, opts) => run("Versions", async () => {
|
|
41164
41175
|
const { config } = await resolveProjectContext();
|
|
@@ -42976,6 +42987,7 @@ brandCommand.command("set").description("Change brand fields and regenerate all
|
|
|
42976
42987
|
return;
|
|
42977
42988
|
}
|
|
42978
42989
|
const res = await post(`/projects/${config.projectGuid}/brand`, body);
|
|
42990
|
+
await pullWrittenFiles(res.data.files ?? [], opts);
|
|
42979
42991
|
if (opts.json) {
|
|
42980
42992
|
console.log(JSON.stringify(res.data));
|
|
42981
42993
|
return;
|
|
@@ -42987,12 +42999,17 @@ brandCommand.command("apply").description("Re-render all brand assets from the s
|
|
|
42987
42999
|
const { config } = await resolveProjectContext({ projectOverride: opts.project });
|
|
42988
43000
|
const body = opts.fixHead ? { fix_head: true } : {};
|
|
42989
43001
|
const res = await post(`/projects/${config.projectGuid}/brand`, body);
|
|
43002
|
+
await pullWrittenFiles(res.data.files ?? [], opts);
|
|
42990
43003
|
if (opts.json) {
|
|
42991
43004
|
console.log(JSON.stringify(res.data));
|
|
42992
43005
|
return;
|
|
42993
43006
|
}
|
|
42994
43007
|
reportFiles(res.data.files ?? []);
|
|
42995
43008
|
}));
|
|
43009
|
+
async function pullWrittenFiles(files, opts) {
|
|
43010
|
+
if (!files.length || opts.project || !getConfigPath()) return;
|
|
43011
|
+
await sync({ interactive: false, progress: opts.json ? void 0 : createProgressReporter() });
|
|
43012
|
+
}
|
|
42996
43013
|
function reportFiles(files) {
|
|
42997
43014
|
if (!files.length) {
|
|
42998
43015
|
console.log(muted("\nStored (assets not regenerated - run gipity brand apply)."));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.34",
|
|
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",
|