gipity 1.1.35 → 1.1.37
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/deploy.js +1 -1
- package/dist/commands/project-auth.js +26 -3
- package/dist/helpers/sync.js +4 -1
- package/dist/index.js +178 -127
- package/dist/knowledge.js +1 -1
- package/dist/setup.js +1 -1
- package/dist/sync.js +47 -6
- package/package.json +1 -1
package/dist/commands/deploy.js
CHANGED
|
@@ -50,7 +50,7 @@ export const deployCommand = new Command('deploy')
|
|
|
50
50
|
.option('--yes-destructive', 'Allow pending prod migrations that destroy data (DROP TABLE/COLUMN, TRUNCATE, DELETE without WHERE, column type changes)')
|
|
51
51
|
.option('--plan', 'Show the pending migrations this deploy would run (and where each already ran), without deploying')
|
|
52
52
|
.option('--source-dir <dir>', 'Source directory to deploy from')
|
|
53
|
-
.option('--only <phases>', 'Run only specific phases, comma-separated, matched by gipity.yaml phase name or type: files/static, database/sql, functions, workflows, services, jobs, records, realtime, env, auth_branding')
|
|
53
|
+
.option('--only <phases>', 'Run only specific phases, comma-separated, matched by gipity.yaml phase name or type: files/static, database/sql, functions, workflows, services, jobs, records, realtime, env, auth_branding, auth')
|
|
54
54
|
.option('--force', 'Re-run all phases (ignore checksums) and bypass the sync bulk-deletion guard')
|
|
55
55
|
.option('--no-sync', 'Skip sync-up before deploy')
|
|
56
56
|
.option('--optimize', 'Bundle and minify the JS/CSS with Vite (off by default: files upload as-is, so prod serves what you verified). Only bundles <script type="module"> references, and page eval import() of an app module then loads a separate copy')
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
2
3
|
import { get, put, del } from '../api.js';
|
|
3
|
-
import { requireConfig } from '../config.js';
|
|
4
|
+
import { requireConfig, getProjectRoot } from '../config.js';
|
|
4
5
|
import { error as clrError, muted, success, warning, bold } from '../colors.js';
|
|
5
6
|
import { run, printResult } from '../helpers/index.js';
|
|
6
7
|
const AUTH_MODES = ['gipity', 'app', 'both'];
|
|
@@ -135,8 +136,14 @@ See: gipity skill read steam-game`)
|
|
|
135
136
|
}
|
|
136
137
|
const res = await put(`/projects/${config.projectGuid}`, body);
|
|
137
138
|
const lines = [];
|
|
138
|
-
if (body.auth_mode)
|
|
139
|
+
if (body.auth_mode) {
|
|
139
140
|
lines.push(success(`Sign-in set to "${body.auth_mode}".`));
|
|
141
|
+
// gipity.yaml is the source of truth (deploys apply it), so keep it in step.
|
|
142
|
+
const root = getProjectRoot();
|
|
143
|
+
if (root && writeYamlAuthMode(join(root, 'gipity.yaml'), body.auth_mode)) {
|
|
144
|
+
lines.push(muted('gipity.yaml: auth.mode updated (deploys apply it).'));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
140
147
|
if (body.unique_player_names !== undefined) {
|
|
141
148
|
lines.push(success(`Unique names ${body.unique_player_names ? 'on' : 'off'}.`));
|
|
142
149
|
const sharing = res.data.players_sharing_names ?? 0;
|
|
@@ -218,4 +225,20 @@ See: gipity skill read steam-game`)
|
|
|
218
225
|
printResult(lines.join('\n'), opts, res.data);
|
|
219
226
|
}));
|
|
220
227
|
}
|
|
228
|
+
/** Write `auth: { mode }` into gipity.yaml, the app's source of truth for its
|
|
229
|
+
* sign-in mode (every deploy applies it). A text edit, so comments survive:
|
|
230
|
+
* replace an existing top-level `auth:` block, or append one. Returns false
|
|
231
|
+
* when the project has no gipity.yaml. Exported for tests. */
|
|
232
|
+
export function writeYamlAuthMode(yamlPath, mode) {
|
|
233
|
+
if (!existsSync(yamlPath))
|
|
234
|
+
return false;
|
|
235
|
+
const text = readFileSync(yamlPath, 'utf-8');
|
|
236
|
+
const block = `auth:\n mode: ${mode}\n`;
|
|
237
|
+
const existing = /^auth:[^\n]*\n(?:[ \t]+[^\n]*\n|[ \t]*\n)*/m;
|
|
238
|
+
const next = existing.test(text)
|
|
239
|
+
? text.replace(existing, block)
|
|
240
|
+
: `${text.replace(/\n*$/, '\n')}\n# Who signs in to the app: gipity | app (its own users, incl. guests) | both\n${block}`;
|
|
241
|
+
writeFileSync(yamlPath, next);
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
221
244
|
//# sourceMappingURL=project-auth.js.map
|
package/dist/helpers/sync.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* sync.ts - Shared sync-before-action helper.
|
|
3
3
|
*/
|
|
4
|
-
import { sync, isLocalTreeClean, appUploadNote } from '../sync.js';
|
|
4
|
+
import { sync, isLocalTreeClean, appUploadNote, heldLargeNote } from '../sync.js';
|
|
5
5
|
import { muted, error as clrError } from '../colors.js';
|
|
6
6
|
import { createProgressReporter } from '../progress.js';
|
|
7
7
|
/**
|
|
@@ -36,6 +36,9 @@ export async function syncBeforeAction(opts) {
|
|
|
36
36
|
const note = appUploadNote(result.appUploadsLeftLocal);
|
|
37
37
|
if (note && !opts.json)
|
|
38
38
|
console.log(muted(note));
|
|
39
|
+
const held = heldLargeNote(result.heldLarge);
|
|
40
|
+
if (held && !opts.json)
|
|
41
|
+
console.log(muted(held));
|
|
39
42
|
if (result.errors.length > 0 && !opts.json) {
|
|
40
43
|
for (const e of result.errors)
|
|
41
44
|
console.error(clrError(`[sync] ${e}`));
|
package/dist/index.js
CHANGED
|
@@ -7095,7 +7095,7 @@ Write files locally - Gipity's editor hooks (installed into Claude Code, Codex,
|
|
|
7095
7095
|
|
|
7096
7096
|
Files your deployed app stores at runtime through the app uploads API (users' uploads, \`gipity upload\`, or an external service using a project API key; under \`uploads/\` or any custom path) are user content, not source: they stay in Gipity Storage and never sync into this directory, and sync never deletes them. List them with \`gipity file tree\`, read one with \`gipity file cat <path>\`.
|
|
7097
7097
|
|
|
7098
|
-
To keep local-only material (research clones, scratch data, vendored references) in the project directory without syncing or deploying it, list it in a \`.gipityignore\` at the project root - gitignore-style, one pattern per line, \`#\` comments. Ignored paths are invisible to sync in both directions; anything that already synced before being ignored stays on the server until you delete it.
|
|
7098
|
+
To keep local-only material (research clones, scratch data, vendored references) in the project directory without syncing or deploying it, list it in a \`.gipityignore\` at the project root - gitignore-style, one pattern per line, \`#\` comments. Ignored paths are invisible to sync in both directions; anything that already synced before being ignored stays on the server until you delete it. Sync also holds back any NEW file over 100 MB outside \`src/\`, \`functions/\` and \`migrations/\` (a stray render or dataset would otherwise upload on every background sync): it stays local, and sync names it each time. Add it to \`.gipityignore\`, or upload it on purpose with \`gipity push <path>\`.
|
|
7099
7099
|
|
|
7100
7100
|
**WSL trap: user-dropped files may be in a Windows-side twin.** On WSL, a same-named folder often exists at \`C:\\Users\\<name>\\GipityProjects\\<project>\` (visible as \`/mnt/c/Users/<name>/GipityProjects/<project>\`) - from Windows Explorer it looks like "the project folder", so users drop new files (audio, images) there. Nothing syncs from it. If the user says files are "in the project" but you can't find them, check that path before searching wider; \`gipity sync\` prints a notice when such a twin exists.
|
|
7101
7101
|
|
|
@@ -7959,7 +7959,7 @@ var init_setup = __esm({
|
|
|
7959
7959
|
GIPITY_MARKETPLACE_NAME = "gipity";
|
|
7960
7960
|
GIPITY_MARKETPLACE_REPO = "GipityAI/skills";
|
|
7961
7961
|
LEGACY_MARKETPLACE_REPO = "GipityAI/claude-plugin";
|
|
7962
|
-
GIPITY_PLUGIN_VERSION = "0.8.
|
|
7962
|
+
GIPITY_PLUGIN_VERSION = "0.8.3";
|
|
7963
7963
|
AGENTS_SKILLS_DIR = join6(homedir4(), ".agents", "skills");
|
|
7964
7964
|
AGENT_HOOKS_DIR = join6(homedir4(), ".gipity", "agent-hooks");
|
|
7965
7965
|
AGENT_SKILLS_MANIFEST = join6(homedir4(), ".gipity", "agent-skills.json");
|
|
@@ -34982,6 +34982,8 @@ init_setup();
|
|
|
34982
34982
|
var tar2 = __toESM(require_tar_stream(), 1);
|
|
34983
34983
|
var CONFIG_FILE2 = ".gipity.json";
|
|
34984
34984
|
var BULK_DELETE_COUNT = 10;
|
|
34985
|
+
var SYNC_LARGE_FILE_BYTES = 100 * 1024 * 1024;
|
|
34986
|
+
var DEPLOY_ROOTS = ["src/", "functions/", "migrations/"];
|
|
34985
34987
|
var BULK_DELETE_FRACTION = 0.25;
|
|
34986
34988
|
var DOWNLOAD_IDLE_MS = 3e4;
|
|
34987
34989
|
function syncStatePath() {
|
|
@@ -35461,6 +35463,30 @@ function withAppUploadNote(summary, leftLocal) {
|
|
|
35461
35463
|
return note ? `${summary}
|
|
35462
35464
|
${note}` : summary;
|
|
35463
35465
|
}
|
|
35466
|
+
function holdLargeNewUploads(planned, baselineFiles) {
|
|
35467
|
+
const held = [];
|
|
35468
|
+
const actions = planned.actions.filter((a) => {
|
|
35469
|
+
const hold = a.kind === "upload" && !baselineFiles[a.path] && (a.localSize ?? 0) > SYNC_LARGE_FILE_BYTES && !DEPLOY_ROOTS.some((r) => a.path.startsWith(r));
|
|
35470
|
+
if (hold) held.push({ path: a.path, size: a.localSize ?? 0 });
|
|
35471
|
+
return !hold;
|
|
35472
|
+
});
|
|
35473
|
+
if (!held.length) return { planned, held };
|
|
35474
|
+
return { planned: { ...planned, actions, uploads: planned.uploads - held.length }, held };
|
|
35475
|
+
}
|
|
35476
|
+
function heldLargeNote(held) {
|
|
35477
|
+
if (!held.length) return "";
|
|
35478
|
+
const list = held.map((h) => ` ${h.path} (${formatSize(h.size)})`).join("\n");
|
|
35479
|
+
const one = held.length === 1;
|
|
35480
|
+
return `Not uploaded: ${held.length} new file${one ? "" : "s"} over ${formatSize(SYNC_LARGE_FILE_BYTES)}:
|
|
35481
|
+
${list}
|
|
35482
|
+
Add ${one ? "it" : "them"} to .gipityignore to keep ${one ? "it" : "them"} local, or upload on purpose with \`gipity push <path>\`.`;
|
|
35483
|
+
}
|
|
35484
|
+
function withNotes(summary, leftLocal, held) {
|
|
35485
|
+
const note = heldLargeNote(held);
|
|
35486
|
+
const base = withAppUploadNote(summary, leftLocal);
|
|
35487
|
+
return note ? `${base}
|
|
35488
|
+
${note}` : base;
|
|
35489
|
+
}
|
|
35464
35490
|
async function bulkDeleteGuard(p, knownFiles, opts) {
|
|
35465
35491
|
const totalDeletes = p.deletesLocal + p.deletesRemote;
|
|
35466
35492
|
if (totalDeletes === 0) return true;
|
|
@@ -35549,16 +35575,17 @@ async function syncInner(projectGuid2, root, ignore2, opts, interactive) {
|
|
|
35549
35575
|
}
|
|
35550
35576
|
if (needHash.length) p?.phase(`Hashing ${needHash.length} file${needHash.length === 1 ? "" : "s"}...`);
|
|
35551
35577
|
await ensureLocalHashes(root, local, needHash);
|
|
35552
|
-
const planned = plan(local, remote, baseline.files);
|
|
35578
|
+
const { planned, held: heldLarge } = holdLargeNewUploads(plan(local, remote, baseline.files), baseline.files);
|
|
35553
35579
|
if (opts.plan) {
|
|
35554
35580
|
return {
|
|
35555
35581
|
plan: planned,
|
|
35556
35582
|
applied: 0,
|
|
35557
35583
|
skipped: 0,
|
|
35558
35584
|
errors: [],
|
|
35559
|
-
summary:
|
|
35585
|
+
summary: withNotes(formatPlan(planned), appUploadsLeftLocal, heldLarge),
|
|
35560
35586
|
deferredDeletes: 0,
|
|
35561
|
-
appUploadsLeftLocal
|
|
35587
|
+
appUploadsLeftLocal,
|
|
35588
|
+
heldLarge
|
|
35562
35589
|
};
|
|
35563
35590
|
}
|
|
35564
35591
|
if (opts.confirmMerge && remote.size > 0 && // project already has files - a real merge target
|
|
@@ -35581,7 +35608,8 @@ async function syncInner(projectGuid2, root, ignore2, opts, interactive) {
|
|
|
35581
35608
|
].join("\n"),
|
|
35582
35609
|
deferredDeletes: 0,
|
|
35583
35610
|
aborted: true,
|
|
35584
|
-
appUploadsLeftLocal: []
|
|
35611
|
+
appUploadsLeftLocal: [],
|
|
35612
|
+
heldLarge: []
|
|
35585
35613
|
});
|
|
35586
35614
|
if (getAutoConfirm()) {
|
|
35587
35615
|
} else if (interactive) {
|
|
@@ -36021,9 +36049,10 @@ async function syncInner(projectGuid2, root, ignore2, opts, interactive) {
|
|
|
36021
36049
|
applied,
|
|
36022
36050
|
skipped: skippedByGuard,
|
|
36023
36051
|
errors,
|
|
36024
|
-
summary:
|
|
36052
|
+
summary: withNotes(formatPlan(planned), appUploadsLeftLocal, heldLarge),
|
|
36025
36053
|
deferredDeletes: skippedByGuard,
|
|
36026
|
-
appUploadsLeftLocal
|
|
36054
|
+
appUploadsLeftLocal,
|
|
36055
|
+
heldLarge
|
|
36027
36056
|
};
|
|
36028
36057
|
}
|
|
36029
36058
|
function cleanupEmptyDirs(root, emptiedDirs) {
|
|
@@ -36255,6 +36284,8 @@ async function syncBeforeAction(opts) {
|
|
|
36255
36284
|
}
|
|
36256
36285
|
const note = appUploadNote(result.appUploadsLeftLocal);
|
|
36257
36286
|
if (note && !opts.json) console.log(muted(note));
|
|
36287
|
+
const held = heldLargeNote(result.heldLarge);
|
|
36288
|
+
if (held && !opts.json) console.log(muted(held));
|
|
36258
36289
|
if (result.errors.length > 0 && !opts.json) {
|
|
36259
36290
|
for (const e of result.errors) console.error(error(`[sync] ${e}`));
|
|
36260
36291
|
}
|
|
@@ -39226,7 +39257,7 @@ async function printPlan(appGuid2, env, json) {
|
|
|
39226
39257
|
console.log(warning("A prod deploy stops on the destructive statements above until you pass --yes-destructive."));
|
|
39227
39258
|
}
|
|
39228
39259
|
}
|
|
39229
|
-
var deployCommand = new Command("deploy").description("Deploy the app to prod, or to an environment (created on first deploy)").argument("[env]", "prod, or an environment name (dev, staging, ...). Omitted: prod while the app has no environments; once it has any, name one").option("--yes-destructive", "Allow pending prod migrations that destroy data (DROP TABLE/COLUMN, TRUNCATE, DELETE without WHERE, column type changes)").option("--plan", "Show the pending migrations this deploy would run (and where each already ran), without deploying").option("--source-dir <dir>", "Source directory to deploy from").option("--only <phases>", "Run only specific phases, comma-separated, matched by gipity.yaml phase name or type: files/static, database/sql, functions, workflows, services, jobs, records, realtime, env, auth_branding").option("--force", "Re-run all phases (ignore checksums) and bypass the sync bulk-deletion guard").option("--no-sync", "Skip sync-up before deploy").option("--optimize", 'Bundle and minify the JS/CSS with Vite (off by default: files upload as-is, so prod serves what you verified). Only bundles <script type="module"> references, and page eval import() of an app module then loads a separate copy').option("--json", "Output as JSON").option("--inspect [path]", "After a successful deploy, run `page inspect` on the deployed URL (or URL + path) in the same command - one build-loop step instead of two. With --json, emits two JSON lines: deploy, then inspect.").option("--wait <ms>", "With --inspect: sleep this many ms before capturing (max 30000)").option("--wait-for <selector>", "With --inspect: wait until this CSS selector appears before capturing (deterministic; the app's own ready signal)").option("--wait-timeout <ms>", "With --inspect: max ms to wait for --wait-for before giving up", "5000").action((envArg, opts) => run("Deploy", async () => {
|
|
39260
|
+
var deployCommand = new Command("deploy").description("Deploy the app to prod, or to an environment (created on first deploy)").argument("[env]", "prod, or an environment name (dev, staging, ...). Omitted: prod while the app has no environments; once it has any, name one").option("--yes-destructive", "Allow pending prod migrations that destroy data (DROP TABLE/COLUMN, TRUNCATE, DELETE without WHERE, column type changes)").option("--plan", "Show the pending migrations this deploy would run (and where each already ran), without deploying").option("--source-dir <dir>", "Source directory to deploy from").option("--only <phases>", "Run only specific phases, comma-separated, matched by gipity.yaml phase name or type: files/static, database/sql, functions, workflows, services, jobs, records, realtime, env, auth_branding, auth").option("--force", "Re-run all phases (ignore checksums) and bypass the sync bulk-deletion guard").option("--no-sync", "Skip sync-up before deploy").option("--optimize", 'Bundle and minify the JS/CSS with Vite (off by default: files upload as-is, so prod serves what you verified). Only bundles <script type="module"> references, and page eval import() of an app module then loads a separate copy').option("--json", "Output as JSON").option("--inspect [path]", "After a successful deploy, run `page inspect` on the deployed URL (or URL + path) in the same command - one build-loop step instead of two. With --json, emits two JSON lines: deploy, then inspect.").option("--wait <ms>", "With --inspect: sleep this many ms before capturing (max 30000)").option("--wait-for <selector>", "With --inspect: wait until this CSS selector appears before capturing (deterministic; the app's own ready signal)").option("--wait-timeout <ms>", "With --inspect: max ms to wait for --wait-for before giving up", "5000").action((envArg, opts) => run("Deploy", async () => {
|
|
39230
39261
|
const env = envArg ?? getEnvOption();
|
|
39231
39262
|
if (opts.plan) {
|
|
39232
39263
|
await printPlan(requireConfig2().projectGuid, env ?? "prod", !!opts.json);
|
|
@@ -40101,14 +40132,15 @@ init_config();
|
|
|
40101
40132
|
init_setup();
|
|
40102
40133
|
init_colors();
|
|
40103
40134
|
init_utils();
|
|
40104
|
-
import { join as
|
|
40135
|
+
import { join as join20 } from "path";
|
|
40105
40136
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
40106
40137
|
|
|
40107
40138
|
// src/commands/project-auth.ts
|
|
40108
40139
|
init_api();
|
|
40109
40140
|
init_config();
|
|
40110
40141
|
init_colors();
|
|
40111
|
-
import { readFileSync as readFileSync18 } from "fs";
|
|
40142
|
+
import { readFileSync as readFileSync18, writeFileSync as writeFileSync12, existsSync as existsSync15 } from "fs";
|
|
40143
|
+
import { join as join19 } from "path";
|
|
40112
40144
|
var AUTH_MODES = ["gipity", "app", "both"];
|
|
40113
40145
|
var PROVIDERS = ["google", "apple", "discord"];
|
|
40114
40146
|
var PROVIDER_LABEL = { google: "Google", apple: "Apple", discord: "Discord" };
|
|
@@ -40228,7 +40260,13 @@ See: gipity skill read steam-game`).option("--unique-names <on|off>", "Require u
|
|
|
40228
40260
|
}
|
|
40229
40261
|
const res = await put(`/projects/${config.projectGuid}`, body);
|
|
40230
40262
|
const lines = [];
|
|
40231
|
-
if (body.auth_mode)
|
|
40263
|
+
if (body.auth_mode) {
|
|
40264
|
+
lines.push(success(`Sign-in set to "${body.auth_mode}".`));
|
|
40265
|
+
const root = getProjectRoot();
|
|
40266
|
+
if (root && writeYamlAuthMode(join19(root, "gipity.yaml"), body.auth_mode)) {
|
|
40267
|
+
lines.push(muted("gipity.yaml: auth.mode updated (deploys apply it)."));
|
|
40268
|
+
}
|
|
40269
|
+
}
|
|
40232
40270
|
if (body.unique_player_names !== void 0) {
|
|
40233
40271
|
lines.push(success(`Unique names ${body.unique_player_names ? "on" : "off"}.`));
|
|
40234
40272
|
const sharing = res.data.players_sharing_names ?? 0;
|
|
@@ -40285,13 +40323,26 @@ See: gipity skill read steam-game`).option("--unique-names <on|off>", "Require u
|
|
|
40285
40323
|
printResult(lines.join("\n"), opts, res.data);
|
|
40286
40324
|
}));
|
|
40287
40325
|
}
|
|
40326
|
+
function writeYamlAuthMode(yamlPath, mode) {
|
|
40327
|
+
if (!existsSync15(yamlPath)) return false;
|
|
40328
|
+
const text = readFileSync18(yamlPath, "utf-8");
|
|
40329
|
+
const block = `auth:
|
|
40330
|
+
mode: ${mode}
|
|
40331
|
+
`;
|
|
40332
|
+
const existing = /^auth:[^\n]*\n(?:[ \t]+[^\n]*\n|[ \t]*\n)*/m;
|
|
40333
|
+
const next = existing.test(text) ? text.replace(existing, block) : `${text.replace(/\n*$/, "\n")}
|
|
40334
|
+
# Who signs in to the app: gipity | app (its own users, incl. guests) | both
|
|
40335
|
+
${block}`;
|
|
40336
|
+
writeFileSync12(yamlPath, next);
|
|
40337
|
+
return true;
|
|
40338
|
+
}
|
|
40288
40339
|
|
|
40289
40340
|
// src/commands/project-users.ts
|
|
40290
40341
|
init_api();
|
|
40291
40342
|
init_config();
|
|
40292
40343
|
init_colors();
|
|
40293
40344
|
init_utils();
|
|
40294
|
-
import { writeFileSync as
|
|
40345
|
+
import { writeFileSync as writeFileSync13 } from "fs";
|
|
40295
40346
|
var EXPORT_PAGE_SIZE = 500;
|
|
40296
40347
|
function fail2(msg) {
|
|
40297
40348
|
console.error(error(msg));
|
|
@@ -40368,7 +40419,7 @@ email code, Steam or a guest device. They belong to the app, not to Gipity.
|
|
|
40368
40419
|
process.stdout.write(out);
|
|
40369
40420
|
return;
|
|
40370
40421
|
}
|
|
40371
|
-
|
|
40422
|
+
writeFileSync13(opts.output, out);
|
|
40372
40423
|
printResult(success(`Exported ${all.length} user${all.length === 1 ? "" : "s"} to ${opts.output}.`), opts, { file: opts.output, count: all.length, format: opts.format });
|
|
40373
40424
|
}));
|
|
40374
40425
|
users.command("delete <userGuid>").description("Erase a user and everything the app keeps for them (runs the app's user_deleted hooks)").option("--json", "Output as JSON").action((userGuid, opts) => run("Delete", async () => {
|
|
@@ -40440,7 +40491,7 @@ projectCommand.command("create <name>").description("Create a project").option("
|
|
|
40440
40491
|
}
|
|
40441
40492
|
const res = await post("/projects", body);
|
|
40442
40493
|
const project = res.data;
|
|
40443
|
-
const dir =
|
|
40494
|
+
const dir = join20(getProjectsRoot(), project.slug);
|
|
40444
40495
|
mkdirSync11(dir, { recursive: true });
|
|
40445
40496
|
const accountSlug = await getAccountSlug();
|
|
40446
40497
|
const { applied } = await finalizeLocalProject({
|
|
@@ -40509,8 +40560,8 @@ registerUsersCommand(projectCommand);
|
|
|
40509
40560
|
// src/commands/workflow.ts
|
|
40510
40561
|
init_api();
|
|
40511
40562
|
init_config();
|
|
40512
|
-
import { existsSync as
|
|
40513
|
-
import { isAbsolute, join as
|
|
40563
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync12, readFileSync as readFileSync19, writeFileSync as writeFileSync14 } from "fs";
|
|
40564
|
+
import { isAbsolute, join as join21, resolve as resolve13 } from "path";
|
|
40514
40565
|
init_colors();
|
|
40515
40566
|
function mergedOpts(cmd) {
|
|
40516
40567
|
return cmd.optsWithGlobals();
|
|
@@ -40717,8 +40768,8 @@ steps:
|
|
|
40717
40768
|
tools: [memory, db_query]
|
|
40718
40769
|
`;
|
|
40719
40770
|
function readWorkflowYaml(from) {
|
|
40720
|
-
const candidates = isAbsolute(from) ? [from] : [resolve13(from), ...getProjectRoot() ? [
|
|
40721
|
-
const found = candidates.find((p) =>
|
|
40771
|
+
const candidates = isAbsolute(from) ? [from] : [resolve13(from), ...getProjectRoot() ? [join21(getProjectRoot(), from)] : []];
|
|
40772
|
+
const found = candidates.find((p) => existsSync16(p));
|
|
40722
40773
|
if (!found) throw new Error(`No workflow file at ${from}.`);
|
|
40723
40774
|
return readFileSync19(found, "utf-8");
|
|
40724
40775
|
}
|
|
@@ -40731,10 +40782,10 @@ workflowCommand.command("create").description("Create a workflow from a YAML fil
|
|
|
40731
40782
|
if (opts.heartbeat) {
|
|
40732
40783
|
from = HEARTBEAT_PATH;
|
|
40733
40784
|
const root = getProjectRoot();
|
|
40734
|
-
const local =
|
|
40735
|
-
if (!
|
|
40736
|
-
mkdirSync12(
|
|
40737
|
-
|
|
40785
|
+
const local = join21(root, HEARTBEAT_PATH);
|
|
40786
|
+
if (!existsSync16(local)) {
|
|
40787
|
+
mkdirSync12(join21(root, "workflows"), { recursive: true });
|
|
40788
|
+
writeFileSync14(local, HEARTBEAT_YAML);
|
|
40738
40789
|
}
|
|
40739
40790
|
await pushFile(local);
|
|
40740
40791
|
}
|
|
@@ -41314,8 +41365,8 @@ storageCommand.command("retention").description("View or adjust your file versio
|
|
|
41314
41365
|
init_platform();
|
|
41315
41366
|
init_auth();
|
|
41316
41367
|
init_api();
|
|
41317
|
-
import { join as
|
|
41318
|
-
import { existsSync as
|
|
41368
|
+
import { join as join23, dirname as dirname12, resolve as resolve14, basename as basename6, sep as sep6 } from "path";
|
|
41369
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync14, readFileSync as readFileSync21, writeFileSync as writeFileSync16, renameSync as renameSync2, readdirSync as readdirSync8, statSync as statSync8 } from "fs";
|
|
41319
41370
|
import { homedir as homedir15 } from "os";
|
|
41320
41371
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
41321
41372
|
import { randomUUID } from "crypto";
|
|
@@ -41675,12 +41726,12 @@ init_claude_setup();
|
|
|
41675
41726
|
init_agents();
|
|
41676
41727
|
|
|
41677
41728
|
// src/prefs.ts
|
|
41678
|
-
import { existsSync as
|
|
41729
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync13, readFileSync as readFileSync20, writeFileSync as writeFileSync15 } from "fs";
|
|
41679
41730
|
import { homedir as homedir14 } from "os";
|
|
41680
|
-
import { join as
|
|
41681
|
-
var PREFS_PATH =
|
|
41731
|
+
import { join as join22 } from "path";
|
|
41732
|
+
var PREFS_PATH = join22(homedir14(), ".gipity", "prefs.json");
|
|
41682
41733
|
function readPrefs() {
|
|
41683
|
-
if (!
|
|
41734
|
+
if (!existsSync17(PREFS_PATH)) return {};
|
|
41684
41735
|
try {
|
|
41685
41736
|
const parsed = JSON.parse(readFileSync20(PREFS_PATH, "utf-8"));
|
|
41686
41737
|
return {
|
|
@@ -41694,8 +41745,8 @@ function writePrefs(update) {
|
|
|
41694
41745
|
try {
|
|
41695
41746
|
const current = readPrefs();
|
|
41696
41747
|
const next = { ...current, ...update };
|
|
41697
|
-
mkdirSync13(
|
|
41698
|
-
|
|
41748
|
+
mkdirSync13(join22(homedir14(), ".gipity"), { recursive: true });
|
|
41749
|
+
writeFileSync15(PREFS_PATH, JSON.stringify(next, null, 2) + "\n");
|
|
41699
41750
|
} catch {
|
|
41700
41751
|
}
|
|
41701
41752
|
}
|
|
@@ -41705,8 +41756,8 @@ init_setup();
|
|
|
41705
41756
|
var __clDir = dirname12(fileURLToPath2(import.meta.url));
|
|
41706
41757
|
function readOwnPkg(fromDir) {
|
|
41707
41758
|
for (let d = fromDir; ; d = dirname12(d)) {
|
|
41708
|
-
const p =
|
|
41709
|
-
if (
|
|
41759
|
+
const p = join23(d, "package.json");
|
|
41760
|
+
if (existsSync18(p)) {
|
|
41710
41761
|
try {
|
|
41711
41762
|
const pkg2 = JSON.parse(readFileSync21(p, "utf-8"));
|
|
41712
41763
|
if (pkg2.name === "gipity") return pkg2;
|
|
@@ -41762,7 +41813,7 @@ function localFsFallback(dir) {
|
|
|
41762
41813
|
let isDir = false;
|
|
41763
41814
|
let size = 0;
|
|
41764
41815
|
try {
|
|
41765
|
-
const st2 = statSync8(
|
|
41816
|
+
const st2 = statSync8(join23(d, name));
|
|
41766
41817
|
isDir = st2.isDirectory();
|
|
41767
41818
|
size = st2.isFile() ? st2.size : 0;
|
|
41768
41819
|
} catch {
|
|
@@ -41771,7 +41822,7 @@ function localFsFallback(dir) {
|
|
|
41771
41822
|
if (isDir) {
|
|
41772
41823
|
folderCount++;
|
|
41773
41824
|
if (depth === 0) topLevelEntries.push(`${name}/`);
|
|
41774
|
-
walk(
|
|
41825
|
+
walk(join23(d, name), depth + 1);
|
|
41775
41826
|
} else {
|
|
41776
41827
|
fileCount++;
|
|
41777
41828
|
totalBytes += size;
|
|
@@ -41804,8 +41855,8 @@ function hasStreamJsonFlag(args) {
|
|
|
41804
41855
|
}
|
|
41805
41856
|
function markFolderTrusted(dir) {
|
|
41806
41857
|
try {
|
|
41807
|
-
const file =
|
|
41808
|
-
const cfg =
|
|
41858
|
+
const file = join23(homedir15(), ".claude.json");
|
|
41859
|
+
const cfg = existsSync18(file) ? JSON.parse(readFileSync21(file, "utf-8")) : {};
|
|
41809
41860
|
if (typeof cfg !== "object" || cfg === null) return;
|
|
41810
41861
|
if (typeof cfg.projects !== "object" || cfg.projects === null) cfg.projects = {};
|
|
41811
41862
|
const entry = typeof cfg.projects[dir] === "object" && cfg.projects[dir] !== null ? cfg.projects[dir] : {};
|
|
@@ -41813,7 +41864,7 @@ function markFolderTrusted(dir) {
|
|
|
41813
41864
|
entry.hasTrustDialogAccepted = true;
|
|
41814
41865
|
cfg.projects[dir] = entry;
|
|
41815
41866
|
const tmp = `${file}.gipity-tmp`;
|
|
41816
|
-
|
|
41867
|
+
writeFileSync16(tmp, JSON.stringify(cfg, null, 2));
|
|
41817
41868
|
renameSync2(tmp, file);
|
|
41818
41869
|
} catch {
|
|
41819
41870
|
}
|
|
@@ -41924,7 +41975,7 @@ async function runLaunch(cmdName, cmdCfg, opts) {
|
|
|
41924
41975
|
let existing = getConfig();
|
|
41925
41976
|
let forceAdoptCwd = false;
|
|
41926
41977
|
if (existing && !opts.newProject && !opts.project && !nonInteractive) {
|
|
41927
|
-
const cwdHasConfig =
|
|
41978
|
+
const cwdHasConfig = existsSync18(resolve14(process.cwd(), ".gipity.json"));
|
|
41928
41979
|
if (!cwdHasConfig && isLikelyEmpty(process.cwd())) {
|
|
41929
41980
|
const ancestorRoot = dirname12(getConfigPath());
|
|
41930
41981
|
console.log(` ${bold("You are inside an existing Gipity project.")}
|
|
@@ -41973,7 +42024,7 @@ async function runLaunch(cmdName, cmdCfg, opts) {
|
|
|
41973
42024
|
}
|
|
41974
42025
|
project = found;
|
|
41975
42026
|
}
|
|
41976
|
-
const projectDir2 = opts.here ? process.cwd() :
|
|
42027
|
+
const projectDir2 = opts.here ? process.cwd() : join23(getProjectsRoot(), project.slug);
|
|
41977
42028
|
mkdirSync14(projectDir2, { recursive: true });
|
|
41978
42029
|
process.chdir(projectDir2);
|
|
41979
42030
|
clearConfigCache();
|
|
@@ -42088,7 +42139,7 @@ async function runLaunch(cmdName, cmdCfg, opts) {
|
|
|
42088
42139
|
} else {
|
|
42089
42140
|
project = result.project;
|
|
42090
42141
|
isNewProject = result.kind === "create-new";
|
|
42091
|
-
const projectDir2 =
|
|
42142
|
+
const projectDir2 = join23(getProjectsRoot(), project.slug);
|
|
42092
42143
|
mkdirSync14(projectDir2, { recursive: true });
|
|
42093
42144
|
process.chdir(projectDir2);
|
|
42094
42145
|
clearConfigCache();
|
|
@@ -42479,8 +42530,8 @@ ${doneLine}
|
|
|
42479
42530
|
});
|
|
42480
42531
|
}
|
|
42481
42532
|
function flushHeadlessCapture(adapter, sessionId, convGuid) {
|
|
42482
|
-
const runner =
|
|
42483
|
-
if (!
|
|
42533
|
+
const runner = join23(__clDir, "..", "hooks", "capture-runner.js");
|
|
42534
|
+
if (!existsSync18(runner)) return;
|
|
42484
42535
|
const payload = JSON.stringify({ session_id: sessionId, cwd: process.cwd() });
|
|
42485
42536
|
const env = { ...process.env, GIPITY_CONVERSATION_GUID: convGuid };
|
|
42486
42537
|
for (const event of ["session-start", "stop"]) {
|
|
@@ -44734,11 +44785,11 @@ jobCommand.command("cancel <runGuid>").description("Cancel a queued or running j
|
|
|
44734
44785
|
}
|
|
44735
44786
|
}));
|
|
44736
44787
|
jobCommand.command("run-local <name>").description("Run the job in a local Docker container against your local filesystem (no platform round-trip)").option("--image <image>", "Docker image to run inside", "easyclaw/sandbox:latest").option("--no-deps", "Skip pip/npm install even if a deps file is present").option("--json", "Capture the job's output and print one JSON result (exitCode, stdout, stderr) instead of streaming it").action(async (name, opts) => {
|
|
44737
|
-
const { existsSync:
|
|
44738
|
-
const { resolve: resolve21, join:
|
|
44788
|
+
const { existsSync: existsSync28, statSync: statSync12 } = await import("node:fs");
|
|
44789
|
+
const { resolve: resolve21, join: join33 } = await import("node:path");
|
|
44739
44790
|
const { spawnCommand: spawnCommand2, spawnSyncCommand: spawnSyncCommand2 } = await Promise.resolve().then(() => (init_platform(), platform_exports));
|
|
44740
44791
|
const jobDir = resolve21(process.cwd(), "jobs", name);
|
|
44741
|
-
if (!
|
|
44792
|
+
if (!existsSync28(jobDir) || !statSync12(jobDir).isDirectory()) {
|
|
44742
44793
|
console.error(error(`jobs/${name}/ not found in current directory`));
|
|
44743
44794
|
process.exit(1);
|
|
44744
44795
|
}
|
|
@@ -44759,7 +44810,7 @@ jobCommand.command("run-local <name>").description("Run the job in a local Docke
|
|
|
44759
44810
|
},
|
|
44760
44811
|
{ file: "main.sh", runtime: "bash", entry: "bash" }
|
|
44761
44812
|
];
|
|
44762
|
-
const picked = variants.find((v7) =>
|
|
44813
|
+
const picked = variants.find((v7) => existsSync28(join33(jobDir, v7.file)));
|
|
44763
44814
|
if (!picked) {
|
|
44764
44815
|
console.error(error(`No main.py / main.js / main.sh found under jobs/${name}/`));
|
|
44765
44816
|
process.exit(1);
|
|
@@ -44784,7 +44835,7 @@ jobCommand.command("run-local <name>").description("Run the job in a local Docke
|
|
|
44784
44835
|
"-v",
|
|
44785
44836
|
`${jobDir}:/work`
|
|
44786
44837
|
];
|
|
44787
|
-
const needsDeps = opts.deps !== false && picked.depsFile && picked.installCmd &&
|
|
44838
|
+
const needsDeps = opts.deps !== false && picked.depsFile && picked.installCmd && existsSync28(join33(jobDir, picked.depsFile));
|
|
44788
44839
|
const handlerCmd = `${picked.entry} /work/${picked.file}`;
|
|
44789
44840
|
let shellCmd;
|
|
44790
44841
|
if (needsDeps && picked.installCmd) {
|
|
@@ -44958,7 +45009,7 @@ emailCommand.command("log").description("Recent email() sends and skipped attemp
|
|
|
44958
45009
|
init_api();
|
|
44959
45010
|
init_config();
|
|
44960
45011
|
init_colors();
|
|
44961
|
-
import { mkdirSync as mkdirSync15, writeFileSync as
|
|
45012
|
+
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync17, readFileSync as readFileSync22 } from "fs";
|
|
44962
45013
|
import { resolve as resolvePath2, dirname as dirname13, relative as relative5, isAbsolute as isAbsolute2, basename as basename7 } from "path";
|
|
44963
45014
|
|
|
44964
45015
|
// src/commands/generate-async.ts
|
|
@@ -45265,7 +45316,7 @@ async function downloadFile(url, filename, explicit) {
|
|
|
45265
45316
|
const outPath = explicit ? filename : correctExtension(filename, buffer);
|
|
45266
45317
|
if (explicit) noteFormatMismatch(filename, buffer);
|
|
45267
45318
|
ensureOutputDir(outPath);
|
|
45268
|
-
|
|
45319
|
+
writeFileSync17(outPath, buffer);
|
|
45269
45320
|
const savedPath = resolvePath2(outPath);
|
|
45270
45321
|
await pushGenerated(savedPath);
|
|
45271
45322
|
return savedPath;
|
|
@@ -45769,14 +45820,14 @@ Examples:
|
|
|
45769
45820
|
init_api();
|
|
45770
45821
|
init_config();
|
|
45771
45822
|
init_colors();
|
|
45772
|
-
import { existsSync as
|
|
45773
|
-
import { join as
|
|
45823
|
+
import { existsSync as existsSync19, readFileSync as readFileSync24 } from "fs";
|
|
45824
|
+
import { join as join24 } from "path";
|
|
45774
45825
|
function readInstalledKitReadme(name) {
|
|
45775
45826
|
const root = getProjectRoot() ?? process.cwd();
|
|
45776
|
-
const kitDir =
|
|
45777
|
-
if (!
|
|
45778
|
-
const readme =
|
|
45779
|
-
return
|
|
45827
|
+
const kitDir = join24(root, "src", "packages", name);
|
|
45828
|
+
if (!existsSync19(join24(kitDir, "package.json"))) return null;
|
|
45829
|
+
const readme = join24(kitDir, "README.md");
|
|
45830
|
+
return existsSync19(readme) ? readFileSync24(readme, "utf-8") : null;
|
|
45780
45831
|
}
|
|
45781
45832
|
function slugify2(title) {
|
|
45782
45833
|
return title.toLowerCase().replace(/[`*_]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -46071,7 +46122,7 @@ var domainCommand = new Command("domain").description("Manage custom domains").a
|
|
|
46071
46122
|
}));
|
|
46072
46123
|
|
|
46073
46124
|
// src/commands/realtime.ts
|
|
46074
|
-
import { existsSync as
|
|
46125
|
+
import { existsSync as existsSync20 } from "fs";
|
|
46075
46126
|
import { dirname as dirname14, resolve as resolve15 } from "path";
|
|
46076
46127
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "url";
|
|
46077
46128
|
init_api();
|
|
@@ -46080,7 +46131,7 @@ init_colors();
|
|
|
46080
46131
|
function hasDeployManifest() {
|
|
46081
46132
|
const cfgPath = getConfigPath();
|
|
46082
46133
|
if (!cfgPath) return false;
|
|
46083
|
-
return
|
|
46134
|
+
return existsSync20(resolve15(dirname14(cfgPath), "gipity.yaml"));
|
|
46084
46135
|
}
|
|
46085
46136
|
var roomCommand = new Command("room").description("Manage realtime rooms").argument("[action]", "list | create | delete | info", "list").argument("[name]", "room name (for create | delete | info)").addOption(new Option("--type <type>", "Room type for create").choices(["state", "relay"]).default("state")).addOption(new Option("--auth <level>", "Auth level for create").choices(["public", "user"]).default("public")).option("--max-clients <n>", "max clients for create (1-200)").option("--seat-hold <seconds>", "create: how long a dropped client keeps its seat (0-300, default 30)").option("--host-hold <seconds>", "create: how long the host role waits for a dropped or reloading host (0-600, default 60)").option("--host-handoff", "create: move the host role to another player when the host is gone").option("--host-grace <seconds>", "create: with handoff, how long the host may be unreachable before the role moves (1-60, default 5)").option("--server-channels <names>", "create: comma-separated channels only the app's functions may publish on (realtime.publish)").option("--json", "Output as JSON").action((action, name, opts) => run("Realtime room", async () => {
|
|
46086
46137
|
const config = requireConfig2();
|
|
@@ -46171,7 +46222,7 @@ var roomCommand = new Command("room").description("Manage realtime rooms").argum
|
|
|
46171
46222
|
function benchModulePath() {
|
|
46172
46223
|
const here = dirname14(fileURLToPath3(import.meta.url));
|
|
46173
46224
|
for (const candidate of [resolve15(here, "realtime-bench.js"), resolve15(here, "..", "realtime-bench.js")]) {
|
|
46174
|
-
if (
|
|
46225
|
+
if (existsSync20(candidate)) return pathToFileURL(candidate).href;
|
|
46175
46226
|
}
|
|
46176
46227
|
throw new Error("realtime-bench.js is missing from this CLI build; reinstall the gipity CLI");
|
|
46177
46228
|
}
|
|
@@ -46560,27 +46611,27 @@ var locationCommand = new Command("location").description("Show location").argum
|
|
|
46560
46611
|
}));
|
|
46561
46612
|
|
|
46562
46613
|
// src/commands/doctor.ts
|
|
46563
|
-
import { existsSync as
|
|
46564
|
-
import { join as
|
|
46614
|
+
import { existsSync as existsSync22, readFileSync as readFileSync26, statSync as statSync9 } from "fs";
|
|
46615
|
+
import { join as join26, resolve as resolve17 } from "path";
|
|
46565
46616
|
import { homedir as homedir17 } from "os";
|
|
46566
46617
|
|
|
46567
46618
|
// src/updater/state.ts
|
|
46568
|
-
import { readFileSync as readFileSync25, writeFileSync as
|
|
46569
|
-
import { dirname as dirname15, join as
|
|
46619
|
+
import { readFileSync as readFileSync25, writeFileSync as writeFileSync18, mkdirSync as mkdirSync16, existsSync as existsSync21 } from "fs";
|
|
46620
|
+
import { dirname as dirname15, join as join25, resolve as resolve16 } from "path";
|
|
46570
46621
|
import { homedir as homedir16 } from "os";
|
|
46571
46622
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
46572
|
-
var GIPITY_DIR =
|
|
46573
|
-
var LOCAL_DIR =
|
|
46574
|
-
var LOCAL_PKG_DIR =
|
|
46575
|
-
var LOCAL_ENTRY =
|
|
46576
|
-
var STATE_FILE =
|
|
46577
|
-
var SETTINGS_FILE =
|
|
46578
|
-
var UPDATE_LOG =
|
|
46623
|
+
var GIPITY_DIR = join25(homedir16(), ".gipity");
|
|
46624
|
+
var LOCAL_DIR = join25(GIPITY_DIR, "local");
|
|
46625
|
+
var LOCAL_PKG_DIR = join25(LOCAL_DIR, "node_modules", "gipity");
|
|
46626
|
+
var LOCAL_ENTRY = join25(LOCAL_PKG_DIR, "dist", "index.js");
|
|
46627
|
+
var STATE_FILE = join25(GIPITY_DIR, "update-state.json");
|
|
46628
|
+
var SETTINGS_FILE = join25(GIPITY_DIR, "settings.json");
|
|
46629
|
+
var UPDATE_LOG = join25(GIPITY_DIR, "update.log");
|
|
46579
46630
|
function findPkgRoot() {
|
|
46580
46631
|
let dir = dirname15(fileURLToPath4(import.meta.url));
|
|
46581
46632
|
for (; ; ) {
|
|
46582
46633
|
try {
|
|
46583
|
-
if (JSON.parse(readFileSync25(
|
|
46634
|
+
if (JSON.parse(readFileSync25(join25(dir, "package.json"), "utf-8")).name === "gipity") return dir;
|
|
46584
46635
|
} catch {
|
|
46585
46636
|
}
|
|
46586
46637
|
const up2 = dirname15(dir);
|
|
@@ -46590,7 +46641,7 @@ function findPkgRoot() {
|
|
|
46590
46641
|
}
|
|
46591
46642
|
var PKG_ROOT = findPkgRoot();
|
|
46592
46643
|
function isDevLink() {
|
|
46593
|
-
return
|
|
46644
|
+
return existsSync21(join25(PKG_ROOT, "src"));
|
|
46594
46645
|
}
|
|
46595
46646
|
var DEFAULT_STATE = {
|
|
46596
46647
|
installedVersion: null,
|
|
@@ -46605,7 +46656,7 @@ function ensureDir() {
|
|
|
46605
46656
|
mkdirSync16(GIPITY_DIR, { recursive: true });
|
|
46606
46657
|
}
|
|
46607
46658
|
function readState() {
|
|
46608
|
-
if (!
|
|
46659
|
+
if (!existsSync21(STATE_FILE)) return { ...DEFAULT_STATE };
|
|
46609
46660
|
try {
|
|
46610
46661
|
return { ...DEFAULT_STATE, ...JSON.parse(readFileSync25(STATE_FILE, "utf-8")) };
|
|
46611
46662
|
} catch {
|
|
@@ -46614,10 +46665,10 @@ function readState() {
|
|
|
46614
46665
|
}
|
|
46615
46666
|
function writeState(state) {
|
|
46616
46667
|
ensureDir();
|
|
46617
|
-
|
|
46668
|
+
writeFileSync18(STATE_FILE, JSON.stringify(state, null, 2));
|
|
46618
46669
|
}
|
|
46619
46670
|
function readSettings() {
|
|
46620
|
-
if (!
|
|
46671
|
+
if (!existsSync21(SETTINGS_FILE)) return { ...DEFAULT_SETTINGS };
|
|
46621
46672
|
try {
|
|
46622
46673
|
return { ...DEFAULT_SETTINGS, ...JSON.parse(readFileSync25(SETTINGS_FILE, "utf-8")) };
|
|
46623
46674
|
} catch {
|
|
@@ -46653,8 +46704,8 @@ function versionManagerNode(execPath, env = process.env, home = homedir17()) {
|
|
|
46653
46704
|
return null;
|
|
46654
46705
|
}
|
|
46655
46706
|
function localVersion() {
|
|
46656
|
-
const pkgPath =
|
|
46657
|
-
if (!
|
|
46707
|
+
const pkgPath = join26(LOCAL_PKG_DIR, "package.json");
|
|
46708
|
+
if (!existsSync22(pkgPath)) return null;
|
|
46658
46709
|
try {
|
|
46659
46710
|
return JSON.parse(readFileSync26(pkgPath, "utf-8")).version ?? null;
|
|
46660
46711
|
} catch {
|
|
@@ -46679,7 +46730,7 @@ function rel(t) {
|
|
|
46679
46730
|
}
|
|
46680
46731
|
function relayAutostartInstalled() {
|
|
46681
46732
|
try {
|
|
46682
|
-
return
|
|
46733
|
+
return existsSync22(planFor({ cliPath: resolveCliPath() }).path);
|
|
46683
46734
|
} catch (err) {
|
|
46684
46735
|
if (err instanceof UnsupportedPlatformError) return null;
|
|
46685
46736
|
return null;
|
|
@@ -46722,7 +46773,7 @@ function gatherEnv(opts = {}) {
|
|
|
46722
46773
|
const cli = {
|
|
46723
46774
|
shim_version: shimVersion(),
|
|
46724
46775
|
local_version: localVersion(),
|
|
46725
|
-
local_install_ok:
|
|
46776
|
+
local_install_ok: existsSync22(LOCAL_ENTRY),
|
|
46726
46777
|
auto_updates: !dis.disabled,
|
|
46727
46778
|
updates_disabled_reason: dis.disabled ? dis.reason ?? null : null,
|
|
46728
46779
|
last_check_at: updState.lastCheckAt,
|
|
@@ -46754,7 +46805,7 @@ var doctorCommand = new Command("doctor").description("Check install + environme
|
|
|
46754
46805
|
if (env.claude.installed && !env.claude.authenticated) {
|
|
46755
46806
|
console.log(`${muted(" ")} ${warning("Claude Code is not logged in. Run `claude auth login` and sign in.")}`);
|
|
46756
46807
|
}
|
|
46757
|
-
if (
|
|
46808
|
+
if (existsSync22(resolve17(process.cwd(), ".codex", "hooks.json"))) {
|
|
46758
46809
|
console.log(`${muted("codex hooks ")} ${warning("written")} - session capture needs a one-time approval: run /hooks inside Codex in this project`);
|
|
46759
46810
|
}
|
|
46760
46811
|
const buildReady = env.node.ok && env.gipity.logged_in;
|
|
@@ -46763,7 +46814,7 @@ var doctorCommand = new Command("doctor").description("Check install + environme
|
|
|
46763
46814
|
const settings = readSettings();
|
|
46764
46815
|
const dis = updatesDisabled();
|
|
46765
46816
|
const local = localVersion();
|
|
46766
|
-
const localOk =
|
|
46817
|
+
const localOk = existsSync22(LOCAL_ENTRY);
|
|
46767
46818
|
console.log("");
|
|
46768
46819
|
console.log(bold("CLI install"));
|
|
46769
46820
|
console.log(`${muted("shim version ")} ${shimVersion()}`);
|
|
@@ -46771,11 +46822,11 @@ var doctorCommand = new Command("doctor").description("Check install + environme
|
|
|
46771
46822
|
console.log(`${muted("local install ")} ${LOCAL_PKG_DIR}`);
|
|
46772
46823
|
console.log("");
|
|
46773
46824
|
console.log(`${muted("auto-updates ")} ${dis.disabled ? warning(`disabled (${dis.reason})`) : success("enabled")}`);
|
|
46774
|
-
console.log(`${muted("settings file ")} ${
|
|
46825
|
+
console.log(`${muted("settings file ")} ${existsSync22(SETTINGS_FILE) ? SETTINGS_FILE : dim("(default)")} autoUpdates=${settings.autoUpdates}`);
|
|
46775
46826
|
console.log(`${muted("last check ")} ${rel(state.lastCheckAt)}`);
|
|
46776
46827
|
console.log(`${muted("last error ")} ${state.lastError ? error(state.lastError) : dim("none")}`);
|
|
46777
|
-
console.log(`${muted("state file ")} ${
|
|
46778
|
-
console.log(`${muted("update log ")} ${
|
|
46828
|
+
console.log(`${muted("state file ")} ${existsSync22(STATE_FILE) ? STATE_FILE : dim("(none yet)")}`);
|
|
46829
|
+
console.log(`${muted("update log ")} ${existsSync22(UPDATE_LOG) ? `${UPDATE_LOG} (${statSync9(UPDATE_LOG).size} bytes)` : dim("(none yet)")}`);
|
|
46779
46830
|
console.log("");
|
|
46780
46831
|
console.log(dim("Force an update with: gipity update"));
|
|
46781
46832
|
});
|
|
@@ -46784,10 +46835,10 @@ var doctorCommand = new Command("doctor").description("Check install + environme
|
|
|
46784
46835
|
import { appendFileSync } from "fs";
|
|
46785
46836
|
|
|
46786
46837
|
// src/updater/install.ts
|
|
46787
|
-
import { existsSync as
|
|
46788
|
-
import { dirname as dirname16, join as
|
|
46838
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync17, rmSync as rmSync2, statSync as statSync10, unlinkSync as unlinkSync6, writeFileSync as writeFileSync19 } from "fs";
|
|
46839
|
+
import { dirname as dirname16, join as join27 } from "path";
|
|
46789
46840
|
init_platform();
|
|
46790
|
-
var UPDATE_LOCK =
|
|
46841
|
+
var UPDATE_LOCK = join27(GIPITY_DIR, "update.lock");
|
|
46791
46842
|
var LOCK_STALE_MS2 = 10 * 60 * 1e3;
|
|
46792
46843
|
function npmInstallGipity(version) {
|
|
46793
46844
|
ensureLocalTree();
|
|
@@ -46797,7 +46848,7 @@ function npmInstallGipity(version) {
|
|
|
46797
46848
|
encoding: "utf-8"
|
|
46798
46849
|
});
|
|
46799
46850
|
return {
|
|
46800
|
-
ok: res.status === 0 &&
|
|
46851
|
+
ok: res.status === 0 && existsSync23(LOCAL_ENTRY),
|
|
46801
46852
|
status: res.status,
|
|
46802
46853
|
stderr: (res.stderr || "").toString(),
|
|
46803
46854
|
spawnError: res.error
|
|
@@ -46809,27 +46860,27 @@ function isWedged(stderr) {
|
|
|
46809
46860
|
}
|
|
46810
46861
|
function ensureLocalTree(dir = LOCAL_DIR) {
|
|
46811
46862
|
mkdirSync17(dir, { recursive: true });
|
|
46812
|
-
const pkgJson =
|
|
46813
|
-
if (!
|
|
46814
|
-
|
|
46863
|
+
const pkgJson = join27(dir, "package.json");
|
|
46864
|
+
if (!existsSync23(pkgJson)) {
|
|
46865
|
+
writeFileSync19(pkgJson, JSON.stringify({ name: "gipity-local", private: true, version: "0.0.0" }, null, 2));
|
|
46815
46866
|
}
|
|
46816
46867
|
}
|
|
46817
46868
|
function resetLocalTree(dir = LOCAL_DIR) {
|
|
46818
46869
|
mkdirSync17(dir, { recursive: true });
|
|
46819
|
-
rmSync2(
|
|
46820
|
-
rmSync2(
|
|
46821
|
-
|
|
46870
|
+
rmSync2(join27(dir, "node_modules"), { recursive: true, force: true });
|
|
46871
|
+
rmSync2(join27(dir, "package-lock.json"), { force: true });
|
|
46872
|
+
writeFileSync19(join27(dir, "package.json"), JSON.stringify({ name: "gipity-local", private: true, version: "0.0.0" }, null, 2));
|
|
46822
46873
|
}
|
|
46823
46874
|
function acquireUpdateLock(lockPath2 = UPDATE_LOCK) {
|
|
46824
46875
|
mkdirSync17(dirname16(lockPath2), { recursive: true });
|
|
46825
46876
|
try {
|
|
46826
|
-
|
|
46877
|
+
writeFileSync19(lockPath2, String(process.pid), { flag: "wx" });
|
|
46827
46878
|
return true;
|
|
46828
46879
|
} catch {
|
|
46829
46880
|
try {
|
|
46830
46881
|
if (Date.now() - statSync10(lockPath2).mtimeMs > LOCK_STALE_MS2) {
|
|
46831
46882
|
unlinkSync6(lockPath2);
|
|
46832
|
-
|
|
46883
|
+
writeFileSync19(lockPath2, String(process.pid), { flag: "wx" });
|
|
46833
46884
|
return true;
|
|
46834
46885
|
}
|
|
46835
46886
|
} catch {
|
|
@@ -46994,17 +47045,17 @@ var updateCommand = new Command("update").description("Update the CLI").option("
|
|
|
46994
47045
|
init_api();
|
|
46995
47046
|
init_utils();
|
|
46996
47047
|
init_colors();
|
|
46997
|
-
import { existsSync as
|
|
47048
|
+
import { existsSync as existsSync26, readFileSync as readFileSync29, unlinkSync as unlinkSync9 } from "fs";
|
|
46998
47049
|
import { spawn as spawn2 } from "child_process";
|
|
46999
47050
|
|
|
47000
47051
|
// src/relay/daemon.ts
|
|
47001
47052
|
init_platform();
|
|
47002
47053
|
init_config();
|
|
47003
|
-
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync19, existsSync as
|
|
47054
|
+
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync19, existsSync as existsSync25, readFileSync as readFileSync28, writeFileSync as writeFileSync20, chmodSync as chmodSync4, closeSync as closeSync4, openSync as openSync4, unlinkSync as unlinkSync8 } from "fs";
|
|
47004
47055
|
import { stat, readFile } from "fs/promises";
|
|
47005
47056
|
import { createInterface as createInterface2 } from "readline";
|
|
47006
47057
|
import { homedir as homedir19, hostname as hostname6, platform as osPlatform3, loadavg as loadavg2, freemem as freemem2, totalmem as totalmem2, cpus as cpus2 } from "os";
|
|
47007
|
-
import { join as
|
|
47058
|
+
import { join as join30 } from "path";
|
|
47008
47059
|
init_setup();
|
|
47009
47060
|
init_auth();
|
|
47010
47061
|
init_api();
|
|
@@ -47764,7 +47815,7 @@ init_agents();
|
|
|
47764
47815
|
init_claude_setup();
|
|
47765
47816
|
import { cpus, freemem, totalmem, loadavg, release, uptime, homedir as homedir18 } from "os";
|
|
47766
47817
|
import { statfsSync, readdirSync as readdirSync9 } from "fs";
|
|
47767
|
-
import { join as
|
|
47818
|
+
import { join as join28 } from "path";
|
|
47768
47819
|
var PROBE_TIMEOUT_MS = 4e3;
|
|
47769
47820
|
function parseVersion(out) {
|
|
47770
47821
|
const m = out.match(/\d+\.\d+(?:\.\d+)?(?:[-.\w]*)?/);
|
|
@@ -47831,7 +47882,7 @@ async function detectGpu() {
|
|
|
47831
47882
|
function diskUsage() {
|
|
47832
47883
|
try {
|
|
47833
47884
|
if (typeof statfsSync !== "function") return void 0;
|
|
47834
|
-
const st2 = statfsSync(
|
|
47885
|
+
const st2 = statfsSync(join28(homedir18(), "GipityProjects"), { bigint: false });
|
|
47835
47886
|
if (!st2 || !st2.bsize) return void 0;
|
|
47836
47887
|
return { total: st2.bsize * st2.blocks, free: st2.bsize * st2.bavail };
|
|
47837
47888
|
} catch {
|
|
@@ -47845,7 +47896,7 @@ function diskUsage() {
|
|
|
47845
47896
|
}
|
|
47846
47897
|
function localProjectCount() {
|
|
47847
47898
|
try {
|
|
47848
|
-
return readdirSync9(
|
|
47899
|
+
return readdirSync9(join28(homedir18(), "GipityProjects"), { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith(".")).length;
|
|
47849
47900
|
} catch {
|
|
47850
47901
|
return void 0;
|
|
47851
47902
|
}
|
|
@@ -48302,7 +48353,7 @@ var SessionPool = class {
|
|
|
48302
48353
|
init_config();
|
|
48303
48354
|
init_api();
|
|
48304
48355
|
init_agents();
|
|
48305
|
-
var RELAY_LOG_PATH =
|
|
48356
|
+
var RELAY_LOG_PATH = join30(homedir19(), ".gipity", "relay.log");
|
|
48306
48357
|
var HEARTBEAT_INTERVAL_MS = parseInt(process.env.GIPITY_RELAY_HEARTBEAT_MS || "60000", 10);
|
|
48307
48358
|
var DIAGNOSTICS_INTERVAL_MS = parseInt(process.env.GIPITY_RELAY_DIAGNOSTICS_MS || String(24 * 60 * 60 * 1e3), 10);
|
|
48308
48359
|
var LONG_POLL_TIMEOUT_MS = parseInt(process.env.GIPITY_RELAY_POLL_TIMEOUT_MS || "35000", 10);
|
|
@@ -48410,7 +48461,7 @@ function lockLogPerms(dir, file) {
|
|
|
48410
48461
|
chmodSync4(dir, 448);
|
|
48411
48462
|
} catch {
|
|
48412
48463
|
}
|
|
48413
|
-
if (!
|
|
48464
|
+
if (!existsSync25(file)) {
|
|
48414
48465
|
try {
|
|
48415
48466
|
closeSync4(openSync4(file, "a", 384));
|
|
48416
48467
|
} catch {
|
|
@@ -48427,7 +48478,7 @@ function log2(level, msg, extra) {
|
|
|
48427
48478
|
const pretty = `${C7.dim(hhmmss())} ${badge(level)} ${C7.bold(msg)}${formatExtra(extra)}`;
|
|
48428
48479
|
process.stderr.write(pretty + "\n");
|
|
48429
48480
|
try {
|
|
48430
|
-
const dir =
|
|
48481
|
+
const dir = join30(homedir19(), ".gipity");
|
|
48431
48482
|
mkdirSync19(dir, { recursive: true });
|
|
48432
48483
|
lockLogPerms(dir, RELAY_LOG_PATH);
|
|
48433
48484
|
const json = JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), level, msg, ...extra ?? {} });
|
|
@@ -48859,7 +48910,7 @@ function isSafeSessionId(s) {
|
|
|
48859
48910
|
function transcriptPathFor(cwd, sessionId) {
|
|
48860
48911
|
if (!isSafeSessionId(sessionId)) return null;
|
|
48861
48912
|
const slug = cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
48862
|
-
return
|
|
48913
|
+
return join30(homedir19(), ".claude", "projects", slug, `${sessionId}.jsonl`);
|
|
48863
48914
|
}
|
|
48864
48915
|
function formatDuration(ms2) {
|
|
48865
48916
|
const totalSec = ms2 / 1e3;
|
|
@@ -49323,9 +49374,9 @@ async function resolveCwdForProject(d) {
|
|
|
49323
49374
|
throw new Error(`Invalid project slug: ${JSON.stringify(d.project_slug)}`);
|
|
49324
49375
|
}
|
|
49325
49376
|
const root = getProjectsRoot();
|
|
49326
|
-
const path5 =
|
|
49327
|
-
const configPath =
|
|
49328
|
-
if (
|
|
49377
|
+
const path5 = join30(root, d.project_slug);
|
|
49378
|
+
const configPath = join30(path5, ".gipity.json");
|
|
49379
|
+
if (existsSync25(configPath)) {
|
|
49329
49380
|
try {
|
|
49330
49381
|
const cfg = JSON.parse(readFileSync28(configPath, "utf-8"));
|
|
49331
49382
|
if (cfg.projectGuid === d.project_guid) return { cwd: path5, bootstrapped: false };
|
|
@@ -49341,7 +49392,7 @@ async function resolveCwdForProject(d) {
|
|
|
49341
49392
|
log2("info", "bootstrapping new project dir", { slug: d.project_slug, path: path5 });
|
|
49342
49393
|
mkdirSync19(path5, { recursive: true });
|
|
49343
49394
|
const apiBase2 = getApiBaseOverride() || DEFAULT_API_BASE;
|
|
49344
|
-
|
|
49395
|
+
writeFileSync20(configPath, JSON.stringify({
|
|
49345
49396
|
projectGuid: d.project_guid,
|
|
49346
49397
|
projectSlug: d.project_slug,
|
|
49347
49398
|
accountSlug: d.account_slug,
|
|
@@ -49461,7 +49512,7 @@ async function spawnSync2(cwd, timeoutMs, onSpawn) {
|
|
|
49461
49512
|
} catch {
|
|
49462
49513
|
}
|
|
49463
49514
|
try {
|
|
49464
|
-
unlinkSync8(
|
|
49515
|
+
unlinkSync8(join30(cwd, ".gipity", "sync.lock"));
|
|
49465
49516
|
} catch {
|
|
49466
49517
|
}
|
|
49467
49518
|
finish(() => reject(new Error(`timed out after ${Math.round(timeoutMs / 1e3)}s`)));
|
|
@@ -49906,7 +49957,7 @@ relayCommand.command("run").description("Run the background service").option("-v
|
|
|
49906
49957
|
});
|
|
49907
49958
|
relayCommand.command("stop").description("Stop the background service").option("--force", "Force-stop if it doesn't exit cleanly within 5s").action(async (opts) => {
|
|
49908
49959
|
const pidPath = getDaemonPidPath();
|
|
49909
|
-
if (!
|
|
49960
|
+
if (!existsSync26(pidPath)) {
|
|
49910
49961
|
console.log(muted("Background service isn't running."));
|
|
49911
49962
|
return;
|
|
49912
49963
|
}
|
|
@@ -50058,7 +50109,7 @@ relayCommand.command("revoke").description("Revoke and forget this device").acti
|
|
|
50058
50109
|
} catch {
|
|
50059
50110
|
}
|
|
50060
50111
|
const pidPath = getDaemonPidPath();
|
|
50061
|
-
if (
|
|
50112
|
+
if (existsSync26(pidPath)) {
|
|
50062
50113
|
const pid = parseInt(readFileSync29(pidPath, "utf-8").trim(), 10);
|
|
50063
50114
|
if (pid && !isNaN(pid)) {
|
|
50064
50115
|
try {
|
|
@@ -50072,7 +50123,7 @@ relayCommand.command("revoke").description("Revoke and forget this device").acti
|
|
|
50072
50123
|
});
|
|
50073
50124
|
relayCommand.command("log").description("Tail the service log").option("-n, --lines <n>", "How many lines to print (default 100)", "100").option("-f, --follow", "Follow the log like `tail -f`").action((opts) => {
|
|
50074
50125
|
const path5 = RELAY_LOG_PATH;
|
|
50075
|
-
if (!
|
|
50126
|
+
if (!existsSync26(path5)) {
|
|
50076
50127
|
console.log(muted("No log file yet. Start the service with `gipity relay run` (or install it)."));
|
|
50077
50128
|
return;
|
|
50078
50129
|
}
|
|
@@ -50254,17 +50305,17 @@ init_api();
|
|
|
50254
50305
|
init_auth();
|
|
50255
50306
|
init_utils();
|
|
50256
50307
|
init_colors();
|
|
50257
|
-
import { existsSync as
|
|
50308
|
+
import { existsSync as existsSync27, rmSync as rmSync4, unlinkSync as unlinkSync10, readFileSync as readFileSync30, writeFileSync as writeFileSync21 } from "fs";
|
|
50258
50309
|
import { homedir as homedir20, platform as osPlatform4 } from "os";
|
|
50259
|
-
import { join as
|
|
50310
|
+
import { join as join31, resolve as resolve19 } from "path";
|
|
50260
50311
|
init_agents();
|
|
50261
50312
|
function removeInstallerPathLines() {
|
|
50262
50313
|
if (osPlatform4() === "win32") return [];
|
|
50263
50314
|
const marker = "# Added by the Gipity installer";
|
|
50264
50315
|
const touched = [];
|
|
50265
50316
|
for (const name of [".bashrc", ".zshrc", ".profile"]) {
|
|
50266
|
-
const rc2 =
|
|
50267
|
-
if (!
|
|
50317
|
+
const rc2 = join31(homedir20(), name);
|
|
50318
|
+
if (!existsSync27(rc2)) continue;
|
|
50268
50319
|
let text;
|
|
50269
50320
|
try {
|
|
50270
50321
|
text = readFileSync30(rc2, "utf-8");
|
|
@@ -50277,7 +50328,7 @@ function removeInstallerPathLines() {
|
|
|
50277
50328
|
);
|
|
50278
50329
|
if (kept.length === lines.length) continue;
|
|
50279
50330
|
try {
|
|
50280
|
-
|
|
50331
|
+
writeFileSync21(rc2, kept.join("\n"));
|
|
50281
50332
|
touched.push(rc2);
|
|
50282
50333
|
} catch {
|
|
50283
50334
|
}
|
|
@@ -50323,7 +50374,7 @@ function removeServiceUnit() {
|
|
|
50323
50374
|
const r = spawnSyncCommand(argv2[0], argv2.slice(1), { stdio: "ignore" });
|
|
50324
50375
|
if (r.status !== 0) allOk = false;
|
|
50325
50376
|
}
|
|
50326
|
-
if (
|
|
50377
|
+
if (existsSync27(plan2.path)) {
|
|
50327
50378
|
try {
|
|
50328
50379
|
unlinkSync10(plan2.path);
|
|
50329
50380
|
} catch {
|
|
@@ -50353,9 +50404,9 @@ var uninstallCommand = new Command("uninstall").description("Uninstall Gipity").
|
|
|
50353
50404
|
const say = (line) => {
|
|
50354
50405
|
if (!opts.json) console.log(line);
|
|
50355
50406
|
};
|
|
50356
|
-
const gipityDir =
|
|
50357
|
-
const launcherBin =
|
|
50358
|
-
const installedViaLauncher =
|
|
50407
|
+
const gipityDir = join31(homedir20(), ".gipity");
|
|
50408
|
+
const launcherBin = join31(gipityDir, "launcher", "bin", "gipity");
|
|
50409
|
+
const installedViaLauncher = existsSync27(launcherBin);
|
|
50359
50410
|
say(`${bold("Gipity uninstall")} - this will:`);
|
|
50360
50411
|
say(`\u2022 Stop the running relay daemon (if any)`);
|
|
50361
50412
|
say(`\u2022 Remove the OS autostart service (launchd / systemd / Task Scheduler)`);
|
|
@@ -50397,7 +50448,7 @@ var uninstallCommand = new Command("uninstall").description("Uninstall Gipity").
|
|
|
50397
50448
|
say(`${muted("No Gipity entries in any detected coding agent.")}`);
|
|
50398
50449
|
}
|
|
50399
50450
|
let gipityDirRemoved = false;
|
|
50400
|
-
if (
|
|
50451
|
+
if (existsSync27(gipityDir)) {
|
|
50401
50452
|
try {
|
|
50402
50453
|
rmSync4(gipityDir, { recursive: true, force: true });
|
|
50403
50454
|
gipityDirRemoved = true;
|
|
@@ -50975,7 +51026,7 @@ function resolveTarget(argv2, program3) {
|
|
|
50975
51026
|
|
|
50976
51027
|
// src/trace.ts
|
|
50977
51028
|
import { openSync as openSync5, writeSync, mkdirSync as mkdirSync20 } from "fs";
|
|
50978
|
-
import { join as
|
|
51029
|
+
import { join as join32 } from "path";
|
|
50979
51030
|
import { homedir as homedir21 } from "os";
|
|
50980
51031
|
var TRACE_KEY = /* @__PURE__ */ Symbol.for("gipity.traceOutput");
|
|
50981
51032
|
function installOutputTrace(label2) {
|
|
@@ -50987,10 +51038,10 @@ function installOutputTrace(label2) {
|
|
|
50987
51038
|
existing.emit({ event: "reenter", label: label2 });
|
|
50988
51039
|
return;
|
|
50989
51040
|
}
|
|
50990
|
-
const dir =
|
|
51041
|
+
const dir = join32(process.env.GIPITY_DIR || join32(homedir21(), ".gipity"), "trace");
|
|
50991
51042
|
mkdirSync20(dir, { recursive: true });
|
|
50992
51043
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", "_").replace(/:/g, "-");
|
|
50993
|
-
const fd2 = openSync5(
|
|
51044
|
+
const fd2 = openSync5(join32(dir, `${stamp}-pid${process.pid}.jsonl`), "a");
|
|
50994
51045
|
const emit = (rec) => {
|
|
50995
51046
|
try {
|
|
50996
51047
|
writeSync(fd2, JSON.stringify({ t: (/* @__PURE__ */ new Date()).toISOString(), ...rec }) + "\n");
|
package/dist/knowledge.js
CHANGED
|
@@ -152,7 +152,7 @@ Write files locally - Gipity's editor hooks (installed into Claude Code, Codex,
|
|
|
152
152
|
|
|
153
153
|
Files your deployed app stores at runtime through the app uploads API (users' uploads, \`gipity upload\`, or an external service using a project API key; under \`uploads/\` or any custom path) are user content, not source: they stay in Gipity Storage and never sync into this directory, and sync never deletes them. List them with \`gipity file tree\`, read one with \`gipity file cat <path>\`.
|
|
154
154
|
|
|
155
|
-
To keep local-only material (research clones, scratch data, vendored references) in the project directory without syncing or deploying it, list it in a \`.gipityignore\` at the project root - gitignore-style, one pattern per line, \`#\` comments. Ignored paths are invisible to sync in both directions; anything that already synced before being ignored stays on the server until you delete it.
|
|
155
|
+
To keep local-only material (research clones, scratch data, vendored references) in the project directory without syncing or deploying it, list it in a \`.gipityignore\` at the project root - gitignore-style, one pattern per line, \`#\` comments. Ignored paths are invisible to sync in both directions; anything that already synced before being ignored stays on the server until you delete it. Sync also holds back any NEW file over 100 MB outside \`src/\`, \`functions/\` and \`migrations/\` (a stray render or dataset would otherwise upload on every background sync): it stays local, and sync names it each time. Add it to \`.gipityignore\`, or upload it on purpose with \`gipity push <path>\`.
|
|
156
156
|
|
|
157
157
|
**WSL trap: user-dropped files may be in a Windows-side twin.** On WSL, a same-named folder often exists at \`C:\\Users\\<name>\\GipityProjects\\<project>\` (visible as \`/mnt/c/Users/<name>/GipityProjects/<project>\`) - from Windows Explorer it looks like "the project folder", so users drop new files (audio, images) there. Nothing syncs from it. If the user says files are "in the project" but you can't find them, check that path before searching wider; \`gipity sync\` prints a notice when such a twin exists.
|
|
158
158
|
|
package/dist/setup.js
CHANGED
|
@@ -172,7 +172,7 @@ export const LEGACY_MARKETPLACE_REPO = 'GipityAI/claude-plugin';
|
|
|
172
172
|
// an installed plugin when the marketplace advances - only an explicit
|
|
173
173
|
// `plugin install`/`update` does - so this constant is how a CLI upgrade tells
|
|
174
174
|
// ensureGipityPluginInstalled() to refresh a stale user-scope install.
|
|
175
|
-
export const GIPITY_PLUGIN_VERSION = '0.8.
|
|
175
|
+
export const GIPITY_PLUGIN_VERSION = '0.8.3';
|
|
176
176
|
/** True for hook commands the CLI itself wrote into settings.json in past
|
|
177
177
|
* versions. Matched by signature so migration strips exactly our own
|
|
178
178
|
* entries and never touches user-authored hooks. */
|
package/dist/sync.js
CHANGED
|
@@ -38,6 +38,14 @@ import * as tar from 'tar-stream';
|
|
|
38
38
|
* deletion in a small project isn't noise, and many deletions in a huge
|
|
39
39
|
* project probably are intentional. */
|
|
40
40
|
const BULK_DELETE_COUNT = 10;
|
|
41
|
+
/** New files above this size are held back from a full sync (see
|
|
42
|
+
* holdLargeNewUploads). A stray render or dataset dropped into a project
|
|
43
|
+
* folder otherwise uploads on every background sync: the UserPromptSubmit
|
|
44
|
+
* hook timed out mid-upload, never finished, and stalled every prompt. */
|
|
45
|
+
export const SYNC_LARGE_FILE_BYTES = 100 * 1024 * 1024;
|
|
46
|
+
/** Folders deploy ships. Large files here are part of the app, so they always
|
|
47
|
+
* sync (holding one back would silently drop it from the next deploy). */
|
|
48
|
+
const DEPLOY_ROOTS = ['src/', 'functions/', 'migrations/'];
|
|
41
49
|
const BULK_DELETE_FRACTION = 0.25;
|
|
42
50
|
/** A tar download that stops producing bytes for this long - without ever
|
|
43
51
|
* ending the stream - is treated as a stall and aborted, so a wedged
|
|
@@ -699,6 +707,39 @@ function withAppUploadNote(summary, leftLocal) {
|
|
|
699
707
|
const note = appUploadNote(leftLocal);
|
|
700
708
|
return note ? `${summary}\n${note}` : summary;
|
|
701
709
|
}
|
|
710
|
+
/** Pull new, never-synced files over SYNC_LARGE_FILE_BYTES out of the upload
|
|
711
|
+
* plan. A file already in the baseline was synced on purpose and keeps
|
|
712
|
+
* syncing; files under the deploy roots always sync. Pure: returns a new plan
|
|
713
|
+
* plus the held files. Exported for tests. */
|
|
714
|
+
export function holdLargeNewUploads(planned, baselineFiles) {
|
|
715
|
+
const held = [];
|
|
716
|
+
const actions = planned.actions.filter(a => {
|
|
717
|
+
const hold = a.kind === 'upload' &&
|
|
718
|
+
!baselineFiles[a.path] &&
|
|
719
|
+
(a.localSize ?? 0) > SYNC_LARGE_FILE_BYTES &&
|
|
720
|
+
!DEPLOY_ROOTS.some(r => a.path.startsWith(r));
|
|
721
|
+
if (hold)
|
|
722
|
+
held.push({ path: a.path, size: a.localSize ?? 0 });
|
|
723
|
+
return !hold;
|
|
724
|
+
});
|
|
725
|
+
if (!held.length)
|
|
726
|
+
return { planned, held };
|
|
727
|
+
return { planned: { ...planned, actions, uploads: planned.uploads - held.length }, held };
|
|
728
|
+
}
|
|
729
|
+
/** One-paragraph note for held large files: what happened and the two ways out. */
|
|
730
|
+
export function heldLargeNote(held) {
|
|
731
|
+
if (!held.length)
|
|
732
|
+
return '';
|
|
733
|
+
const list = held.map(h => ` ${h.path} (${formatSize(h.size)})`).join('\n');
|
|
734
|
+
const one = held.length === 1;
|
|
735
|
+
return `Not uploaded: ${held.length} new file${one ? '' : 's'} over ${formatSize(SYNC_LARGE_FILE_BYTES)}:\n${list}\n` +
|
|
736
|
+
`Add ${one ? 'it' : 'them'} to .gipityignore to keep ${one ? 'it' : 'them'} local, or upload on purpose with \`gipity push <path>\`.`;
|
|
737
|
+
}
|
|
738
|
+
function withNotes(summary, leftLocal, held) {
|
|
739
|
+
const note = heldLargeNote(held);
|
|
740
|
+
const base = withAppUploadNote(summary, leftLocal);
|
|
741
|
+
return note ? `${base}\n${note}` : base;
|
|
742
|
+
}
|
|
702
743
|
async function bulkDeleteGuard(p, knownFiles, opts) {
|
|
703
744
|
const totalDeletes = p.deletesLocal + p.deletesRemote;
|
|
704
745
|
if (totalDeletes === 0)
|
|
@@ -864,13 +905,13 @@ async function syncInner(projectGuid, root, ignore, opts, interactive) {
|
|
|
864
905
|
if (needHash.length)
|
|
865
906
|
p?.phase(`Hashing ${needHash.length} file${needHash.length === 1 ? '' : 's'}...`);
|
|
866
907
|
await ensureLocalHashes(root, local, needHash);
|
|
867
|
-
const planned = plan(local, remote, baseline.files);
|
|
908
|
+
const { planned, held: heldLarge } = holdLargeNewUploads(plan(local, remote, baseline.files), baseline.files);
|
|
868
909
|
if (opts.plan) {
|
|
869
910
|
return {
|
|
870
911
|
plan: planned, applied: 0, skipped: 0, errors: [],
|
|
871
|
-
summary:
|
|
912
|
+
summary: withNotes(formatPlan(planned), appUploadsLeftLocal, heldLarge),
|
|
872
913
|
deferredDeletes: 0,
|
|
873
|
-
appUploadsLeftLocal,
|
|
914
|
+
appUploadsLeftLocal, heldLarge,
|
|
874
915
|
};
|
|
875
916
|
}
|
|
876
917
|
// Uncertain-merge guard (armed via confirmMerge): syncing INTO a populated
|
|
@@ -903,7 +944,7 @@ async function syncInner(projectGuid, root, ignore, opts, interactive) {
|
|
|
903
944
|
...shape,
|
|
904
945
|
`Re-run with --yes to merge, or sync into an empty folder.`,
|
|
905
946
|
].join('\n'),
|
|
906
|
-
deferredDeletes: 0, aborted: true, appUploadsLeftLocal: [],
|
|
947
|
+
deferredDeletes: 0, aborted: true, appUploadsLeftLocal: [], heldLarge: [],
|
|
907
948
|
});
|
|
908
949
|
if (getAutoConfirm()) {
|
|
909
950
|
// --yes: proceed with the merge; the caller reports the applied counts.
|
|
@@ -1490,9 +1531,9 @@ async function syncInner(projectGuid, root, ignore, opts, interactive) {
|
|
|
1490
1531
|
applied,
|
|
1491
1532
|
skipped: skippedByGuard,
|
|
1492
1533
|
errors,
|
|
1493
|
-
summary:
|
|
1534
|
+
summary: withNotes(formatPlan(planned), appUploadsLeftLocal, heldLarge),
|
|
1494
1535
|
deferredDeletes: skippedByGuard,
|
|
1495
|
-
appUploadsLeftLocal,
|
|
1536
|
+
appUploadsLeftLocal, heldLarge,
|
|
1496
1537
|
};
|
|
1497
1538
|
}
|
|
1498
1539
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.37",
|
|
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",
|