gipity 1.1.34 → 1.1.36
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
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')
|
|
@@ -441,7 +441,7 @@ export const pageEvalCommand = new Command('eval')
|
|
|
441
441
|
.option('--wait-for <selector>', `Wait until this CSS selector appears before evaluating, then evaluate (deterministic - beats guessing a --wait). Gate on the state you are ASSERTING, not just a ready flag: '#verdict:not(:empty)' returns the instant the round lands, where a fixed wait snapshots mid-sequence. Same flag on page inspect/screenshot. Max ${WAIT_FOR_MAX_MS}ms (--wait-timeout).`)
|
|
442
442
|
.option('--wait-timeout <ms>', `Max ms to wait for --wait-for before giving up (max ${WAIT_FOR_MAX_MS})`, '5000')
|
|
443
443
|
.option('--timeout <ms>', `How long the script itself may run IN the page. Bare number = MILLISECONDS (so 90s = 90000, NOT 90); or pass an explicit unit that means the same on both this and \`sandbox run --timeout\`: --timeout 90s. Its own await/setTimeout pauses count (default ${EVAL_SCRIPT_BUDGET_MS}, ${EVAL_SCRIPT_BUDGET_CAMERA_MS} with --camera/--fake-media; floor 1000 - a bare number under it is rejected as a unit mix-up, a suffixed one just floors; max ${EVAL_SCRIPT_BUDGET_MAX_MS}). Raise it to trace a sequence that unfolds over time (a game round, an animation). Distinct from --wait, which only sleeps BEFORE the script.`)
|
|
444
|
-
.option('--auth', 'Evaluate signed in as you (your Gipity account), so a page behind a Sign-in-with-Gipity login is reachable.
|
|
444
|
+
.option('--auth', 'Evaluate signed in as you (your Gipity account, or on your own app-user-mode app your app user), so a page behind a Sign-in-with-Gipity login is reachable. Works for your apps hosted on *.gipity.ai that use Sign in with Gipity or app users. Without this flag the page loads as a genuinely anonymous, signed-out visitor: nothing carries over from earlier --auth runs.')
|
|
445
445
|
.option('--restore-db', "Snapshot the app database before the script runs and roll it back after, so a write-path check (click Approve, submit the form, edit a row) leaves the real data untouched. Use this whenever the eval WRITES - it is the undo for driving the deployed app against real project data. Same snapshot/undo standalone: gipity db checkpoint / gipity db restore.")
|
|
446
446
|
.option('--json', 'Output as JSON')
|
|
447
447
|
.action((url, exprArg, opts) => run('Page eval', async () => {
|
|
@@ -752,7 +752,7 @@ export const pageEvalCommand = new Command('eval')
|
|
|
752
752
|
console.log(muted(RESTORE_DB_TIP));
|
|
753
753
|
}
|
|
754
754
|
else {
|
|
755
|
-
console.log(muted('Auth: anonymous visitor (signed out; pass --auth to run
|
|
755
|
+
console.log(muted('Auth: anonymous visitor (signed out; pass --auth to run signed in as you)'));
|
|
756
756
|
}
|
|
757
757
|
if (camera)
|
|
758
758
|
console.log(`${muted('Camera:')} ${camera.name} ${muted('(played as the webcam feed; getUserMedia resolves)')}`);
|
|
@@ -43,7 +43,7 @@ export const pageInspectCommand = new Command('inspect')
|
|
|
43
43
|
.option('--all', 'Include render-blocking, large resources, oversized images, overflow culprits, and LCP detail')
|
|
44
44
|
.option('--no-fake-media', "Inspect with NO camera or microphone present, so a getUserMedia app takes its no-device error path (use this only when that fallback IS what you're inspecting)")
|
|
45
45
|
.option('--device <name>', `Inspect as a real touch device: ${INSPECT_DEVICES.join(', ')}. Emulates touch events, mobile user-agent and DPR, so a touch-gated mobile layout is what gets inspected.`)
|
|
46
|
-
.option('--auth', 'Load the page signed in as you (your Gipity account), so pages behind a Sign-in-with-Gipity login are reachable.
|
|
46
|
+
.option('--auth', 'Load the page signed in as you (your Gipity account, or on your own app-user-mode app your app user), so pages behind a Sign-in-with-Gipity login are reachable. Works for your apps hosted on *.gipity.ai that use Sign in with Gipity or app users. Without this flag the page loads as a genuinely anonymous, signed-out visitor: nothing carries over from earlier --auth runs.')
|
|
47
47
|
// Hidden redirect: agents reach for `page inspect --screenshot`. We don't take
|
|
48
48
|
// an image here (`page screenshot` is the single path for that) — just point there.
|
|
49
49
|
.addOption(new Option('--screenshot [path]', 'Capture a screenshot').hideHelp())
|
|
@@ -37,7 +37,7 @@ function fmtMs(ms) {
|
|
|
37
37
|
* signed-in session. */
|
|
38
38
|
function printAuthLine(auth) {
|
|
39
39
|
if (!auth?.requested) {
|
|
40
|
-
console.log(`${label('Auth')} ${muted('anonymous visitor (signed out; pass --auth to capture
|
|
40
|
+
console.log(`${label('Auth')} ${muted('anonymous visitor (signed out; pass --auth to capture signed in as you)')}`);
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
const who = getAuth()?.email;
|
|
@@ -268,7 +268,7 @@ export const pageScreenshotCommand = new Command('screenshot')
|
|
|
268
268
|
.option('--no-reload-between', 'Skip reload between viewports (faster, lower fidelity - only safe for static pages)')
|
|
269
269
|
.option('--fake-media', 'Grant a synthetic microphone + camera and auto-accept the getUserMedia prompt, so voice/camera apps render headlessly. The video feed is a built-in test pattern. To capture what the app does with a REAL frame (a hand, a face, an object), use --camera <path> instead.')
|
|
270
270
|
.option('--camera <path>', 'Play a local image or video (.png/.jpg/.webp/.mp4/.webm/.y4m/.mjpeg) as the browser\'s WEBCAM feed, then capture, so the shot shows the app reacting to a frame you chose (detected gesture, boxes, labels). Implies --fake-media.')
|
|
271
|
-
.option('--auth', 'Capture the page signed in as you (your Gipity account), so UI behind a Sign-in-with-Gipity login is shown.
|
|
271
|
+
.option('--auth', 'Capture the page signed in as you (your Gipity account, or on your own app-user-mode app your app user), so UI behind a Sign-in-with-Gipity login is shown. Works for your apps hosted on *.gipity.ai that use Sign in with Gipity or app users. Without this flag the page loads as a genuinely anonymous, signed-out visitor: nothing carries over from earlier --auth runs.')
|
|
272
272
|
.option('--json', 'Output JSON metadata instead of a friendly summary')
|
|
273
273
|
.addOption(new Option('--post-load-delay <ms>', 'Alias for --wait').hideHelp())
|
|
274
274
|
// (--eval and the other JS-intent guesses are registered in one place from
|
|
@@ -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/index.js
CHANGED
|
@@ -38256,7 +38256,7 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38256
38256
|
).option("--fake-media", "Grant a synthetic microphone + camera and auto-accept the getUserMedia prompt, so a voice/camera app runs headlessly instead of hitting its no-camera path. The feed is a built-in test pattern (and a tone): nothing a vision model can recognize; to drive a vision app use --camera <path> instead.").option("--wait <ms>", "Sleep this many ms after DOMContentLoaded before evaluating (lets late async work settle; max 30000). With --wait-for, it elapses AFTER the selector appears - gate, then settle.", "500").option("--wait-for <selector>", `Wait until this CSS selector appears before evaluating, then evaluate (deterministic - beats guessing a --wait). Gate on the state you are ASSERTING, not just a ready flag: '#verdict:not(:empty)' returns the instant the round lands, where a fixed wait snapshots mid-sequence. Same flag on page inspect/screenshot. Max ${WAIT_FOR_MAX_MS}ms (--wait-timeout).`).option("--wait-timeout <ms>", `Max ms to wait for --wait-for before giving up (max ${WAIT_FOR_MAX_MS})`, "5000").option(
|
|
38257
38257
|
"--timeout <ms>",
|
|
38258
38258
|
`How long the script itself may run IN the page. Bare number = MILLISECONDS (so 90s = 90000, NOT 90); or pass an explicit unit that means the same on both this and \`sandbox run --timeout\`: --timeout 90s. Its own await/setTimeout pauses count (default ${EVAL_SCRIPT_BUDGET_MS}, ${EVAL_SCRIPT_BUDGET_CAMERA_MS} with --camera/--fake-media; floor 1000 - a bare number under it is rejected as a unit mix-up, a suffixed one just floors; max ${EVAL_SCRIPT_BUDGET_MAX_MS}). Raise it to trace a sequence that unfolds over time (a game round, an animation). Distinct from --wait, which only sleeps BEFORE the script.`
|
|
38259
|
-
).option("--auth", "Evaluate signed in as you (your Gipity account), so a page behind a Sign-in-with-Gipity login is reachable.
|
|
38259
|
+
).option("--auth", "Evaluate signed in as you (your Gipity account, or on your own app-user-mode app your app user), so a page behind a Sign-in-with-Gipity login is reachable. Works for your apps hosted on *.gipity.ai that use Sign in with Gipity or app users. Without this flag the page loads as a genuinely anonymous, signed-out visitor: nothing carries over from earlier --auth runs.").option("--restore-db", "Snapshot the app database before the script runs and roll it back after, so a write-path check (click Approve, submit the form, edit a row) leaves the real data untouched. Use this whenever the eval WRITES - it is the undo for driving the deployed app against real project data. Same snapshot/undo standalone: gipity db checkpoint / gipity db restore.").option("--json", "Output as JSON").action((url, exprArg, opts) => run("Page eval", async () => {
|
|
38260
38260
|
const decoy = JS_DECOY_FLAGS.find((f) => opts[f.slice(2)] !== void 0);
|
|
38261
38261
|
if (decoy) {
|
|
38262
38262
|
pageEvalCommand.error(
|
|
@@ -38459,7 +38459,7 @@ ${hint}`);
|
|
|
38459
38459
|
console.log(d.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")}${d.auth.detail ? `: ${d.auth.detail}` : ""} ${muted("(this is the anonymous view)")}`);
|
|
38460
38460
|
if (d.auth.established && !opts.restoreDb) console.log(muted(RESTORE_DB_TIP));
|
|
38461
38461
|
} else {
|
|
38462
|
-
console.log(muted("Auth: anonymous visitor (signed out; pass --auth to run
|
|
38462
|
+
console.log(muted("Auth: anonymous visitor (signed out; pass --auth to run signed in as you)"));
|
|
38463
38463
|
}
|
|
38464
38464
|
if (camera) console.log(`${muted("Camera:")} ${camera.name} ${muted("(played as the webcam feed; getUserMedia resolves)")}`);
|
|
38465
38465
|
if (hosted.length) console.log(`${muted("Fixtures:")} ${hosted.map((h) => h.name).join(", ")}`);
|
|
@@ -38617,7 +38617,7 @@ function fmtMs(ms2) {
|
|
|
38617
38617
|
}
|
|
38618
38618
|
function printAuthLine(auth) {
|
|
38619
38619
|
if (!auth?.requested) {
|
|
38620
|
-
console.log(`${label("Auth")} ${muted("anonymous visitor (signed out; pass --auth to capture
|
|
38620
|
+
console.log(`${label("Auth")} ${muted("anonymous visitor (signed out; pass --auth to capture signed in as you)")}`);
|
|
38621
38621
|
return;
|
|
38622
38622
|
}
|
|
38623
38623
|
const who = getAuth()?.email;
|
|
@@ -38739,7 +38739,7 @@ var WAIT_FOR_MAX_MS2 = 15e3;
|
|
|
38739
38739
|
var WAIT_FOR_DEFAULT_MS = 15e3;
|
|
38740
38740
|
var MAX_POST_LOAD_DELAY_MS = 3e4;
|
|
38741
38741
|
var CAMERA_DEFAULT_DELAY_MS = 15e3;
|
|
38742
|
-
var pageScreenshotCommand = new Command("screenshot").description("Screenshot a web page").argument("<url>", "URL to screenshot").option("--device <names>", `Device preset(s): ${Object.keys(DEVICE_PRESETS).join(", ")} (comma-separated or repeat flag). mobile/tablet emulate a real touch device (touch events, mobile user-agent, DPR) so touch-gated mobile UI actually renders.`, appendOption, []).option("--viewport <dims>", "Raw viewport(s): WxH or WxH@dpr (comma-separated or repeat flag), e.g. --viewport 390x844 for a phone-sized window", appendOption, []).option("--wait <ms>", `Sleep this many ms after DOMContentLoaded before capturing (default 1000, max ${MAX_POST_LOAD_DELAY_MS}). With --camera it defaults to ${CAMERA_DEFAULT_DELAY_MS} so the vision model is up. Same flag as page eval/inspect.`).option("--wait-for <selector>", `Wait until this CSS selector appears before capturing, then capture (deterministic - beats guessing a --wait). Same flag as page eval/inspect. Gate on what you are photographing ('[data-vision="ready"]', '#verdict:not(:empty)'). Max ${WAIT_FOR_MAX_MS2}ms (--wait-timeout).`).option("--wait-timeout <ms>", `Max ms to wait for --wait-for before giving up (default ${WAIT_FOR_DEFAULT_MS}, max ${WAIT_FOR_MAX_MS2}). Timing out is reported - the capture still happens, so you see the state it got stuck in.`).option("--action <js>", `Run JS in the page before capturing - e.g. click a button to enter a state ("document.getElementById('play').click()"). Runs as an async function body, so const/await and app-relative import('./...') work. Runs after the post-load delay, then settles again before the shot. If it throws, the capture still happens and the failure is reported.`).option("--file <path>", "Read the pre-capture script from a file instead of inline --action (mutually exclusive), or --file - to read it from stdin (pipe a heredoc: --file - <<'EOF' ... EOF) with no tmp file. For a multi-step driver - click through a flow, wait for it to render - then capture. Same async-function-body semantics as --action; same --file flag as page eval.").option("--full", "Capture the full scrollable page (default: viewport only). Scrolls the page through first so scroll-reveal/fade-in-on-scroll (IntersectionObserver) sections render into the shot instead of capturing blank.").option("-o, --output <file>", "Output path (default tmp/screenshots/ss-<host>-<timestamp>.png in the project: scratch, never synced or deployed). To keep a capture, write it under docs/ (-o docs/home.png: synced, never deployed). With several viewports it is a stem: -o tmp/shot.png --device desktop,mobile writes tmp/shot-desktop.png and tmp/shot-mobile.png.").option("--no-reload-between", "Skip reload between viewports (faster, lower fidelity - only safe for static pages)").option("--fake-media", "Grant a synthetic microphone + camera and auto-accept the getUserMedia prompt, so voice/camera apps render headlessly. The video feed is a built-in test pattern. To capture what the app does with a REAL frame (a hand, a face, an object), use --camera <path> instead.").option("--camera <path>", "Play a local image or video (.png/.jpg/.webp/.mp4/.webm/.y4m/.mjpeg) as the browser's WEBCAM feed, then capture, so the shot shows the app reacting to a frame you chose (detected gesture, boxes, labels). Implies --fake-media.").option("--auth", "Capture the page signed in as you (your Gipity account), so UI behind a Sign-in-with-Gipity login is shown.
|
|
38742
|
+
var pageScreenshotCommand = new Command("screenshot").description("Screenshot a web page").argument("<url>", "URL to screenshot").option("--device <names>", `Device preset(s): ${Object.keys(DEVICE_PRESETS).join(", ")} (comma-separated or repeat flag). mobile/tablet emulate a real touch device (touch events, mobile user-agent, DPR) so touch-gated mobile UI actually renders.`, appendOption, []).option("--viewport <dims>", "Raw viewport(s): WxH or WxH@dpr (comma-separated or repeat flag), e.g. --viewport 390x844 for a phone-sized window", appendOption, []).option("--wait <ms>", `Sleep this many ms after DOMContentLoaded before capturing (default 1000, max ${MAX_POST_LOAD_DELAY_MS}). With --camera it defaults to ${CAMERA_DEFAULT_DELAY_MS} so the vision model is up. Same flag as page eval/inspect.`).option("--wait-for <selector>", `Wait until this CSS selector appears before capturing, then capture (deterministic - beats guessing a --wait). Same flag as page eval/inspect. Gate on what you are photographing ('[data-vision="ready"]', '#verdict:not(:empty)'). Max ${WAIT_FOR_MAX_MS2}ms (--wait-timeout).`).option("--wait-timeout <ms>", `Max ms to wait for --wait-for before giving up (default ${WAIT_FOR_DEFAULT_MS}, max ${WAIT_FOR_MAX_MS2}). Timing out is reported - the capture still happens, so you see the state it got stuck in.`).option("--action <js>", `Run JS in the page before capturing - e.g. click a button to enter a state ("document.getElementById('play').click()"). Runs as an async function body, so const/await and app-relative import('./...') work. Runs after the post-load delay, then settles again before the shot. If it throws, the capture still happens and the failure is reported.`).option("--file <path>", "Read the pre-capture script from a file instead of inline --action (mutually exclusive), or --file - to read it from stdin (pipe a heredoc: --file - <<'EOF' ... EOF) with no tmp file. For a multi-step driver - click through a flow, wait for it to render - then capture. Same async-function-body semantics as --action; same --file flag as page eval.").option("--full", "Capture the full scrollable page (default: viewport only). Scrolls the page through first so scroll-reveal/fade-in-on-scroll (IntersectionObserver) sections render into the shot instead of capturing blank.").option("-o, --output <file>", "Output path (default tmp/screenshots/ss-<host>-<timestamp>.png in the project: scratch, never synced or deployed). To keep a capture, write it under docs/ (-o docs/home.png: synced, never deployed). With several viewports it is a stem: -o tmp/shot.png --device desktop,mobile writes tmp/shot-desktop.png and tmp/shot-mobile.png.").option("--no-reload-between", "Skip reload between viewports (faster, lower fidelity - only safe for static pages)").option("--fake-media", "Grant a synthetic microphone + camera and auto-accept the getUserMedia prompt, so voice/camera apps render headlessly. The video feed is a built-in test pattern. To capture what the app does with a REAL frame (a hand, a face, an object), use --camera <path> instead.").option("--camera <path>", "Play a local image or video (.png/.jpg/.webp/.mp4/.webm/.y4m/.mjpeg) as the browser's WEBCAM feed, then capture, so the shot shows the app reacting to a frame you chose (detected gesture, boxes, labels). Implies --fake-media.").option("--auth", "Capture the page signed in as you (your Gipity account, or on your own app-user-mode app your app user), so UI behind a Sign-in-with-Gipity login is shown. Works for your apps hosted on *.gipity.ai that use Sign in with Gipity or app users. Without this flag the page loads as a genuinely anonymous, signed-out visitor: nothing carries over from earlier --auth runs.").option("--json", "Output JSON metadata instead of a friendly summary").addOption(new Option("--post-load-delay <ms>", "Alias for --wait").hideHelp()).addOption(new Option("--full-page", "Alias for --full").hideHelp()).addOption(new Option("--width <px>", "Alias: --viewport WxH").hideHelp()).addOption(new Option("--height <px>", "Alias: --viewport WxH").hideHelp()).action((url, opts) => run("Page screenshot", async () => {
|
|
38743
38743
|
const aliasFlag = ACTION_ALIAS_FLAGS.find((f) => opts[f.slice(2)] !== void 0);
|
|
38744
38744
|
if (aliasFlag) {
|
|
38745
38745
|
console.error(muted(
|
|
@@ -39007,7 +39007,7 @@ function shortUrl(url, truncate = true, maxLen = 100) {
|
|
|
39007
39007
|
const tailLen = Math.floor(keep / 2);
|
|
39008
39008
|
return result.slice(0, headLen) + "..." + result.slice(-tailLen);
|
|
39009
39009
|
}
|
|
39010
|
-
var pageInspectCommand = new Command("inspect").description("Inspect a web page (console, failed resources, timing, layout overflow). ONE passive load - to verify realtime/presence across concurrent clients use `page test --observe`").argument("<url>", "URL to inspect").option("--wait <ms>", "Sleep this many ms after DOMContentLoaded before capturing (lets late async/LCP work settle; max 30000)", "500").option("--wait-for <selector>", "Wait until this CSS selector appears before capturing (deterministic; replaces --wait)").option("--wait-timeout <ms>", "Max ms to wait for --wait-for before giving up", "5000").option("--json", "Output as JSON").option("--no-reprobe", "Skip the automatic second probe that filters one-time transient console errors - roughly halves inspect time on a page with any console error, at the cost of possibly reporting a cold-load transient as real").option("--no-truncate", "Show full URLs instead of truncating long ones with middle-ellipsis").option("--all", "Include render-blocking, large resources, oversized images, overflow culprits, and LCP detail").option("--no-fake-media", "Inspect with NO camera or microphone present, so a getUserMedia app takes its no-device error path (use this only when that fallback IS what you're inspecting)").option("--device <name>", `Inspect as a real touch device: ${TOUCH_DEVICES.join(", ")}. Emulates touch events, mobile user-agent and DPR, so a touch-gated mobile layout is what gets inspected.`).option("--auth", "Load the page signed in as you (your Gipity account), so pages behind a Sign-in-with-Gipity login are reachable.
|
|
39010
|
+
var pageInspectCommand = new Command("inspect").description("Inspect a web page (console, failed resources, timing, layout overflow). ONE passive load - to verify realtime/presence across concurrent clients use `page test --observe`").argument("<url>", "URL to inspect").option("--wait <ms>", "Sleep this many ms after DOMContentLoaded before capturing (lets late async/LCP work settle; max 30000)", "500").option("--wait-for <selector>", "Wait until this CSS selector appears before capturing (deterministic; replaces --wait)").option("--wait-timeout <ms>", "Max ms to wait for --wait-for before giving up", "5000").option("--json", "Output as JSON").option("--no-reprobe", "Skip the automatic second probe that filters one-time transient console errors - roughly halves inspect time on a page with any console error, at the cost of possibly reporting a cold-load transient as real").option("--no-truncate", "Show full URLs instead of truncating long ones with middle-ellipsis").option("--all", "Include render-blocking, large resources, oversized images, overflow culprits, and LCP detail").option("--no-fake-media", "Inspect with NO camera or microphone present, so a getUserMedia app takes its no-device error path (use this only when that fallback IS what you're inspecting)").option("--device <name>", `Inspect as a real touch device: ${TOUCH_DEVICES.join(", ")}. Emulates touch events, mobile user-agent and DPR, so a touch-gated mobile layout is what gets inspected.`).option("--auth", "Load the page signed in as you (your Gipity account, or on your own app-user-mode app your app user), so pages behind a Sign-in-with-Gipity login are reachable. Works for your apps hosted on *.gipity.ai that use Sign in with Gipity or app users. Without this flag the page loads as a genuinely anonymous, signed-out visitor: nothing carries over from earlier --auth runs.").addOption(new Option("--screenshot [path]", "Capture a screenshot").hideHelp()).action((url, opts) => {
|
|
39011
39011
|
if (opts.screenshot !== void 0) {
|
|
39012
39012
|
console.error(error("page inspect does not capture screenshots. Use page screenshot:"));
|
|
39013
39013
|
console.error(` gipity page screenshot ${url}${typeof opts.screenshot === "string" ? ` -o ${opts.screenshot}` : ""}`);
|
|
@@ -39226,7 +39226,7 @@ async function printPlan(appGuid2, env, json) {
|
|
|
39226
39226
|
console.log(warning("A prod deploy stops on the destructive statements above until you pass --yes-destructive."));
|
|
39227
39227
|
}
|
|
39228
39228
|
}
|
|
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 () => {
|
|
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, 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
39230
|
const env = envArg ?? getEnvOption();
|
|
39231
39231
|
if (opts.plan) {
|
|
39232
39232
|
await printPlan(requireConfig2().projectGuid, env ?? "prod", !!opts.json);
|
|
@@ -40101,14 +40101,15 @@ init_config();
|
|
|
40101
40101
|
init_setup();
|
|
40102
40102
|
init_colors();
|
|
40103
40103
|
init_utils();
|
|
40104
|
-
import { join as
|
|
40104
|
+
import { join as join20 } from "path";
|
|
40105
40105
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
40106
40106
|
|
|
40107
40107
|
// src/commands/project-auth.ts
|
|
40108
40108
|
init_api();
|
|
40109
40109
|
init_config();
|
|
40110
40110
|
init_colors();
|
|
40111
|
-
import { readFileSync as readFileSync18 } from "fs";
|
|
40111
|
+
import { readFileSync as readFileSync18, writeFileSync as writeFileSync12, existsSync as existsSync15 } from "fs";
|
|
40112
|
+
import { join as join19 } from "path";
|
|
40112
40113
|
var AUTH_MODES = ["gipity", "app", "both"];
|
|
40113
40114
|
var PROVIDERS = ["google", "apple", "discord"];
|
|
40114
40115
|
var PROVIDER_LABEL = { google: "Google", apple: "Apple", discord: "Discord" };
|
|
@@ -40228,7 +40229,13 @@ See: gipity skill read steam-game`).option("--unique-names <on|off>", "Require u
|
|
|
40228
40229
|
}
|
|
40229
40230
|
const res = await put(`/projects/${config.projectGuid}`, body);
|
|
40230
40231
|
const lines = [];
|
|
40231
|
-
if (body.auth_mode)
|
|
40232
|
+
if (body.auth_mode) {
|
|
40233
|
+
lines.push(success(`Sign-in set to "${body.auth_mode}".`));
|
|
40234
|
+
const root = getProjectRoot();
|
|
40235
|
+
if (root && writeYamlAuthMode(join19(root, "gipity.yaml"), body.auth_mode)) {
|
|
40236
|
+
lines.push(muted("gipity.yaml: auth.mode updated (deploys apply it)."));
|
|
40237
|
+
}
|
|
40238
|
+
}
|
|
40232
40239
|
if (body.unique_player_names !== void 0) {
|
|
40233
40240
|
lines.push(success(`Unique names ${body.unique_player_names ? "on" : "off"}.`));
|
|
40234
40241
|
const sharing = res.data.players_sharing_names ?? 0;
|
|
@@ -40285,13 +40292,26 @@ See: gipity skill read steam-game`).option("--unique-names <on|off>", "Require u
|
|
|
40285
40292
|
printResult(lines.join("\n"), opts, res.data);
|
|
40286
40293
|
}));
|
|
40287
40294
|
}
|
|
40295
|
+
function writeYamlAuthMode(yamlPath, mode) {
|
|
40296
|
+
if (!existsSync15(yamlPath)) return false;
|
|
40297
|
+
const text = readFileSync18(yamlPath, "utf-8");
|
|
40298
|
+
const block = `auth:
|
|
40299
|
+
mode: ${mode}
|
|
40300
|
+
`;
|
|
40301
|
+
const existing = /^auth:[^\n]*\n(?:[ \t]+[^\n]*\n|[ \t]*\n)*/m;
|
|
40302
|
+
const next = existing.test(text) ? text.replace(existing, block) : `${text.replace(/\n*$/, "\n")}
|
|
40303
|
+
# Who signs in to the app: gipity | app (its own users, incl. guests) | both
|
|
40304
|
+
${block}`;
|
|
40305
|
+
writeFileSync12(yamlPath, next);
|
|
40306
|
+
return true;
|
|
40307
|
+
}
|
|
40288
40308
|
|
|
40289
40309
|
// src/commands/project-users.ts
|
|
40290
40310
|
init_api();
|
|
40291
40311
|
init_config();
|
|
40292
40312
|
init_colors();
|
|
40293
40313
|
init_utils();
|
|
40294
|
-
import { writeFileSync as
|
|
40314
|
+
import { writeFileSync as writeFileSync13 } from "fs";
|
|
40295
40315
|
var EXPORT_PAGE_SIZE = 500;
|
|
40296
40316
|
function fail2(msg) {
|
|
40297
40317
|
console.error(error(msg));
|
|
@@ -40368,7 +40388,7 @@ email code, Steam or a guest device. They belong to the app, not to Gipity.
|
|
|
40368
40388
|
process.stdout.write(out);
|
|
40369
40389
|
return;
|
|
40370
40390
|
}
|
|
40371
|
-
|
|
40391
|
+
writeFileSync13(opts.output, out);
|
|
40372
40392
|
printResult(success(`Exported ${all.length} user${all.length === 1 ? "" : "s"} to ${opts.output}.`), opts, { file: opts.output, count: all.length, format: opts.format });
|
|
40373
40393
|
}));
|
|
40374
40394
|
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 +40460,7 @@ projectCommand.command("create <name>").description("Create a project").option("
|
|
|
40440
40460
|
}
|
|
40441
40461
|
const res = await post("/projects", body);
|
|
40442
40462
|
const project = res.data;
|
|
40443
|
-
const dir =
|
|
40463
|
+
const dir = join20(getProjectsRoot(), project.slug);
|
|
40444
40464
|
mkdirSync11(dir, { recursive: true });
|
|
40445
40465
|
const accountSlug = await getAccountSlug();
|
|
40446
40466
|
const { applied } = await finalizeLocalProject({
|
|
@@ -40509,8 +40529,8 @@ registerUsersCommand(projectCommand);
|
|
|
40509
40529
|
// src/commands/workflow.ts
|
|
40510
40530
|
init_api();
|
|
40511
40531
|
init_config();
|
|
40512
|
-
import { existsSync as
|
|
40513
|
-
import { isAbsolute, join as
|
|
40532
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync12, readFileSync as readFileSync19, writeFileSync as writeFileSync14 } from "fs";
|
|
40533
|
+
import { isAbsolute, join as join21, resolve as resolve13 } from "path";
|
|
40514
40534
|
init_colors();
|
|
40515
40535
|
function mergedOpts(cmd) {
|
|
40516
40536
|
return cmd.optsWithGlobals();
|
|
@@ -40717,8 +40737,8 @@ steps:
|
|
|
40717
40737
|
tools: [memory, db_query]
|
|
40718
40738
|
`;
|
|
40719
40739
|
function readWorkflowYaml(from) {
|
|
40720
|
-
const candidates = isAbsolute(from) ? [from] : [resolve13(from), ...getProjectRoot() ? [
|
|
40721
|
-
const found = candidates.find((p) =>
|
|
40740
|
+
const candidates = isAbsolute(from) ? [from] : [resolve13(from), ...getProjectRoot() ? [join21(getProjectRoot(), from)] : []];
|
|
40741
|
+
const found = candidates.find((p) => existsSync16(p));
|
|
40722
40742
|
if (!found) throw new Error(`No workflow file at ${from}.`);
|
|
40723
40743
|
return readFileSync19(found, "utf-8");
|
|
40724
40744
|
}
|
|
@@ -40731,10 +40751,10 @@ workflowCommand.command("create").description("Create a workflow from a YAML fil
|
|
|
40731
40751
|
if (opts.heartbeat) {
|
|
40732
40752
|
from = HEARTBEAT_PATH;
|
|
40733
40753
|
const root = getProjectRoot();
|
|
40734
|
-
const local =
|
|
40735
|
-
if (!
|
|
40736
|
-
mkdirSync12(
|
|
40737
|
-
|
|
40754
|
+
const local = join21(root, HEARTBEAT_PATH);
|
|
40755
|
+
if (!existsSync16(local)) {
|
|
40756
|
+
mkdirSync12(join21(root, "workflows"), { recursive: true });
|
|
40757
|
+
writeFileSync14(local, HEARTBEAT_YAML);
|
|
40738
40758
|
}
|
|
40739
40759
|
await pushFile(local);
|
|
40740
40760
|
}
|
|
@@ -41314,8 +41334,8 @@ storageCommand.command("retention").description("View or adjust your file versio
|
|
|
41314
41334
|
init_platform();
|
|
41315
41335
|
init_auth();
|
|
41316
41336
|
init_api();
|
|
41317
|
-
import { join as
|
|
41318
|
-
import { existsSync as
|
|
41337
|
+
import { join as join23, dirname as dirname12, resolve as resolve14, basename as basename6, sep as sep6 } from "path";
|
|
41338
|
+
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
41339
|
import { homedir as homedir15 } from "os";
|
|
41320
41340
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
41321
41341
|
import { randomUUID } from "crypto";
|
|
@@ -41675,12 +41695,12 @@ init_claude_setup();
|
|
|
41675
41695
|
init_agents();
|
|
41676
41696
|
|
|
41677
41697
|
// src/prefs.ts
|
|
41678
|
-
import { existsSync as
|
|
41698
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync13, readFileSync as readFileSync20, writeFileSync as writeFileSync15 } from "fs";
|
|
41679
41699
|
import { homedir as homedir14 } from "os";
|
|
41680
|
-
import { join as
|
|
41681
|
-
var PREFS_PATH =
|
|
41700
|
+
import { join as join22 } from "path";
|
|
41701
|
+
var PREFS_PATH = join22(homedir14(), ".gipity", "prefs.json");
|
|
41682
41702
|
function readPrefs() {
|
|
41683
|
-
if (!
|
|
41703
|
+
if (!existsSync17(PREFS_PATH)) return {};
|
|
41684
41704
|
try {
|
|
41685
41705
|
const parsed = JSON.parse(readFileSync20(PREFS_PATH, "utf-8"));
|
|
41686
41706
|
return {
|
|
@@ -41694,8 +41714,8 @@ function writePrefs(update) {
|
|
|
41694
41714
|
try {
|
|
41695
41715
|
const current = readPrefs();
|
|
41696
41716
|
const next = { ...current, ...update };
|
|
41697
|
-
mkdirSync13(
|
|
41698
|
-
|
|
41717
|
+
mkdirSync13(join22(homedir14(), ".gipity"), { recursive: true });
|
|
41718
|
+
writeFileSync15(PREFS_PATH, JSON.stringify(next, null, 2) + "\n");
|
|
41699
41719
|
} catch {
|
|
41700
41720
|
}
|
|
41701
41721
|
}
|
|
@@ -41705,8 +41725,8 @@ init_setup();
|
|
|
41705
41725
|
var __clDir = dirname12(fileURLToPath2(import.meta.url));
|
|
41706
41726
|
function readOwnPkg(fromDir) {
|
|
41707
41727
|
for (let d = fromDir; ; d = dirname12(d)) {
|
|
41708
|
-
const p =
|
|
41709
|
-
if (
|
|
41728
|
+
const p = join23(d, "package.json");
|
|
41729
|
+
if (existsSync18(p)) {
|
|
41710
41730
|
try {
|
|
41711
41731
|
const pkg2 = JSON.parse(readFileSync21(p, "utf-8"));
|
|
41712
41732
|
if (pkg2.name === "gipity") return pkg2;
|
|
@@ -41762,7 +41782,7 @@ function localFsFallback(dir) {
|
|
|
41762
41782
|
let isDir = false;
|
|
41763
41783
|
let size = 0;
|
|
41764
41784
|
try {
|
|
41765
|
-
const st2 = statSync8(
|
|
41785
|
+
const st2 = statSync8(join23(d, name));
|
|
41766
41786
|
isDir = st2.isDirectory();
|
|
41767
41787
|
size = st2.isFile() ? st2.size : 0;
|
|
41768
41788
|
} catch {
|
|
@@ -41771,7 +41791,7 @@ function localFsFallback(dir) {
|
|
|
41771
41791
|
if (isDir) {
|
|
41772
41792
|
folderCount++;
|
|
41773
41793
|
if (depth === 0) topLevelEntries.push(`${name}/`);
|
|
41774
|
-
walk(
|
|
41794
|
+
walk(join23(d, name), depth + 1);
|
|
41775
41795
|
} else {
|
|
41776
41796
|
fileCount++;
|
|
41777
41797
|
totalBytes += size;
|
|
@@ -41804,8 +41824,8 @@ function hasStreamJsonFlag(args) {
|
|
|
41804
41824
|
}
|
|
41805
41825
|
function markFolderTrusted(dir) {
|
|
41806
41826
|
try {
|
|
41807
|
-
const file =
|
|
41808
|
-
const cfg =
|
|
41827
|
+
const file = join23(homedir15(), ".claude.json");
|
|
41828
|
+
const cfg = existsSync18(file) ? JSON.parse(readFileSync21(file, "utf-8")) : {};
|
|
41809
41829
|
if (typeof cfg !== "object" || cfg === null) return;
|
|
41810
41830
|
if (typeof cfg.projects !== "object" || cfg.projects === null) cfg.projects = {};
|
|
41811
41831
|
const entry = typeof cfg.projects[dir] === "object" && cfg.projects[dir] !== null ? cfg.projects[dir] : {};
|
|
@@ -41813,7 +41833,7 @@ function markFolderTrusted(dir) {
|
|
|
41813
41833
|
entry.hasTrustDialogAccepted = true;
|
|
41814
41834
|
cfg.projects[dir] = entry;
|
|
41815
41835
|
const tmp = `${file}.gipity-tmp`;
|
|
41816
|
-
|
|
41836
|
+
writeFileSync16(tmp, JSON.stringify(cfg, null, 2));
|
|
41817
41837
|
renameSync2(tmp, file);
|
|
41818
41838
|
} catch {
|
|
41819
41839
|
}
|
|
@@ -41924,7 +41944,7 @@ async function runLaunch(cmdName, cmdCfg, opts) {
|
|
|
41924
41944
|
let existing = getConfig();
|
|
41925
41945
|
let forceAdoptCwd = false;
|
|
41926
41946
|
if (existing && !opts.newProject && !opts.project && !nonInteractive) {
|
|
41927
|
-
const cwdHasConfig =
|
|
41947
|
+
const cwdHasConfig = existsSync18(resolve14(process.cwd(), ".gipity.json"));
|
|
41928
41948
|
if (!cwdHasConfig && isLikelyEmpty(process.cwd())) {
|
|
41929
41949
|
const ancestorRoot = dirname12(getConfigPath());
|
|
41930
41950
|
console.log(` ${bold("You are inside an existing Gipity project.")}
|
|
@@ -41973,7 +41993,7 @@ async function runLaunch(cmdName, cmdCfg, opts) {
|
|
|
41973
41993
|
}
|
|
41974
41994
|
project = found;
|
|
41975
41995
|
}
|
|
41976
|
-
const projectDir2 = opts.here ? process.cwd() :
|
|
41996
|
+
const projectDir2 = opts.here ? process.cwd() : join23(getProjectsRoot(), project.slug);
|
|
41977
41997
|
mkdirSync14(projectDir2, { recursive: true });
|
|
41978
41998
|
process.chdir(projectDir2);
|
|
41979
41999
|
clearConfigCache();
|
|
@@ -42088,7 +42108,7 @@ async function runLaunch(cmdName, cmdCfg, opts) {
|
|
|
42088
42108
|
} else {
|
|
42089
42109
|
project = result.project;
|
|
42090
42110
|
isNewProject = result.kind === "create-new";
|
|
42091
|
-
const projectDir2 =
|
|
42111
|
+
const projectDir2 = join23(getProjectsRoot(), project.slug);
|
|
42092
42112
|
mkdirSync14(projectDir2, { recursive: true });
|
|
42093
42113
|
process.chdir(projectDir2);
|
|
42094
42114
|
clearConfigCache();
|
|
@@ -42479,8 +42499,8 @@ ${doneLine}
|
|
|
42479
42499
|
});
|
|
42480
42500
|
}
|
|
42481
42501
|
function flushHeadlessCapture(adapter, sessionId, convGuid) {
|
|
42482
|
-
const runner =
|
|
42483
|
-
if (!
|
|
42502
|
+
const runner = join23(__clDir, "..", "hooks", "capture-runner.js");
|
|
42503
|
+
if (!existsSync18(runner)) return;
|
|
42484
42504
|
const payload = JSON.stringify({ session_id: sessionId, cwd: process.cwd() });
|
|
42485
42505
|
const env = { ...process.env, GIPITY_CONVERSATION_GUID: convGuid };
|
|
42486
42506
|
for (const event of ["session-start", "stop"]) {
|
|
@@ -44734,11 +44754,11 @@ jobCommand.command("cancel <runGuid>").description("Cancel a queued or running j
|
|
|
44734
44754
|
}
|
|
44735
44755
|
}));
|
|
44736
44756
|
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:
|
|
44757
|
+
const { existsSync: existsSync28, statSync: statSync12 } = await import("node:fs");
|
|
44758
|
+
const { resolve: resolve21, join: join33 } = await import("node:path");
|
|
44739
44759
|
const { spawnCommand: spawnCommand2, spawnSyncCommand: spawnSyncCommand2 } = await Promise.resolve().then(() => (init_platform(), platform_exports));
|
|
44740
44760
|
const jobDir = resolve21(process.cwd(), "jobs", name);
|
|
44741
|
-
if (!
|
|
44761
|
+
if (!existsSync28(jobDir) || !statSync12(jobDir).isDirectory()) {
|
|
44742
44762
|
console.error(error(`jobs/${name}/ not found in current directory`));
|
|
44743
44763
|
process.exit(1);
|
|
44744
44764
|
}
|
|
@@ -44759,7 +44779,7 @@ jobCommand.command("run-local <name>").description("Run the job in a local Docke
|
|
|
44759
44779
|
},
|
|
44760
44780
|
{ file: "main.sh", runtime: "bash", entry: "bash" }
|
|
44761
44781
|
];
|
|
44762
|
-
const picked = variants.find((v7) =>
|
|
44782
|
+
const picked = variants.find((v7) => existsSync28(join33(jobDir, v7.file)));
|
|
44763
44783
|
if (!picked) {
|
|
44764
44784
|
console.error(error(`No main.py / main.js / main.sh found under jobs/${name}/`));
|
|
44765
44785
|
process.exit(1);
|
|
@@ -44784,7 +44804,7 @@ jobCommand.command("run-local <name>").description("Run the job in a local Docke
|
|
|
44784
44804
|
"-v",
|
|
44785
44805
|
`${jobDir}:/work`
|
|
44786
44806
|
];
|
|
44787
|
-
const needsDeps = opts.deps !== false && picked.depsFile && picked.installCmd &&
|
|
44807
|
+
const needsDeps = opts.deps !== false && picked.depsFile && picked.installCmd && existsSync28(join33(jobDir, picked.depsFile));
|
|
44788
44808
|
const handlerCmd = `${picked.entry} /work/${picked.file}`;
|
|
44789
44809
|
let shellCmd;
|
|
44790
44810
|
if (needsDeps && picked.installCmd) {
|
|
@@ -44958,7 +44978,7 @@ emailCommand.command("log").description("Recent email() sends and skipped attemp
|
|
|
44958
44978
|
init_api();
|
|
44959
44979
|
init_config();
|
|
44960
44980
|
init_colors();
|
|
44961
|
-
import { mkdirSync as mkdirSync15, writeFileSync as
|
|
44981
|
+
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync17, readFileSync as readFileSync22 } from "fs";
|
|
44962
44982
|
import { resolve as resolvePath2, dirname as dirname13, relative as relative5, isAbsolute as isAbsolute2, basename as basename7 } from "path";
|
|
44963
44983
|
|
|
44964
44984
|
// src/commands/generate-async.ts
|
|
@@ -45265,7 +45285,7 @@ async function downloadFile(url, filename, explicit) {
|
|
|
45265
45285
|
const outPath = explicit ? filename : correctExtension(filename, buffer);
|
|
45266
45286
|
if (explicit) noteFormatMismatch(filename, buffer);
|
|
45267
45287
|
ensureOutputDir(outPath);
|
|
45268
|
-
|
|
45288
|
+
writeFileSync17(outPath, buffer);
|
|
45269
45289
|
const savedPath = resolvePath2(outPath);
|
|
45270
45290
|
await pushGenerated(savedPath);
|
|
45271
45291
|
return savedPath;
|
|
@@ -45769,14 +45789,14 @@ Examples:
|
|
|
45769
45789
|
init_api();
|
|
45770
45790
|
init_config();
|
|
45771
45791
|
init_colors();
|
|
45772
|
-
import { existsSync as
|
|
45773
|
-
import { join as
|
|
45792
|
+
import { existsSync as existsSync19, readFileSync as readFileSync24 } from "fs";
|
|
45793
|
+
import { join as join24 } from "path";
|
|
45774
45794
|
function readInstalledKitReadme(name) {
|
|
45775
45795
|
const root = getProjectRoot() ?? process.cwd();
|
|
45776
|
-
const kitDir =
|
|
45777
|
-
if (!
|
|
45778
|
-
const readme =
|
|
45779
|
-
return
|
|
45796
|
+
const kitDir = join24(root, "src", "packages", name);
|
|
45797
|
+
if (!existsSync19(join24(kitDir, "package.json"))) return null;
|
|
45798
|
+
const readme = join24(kitDir, "README.md");
|
|
45799
|
+
return existsSync19(readme) ? readFileSync24(readme, "utf-8") : null;
|
|
45780
45800
|
}
|
|
45781
45801
|
function slugify2(title) {
|
|
45782
45802
|
return title.toLowerCase().replace(/[`*_]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -46071,7 +46091,7 @@ var domainCommand = new Command("domain").description("Manage custom domains").a
|
|
|
46071
46091
|
}));
|
|
46072
46092
|
|
|
46073
46093
|
// src/commands/realtime.ts
|
|
46074
|
-
import { existsSync as
|
|
46094
|
+
import { existsSync as existsSync20 } from "fs";
|
|
46075
46095
|
import { dirname as dirname14, resolve as resolve15 } from "path";
|
|
46076
46096
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "url";
|
|
46077
46097
|
init_api();
|
|
@@ -46080,7 +46100,7 @@ init_colors();
|
|
|
46080
46100
|
function hasDeployManifest() {
|
|
46081
46101
|
const cfgPath = getConfigPath();
|
|
46082
46102
|
if (!cfgPath) return false;
|
|
46083
|
-
return
|
|
46103
|
+
return existsSync20(resolve15(dirname14(cfgPath), "gipity.yaml"));
|
|
46084
46104
|
}
|
|
46085
46105
|
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
46106
|
const config = requireConfig2();
|
|
@@ -46171,7 +46191,7 @@ var roomCommand = new Command("room").description("Manage realtime rooms").argum
|
|
|
46171
46191
|
function benchModulePath() {
|
|
46172
46192
|
const here = dirname14(fileURLToPath3(import.meta.url));
|
|
46173
46193
|
for (const candidate of [resolve15(here, "realtime-bench.js"), resolve15(here, "..", "realtime-bench.js")]) {
|
|
46174
|
-
if (
|
|
46194
|
+
if (existsSync20(candidate)) return pathToFileURL(candidate).href;
|
|
46175
46195
|
}
|
|
46176
46196
|
throw new Error("realtime-bench.js is missing from this CLI build; reinstall the gipity CLI");
|
|
46177
46197
|
}
|
|
@@ -46560,27 +46580,27 @@ var locationCommand = new Command("location").description("Show location").argum
|
|
|
46560
46580
|
}));
|
|
46561
46581
|
|
|
46562
46582
|
// src/commands/doctor.ts
|
|
46563
|
-
import { existsSync as
|
|
46564
|
-
import { join as
|
|
46583
|
+
import { existsSync as existsSync22, readFileSync as readFileSync26, statSync as statSync9 } from "fs";
|
|
46584
|
+
import { join as join26, resolve as resolve17 } from "path";
|
|
46565
46585
|
import { homedir as homedir17 } from "os";
|
|
46566
46586
|
|
|
46567
46587
|
// src/updater/state.ts
|
|
46568
|
-
import { readFileSync as readFileSync25, writeFileSync as
|
|
46569
|
-
import { dirname as dirname15, join as
|
|
46588
|
+
import { readFileSync as readFileSync25, writeFileSync as writeFileSync18, mkdirSync as mkdirSync16, existsSync as existsSync21 } from "fs";
|
|
46589
|
+
import { dirname as dirname15, join as join25, resolve as resolve16 } from "path";
|
|
46570
46590
|
import { homedir as homedir16 } from "os";
|
|
46571
46591
|
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 =
|
|
46592
|
+
var GIPITY_DIR = join25(homedir16(), ".gipity");
|
|
46593
|
+
var LOCAL_DIR = join25(GIPITY_DIR, "local");
|
|
46594
|
+
var LOCAL_PKG_DIR = join25(LOCAL_DIR, "node_modules", "gipity");
|
|
46595
|
+
var LOCAL_ENTRY = join25(LOCAL_PKG_DIR, "dist", "index.js");
|
|
46596
|
+
var STATE_FILE = join25(GIPITY_DIR, "update-state.json");
|
|
46597
|
+
var SETTINGS_FILE = join25(GIPITY_DIR, "settings.json");
|
|
46598
|
+
var UPDATE_LOG = join25(GIPITY_DIR, "update.log");
|
|
46579
46599
|
function findPkgRoot() {
|
|
46580
46600
|
let dir = dirname15(fileURLToPath4(import.meta.url));
|
|
46581
46601
|
for (; ; ) {
|
|
46582
46602
|
try {
|
|
46583
|
-
if (JSON.parse(readFileSync25(
|
|
46603
|
+
if (JSON.parse(readFileSync25(join25(dir, "package.json"), "utf-8")).name === "gipity") return dir;
|
|
46584
46604
|
} catch {
|
|
46585
46605
|
}
|
|
46586
46606
|
const up2 = dirname15(dir);
|
|
@@ -46590,7 +46610,7 @@ function findPkgRoot() {
|
|
|
46590
46610
|
}
|
|
46591
46611
|
var PKG_ROOT = findPkgRoot();
|
|
46592
46612
|
function isDevLink() {
|
|
46593
|
-
return
|
|
46613
|
+
return existsSync21(join25(PKG_ROOT, "src"));
|
|
46594
46614
|
}
|
|
46595
46615
|
var DEFAULT_STATE = {
|
|
46596
46616
|
installedVersion: null,
|
|
@@ -46605,7 +46625,7 @@ function ensureDir() {
|
|
|
46605
46625
|
mkdirSync16(GIPITY_DIR, { recursive: true });
|
|
46606
46626
|
}
|
|
46607
46627
|
function readState() {
|
|
46608
|
-
if (!
|
|
46628
|
+
if (!existsSync21(STATE_FILE)) return { ...DEFAULT_STATE };
|
|
46609
46629
|
try {
|
|
46610
46630
|
return { ...DEFAULT_STATE, ...JSON.parse(readFileSync25(STATE_FILE, "utf-8")) };
|
|
46611
46631
|
} catch {
|
|
@@ -46614,10 +46634,10 @@ function readState() {
|
|
|
46614
46634
|
}
|
|
46615
46635
|
function writeState(state) {
|
|
46616
46636
|
ensureDir();
|
|
46617
|
-
|
|
46637
|
+
writeFileSync18(STATE_FILE, JSON.stringify(state, null, 2));
|
|
46618
46638
|
}
|
|
46619
46639
|
function readSettings() {
|
|
46620
|
-
if (!
|
|
46640
|
+
if (!existsSync21(SETTINGS_FILE)) return { ...DEFAULT_SETTINGS };
|
|
46621
46641
|
try {
|
|
46622
46642
|
return { ...DEFAULT_SETTINGS, ...JSON.parse(readFileSync25(SETTINGS_FILE, "utf-8")) };
|
|
46623
46643
|
} catch {
|
|
@@ -46653,8 +46673,8 @@ function versionManagerNode(execPath, env = process.env, home = homedir17()) {
|
|
|
46653
46673
|
return null;
|
|
46654
46674
|
}
|
|
46655
46675
|
function localVersion() {
|
|
46656
|
-
const pkgPath =
|
|
46657
|
-
if (!
|
|
46676
|
+
const pkgPath = join26(LOCAL_PKG_DIR, "package.json");
|
|
46677
|
+
if (!existsSync22(pkgPath)) return null;
|
|
46658
46678
|
try {
|
|
46659
46679
|
return JSON.parse(readFileSync26(pkgPath, "utf-8")).version ?? null;
|
|
46660
46680
|
} catch {
|
|
@@ -46679,7 +46699,7 @@ function rel(t) {
|
|
|
46679
46699
|
}
|
|
46680
46700
|
function relayAutostartInstalled() {
|
|
46681
46701
|
try {
|
|
46682
|
-
return
|
|
46702
|
+
return existsSync22(planFor({ cliPath: resolveCliPath() }).path);
|
|
46683
46703
|
} catch (err) {
|
|
46684
46704
|
if (err instanceof UnsupportedPlatformError) return null;
|
|
46685
46705
|
return null;
|
|
@@ -46722,7 +46742,7 @@ function gatherEnv(opts = {}) {
|
|
|
46722
46742
|
const cli = {
|
|
46723
46743
|
shim_version: shimVersion(),
|
|
46724
46744
|
local_version: localVersion(),
|
|
46725
|
-
local_install_ok:
|
|
46745
|
+
local_install_ok: existsSync22(LOCAL_ENTRY),
|
|
46726
46746
|
auto_updates: !dis.disabled,
|
|
46727
46747
|
updates_disabled_reason: dis.disabled ? dis.reason ?? null : null,
|
|
46728
46748
|
last_check_at: updState.lastCheckAt,
|
|
@@ -46754,7 +46774,7 @@ var doctorCommand = new Command("doctor").description("Check install + environme
|
|
|
46754
46774
|
if (env.claude.installed && !env.claude.authenticated) {
|
|
46755
46775
|
console.log(`${muted(" ")} ${warning("Claude Code is not logged in. Run `claude auth login` and sign in.")}`);
|
|
46756
46776
|
}
|
|
46757
|
-
if (
|
|
46777
|
+
if (existsSync22(resolve17(process.cwd(), ".codex", "hooks.json"))) {
|
|
46758
46778
|
console.log(`${muted("codex hooks ")} ${warning("written")} - session capture needs a one-time approval: run /hooks inside Codex in this project`);
|
|
46759
46779
|
}
|
|
46760
46780
|
const buildReady = env.node.ok && env.gipity.logged_in;
|
|
@@ -46763,7 +46783,7 @@ var doctorCommand = new Command("doctor").description("Check install + environme
|
|
|
46763
46783
|
const settings = readSettings();
|
|
46764
46784
|
const dis = updatesDisabled();
|
|
46765
46785
|
const local = localVersion();
|
|
46766
|
-
const localOk =
|
|
46786
|
+
const localOk = existsSync22(LOCAL_ENTRY);
|
|
46767
46787
|
console.log("");
|
|
46768
46788
|
console.log(bold("CLI install"));
|
|
46769
46789
|
console.log(`${muted("shim version ")} ${shimVersion()}`);
|
|
@@ -46771,11 +46791,11 @@ var doctorCommand = new Command("doctor").description("Check install + environme
|
|
|
46771
46791
|
console.log(`${muted("local install ")} ${LOCAL_PKG_DIR}`);
|
|
46772
46792
|
console.log("");
|
|
46773
46793
|
console.log(`${muted("auto-updates ")} ${dis.disabled ? warning(`disabled (${dis.reason})`) : success("enabled")}`);
|
|
46774
|
-
console.log(`${muted("settings file ")} ${
|
|
46794
|
+
console.log(`${muted("settings file ")} ${existsSync22(SETTINGS_FILE) ? SETTINGS_FILE : dim("(default)")} autoUpdates=${settings.autoUpdates}`);
|
|
46775
46795
|
console.log(`${muted("last check ")} ${rel(state.lastCheckAt)}`);
|
|
46776
46796
|
console.log(`${muted("last error ")} ${state.lastError ? error(state.lastError) : dim("none")}`);
|
|
46777
|
-
console.log(`${muted("state file ")} ${
|
|
46778
|
-
console.log(`${muted("update log ")} ${
|
|
46797
|
+
console.log(`${muted("state file ")} ${existsSync22(STATE_FILE) ? STATE_FILE : dim("(none yet)")}`);
|
|
46798
|
+
console.log(`${muted("update log ")} ${existsSync22(UPDATE_LOG) ? `${UPDATE_LOG} (${statSync9(UPDATE_LOG).size} bytes)` : dim("(none yet)")}`);
|
|
46779
46799
|
console.log("");
|
|
46780
46800
|
console.log(dim("Force an update with: gipity update"));
|
|
46781
46801
|
});
|
|
@@ -46784,10 +46804,10 @@ var doctorCommand = new Command("doctor").description("Check install + environme
|
|
|
46784
46804
|
import { appendFileSync } from "fs";
|
|
46785
46805
|
|
|
46786
46806
|
// src/updater/install.ts
|
|
46787
|
-
import { existsSync as
|
|
46788
|
-
import { dirname as dirname16, join as
|
|
46807
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync17, rmSync as rmSync2, statSync as statSync10, unlinkSync as unlinkSync6, writeFileSync as writeFileSync19 } from "fs";
|
|
46808
|
+
import { dirname as dirname16, join as join27 } from "path";
|
|
46789
46809
|
init_platform();
|
|
46790
|
-
var UPDATE_LOCK =
|
|
46810
|
+
var UPDATE_LOCK = join27(GIPITY_DIR, "update.lock");
|
|
46791
46811
|
var LOCK_STALE_MS2 = 10 * 60 * 1e3;
|
|
46792
46812
|
function npmInstallGipity(version) {
|
|
46793
46813
|
ensureLocalTree();
|
|
@@ -46797,7 +46817,7 @@ function npmInstallGipity(version) {
|
|
|
46797
46817
|
encoding: "utf-8"
|
|
46798
46818
|
});
|
|
46799
46819
|
return {
|
|
46800
|
-
ok: res.status === 0 &&
|
|
46820
|
+
ok: res.status === 0 && existsSync23(LOCAL_ENTRY),
|
|
46801
46821
|
status: res.status,
|
|
46802
46822
|
stderr: (res.stderr || "").toString(),
|
|
46803
46823
|
spawnError: res.error
|
|
@@ -46809,27 +46829,27 @@ function isWedged(stderr) {
|
|
|
46809
46829
|
}
|
|
46810
46830
|
function ensureLocalTree(dir = LOCAL_DIR) {
|
|
46811
46831
|
mkdirSync17(dir, { recursive: true });
|
|
46812
|
-
const pkgJson =
|
|
46813
|
-
if (!
|
|
46814
|
-
|
|
46832
|
+
const pkgJson = join27(dir, "package.json");
|
|
46833
|
+
if (!existsSync23(pkgJson)) {
|
|
46834
|
+
writeFileSync19(pkgJson, JSON.stringify({ name: "gipity-local", private: true, version: "0.0.0" }, null, 2));
|
|
46815
46835
|
}
|
|
46816
46836
|
}
|
|
46817
46837
|
function resetLocalTree(dir = LOCAL_DIR) {
|
|
46818
46838
|
mkdirSync17(dir, { recursive: true });
|
|
46819
|
-
rmSync2(
|
|
46820
|
-
rmSync2(
|
|
46821
|
-
|
|
46839
|
+
rmSync2(join27(dir, "node_modules"), { recursive: true, force: true });
|
|
46840
|
+
rmSync2(join27(dir, "package-lock.json"), { force: true });
|
|
46841
|
+
writeFileSync19(join27(dir, "package.json"), JSON.stringify({ name: "gipity-local", private: true, version: "0.0.0" }, null, 2));
|
|
46822
46842
|
}
|
|
46823
46843
|
function acquireUpdateLock(lockPath2 = UPDATE_LOCK) {
|
|
46824
46844
|
mkdirSync17(dirname16(lockPath2), { recursive: true });
|
|
46825
46845
|
try {
|
|
46826
|
-
|
|
46846
|
+
writeFileSync19(lockPath2, String(process.pid), { flag: "wx" });
|
|
46827
46847
|
return true;
|
|
46828
46848
|
} catch {
|
|
46829
46849
|
try {
|
|
46830
46850
|
if (Date.now() - statSync10(lockPath2).mtimeMs > LOCK_STALE_MS2) {
|
|
46831
46851
|
unlinkSync6(lockPath2);
|
|
46832
|
-
|
|
46852
|
+
writeFileSync19(lockPath2, String(process.pid), { flag: "wx" });
|
|
46833
46853
|
return true;
|
|
46834
46854
|
}
|
|
46835
46855
|
} catch {
|
|
@@ -46994,17 +47014,17 @@ var updateCommand = new Command("update").description("Update the CLI").option("
|
|
|
46994
47014
|
init_api();
|
|
46995
47015
|
init_utils();
|
|
46996
47016
|
init_colors();
|
|
46997
|
-
import { existsSync as
|
|
47017
|
+
import { existsSync as existsSync26, readFileSync as readFileSync29, unlinkSync as unlinkSync9 } from "fs";
|
|
46998
47018
|
import { spawn as spawn2 } from "child_process";
|
|
46999
47019
|
|
|
47000
47020
|
// src/relay/daemon.ts
|
|
47001
47021
|
init_platform();
|
|
47002
47022
|
init_config();
|
|
47003
|
-
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync19, existsSync as
|
|
47023
|
+
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
47024
|
import { stat, readFile } from "fs/promises";
|
|
47005
47025
|
import { createInterface as createInterface2 } from "readline";
|
|
47006
47026
|
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
|
|
47027
|
+
import { join as join30 } from "path";
|
|
47008
47028
|
init_setup();
|
|
47009
47029
|
init_auth();
|
|
47010
47030
|
init_api();
|
|
@@ -47764,7 +47784,7 @@ init_agents();
|
|
|
47764
47784
|
init_claude_setup();
|
|
47765
47785
|
import { cpus, freemem, totalmem, loadavg, release, uptime, homedir as homedir18 } from "os";
|
|
47766
47786
|
import { statfsSync, readdirSync as readdirSync9 } from "fs";
|
|
47767
|
-
import { join as
|
|
47787
|
+
import { join as join28 } from "path";
|
|
47768
47788
|
var PROBE_TIMEOUT_MS = 4e3;
|
|
47769
47789
|
function parseVersion(out) {
|
|
47770
47790
|
const m = out.match(/\d+\.\d+(?:\.\d+)?(?:[-.\w]*)?/);
|
|
@@ -47831,7 +47851,7 @@ async function detectGpu() {
|
|
|
47831
47851
|
function diskUsage() {
|
|
47832
47852
|
try {
|
|
47833
47853
|
if (typeof statfsSync !== "function") return void 0;
|
|
47834
|
-
const st2 = statfsSync(
|
|
47854
|
+
const st2 = statfsSync(join28(homedir18(), "GipityProjects"), { bigint: false });
|
|
47835
47855
|
if (!st2 || !st2.bsize) return void 0;
|
|
47836
47856
|
return { total: st2.bsize * st2.blocks, free: st2.bsize * st2.bavail };
|
|
47837
47857
|
} catch {
|
|
@@ -47845,7 +47865,7 @@ function diskUsage() {
|
|
|
47845
47865
|
}
|
|
47846
47866
|
function localProjectCount() {
|
|
47847
47867
|
try {
|
|
47848
|
-
return readdirSync9(
|
|
47868
|
+
return readdirSync9(join28(homedir18(), "GipityProjects"), { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith(".")).length;
|
|
47849
47869
|
} catch {
|
|
47850
47870
|
return void 0;
|
|
47851
47871
|
}
|
|
@@ -48302,7 +48322,7 @@ var SessionPool = class {
|
|
|
48302
48322
|
init_config();
|
|
48303
48323
|
init_api();
|
|
48304
48324
|
init_agents();
|
|
48305
|
-
var RELAY_LOG_PATH =
|
|
48325
|
+
var RELAY_LOG_PATH = join30(homedir19(), ".gipity", "relay.log");
|
|
48306
48326
|
var HEARTBEAT_INTERVAL_MS = parseInt(process.env.GIPITY_RELAY_HEARTBEAT_MS || "60000", 10);
|
|
48307
48327
|
var DIAGNOSTICS_INTERVAL_MS = parseInt(process.env.GIPITY_RELAY_DIAGNOSTICS_MS || String(24 * 60 * 60 * 1e3), 10);
|
|
48308
48328
|
var LONG_POLL_TIMEOUT_MS = parseInt(process.env.GIPITY_RELAY_POLL_TIMEOUT_MS || "35000", 10);
|
|
@@ -48410,7 +48430,7 @@ function lockLogPerms(dir, file) {
|
|
|
48410
48430
|
chmodSync4(dir, 448);
|
|
48411
48431
|
} catch {
|
|
48412
48432
|
}
|
|
48413
|
-
if (!
|
|
48433
|
+
if (!existsSync25(file)) {
|
|
48414
48434
|
try {
|
|
48415
48435
|
closeSync4(openSync4(file, "a", 384));
|
|
48416
48436
|
} catch {
|
|
@@ -48427,7 +48447,7 @@ function log2(level, msg, extra) {
|
|
|
48427
48447
|
const pretty = `${C7.dim(hhmmss())} ${badge(level)} ${C7.bold(msg)}${formatExtra(extra)}`;
|
|
48428
48448
|
process.stderr.write(pretty + "\n");
|
|
48429
48449
|
try {
|
|
48430
|
-
const dir =
|
|
48450
|
+
const dir = join30(homedir19(), ".gipity");
|
|
48431
48451
|
mkdirSync19(dir, { recursive: true });
|
|
48432
48452
|
lockLogPerms(dir, RELAY_LOG_PATH);
|
|
48433
48453
|
const json = JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), level, msg, ...extra ?? {} });
|
|
@@ -48859,7 +48879,7 @@ function isSafeSessionId(s) {
|
|
|
48859
48879
|
function transcriptPathFor(cwd, sessionId) {
|
|
48860
48880
|
if (!isSafeSessionId(sessionId)) return null;
|
|
48861
48881
|
const slug = cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
48862
|
-
return
|
|
48882
|
+
return join30(homedir19(), ".claude", "projects", slug, `${sessionId}.jsonl`);
|
|
48863
48883
|
}
|
|
48864
48884
|
function formatDuration(ms2) {
|
|
48865
48885
|
const totalSec = ms2 / 1e3;
|
|
@@ -49323,9 +49343,9 @@ async function resolveCwdForProject(d) {
|
|
|
49323
49343
|
throw new Error(`Invalid project slug: ${JSON.stringify(d.project_slug)}`);
|
|
49324
49344
|
}
|
|
49325
49345
|
const root = getProjectsRoot();
|
|
49326
|
-
const path5 =
|
|
49327
|
-
const configPath =
|
|
49328
|
-
if (
|
|
49346
|
+
const path5 = join30(root, d.project_slug);
|
|
49347
|
+
const configPath = join30(path5, ".gipity.json");
|
|
49348
|
+
if (existsSync25(configPath)) {
|
|
49329
49349
|
try {
|
|
49330
49350
|
const cfg = JSON.parse(readFileSync28(configPath, "utf-8"));
|
|
49331
49351
|
if (cfg.projectGuid === d.project_guid) return { cwd: path5, bootstrapped: false };
|
|
@@ -49341,7 +49361,7 @@ async function resolveCwdForProject(d) {
|
|
|
49341
49361
|
log2("info", "bootstrapping new project dir", { slug: d.project_slug, path: path5 });
|
|
49342
49362
|
mkdirSync19(path5, { recursive: true });
|
|
49343
49363
|
const apiBase2 = getApiBaseOverride() || DEFAULT_API_BASE;
|
|
49344
|
-
|
|
49364
|
+
writeFileSync20(configPath, JSON.stringify({
|
|
49345
49365
|
projectGuid: d.project_guid,
|
|
49346
49366
|
projectSlug: d.project_slug,
|
|
49347
49367
|
accountSlug: d.account_slug,
|
|
@@ -49461,7 +49481,7 @@ async function spawnSync2(cwd, timeoutMs, onSpawn) {
|
|
|
49461
49481
|
} catch {
|
|
49462
49482
|
}
|
|
49463
49483
|
try {
|
|
49464
|
-
unlinkSync8(
|
|
49484
|
+
unlinkSync8(join30(cwd, ".gipity", "sync.lock"));
|
|
49465
49485
|
} catch {
|
|
49466
49486
|
}
|
|
49467
49487
|
finish(() => reject(new Error(`timed out after ${Math.round(timeoutMs / 1e3)}s`)));
|
|
@@ -49906,7 +49926,7 @@ relayCommand.command("run").description("Run the background service").option("-v
|
|
|
49906
49926
|
});
|
|
49907
49927
|
relayCommand.command("stop").description("Stop the background service").option("--force", "Force-stop if it doesn't exit cleanly within 5s").action(async (opts) => {
|
|
49908
49928
|
const pidPath = getDaemonPidPath();
|
|
49909
|
-
if (!
|
|
49929
|
+
if (!existsSync26(pidPath)) {
|
|
49910
49930
|
console.log(muted("Background service isn't running."));
|
|
49911
49931
|
return;
|
|
49912
49932
|
}
|
|
@@ -50058,7 +50078,7 @@ relayCommand.command("revoke").description("Revoke and forget this device").acti
|
|
|
50058
50078
|
} catch {
|
|
50059
50079
|
}
|
|
50060
50080
|
const pidPath = getDaemonPidPath();
|
|
50061
|
-
if (
|
|
50081
|
+
if (existsSync26(pidPath)) {
|
|
50062
50082
|
const pid = parseInt(readFileSync29(pidPath, "utf-8").trim(), 10);
|
|
50063
50083
|
if (pid && !isNaN(pid)) {
|
|
50064
50084
|
try {
|
|
@@ -50072,7 +50092,7 @@ relayCommand.command("revoke").description("Revoke and forget this device").acti
|
|
|
50072
50092
|
});
|
|
50073
50093
|
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
50094
|
const path5 = RELAY_LOG_PATH;
|
|
50075
|
-
if (!
|
|
50095
|
+
if (!existsSync26(path5)) {
|
|
50076
50096
|
console.log(muted("No log file yet. Start the service with `gipity relay run` (or install it)."));
|
|
50077
50097
|
return;
|
|
50078
50098
|
}
|
|
@@ -50254,17 +50274,17 @@ init_api();
|
|
|
50254
50274
|
init_auth();
|
|
50255
50275
|
init_utils();
|
|
50256
50276
|
init_colors();
|
|
50257
|
-
import { existsSync as
|
|
50277
|
+
import { existsSync as existsSync27, rmSync as rmSync4, unlinkSync as unlinkSync10, readFileSync as readFileSync30, writeFileSync as writeFileSync21 } from "fs";
|
|
50258
50278
|
import { homedir as homedir20, platform as osPlatform4 } from "os";
|
|
50259
|
-
import { join as
|
|
50279
|
+
import { join as join31, resolve as resolve19 } from "path";
|
|
50260
50280
|
init_agents();
|
|
50261
50281
|
function removeInstallerPathLines() {
|
|
50262
50282
|
if (osPlatform4() === "win32") return [];
|
|
50263
50283
|
const marker = "# Added by the Gipity installer";
|
|
50264
50284
|
const touched = [];
|
|
50265
50285
|
for (const name of [".bashrc", ".zshrc", ".profile"]) {
|
|
50266
|
-
const rc2 =
|
|
50267
|
-
if (!
|
|
50286
|
+
const rc2 = join31(homedir20(), name);
|
|
50287
|
+
if (!existsSync27(rc2)) continue;
|
|
50268
50288
|
let text;
|
|
50269
50289
|
try {
|
|
50270
50290
|
text = readFileSync30(rc2, "utf-8");
|
|
@@ -50277,7 +50297,7 @@ function removeInstallerPathLines() {
|
|
|
50277
50297
|
);
|
|
50278
50298
|
if (kept.length === lines.length) continue;
|
|
50279
50299
|
try {
|
|
50280
|
-
|
|
50300
|
+
writeFileSync21(rc2, kept.join("\n"));
|
|
50281
50301
|
touched.push(rc2);
|
|
50282
50302
|
} catch {
|
|
50283
50303
|
}
|
|
@@ -50323,7 +50343,7 @@ function removeServiceUnit() {
|
|
|
50323
50343
|
const r = spawnSyncCommand(argv2[0], argv2.slice(1), { stdio: "ignore" });
|
|
50324
50344
|
if (r.status !== 0) allOk = false;
|
|
50325
50345
|
}
|
|
50326
|
-
if (
|
|
50346
|
+
if (existsSync27(plan2.path)) {
|
|
50327
50347
|
try {
|
|
50328
50348
|
unlinkSync10(plan2.path);
|
|
50329
50349
|
} catch {
|
|
@@ -50353,9 +50373,9 @@ var uninstallCommand = new Command("uninstall").description("Uninstall Gipity").
|
|
|
50353
50373
|
const say = (line) => {
|
|
50354
50374
|
if (!opts.json) console.log(line);
|
|
50355
50375
|
};
|
|
50356
|
-
const gipityDir =
|
|
50357
|
-
const launcherBin =
|
|
50358
|
-
const installedViaLauncher =
|
|
50376
|
+
const gipityDir = join31(homedir20(), ".gipity");
|
|
50377
|
+
const launcherBin = join31(gipityDir, "launcher", "bin", "gipity");
|
|
50378
|
+
const installedViaLauncher = existsSync27(launcherBin);
|
|
50359
50379
|
say(`${bold("Gipity uninstall")} - this will:`);
|
|
50360
50380
|
say(`\u2022 Stop the running relay daemon (if any)`);
|
|
50361
50381
|
say(`\u2022 Remove the OS autostart service (launchd / systemd / Task Scheduler)`);
|
|
@@ -50397,7 +50417,7 @@ var uninstallCommand = new Command("uninstall").description("Uninstall Gipity").
|
|
|
50397
50417
|
say(`${muted("No Gipity entries in any detected coding agent.")}`);
|
|
50398
50418
|
}
|
|
50399
50419
|
let gipityDirRemoved = false;
|
|
50400
|
-
if (
|
|
50420
|
+
if (existsSync27(gipityDir)) {
|
|
50401
50421
|
try {
|
|
50402
50422
|
rmSync4(gipityDir, { recursive: true, force: true });
|
|
50403
50423
|
gipityDirRemoved = true;
|
|
@@ -50975,7 +50995,7 @@ function resolveTarget(argv2, program3) {
|
|
|
50975
50995
|
|
|
50976
50996
|
// src/trace.ts
|
|
50977
50997
|
import { openSync as openSync5, writeSync, mkdirSync as mkdirSync20 } from "fs";
|
|
50978
|
-
import { join as
|
|
50998
|
+
import { join as join32 } from "path";
|
|
50979
50999
|
import { homedir as homedir21 } from "os";
|
|
50980
51000
|
var TRACE_KEY = /* @__PURE__ */ Symbol.for("gipity.traceOutput");
|
|
50981
51001
|
function installOutputTrace(label2) {
|
|
@@ -50987,10 +51007,10 @@ function installOutputTrace(label2) {
|
|
|
50987
51007
|
existing.emit({ event: "reenter", label: label2 });
|
|
50988
51008
|
return;
|
|
50989
51009
|
}
|
|
50990
|
-
const dir =
|
|
51010
|
+
const dir = join32(process.env.GIPITY_DIR || join32(homedir21(), ".gipity"), "trace");
|
|
50991
51011
|
mkdirSync20(dir, { recursive: true });
|
|
50992
51012
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", "_").replace(/:/g, "-");
|
|
50993
|
-
const fd2 = openSync5(
|
|
51013
|
+
const fd2 = openSync5(join32(dir, `${stamp}-pid${process.pid}.jsonl`), "a");
|
|
50994
51014
|
const emit = (rec) => {
|
|
50995
51015
|
try {
|
|
50996
51016
|
writeSync(fd2, JSON.stringify({ t: (/* @__PURE__ */ new Date()).toISOString(), ...rec }) + "\n");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.36",
|
|
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",
|