gipity 1.1.28 → 1.1.30
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/skill.js +23 -12
- package/dist/commands/update.js +8 -2
- package/dist/commands/workflow.js +16 -6
- package/dist/index.js +172 -130
- package/dist/updater/bootstrap.js +4 -9
- package/dist/updater/check.js +29 -3
- package/dist/updater/install.js +13 -0
- package/dist/updater/shim.js +45 -25
- package/dist/updater/state.js +27 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3979,10 +3979,10 @@ function prompt(question, output = process.stdout) {
|
|
|
3979
3979
|
return Promise.reject(new Error(`prompt() called without a TTY: ${question.trim()}`));
|
|
3980
3980
|
}
|
|
3981
3981
|
const rl2 = createInterface({ input: process.stdin, output });
|
|
3982
|
-
return new Promise((
|
|
3982
|
+
return new Promise((resolve21) => {
|
|
3983
3983
|
rl2.question(question, (answer) => {
|
|
3984
3984
|
rl2.close();
|
|
3985
|
-
|
|
3985
|
+
resolve21(answer.trim());
|
|
3986
3986
|
});
|
|
3987
3987
|
});
|
|
3988
3988
|
}
|
|
@@ -4013,7 +4013,7 @@ async function confirm(question, opts = {}) {
|
|
|
4013
4013
|
const wasRaw = stdin.isRaw ?? false;
|
|
4014
4014
|
stdin.setRawMode(true);
|
|
4015
4015
|
stdin.resume();
|
|
4016
|
-
return new Promise((
|
|
4016
|
+
return new Promise((resolve21) => {
|
|
4017
4017
|
stdin.once("data", (key) => {
|
|
4018
4018
|
stdin.setRawMode(wasRaw);
|
|
4019
4019
|
stdin.pause();
|
|
@@ -4028,12 +4028,12 @@ async function confirm(question, opts = {}) {
|
|
|
4028
4028
|
else if (k7 === "n") answer = false;
|
|
4029
4029
|
else answer = defaultYes;
|
|
4030
4030
|
console.log(answer ? "y" : "n");
|
|
4031
|
-
|
|
4031
|
+
resolve21(answer);
|
|
4032
4032
|
});
|
|
4033
4033
|
});
|
|
4034
4034
|
}
|
|
4035
4035
|
function pickOne(label2, max, defaultIdx = 1) {
|
|
4036
|
-
return new Promise((
|
|
4036
|
+
return new Promise((resolve21, reject) => {
|
|
4037
4037
|
process.stdout.write(` ${bold(label2)} (1-${max}) [${bold(String(defaultIdx))}]: `);
|
|
4038
4038
|
const { stdin } = process;
|
|
4039
4039
|
const wasRaw = stdin.isRaw ?? false;
|
|
@@ -4055,13 +4055,13 @@ function pickOne(label2, max, defaultIdx = 1) {
|
|
|
4055
4055
|
if (ch === "\r" || ch === "\n") {
|
|
4056
4056
|
cleanup();
|
|
4057
4057
|
console.log(String(defaultIdx));
|
|
4058
|
-
return
|
|
4058
|
+
return resolve21(defaultIdx);
|
|
4059
4059
|
}
|
|
4060
4060
|
const n = parseInt(ch, 10);
|
|
4061
4061
|
if (n >= 1 && n <= max) {
|
|
4062
4062
|
cleanup();
|
|
4063
4063
|
console.log(String(n));
|
|
4064
|
-
return
|
|
4064
|
+
return resolve21(n);
|
|
4065
4065
|
}
|
|
4066
4066
|
};
|
|
4067
4067
|
const onEnd = () => {
|
|
@@ -5420,8 +5420,8 @@ var require_streamx = __commonJS({
|
|
|
5420
5420
|
return this;
|
|
5421
5421
|
},
|
|
5422
5422
|
next() {
|
|
5423
|
-
return new Promise(function(
|
|
5424
|
-
promiseResolve =
|
|
5423
|
+
return new Promise(function(resolve21, reject) {
|
|
5424
|
+
promiseResolve = resolve21;
|
|
5425
5425
|
promiseReject = reject;
|
|
5426
5426
|
const data = stream.read();
|
|
5427
5427
|
if (data !== null) ondata(data);
|
|
@@ -5451,11 +5451,11 @@ var require_streamx = __commonJS({
|
|
|
5451
5451
|
}
|
|
5452
5452
|
function destroy(err) {
|
|
5453
5453
|
stream.destroy(err);
|
|
5454
|
-
return new Promise((
|
|
5455
|
-
if (stream._duplexState & DESTROYED) return
|
|
5454
|
+
return new Promise((resolve21, reject) => {
|
|
5455
|
+
if (stream._duplexState & DESTROYED) return resolve21({ value: void 0, done: true });
|
|
5456
5456
|
stream.once("close", function() {
|
|
5457
5457
|
if (err) reject(err);
|
|
5458
|
-
else
|
|
5458
|
+
else resolve21({ value: void 0, done: true });
|
|
5459
5459
|
});
|
|
5460
5460
|
});
|
|
5461
5461
|
}
|
|
@@ -5499,8 +5499,8 @@ var require_streamx = __commonJS({
|
|
|
5499
5499
|
const writes = pending + (ws2._duplexState & WRITE_WRITING ? 1 : 0);
|
|
5500
5500
|
if (writes === 0) return Promise.resolve(true);
|
|
5501
5501
|
if (state.drains === null) state.drains = [];
|
|
5502
|
-
return new Promise((
|
|
5503
|
-
state.drains.push({ writes, resolve:
|
|
5502
|
+
return new Promise((resolve21) => {
|
|
5503
|
+
state.drains.push({ writes, resolve: resolve21 });
|
|
5504
5504
|
});
|
|
5505
5505
|
}
|
|
5506
5506
|
write(data) {
|
|
@@ -5605,10 +5605,10 @@ var require_streamx = __commonJS({
|
|
|
5605
5605
|
cb2(null);
|
|
5606
5606
|
}
|
|
5607
5607
|
function pipelinePromise(...streams) {
|
|
5608
|
-
return new Promise((
|
|
5608
|
+
return new Promise((resolve21, reject) => {
|
|
5609
5609
|
return pipeline(...streams, (err) => {
|
|
5610
5610
|
if (err) return reject(err);
|
|
5611
|
-
|
|
5611
|
+
resolve21();
|
|
5612
5612
|
});
|
|
5613
5613
|
});
|
|
5614
5614
|
}
|
|
@@ -6263,16 +6263,16 @@ var require_extract = __commonJS({
|
|
|
6263
6263
|
entryCallback = null;
|
|
6264
6264
|
cb2(err);
|
|
6265
6265
|
}
|
|
6266
|
-
function onnext(
|
|
6266
|
+
function onnext(resolve21, reject) {
|
|
6267
6267
|
if (error2) {
|
|
6268
6268
|
return reject(error2);
|
|
6269
6269
|
}
|
|
6270
6270
|
if (entryStream) {
|
|
6271
|
-
|
|
6271
|
+
resolve21({ value: entryStream, done: false });
|
|
6272
6272
|
entryStream = null;
|
|
6273
6273
|
return;
|
|
6274
6274
|
}
|
|
6275
|
-
promiseResolve =
|
|
6275
|
+
promiseResolve = resolve21;
|
|
6276
6276
|
promiseReject = reject;
|
|
6277
6277
|
consumeCallback(null);
|
|
6278
6278
|
if (extract3._finished && promiseResolve) {
|
|
@@ -6300,11 +6300,11 @@ var require_extract = __commonJS({
|
|
|
6300
6300
|
function destroy(err) {
|
|
6301
6301
|
extract3.destroy(err);
|
|
6302
6302
|
consumeCallback(err);
|
|
6303
|
-
return new Promise((
|
|
6304
|
-
if (extract3.destroyed) return
|
|
6303
|
+
return new Promise((resolve21, reject) => {
|
|
6304
|
+
if (extract3.destroyed) return resolve21({ value: void 0, done: true });
|
|
6305
6305
|
extract3.once("close", function() {
|
|
6306
6306
|
if (err) reject(err);
|
|
6307
|
-
else
|
|
6307
|
+
else resolve21({ value: void 0, done: true });
|
|
6308
6308
|
});
|
|
6309
6309
|
});
|
|
6310
6310
|
}
|
|
@@ -6705,13 +6705,13 @@ function claudeAuthStatus() {
|
|
|
6705
6705
|
}
|
|
6706
6706
|
}
|
|
6707
6707
|
function claudeAuthStatusAsync() {
|
|
6708
|
-
return new Promise((
|
|
6708
|
+
return new Promise((resolve21) => {
|
|
6709
6709
|
let out = "";
|
|
6710
6710
|
let settled = false;
|
|
6711
6711
|
const done = (v7) => {
|
|
6712
6712
|
if (!settled) {
|
|
6713
6713
|
settled = true;
|
|
6714
|
-
|
|
6714
|
+
resolve21(v7);
|
|
6715
6715
|
}
|
|
6716
6716
|
};
|
|
6717
6717
|
let child;
|
|
@@ -9232,7 +9232,7 @@ async function postForTarEntries(path5, body, retried = false) {
|
|
|
9232
9232
|
}
|
|
9233
9233
|
const extract3 = tar.extract();
|
|
9234
9234
|
const entries = [];
|
|
9235
|
-
const done = new Promise((
|
|
9235
|
+
const done = new Promise((resolve21, reject) => {
|
|
9236
9236
|
extract3.on("entry", (header, stream, next) => {
|
|
9237
9237
|
const chunks = [];
|
|
9238
9238
|
stream.on("data", (c) => chunks.push(c));
|
|
@@ -9243,7 +9243,7 @@ async function postForTarEntries(path5, body, retried = false) {
|
|
|
9243
9243
|
stream.on("error", reject);
|
|
9244
9244
|
stream.resume();
|
|
9245
9245
|
});
|
|
9246
|
-
extract3.on("finish", () =>
|
|
9246
|
+
extract3.on("finish", () => resolve21());
|
|
9247
9247
|
extract3.on("error", reject);
|
|
9248
9248
|
});
|
|
9249
9249
|
return read(async () => {
|
|
@@ -34368,9 +34368,9 @@ var {
|
|
|
34368
34368
|
init_config();
|
|
34369
34369
|
init_setup();
|
|
34370
34370
|
init_utils();
|
|
34371
|
-
import { readFileSync as
|
|
34372
|
-
import { fileURLToPath as
|
|
34373
|
-
import { dirname as
|
|
34371
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
34372
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
34373
|
+
import { dirname as dirname17, resolve as resolve20 } from "path";
|
|
34374
34374
|
|
|
34375
34375
|
// src/helpers/output.ts
|
|
34376
34376
|
var frameOpen = false;
|
|
@@ -34798,25 +34798,25 @@ async function hashFile(path5) {
|
|
|
34798
34798
|
const hash = createHash("sha256");
|
|
34799
34799
|
let size = 0;
|
|
34800
34800
|
const stream = createReadStream(path5);
|
|
34801
|
-
await new Promise((
|
|
34801
|
+
await new Promise((resolve21, reject) => {
|
|
34802
34802
|
stream.on("data", (chunk) => {
|
|
34803
34803
|
const buf = chunk;
|
|
34804
34804
|
hash.update(buf);
|
|
34805
34805
|
size += buf.length;
|
|
34806
34806
|
});
|
|
34807
|
-
stream.on("end", () =>
|
|
34807
|
+
stream.on("end", () => resolve21());
|
|
34808
34808
|
stream.on("error", reject);
|
|
34809
34809
|
});
|
|
34810
34810
|
return { sha256: hash.digest("hex"), size };
|
|
34811
34811
|
}
|
|
34812
34812
|
function readRange(path5, start, end) {
|
|
34813
|
-
return new Promise((
|
|
34813
|
+
return new Promise((resolve21, reject) => {
|
|
34814
34814
|
const chunks = [];
|
|
34815
34815
|
const stream = createReadStream(path5, { start, end });
|
|
34816
34816
|
stream.on("data", (c) => {
|
|
34817
34817
|
chunks.push(c);
|
|
34818
34818
|
});
|
|
34819
|
-
stream.on("end", () =>
|
|
34819
|
+
stream.on("end", () => resolve21(Buffer.concat(chunks)));
|
|
34820
34820
|
stream.on("error", reject);
|
|
34821
34821
|
});
|
|
34822
34822
|
}
|
|
@@ -35207,7 +35207,7 @@ async function fetchRemote(projectGuid2) {
|
|
|
35207
35207
|
function extractTarToMap(stream, idleMs, onBytes, keep) {
|
|
35208
35208
|
const extract3 = tar2.extract();
|
|
35209
35209
|
const files = /* @__PURE__ */ new Map();
|
|
35210
|
-
return new Promise((
|
|
35210
|
+
return new Promise((resolve21, reject) => {
|
|
35211
35211
|
let settled = false;
|
|
35212
35212
|
let idle;
|
|
35213
35213
|
const arm = () => {
|
|
@@ -35243,7 +35243,7 @@ function extractTarToMap(stream, idleMs, onBytes, keep) {
|
|
|
35243
35243
|
});
|
|
35244
35244
|
entryStream.resume();
|
|
35245
35245
|
});
|
|
35246
|
-
extract3.on("finish", () => done(
|
|
35246
|
+
extract3.on("finish", () => done(resolve21, files));
|
|
35247
35247
|
extract3.on("error", (e) => done(reject, e));
|
|
35248
35248
|
stream.on("error", (e) => done(reject, e));
|
|
35249
35249
|
arm();
|
|
@@ -40473,8 +40473,8 @@ registerUsersCommand(projectCommand);
|
|
|
40473
40473
|
// src/commands/workflow.ts
|
|
40474
40474
|
init_api();
|
|
40475
40475
|
init_config();
|
|
40476
|
-
import { existsSync as existsSync15, mkdirSync as mkdirSync12, writeFileSync as writeFileSync13 } from "fs";
|
|
40477
|
-
import { join as join20 } from "path";
|
|
40476
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync12, readFileSync as readFileSync19, writeFileSync as writeFileSync13 } from "fs";
|
|
40477
|
+
import { isAbsolute, join as join20, resolve as resolve13 } from "path";
|
|
40478
40478
|
init_colors();
|
|
40479
40479
|
function mergedOpts(cmd) {
|
|
40480
40480
|
return cmd.optsWithGlobals();
|
|
@@ -40536,7 +40536,7 @@ function printStepRuns(steps, emptyNote) {
|
|
|
40536
40536
|
}
|
|
40537
40537
|
}
|
|
40538
40538
|
var TERMINAL_RUN_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
|
|
40539
|
-
var sleep2 = (ms2) => new Promise((
|
|
40539
|
+
var sleep2 = (ms2) => new Promise((resolve21) => setTimeout(resolve21, ms2));
|
|
40540
40540
|
async function waitForRun(wfGuid, prevGuid, timeoutSec) {
|
|
40541
40541
|
const deadline = Date.now() + timeoutSec * 1e3;
|
|
40542
40542
|
let runGuid;
|
|
@@ -40680,7 +40680,13 @@ steps:
|
|
|
40680
40680
|
then return { summary, needs_attention } where needs_attention is a list of short strings.
|
|
40681
40681
|
tools: [memory, db_query]
|
|
40682
40682
|
`;
|
|
40683
|
-
|
|
40683
|
+
function readWorkflowYaml(from) {
|
|
40684
|
+
const candidates = isAbsolute(from) ? [from] : [resolve13(from), ...getProjectRoot() ? [join20(getProjectRoot(), from)] : []];
|
|
40685
|
+
const found = candidates.find((p) => existsSync15(p));
|
|
40686
|
+
if (!found) throw new Error(`No workflow file at ${from}.`);
|
|
40687
|
+
return readFileSync19(found, "utf-8");
|
|
40688
|
+
}
|
|
40689
|
+
workflowCommand.command("create").description("Create a workflow from a YAML file in the project (e.g. workflows/foo.yaml)").option("--from <path>", "Workflow YAML file (any local path, e.g. workflows/foo.yaml)").option("--heartbeat", `Scaffold ${HEARTBEAT_PATH} (a daily check-in that keeps notes in project memory) and create it`).option("--name <name>", "Override the name in the YAML").option("--json", "Output as JSON").action((_opts, cmd) => run("Create", async () => {
|
|
40684
40690
|
const opts = mergedOpts(cmd);
|
|
40685
40691
|
const config = requireConfig2();
|
|
40686
40692
|
if (opts.from && opts.heartbeat) throw new Error("Pass --from <path> or --heartbeat, not both.");
|
|
@@ -40697,7 +40703,7 @@ workflowCommand.command("create").description("Create a workflow from a YAML fil
|
|
|
40697
40703
|
await pushFile(local);
|
|
40698
40704
|
}
|
|
40699
40705
|
const body = {
|
|
40700
|
-
|
|
40706
|
+
config_yaml: readWorkflowYaml(from),
|
|
40701
40707
|
project_guid: config.projectGuid
|
|
40702
40708
|
};
|
|
40703
40709
|
if (opts.name) body.name = opts.name;
|
|
@@ -40705,12 +40711,12 @@ workflowCommand.command("create").description("Create a workflow from a YAML fil
|
|
|
40705
40711
|
const guid = res.data.short_guid ?? res.data.guid;
|
|
40706
40712
|
printResult(`Workflow created from ${from} (${guid}).`, opts, { created: true, guid, from });
|
|
40707
40713
|
}));
|
|
40708
|
-
workflowCommand.command("edit <name>").alias("update").description("Update a workflow from a YAML file").requiredOption("--from <path>", "
|
|
40714
|
+
workflowCommand.command("edit <name>").alias("update").description("Update a workflow from a YAML file").requiredOption("--from <path>", "Workflow YAML file (any local path, e.g. workflows/foo.yaml)").option("--json", "Output as JSON").action((name, _opts, cmd) => run("Edit", async () => {
|
|
40709
40715
|
const opts = mergedOpts(cmd);
|
|
40710
40716
|
const config = requireConfig2();
|
|
40711
40717
|
const wf2 = await resolveWorkflow(name);
|
|
40712
40718
|
await put(`/workflows/${wf2.short_guid}`, {
|
|
40713
|
-
|
|
40719
|
+
config_yaml: readWorkflowYaml(opts.from),
|
|
40714
40720
|
project_guid: config.projectGuid
|
|
40715
40721
|
});
|
|
40716
40722
|
printResult(`Updated "${wf2.name}" from ${opts.from}.`, opts, { updated: wf2.name });
|
|
@@ -41261,8 +41267,8 @@ storageCommand.command("retention").description("View or adjust your file versio
|
|
|
41261
41267
|
init_platform();
|
|
41262
41268
|
init_auth();
|
|
41263
41269
|
init_api();
|
|
41264
|
-
import { join as join22, dirname as dirname12, resolve as
|
|
41265
|
-
import { existsSync as existsSync17, mkdirSync as mkdirSync14, readFileSync as
|
|
41270
|
+
import { join as join22, dirname as dirname12, resolve as resolve14, basename as basename6, sep as sep6 } from "path";
|
|
41271
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync14, readFileSync as readFileSync21, writeFileSync as writeFileSync15, renameSync as renameSync2, readdirSync as readdirSync8, statSync as statSync8 } from "fs";
|
|
41266
41272
|
import { homedir as homedir15 } from "os";
|
|
41267
41273
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
41268
41274
|
import { randomUUID } from "crypto";
|
|
@@ -41622,14 +41628,14 @@ init_claude_setup();
|
|
|
41622
41628
|
init_agents();
|
|
41623
41629
|
|
|
41624
41630
|
// src/prefs.ts
|
|
41625
|
-
import { existsSync as existsSync16, mkdirSync as mkdirSync13, readFileSync as
|
|
41631
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync13, readFileSync as readFileSync20, writeFileSync as writeFileSync14 } from "fs";
|
|
41626
41632
|
import { homedir as homedir14 } from "os";
|
|
41627
41633
|
import { join as join21 } from "path";
|
|
41628
41634
|
var PREFS_PATH = join21(homedir14(), ".gipity", "prefs.json");
|
|
41629
41635
|
function readPrefs() {
|
|
41630
41636
|
if (!existsSync16(PREFS_PATH)) return {};
|
|
41631
41637
|
try {
|
|
41632
|
-
const parsed = JSON.parse(
|
|
41638
|
+
const parsed = JSON.parse(readFileSync20(PREFS_PATH, "utf-8"));
|
|
41633
41639
|
return {
|
|
41634
41640
|
lastAgent: typeof parsed.lastAgent === "string" ? parsed.lastAgent : void 0
|
|
41635
41641
|
};
|
|
@@ -41655,7 +41661,7 @@ function readOwnPkg(fromDir) {
|
|
|
41655
41661
|
const p = join22(d, "package.json");
|
|
41656
41662
|
if (existsSync17(p)) {
|
|
41657
41663
|
try {
|
|
41658
|
-
const pkg2 = JSON.parse(
|
|
41664
|
+
const pkg2 = JSON.parse(readFileSync21(p, "utf-8"));
|
|
41659
41665
|
if (pkg2.name === "gipity") return pkg2;
|
|
41660
41666
|
} catch {
|
|
41661
41667
|
}
|
|
@@ -41752,7 +41758,7 @@ function hasStreamJsonFlag(args) {
|
|
|
41752
41758
|
function markFolderTrusted(dir) {
|
|
41753
41759
|
try {
|
|
41754
41760
|
const file = join22(homedir15(), ".claude.json");
|
|
41755
|
-
const cfg = existsSync17(file) ? JSON.parse(
|
|
41761
|
+
const cfg = existsSync17(file) ? JSON.parse(readFileSync21(file, "utf-8")) : {};
|
|
41756
41762
|
if (typeof cfg !== "object" || cfg === null) return;
|
|
41757
41763
|
if (typeof cfg.projects !== "object" || cfg.projects === null) cfg.projects = {};
|
|
41758
41764
|
const entry = typeof cfg.projects[dir] === "object" && cfg.projects[dir] !== null ? cfg.projects[dir] : {};
|
|
@@ -41871,7 +41877,7 @@ async function runLaunch(cmdName, cmdCfg, opts) {
|
|
|
41871
41877
|
let existing = getConfig();
|
|
41872
41878
|
let forceAdoptCwd = false;
|
|
41873
41879
|
if (existing && !opts.newProject && !opts.project && !nonInteractive) {
|
|
41874
|
-
const cwdHasConfig = existsSync17(
|
|
41880
|
+
const cwdHasConfig = existsSync17(resolve14(process.cwd(), ".gipity.json"));
|
|
41875
41881
|
if (!cwdHasConfig && isLikelyEmpty(process.cwd())) {
|
|
41876
41882
|
const ancestorRoot = dirname12(getConfigPath());
|
|
41877
41883
|
console.log(` ${bold("You are inside an existing Gipity project.")}
|
|
@@ -44669,9 +44675,9 @@ jobCommand.command("cancel <runGuid>").description("Cancel a queued or running j
|
|
|
44669
44675
|
}));
|
|
44670
44676
|
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) => {
|
|
44671
44677
|
const { existsSync: existsSync27, statSync: statSync12 } = await import("node:fs");
|
|
44672
|
-
const { resolve:
|
|
44678
|
+
const { resolve: resolve21, join: join32 } = await import("node:path");
|
|
44673
44679
|
const { spawnCommand: spawnCommand2, spawnSyncCommand: spawnSyncCommand2 } = await Promise.resolve().then(() => (init_platform(), platform_exports));
|
|
44674
|
-
const jobDir =
|
|
44680
|
+
const jobDir = resolve21(process.cwd(), "jobs", name);
|
|
44675
44681
|
if (!existsSync27(jobDir) || !statSync12(jobDir).isDirectory()) {
|
|
44676
44682
|
console.error(error(`jobs/${name}/ not found in current directory`));
|
|
44677
44683
|
process.exit(1);
|
|
@@ -44891,8 +44897,8 @@ emailCommand.command("log").description("Recent email() sends and skipped attemp
|
|
|
44891
44897
|
init_api();
|
|
44892
44898
|
init_config();
|
|
44893
44899
|
init_colors();
|
|
44894
|
-
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync16, readFileSync as
|
|
44895
|
-
import { resolve as resolvePath2, dirname as dirname13, relative as relative5, isAbsolute, basename as basename7 } from "path";
|
|
44900
|
+
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync16, readFileSync as readFileSync22 } from "fs";
|
|
44901
|
+
import { resolve as resolvePath2, dirname as dirname13, relative as relative5, isAbsolute as isAbsolute2, basename as basename7 } from "path";
|
|
44896
44902
|
|
|
44897
44903
|
// src/commands/generate-async.ts
|
|
44898
44904
|
init_api();
|
|
@@ -45007,10 +45013,10 @@ async function waitForGenerations(projectGuid2, initial, opts = {}) {
|
|
|
45007
45013
|
return gens;
|
|
45008
45014
|
}
|
|
45009
45015
|
function sleepUnlessInterrupted(ms2, stop) {
|
|
45010
|
-
return new Promise((
|
|
45016
|
+
return new Promise((resolve21) => {
|
|
45011
45017
|
const started = Date.now();
|
|
45012
45018
|
const tick = () => {
|
|
45013
|
-
if (stop() || Date.now() - started >= ms2) return
|
|
45019
|
+
if (stop() || Date.now() - started >= ms2) return resolve21();
|
|
45014
45020
|
setTimeout(tick, Math.min(100, ms2));
|
|
45015
45021
|
};
|
|
45016
45022
|
tick();
|
|
@@ -45253,7 +45259,7 @@ async function pushGenerated(savedPath) {
|
|
|
45253
45259
|
const configPath = getConfigPath();
|
|
45254
45260
|
if (!configPath) return;
|
|
45255
45261
|
const rel2 = relative5(dirname13(configPath), savedPath);
|
|
45256
|
-
if (rel2.startsWith("..") ||
|
|
45262
|
+
if (rel2.startsWith("..") || isAbsolute2(rel2)) return;
|
|
45257
45263
|
try {
|
|
45258
45264
|
await pushFile(savedPath);
|
|
45259
45265
|
} catch (err) {
|
|
@@ -45264,7 +45270,7 @@ function readInputImages(paths) {
|
|
|
45264
45270
|
return paths.map((p) => {
|
|
45265
45271
|
let buf;
|
|
45266
45272
|
try {
|
|
45267
|
-
buf =
|
|
45273
|
+
buf = readFileSync22(p);
|
|
45268
45274
|
} catch (e) {
|
|
45269
45275
|
throw new Error(`can't read --input image ${p} (${e.code || e.message}).`);
|
|
45270
45276
|
}
|
|
@@ -45539,7 +45545,7 @@ Examples:
|
|
|
45539
45545
|
console.error(error("Pass --lyrics or --lyrics-file, not both."));
|
|
45540
45546
|
process.exit(1);
|
|
45541
45547
|
}
|
|
45542
|
-
const lyrics = opts.lyricsFile ?
|
|
45548
|
+
const lyrics = opts.lyricsFile ? readFileSync22(opts.lyricsFile, "utf8").trim() : opts.lyrics;
|
|
45543
45549
|
const doGenerate = () => post(`/projects/${config.projectGuid}/generate/music`, {
|
|
45544
45550
|
prompt: prompt2,
|
|
45545
45551
|
duration_seconds: opts.duration,
|
|
@@ -45610,7 +45616,7 @@ var generateCommand = addGenerationSubcommands(new Command("generate").descripti
|
|
|
45610
45616
|
// src/commands/ask.ts
|
|
45611
45617
|
init_api();
|
|
45612
45618
|
init_config();
|
|
45613
|
-
import { readFileSync as
|
|
45619
|
+
import { readFileSync as readFileSync23, fstatSync } from "fs";
|
|
45614
45620
|
init_colors();
|
|
45615
45621
|
var IMAGE_TYPES = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/gif", "image/webp"]);
|
|
45616
45622
|
var MAX_WARM_WAIT_S = 90;
|
|
@@ -45635,7 +45641,7 @@ function stdinIsPiped() {
|
|
|
45635
45641
|
}
|
|
45636
45642
|
function readTextFile(path5) {
|
|
45637
45643
|
try {
|
|
45638
|
-
return
|
|
45644
|
+
return readFileSync23(path5 === "-" ? 0 : path5, "utf8");
|
|
45639
45645
|
} catch (e) {
|
|
45640
45646
|
throw new Error(`can't read --file ${path5} (${e.code || e.message}).`);
|
|
45641
45647
|
}
|
|
@@ -45645,7 +45651,7 @@ function readImage(path5) {
|
|
|
45645
45651
|
if (!IMAGE_TYPES.has(mime)) throw new Error(`--image ${path5} is ${mime}; use a png, jpg, gif or webp.`);
|
|
45646
45652
|
let buf;
|
|
45647
45653
|
try {
|
|
45648
|
-
buf =
|
|
45654
|
+
buf = readFileSync23(path5);
|
|
45649
45655
|
} catch (e) {
|
|
45650
45656
|
throw new Error(`can't read --image ${path5} (${e.code || e.message}).`);
|
|
45651
45657
|
}
|
|
@@ -45702,14 +45708,14 @@ Examples:
|
|
|
45702
45708
|
init_api();
|
|
45703
45709
|
init_config();
|
|
45704
45710
|
init_colors();
|
|
45705
|
-
import { existsSync as existsSync18, readFileSync as
|
|
45711
|
+
import { existsSync as existsSync18, readFileSync as readFileSync24 } from "fs";
|
|
45706
45712
|
import { join as join23 } from "path";
|
|
45707
45713
|
function readInstalledKitReadme(name) {
|
|
45708
45714
|
const root = getProjectRoot() ?? process.cwd();
|
|
45709
45715
|
const kitDir = join23(root, "src", "packages", name);
|
|
45710
45716
|
if (!existsSync18(join23(kitDir, "package.json"))) return null;
|
|
45711
45717
|
const readme = join23(kitDir, "README.md");
|
|
45712
|
-
return existsSync18(readme) ?
|
|
45718
|
+
return existsSync18(readme) ? readFileSync24(readme, "utf-8") : null;
|
|
45713
45719
|
}
|
|
45714
45720
|
function slugify2(title) {
|
|
45715
45721
|
return title.toLowerCase().replace(/[`*_]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -45773,17 +45779,23 @@ function filterContent(content, sections, opts) {
|
|
|
45773
45779
|
if (opts.toc) return { text: tocText(sections) };
|
|
45774
45780
|
let hits = [];
|
|
45775
45781
|
let note;
|
|
45776
|
-
if (opts.section) {
|
|
45777
|
-
const
|
|
45778
|
-
|
|
45779
|
-
|
|
45780
|
-
|
|
45781
|
-
|
|
45782
|
-
if (
|
|
45783
|
-
|
|
45784
|
-
|
|
45782
|
+
if (opts.section?.length) {
|
|
45783
|
+
const notes = [];
|
|
45784
|
+
for (const asked of opts.section) {
|
|
45785
|
+
const want = slugify2(asked);
|
|
45786
|
+
let found = sections.filter((s) => s.slug === want);
|
|
45787
|
+
if (found.length === 0) found = sections.filter((s) => s.slug.includes(want));
|
|
45788
|
+
if (found.length === 0) {
|
|
45789
|
+
const closest = closestSection(sections, want);
|
|
45790
|
+
if (closest) {
|
|
45791
|
+
found = [closest];
|
|
45792
|
+
notes.push(`No section "${asked}"; showing the closest match "${closest.slug}" (all slugs: --toc).`);
|
|
45793
|
+
}
|
|
45785
45794
|
}
|
|
45795
|
+
if (found.length === 0) notes.push(`No section "${asked}" (all slugs: --toc).`);
|
|
45796
|
+
for (const f of found) if (!hits.includes(f)) hits.push(f);
|
|
45786
45797
|
}
|
|
45798
|
+
if (notes.length) note = notes.join(" ");
|
|
45787
45799
|
} else if (opts.grep) {
|
|
45788
45800
|
let re2;
|
|
45789
45801
|
try {
|
|
@@ -45818,7 +45830,7 @@ skillCommand.command("list").description("List skills").option("--json", "Output
|
|
|
45818
45830
|
"Read with `gipity skill read <name> [<name>...]` (one turn, many docs; `--toc`, `--section <slug>` or `--grep <term>` for one part):"
|
|
45819
45831
|
);
|
|
45820
45832
|
}));
|
|
45821
|
-
skillCommand.command("read <names...>").description("Read one or more skills (whole doc, or one part with --toc/--section/--grep)").option("--toc", "Print the doc outline (section slugs + line numbers) instead of the content").option("--section <slug>", "Print only this section (slug or heading text; subsections included). A guess that clearly matches one section by its words prints that section").option("--grep <term>", "Print only the sections matching this term (case-insensitive regex)").option("--json", "Output as JSON").action((names, opts) => run("Read", async () => {
|
|
45833
|
+
skillCommand.command("read <names...>").description("Read one or more skills (whole doc, or one part with --toc/--section/--grep)").option("--toc", "Print the doc outline (section slugs + line numbers) instead of the content").option("--section <slug>", "Print only this section (slug or heading text; subsections included). Repeat for several. A guess that clearly matches one section by its words prints that section", (v7, prev = []) => [...prev, v7]).option("--grep <term>", "Print only the sections matching this term (case-insensitive regex)").option("--json", "Output as JSON").action((names, opts) => run("Read", async () => {
|
|
45822
45834
|
const listRes = await get("/skills");
|
|
45823
45835
|
const jsonDocs = [];
|
|
45824
45836
|
let failed = false;
|
|
@@ -45847,7 +45859,7 @@ skillCommand.command("read <names...>").description("Read one or more skills (wh
|
|
|
45847
45859
|
const sections = parseSections(lines);
|
|
45848
45860
|
const filtered = filterContent(content, sections, opts);
|
|
45849
45861
|
if (filtered === null) {
|
|
45850
|
-
const what = opts.section ? `section
|
|
45862
|
+
const what = opts.section?.length ? `section ${opts.section.map((x) => `"${x}"`).join(" / ")}` : `match for "${opts.grep}"`;
|
|
45851
45863
|
console.error(error(`No ${what} in "${name}". Sections: ${sections.map((s) => s.slug).join(", ") || "(none)"}`));
|
|
45852
45864
|
failed = true;
|
|
45853
45865
|
continue;
|
|
@@ -45999,7 +46011,7 @@ var domainCommand = new Command("domain").description("Manage custom domains").a
|
|
|
45999
46011
|
|
|
46000
46012
|
// src/commands/realtime.ts
|
|
46001
46013
|
import { existsSync as existsSync19 } from "fs";
|
|
46002
|
-
import { dirname as dirname14, resolve as
|
|
46014
|
+
import { dirname as dirname14, resolve as resolve15 } from "path";
|
|
46003
46015
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "url";
|
|
46004
46016
|
init_api();
|
|
46005
46017
|
init_config();
|
|
@@ -46007,7 +46019,7 @@ init_colors();
|
|
|
46007
46019
|
function hasDeployManifest() {
|
|
46008
46020
|
const cfgPath = getConfigPath();
|
|
46009
46021
|
if (!cfgPath) return false;
|
|
46010
|
-
return existsSync19(
|
|
46022
|
+
return existsSync19(resolve15(dirname14(cfgPath), "gipity.yaml"));
|
|
46011
46023
|
}
|
|
46012
46024
|
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 () => {
|
|
46013
46025
|
const config = requireConfig2();
|
|
@@ -46097,7 +46109,7 @@ var roomCommand = new Command("room").description("Manage realtime rooms").argum
|
|
|
46097
46109
|
}));
|
|
46098
46110
|
function benchModulePath() {
|
|
46099
46111
|
const here = dirname14(fileURLToPath3(import.meta.url));
|
|
46100
|
-
for (const candidate of [
|
|
46112
|
+
for (const candidate of [resolve15(here, "realtime-bench.js"), resolve15(here, "..", "realtime-bench.js")]) {
|
|
46101
46113
|
if (existsSync19(candidate)) return pathToFileURL(candidate).href;
|
|
46102
46114
|
}
|
|
46103
46115
|
throw new Error("realtime-bench.js is missing from this CLI build; reinstall the gipity CLI");
|
|
@@ -46259,7 +46271,7 @@ async function pollTestStatus(projectGuid2, runGuid, opts) {
|
|
|
46259
46271
|
}
|
|
46260
46272
|
}
|
|
46261
46273
|
}
|
|
46262
|
-
await new Promise((
|
|
46274
|
+
await new Promise((resolve21) => setTimeout(resolve21, getPollInterval()));
|
|
46263
46275
|
}
|
|
46264
46276
|
}
|
|
46265
46277
|
var testCommand = new Command("test").description("Run tests").argument("[path]", 'Test path filter (e.g. "api", "e2e/portal")').option("--filter <path>", "Alias for the positional test path filter").option("--timeout <ms>", "Per-test timeout in ms", "30000").option("--retry <n>", "Retry failed tests N times", "0").option("--no-sync", "Skip sync-up before tests").option("--json", "Output as JSON").action((pathFilter, opts) => run("Test", async () => {
|
|
@@ -46487,14 +46499,15 @@ var locationCommand = new Command("location").description("Show location").argum
|
|
|
46487
46499
|
}));
|
|
46488
46500
|
|
|
46489
46501
|
// src/commands/doctor.ts
|
|
46490
|
-
import { existsSync as existsSync21, readFileSync as
|
|
46491
|
-
import { join as join25, resolve as
|
|
46502
|
+
import { existsSync as existsSync21, readFileSync as readFileSync26, statSync as statSync9 } from "fs";
|
|
46503
|
+
import { join as join25, resolve as resolve17 } from "path";
|
|
46492
46504
|
import { homedir as homedir17 } from "os";
|
|
46493
46505
|
|
|
46494
46506
|
// src/updater/state.ts
|
|
46495
|
-
import { readFileSync as
|
|
46496
|
-
import { join as join24 } from "path";
|
|
46507
|
+
import { readFileSync as readFileSync25, writeFileSync as writeFileSync17, mkdirSync as mkdirSync16, existsSync as existsSync20 } from "fs";
|
|
46508
|
+
import { dirname as dirname15, join as join24, resolve as resolve16 } from "path";
|
|
46497
46509
|
import { homedir as homedir16 } from "os";
|
|
46510
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
46498
46511
|
var GIPITY_DIR = join24(homedir16(), ".gipity");
|
|
46499
46512
|
var LOCAL_DIR = join24(GIPITY_DIR, "local");
|
|
46500
46513
|
var LOCAL_PKG_DIR = join24(LOCAL_DIR, "node_modules", "gipity");
|
|
@@ -46502,6 +46515,22 @@ var LOCAL_ENTRY = join24(LOCAL_PKG_DIR, "dist", "index.js");
|
|
|
46502
46515
|
var STATE_FILE = join24(GIPITY_DIR, "update-state.json");
|
|
46503
46516
|
var SETTINGS_FILE = join24(GIPITY_DIR, "settings.json");
|
|
46504
46517
|
var UPDATE_LOG = join24(GIPITY_DIR, "update.log");
|
|
46518
|
+
function findPkgRoot() {
|
|
46519
|
+
let dir = dirname15(fileURLToPath4(import.meta.url));
|
|
46520
|
+
for (; ; ) {
|
|
46521
|
+
try {
|
|
46522
|
+
if (JSON.parse(readFileSync25(join24(dir, "package.json"), "utf-8")).name === "gipity") return dir;
|
|
46523
|
+
} catch {
|
|
46524
|
+
}
|
|
46525
|
+
const up2 = dirname15(dir);
|
|
46526
|
+
if (up2 === dir) return resolve16(dirname15(fileURLToPath4(import.meta.url)), "..", "..");
|
|
46527
|
+
dir = up2;
|
|
46528
|
+
}
|
|
46529
|
+
}
|
|
46530
|
+
var PKG_ROOT = findPkgRoot();
|
|
46531
|
+
function isDevLink() {
|
|
46532
|
+
return existsSync20(join24(PKG_ROOT, "src"));
|
|
46533
|
+
}
|
|
46505
46534
|
var DEFAULT_STATE = {
|
|
46506
46535
|
installedVersion: null,
|
|
46507
46536
|
lastCheckAt: 0,
|
|
@@ -46517,7 +46546,7 @@ function ensureDir() {
|
|
|
46517
46546
|
function readState() {
|
|
46518
46547
|
if (!existsSync20(STATE_FILE)) return { ...DEFAULT_STATE };
|
|
46519
46548
|
try {
|
|
46520
|
-
return { ...DEFAULT_STATE, ...JSON.parse(
|
|
46549
|
+
return { ...DEFAULT_STATE, ...JSON.parse(readFileSync25(STATE_FILE, "utf-8")) };
|
|
46521
46550
|
} catch {
|
|
46522
46551
|
return { ...DEFAULT_STATE };
|
|
46523
46552
|
}
|
|
@@ -46529,7 +46558,7 @@ function writeState(state) {
|
|
|
46529
46558
|
function readSettings() {
|
|
46530
46559
|
if (!existsSync20(SETTINGS_FILE)) return { ...DEFAULT_SETTINGS };
|
|
46531
46560
|
try {
|
|
46532
|
-
return { ...DEFAULT_SETTINGS, ...JSON.parse(
|
|
46561
|
+
return { ...DEFAULT_SETTINGS, ...JSON.parse(readFileSync25(SETTINGS_FILE, "utf-8")) };
|
|
46533
46562
|
} catch {
|
|
46534
46563
|
return { ...DEFAULT_SETTINGS };
|
|
46535
46564
|
}
|
|
@@ -46566,7 +46595,7 @@ function localVersion() {
|
|
|
46566
46595
|
const pkgPath = join25(LOCAL_PKG_DIR, "package.json");
|
|
46567
46596
|
if (!existsSync21(pkgPath)) return null;
|
|
46568
46597
|
try {
|
|
46569
|
-
return JSON.parse(
|
|
46598
|
+
return JSON.parse(readFileSync26(pkgPath, "utf-8")).version ?? null;
|
|
46570
46599
|
} catch {
|
|
46571
46600
|
return null;
|
|
46572
46601
|
}
|
|
@@ -46574,7 +46603,7 @@ function localVersion() {
|
|
|
46574
46603
|
function shimVersion() {
|
|
46575
46604
|
try {
|
|
46576
46605
|
const url = new URL("../../package.json", import.meta.url);
|
|
46577
|
-
return JSON.parse(
|
|
46606
|
+
return JSON.parse(readFileSync26(url, "utf-8")).version;
|
|
46578
46607
|
} catch {
|
|
46579
46608
|
return "unknown";
|
|
46580
46609
|
}
|
|
@@ -46664,7 +46693,7 @@ var doctorCommand = new Command("doctor").description("Check install + environme
|
|
|
46664
46693
|
if (env.claude.installed && !env.claude.authenticated) {
|
|
46665
46694
|
console.log(`${muted(" ")} ${warning("Claude Code is not logged in. Run `claude auth login` and sign in.")}`);
|
|
46666
46695
|
}
|
|
46667
|
-
if (existsSync21(
|
|
46696
|
+
if (existsSync21(resolve17(process.cwd(), ".codex", "hooks.json"))) {
|
|
46668
46697
|
console.log(`${muted("codex hooks ")} ${warning("written")} - session capture needs a one-time approval: run /hooks inside Codex in this project`);
|
|
46669
46698
|
}
|
|
46670
46699
|
const buildReady = env.node.ok && env.gipity.logged_in;
|
|
@@ -46695,11 +46724,12 @@ import { appendFileSync } from "fs";
|
|
|
46695
46724
|
|
|
46696
46725
|
// src/updater/install.ts
|
|
46697
46726
|
import { existsSync as existsSync22, mkdirSync as mkdirSync17, rmSync as rmSync2, statSync as statSync10, unlinkSync as unlinkSync6, writeFileSync as writeFileSync18 } from "fs";
|
|
46698
|
-
import { dirname as
|
|
46727
|
+
import { dirname as dirname16, join as join26 } from "path";
|
|
46699
46728
|
init_platform();
|
|
46700
46729
|
var UPDATE_LOCK = join26(GIPITY_DIR, "update.lock");
|
|
46701
46730
|
var LOCK_STALE_MS2 = 10 * 60 * 1e3;
|
|
46702
46731
|
function npmInstallGipity(version) {
|
|
46732
|
+
ensureLocalTree();
|
|
46703
46733
|
const res = spawnSyncCommand(resolveCommand("npm"), ["install", "--no-audit", "--no-fund", "--ignore-scripts", `gipity@${version}`], {
|
|
46704
46734
|
cwd: LOCAL_DIR,
|
|
46705
46735
|
stdio: ["ignore", "ignore", "pipe"],
|
|
@@ -46716,6 +46746,13 @@ var WEDGE_CODES = /\b(ENOTEMPTY|EEXIST|ENOTDIR|EISDIR|EJSONPARSE)\b/;
|
|
|
46716
46746
|
function isWedged(stderr) {
|
|
46717
46747
|
return WEDGE_CODES.test(stderr);
|
|
46718
46748
|
}
|
|
46749
|
+
function ensureLocalTree(dir = LOCAL_DIR) {
|
|
46750
|
+
mkdirSync17(dir, { recursive: true });
|
|
46751
|
+
const pkgJson = join26(dir, "package.json");
|
|
46752
|
+
if (!existsSync22(pkgJson)) {
|
|
46753
|
+
writeFileSync18(pkgJson, JSON.stringify({ name: "gipity-local", private: true, version: "0.0.0" }, null, 2));
|
|
46754
|
+
}
|
|
46755
|
+
}
|
|
46719
46756
|
function resetLocalTree(dir = LOCAL_DIR) {
|
|
46720
46757
|
mkdirSync17(dir, { recursive: true });
|
|
46721
46758
|
rmSync2(join26(dir, "node_modules"), { recursive: true, force: true });
|
|
@@ -46723,7 +46760,7 @@ function resetLocalTree(dir = LOCAL_DIR) {
|
|
|
46723
46760
|
writeFileSync18(join26(dir, "package.json"), JSON.stringify({ name: "gipity-local", private: true, version: "0.0.0" }, null, 2));
|
|
46724
46761
|
}
|
|
46725
46762
|
function acquireUpdateLock(lockPath2 = UPDATE_LOCK) {
|
|
46726
|
-
mkdirSync17(
|
|
46763
|
+
mkdirSync17(dirname16(lockPath2), { recursive: true });
|
|
46727
46764
|
try {
|
|
46728
46765
|
writeFileSync18(lockPath2, String(process.pid), { flag: "wx" });
|
|
46729
46766
|
return true;
|
|
@@ -46795,6 +46832,7 @@ ${res.stderr.trim().slice(-2e3)}`);
|
|
|
46795
46832
|
return { ok: false, detail: firstLine.length > 160 ? firstLine.slice(0, 157) + "..." : firstLine };
|
|
46796
46833
|
}
|
|
46797
46834
|
async function runCheck(opts = {}) {
|
|
46835
|
+
if (isDevLink()) return { updated: false, reason: "dev-link" };
|
|
46798
46836
|
const state = readState();
|
|
46799
46837
|
if (!opts.force) {
|
|
46800
46838
|
const dis = updatesDisabled();
|
|
@@ -46867,15 +46905,19 @@ var updateCommand = new Command("update").description("Update the CLI").option("
|
|
|
46867
46905
|
upToDate: result.reason === "up-to-date",
|
|
46868
46906
|
from: result.from ?? null,
|
|
46869
46907
|
to: result.to ?? null,
|
|
46870
|
-
|
|
46908
|
+
devLink: result.reason === "dev-link",
|
|
46909
|
+
reason: result.updated || result.reason === "up-to-date" || result.reason === "dev-link" ? null : result.reason ?? null
|
|
46871
46910
|
}));
|
|
46872
|
-
if (!result.updated && result.reason !== "up-to-date") process.exitCode = 1;
|
|
46911
|
+
if (!result.updated && result.reason !== "up-to-date" && result.reason !== "dev-link") process.exitCode = 1;
|
|
46873
46912
|
return;
|
|
46874
46913
|
}
|
|
46875
46914
|
console.log("");
|
|
46876
46915
|
if (result.updated) {
|
|
46877
46916
|
console.log(success(`Updated ${result.from} \u2192 ${result.to}`));
|
|
46878
46917
|
console.log(dim(`Installed. This command ran on ${result.from}; everything from here on uses ${result.to}.`));
|
|
46918
|
+
} else if (result.reason === "dev-link") {
|
|
46919
|
+
console.log(info(`This gipity is linked to a source checkout (${PKG_ROOT}) and runs its build, so it never auto-updates.`));
|
|
46920
|
+
console.log(dim("To update it, pull that checkout and run `just cli-link` there."));
|
|
46879
46921
|
} else if (result.reason === "up-to-date") {
|
|
46880
46922
|
console.log(success("Already on the latest version."));
|
|
46881
46923
|
} else {
|
|
@@ -46891,13 +46933,13 @@ var updateCommand = new Command("update").description("Update the CLI").option("
|
|
|
46891
46933
|
init_api();
|
|
46892
46934
|
init_utils();
|
|
46893
46935
|
init_colors();
|
|
46894
|
-
import { existsSync as existsSync25, readFileSync as
|
|
46936
|
+
import { existsSync as existsSync25, readFileSync as readFileSync29, unlinkSync as unlinkSync9 } from "fs";
|
|
46895
46937
|
import { spawn as spawn2 } from "child_process";
|
|
46896
46938
|
|
|
46897
46939
|
// src/relay/daemon.ts
|
|
46898
46940
|
init_platform();
|
|
46899
46941
|
init_config();
|
|
46900
|
-
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync19, existsSync as existsSync24, readFileSync as
|
|
46942
|
+
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync19, existsSync as existsSync24, readFileSync as readFileSync28, writeFileSync as writeFileSync19, chmodSync as chmodSync4, closeSync as closeSync4, openSync as openSync4, unlinkSync as unlinkSync8 } from "fs";
|
|
46901
46943
|
import { stat, readFile } from "fs/promises";
|
|
46902
46944
|
import { createInterface as createInterface2 } from "readline";
|
|
46903
46945
|
import { homedir as homedir19, hostname as hostname6, platform as osPlatform3, loadavg as loadavg2, freemem as freemem2, totalmem as totalmem2, cpus as cpus2 } from "os";
|
|
@@ -47668,13 +47710,13 @@ function parseVersion(out) {
|
|
|
47668
47710
|
return m ? m[0] : void 0;
|
|
47669
47711
|
}
|
|
47670
47712
|
function runProbe(cmd, args) {
|
|
47671
|
-
return new Promise((
|
|
47713
|
+
return new Promise((resolve21) => {
|
|
47672
47714
|
let out = "";
|
|
47673
47715
|
let settled = false;
|
|
47674
47716
|
const done = (s) => {
|
|
47675
47717
|
if (!settled) {
|
|
47676
47718
|
settled = true;
|
|
47677
|
-
|
|
47719
|
+
resolve21(s);
|
|
47678
47720
|
}
|
|
47679
47721
|
};
|
|
47680
47722
|
let child;
|
|
@@ -47813,13 +47855,13 @@ function agentUpdateInProgress() {
|
|
|
47813
47855
|
return inProgress;
|
|
47814
47856
|
}
|
|
47815
47857
|
function execCapture(argv2, timeoutMs, signal) {
|
|
47816
|
-
return new Promise((
|
|
47858
|
+
return new Promise((resolve21) => {
|
|
47817
47859
|
let output = "";
|
|
47818
47860
|
let settled = false;
|
|
47819
47861
|
const done = (ok) => {
|
|
47820
47862
|
if (!settled) {
|
|
47821
47863
|
settled = true;
|
|
47822
|
-
|
|
47864
|
+
resolve21({ ok, output });
|
|
47823
47865
|
}
|
|
47824
47866
|
};
|
|
47825
47867
|
let child;
|
|
@@ -48020,8 +48062,8 @@ var SessionPool = class {
|
|
|
48020
48062
|
const done = new Promise((r) => {
|
|
48021
48063
|
markDone = r;
|
|
48022
48064
|
});
|
|
48023
|
-
return new Promise((
|
|
48024
|
-
const turn = { onMessage: p.onMessage, resolve:
|
|
48065
|
+
return new Promise((resolve21, reject) => {
|
|
48066
|
+
const turn = { onMessage: p.onMessage, resolve: resolve21, reject, interruptRequested: false, wasHot, done, markDone };
|
|
48025
48067
|
session.current = turn;
|
|
48026
48068
|
session.state = "running";
|
|
48027
48069
|
session.lastActivityAt = Date.now();
|
|
@@ -48476,10 +48518,10 @@ async function heartbeatLoop(ctx) {
|
|
|
48476
48518
|
}
|
|
48477
48519
|
await Promise.race([
|
|
48478
48520
|
sleep4(HEARTBEAT_INTERVAL_MS, ctx.abort.signal),
|
|
48479
|
-
new Promise((
|
|
48521
|
+
new Promise((resolve21) => {
|
|
48480
48522
|
heartbeatPoke = () => {
|
|
48481
48523
|
heartbeatPoke = null;
|
|
48482
|
-
|
|
48524
|
+
resolve21();
|
|
48483
48525
|
};
|
|
48484
48526
|
})
|
|
48485
48527
|
]);
|
|
@@ -48523,9 +48565,9 @@ async function dispatchLoop(ctx, opts) {
|
|
|
48523
48565
|
while (inflight.size >= MAX_CONCURRENT_DISPATCHES && !ctx.abort.signal.aborted) {
|
|
48524
48566
|
await Promise.race([
|
|
48525
48567
|
...inflight,
|
|
48526
|
-
new Promise((
|
|
48527
|
-
if (ctx.abort.signal.aborted) return
|
|
48528
|
-
ctx.abort.signal.addEventListener("abort", () =>
|
|
48568
|
+
new Promise((resolve21) => {
|
|
48569
|
+
if (ctx.abort.signal.aborted) return resolve21();
|
|
48570
|
+
ctx.abort.signal.addEventListener("abort", () => resolve21(), { once: true });
|
|
48529
48571
|
})
|
|
48530
48572
|
]);
|
|
48531
48573
|
}
|
|
@@ -49224,7 +49266,7 @@ async function resolveCwdForProject(d) {
|
|
|
49224
49266
|
const configPath = join29(path5, ".gipity.json");
|
|
49225
49267
|
if (existsSync24(configPath)) {
|
|
49226
49268
|
try {
|
|
49227
|
-
const cfg = JSON.parse(
|
|
49269
|
+
const cfg = JSON.parse(readFileSync28(configPath, "utf-8"));
|
|
49228
49270
|
if (cfg.projectGuid === d.project_guid) return { cwd: path5, bootstrapped: false };
|
|
49229
49271
|
log2("warn", "project dir exists but guid mismatch - using it anyway", {
|
|
49230
49272
|
path: path5,
|
|
@@ -49314,7 +49356,7 @@ async function killRunningForConv(convGuid) {
|
|
|
49314
49356
|
}
|
|
49315
49357
|
}
|
|
49316
49358
|
const graceTimers = [];
|
|
49317
|
-
const escalate = new Promise((
|
|
49359
|
+
const escalate = new Promise((resolve21) => {
|
|
49318
49360
|
const t = setTimeout(() => {
|
|
49319
49361
|
for (const e of matches) {
|
|
49320
49362
|
log2("warn", "previous dispatch ignored SIGTERM - escalating to SIGKILL", { conv: convGuid });
|
|
@@ -49323,7 +49365,7 @@ async function killRunningForConv(convGuid) {
|
|
|
49323
49365
|
} catch {
|
|
49324
49366
|
}
|
|
49325
49367
|
}
|
|
49326
|
-
|
|
49368
|
+
resolve21();
|
|
49327
49369
|
}, KILL_GRACE_MS);
|
|
49328
49370
|
graceTimers.push(t);
|
|
49329
49371
|
});
|
|
@@ -49334,7 +49376,7 @@ async function killRunningForConv(convGuid) {
|
|
|
49334
49376
|
}
|
|
49335
49377
|
async function spawnSync2(cwd, timeoutMs, onSpawn) {
|
|
49336
49378
|
const cmd = process.env.GIPITY_RELAY_CLAUDE_CMD || resolveCommand("gipity");
|
|
49337
|
-
return new Promise((
|
|
49379
|
+
return new Promise((resolve21, reject) => {
|
|
49338
49380
|
const child = spawnCommand(cmd, ["sync", "--json"], {
|
|
49339
49381
|
cwd,
|
|
49340
49382
|
env: childEnv(),
|
|
@@ -49374,7 +49416,7 @@ async function spawnSync2(cwd, timeoutMs, onSpawn) {
|
|
|
49374
49416
|
child.on("exit", (code) => finish(() => {
|
|
49375
49417
|
if (code === 0) {
|
|
49376
49418
|
log2("info", "sync done", { cwd, stdoutLen });
|
|
49377
|
-
|
|
49419
|
+
resolve21();
|
|
49378
49420
|
} else {
|
|
49379
49421
|
reject(new Error(`gipity sync exited ${code}${stderrBuf ? `: ${stderrBuf.trim().slice(0, 300)}` : ""}`));
|
|
49380
49422
|
}
|
|
@@ -49386,7 +49428,7 @@ async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
49386
49428
|
const cmd = process.env.GIPITY_RELAY_CLAUDE_CMD || resolveCommand("gipity");
|
|
49387
49429
|
const fullArgs = streamJson ? [...args, "--output-format", "stream-json", "--verbose", "--include-partial-messages"] : [...args];
|
|
49388
49430
|
const env = streamJson ? childEnv({ GIPITY_CONVERSATION_GUID: d.conversation_guid, GIPITY_CAPTURE: "off" }) : childEnv({ GIPITY_CONVERSATION_GUID: d.conversation_guid });
|
|
49389
|
-
return new Promise((
|
|
49431
|
+
return new Promise((resolve21, reject) => {
|
|
49390
49432
|
const child = spawnCommand(cmd, fullArgs, { cwd, env, stdio: ["ignore", "pipe", "pipe"] });
|
|
49391
49433
|
let resolveExited = () => {
|
|
49392
49434
|
};
|
|
@@ -49573,7 +49615,7 @@ async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
49573
49615
|
void postProgress(d.conversation_guid, buildProgressPayload(false));
|
|
49574
49616
|
if (ownQueue) await q.close();
|
|
49575
49617
|
cleanup();
|
|
49576
|
-
|
|
49618
|
+
resolve21({
|
|
49577
49619
|
exitCode: code ?? 1,
|
|
49578
49620
|
killed,
|
|
49579
49621
|
runtimeLimit,
|
|
@@ -49588,10 +49630,10 @@ async function runDispatchSync(d, cwd) {
|
|
|
49588
49630
|
let killed = false;
|
|
49589
49631
|
try {
|
|
49590
49632
|
await spawnSync2(cwd, PROJECT_SYNC_TIMEOUT_MS, (child) => {
|
|
49591
|
-
const exited = new Promise((
|
|
49633
|
+
const exited = new Promise((resolve21) => {
|
|
49592
49634
|
child.once("exit", (_code, signal) => {
|
|
49593
49635
|
if (signal === "SIGTERM") killed = true;
|
|
49594
|
-
|
|
49636
|
+
resolve21();
|
|
49595
49637
|
});
|
|
49596
49638
|
});
|
|
49597
49639
|
running.set(d.short_guid, { child, convGuid: d.conversation_guid, exited });
|
|
@@ -49622,18 +49664,18 @@ function killDispatch(shortGuid) {
|
|
|
49622
49664
|
return false;
|
|
49623
49665
|
}
|
|
49624
49666
|
function sleep4(ms2, signal) {
|
|
49625
|
-
return new Promise((
|
|
49626
|
-
if (signal?.aborted) return
|
|
49667
|
+
return new Promise((resolve21) => {
|
|
49668
|
+
if (signal?.aborted) return resolve21();
|
|
49627
49669
|
let onAbort = null;
|
|
49628
49670
|
const t = setTimeout(() => {
|
|
49629
49671
|
if (onAbort && signal) signal.removeEventListener("abort", onAbort);
|
|
49630
|
-
|
|
49672
|
+
resolve21();
|
|
49631
49673
|
}, ms2);
|
|
49632
49674
|
if (signal) {
|
|
49633
49675
|
onAbort = () => {
|
|
49634
49676
|
clearTimeout(t);
|
|
49635
49677
|
signal.removeEventListener("abort", onAbort);
|
|
49636
|
-
|
|
49678
|
+
resolve21();
|
|
49637
49679
|
};
|
|
49638
49680
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
49639
49681
|
}
|
|
@@ -49807,7 +49849,7 @@ relayCommand.command("stop").description("Stop the background service").option("
|
|
|
49807
49849
|
console.log(muted("Background service isn't running."));
|
|
49808
49850
|
return;
|
|
49809
49851
|
}
|
|
49810
|
-
const pid = parseInt(
|
|
49852
|
+
const pid = parseInt(readFileSync29(pidPath, "utf-8").trim(), 10);
|
|
49811
49853
|
if (!pid || isNaN(pid)) {
|
|
49812
49854
|
console.error(error("PID file is empty or malformed."));
|
|
49813
49855
|
process.exit(1);
|
|
@@ -49956,7 +49998,7 @@ relayCommand.command("revoke").description("Revoke and forget this device").acti
|
|
|
49956
49998
|
}
|
|
49957
49999
|
const pidPath = getDaemonPidPath();
|
|
49958
50000
|
if (existsSync25(pidPath)) {
|
|
49959
|
-
const pid = parseInt(
|
|
50001
|
+
const pid = parseInt(readFileSync29(pidPath, "utf-8").trim(), 10);
|
|
49960
50002
|
if (pid && !isNaN(pid)) {
|
|
49961
50003
|
try {
|
|
49962
50004
|
process.kill(pid, "SIGTERM");
|
|
@@ -49975,7 +50017,7 @@ relayCommand.command("log").description("Tail the service log").option("-n, --li
|
|
|
49975
50017
|
}
|
|
49976
50018
|
const lines = parseInt(opts.lines, 10) || 100;
|
|
49977
50019
|
try {
|
|
49978
|
-
const all =
|
|
50020
|
+
const all = readFileSync29(path5, "utf-8").split("\n");
|
|
49979
50021
|
const tail2 = all.slice(-lines - 1).join("\n");
|
|
49980
50022
|
process.stdout.write(tail2);
|
|
49981
50023
|
} catch (err) {
|
|
@@ -50151,9 +50193,9 @@ init_api();
|
|
|
50151
50193
|
init_auth();
|
|
50152
50194
|
init_utils();
|
|
50153
50195
|
init_colors();
|
|
50154
|
-
import { existsSync as existsSync26, rmSync as rmSync4, unlinkSync as unlinkSync10, readFileSync as
|
|
50196
|
+
import { existsSync as existsSync26, rmSync as rmSync4, unlinkSync as unlinkSync10, readFileSync as readFileSync30, writeFileSync as writeFileSync20 } from "fs";
|
|
50155
50197
|
import { homedir as homedir20, platform as osPlatform4 } from "os";
|
|
50156
|
-
import { join as join30, resolve as
|
|
50198
|
+
import { join as join30, resolve as resolve19 } from "path";
|
|
50157
50199
|
init_agents();
|
|
50158
50200
|
function removeInstallerPathLines() {
|
|
50159
50201
|
if (osPlatform4() === "win32") return [];
|
|
@@ -50164,7 +50206,7 @@ function removeInstallerPathLines() {
|
|
|
50164
50206
|
if (!existsSync26(rc2)) continue;
|
|
50165
50207
|
let text;
|
|
50166
50208
|
try {
|
|
50167
|
-
text =
|
|
50209
|
+
text = readFileSync30(rc2, "utf-8");
|
|
50168
50210
|
} catch {
|
|
50169
50211
|
continue;
|
|
50170
50212
|
}
|
|
@@ -50186,7 +50228,7 @@ function tildify2(p) {
|
|
|
50186
50228
|
return p === home || p.startsWith(home + "/") ? "~" + p.slice(home.length) : p;
|
|
50187
50229
|
}
|
|
50188
50230
|
function resolveCliPath2() {
|
|
50189
|
-
return
|
|
50231
|
+
return resolve19(process.argv[1] ?? "gipity");
|
|
50190
50232
|
}
|
|
50191
50233
|
async function stopDaemon() {
|
|
50192
50234
|
if (!isDaemonRunning()) return;
|
|
@@ -50470,7 +50512,7 @@ gmailCommand.command("reply").description("Reply to a Gmail thread. Get thread-i
|
|
|
50470
50512
|
}));
|
|
50471
50513
|
|
|
50472
50514
|
// src/commands/text.ts
|
|
50473
|
-
import { readFileSync as
|
|
50515
|
+
import { readFileSync as readFileSync31 } from "fs";
|
|
50474
50516
|
init_colors();
|
|
50475
50517
|
|
|
50476
50518
|
// src/helpers/text-analysis.ts
|
|
@@ -50625,10 +50667,10 @@ function areAnagrams(a, b7) {
|
|
|
50625
50667
|
|
|
50626
50668
|
// src/commands/text.ts
|
|
50627
50669
|
function resolveInput(args, opts) {
|
|
50628
|
-
if (opts.file) return
|
|
50670
|
+
if (opts.file) return readFileSync31(opts.file, "utf-8");
|
|
50629
50671
|
if (args.length) return args.join(" ");
|
|
50630
50672
|
try {
|
|
50631
|
-
return
|
|
50673
|
+
return readFileSync31(0, "utf-8");
|
|
50632
50674
|
} catch {
|
|
50633
50675
|
return "";
|
|
50634
50676
|
}
|
|
@@ -50922,13 +50964,13 @@ function installOutputTrace(label2) {
|
|
|
50922
50964
|
|
|
50923
50965
|
// src/index.ts
|
|
50924
50966
|
installOutputTrace("index");
|
|
50925
|
-
var __dirname =
|
|
50967
|
+
var __dirname = dirname17(fileURLToPath5(import.meta.url));
|
|
50926
50968
|
installNetworking();
|
|
50927
|
-
var pkg = JSON.parse(
|
|
50969
|
+
var pkg = JSON.parse(readFileSync32(resolve20(__dirname, "../package.json"), "utf-8"));
|
|
50928
50970
|
function versionLabel() {
|
|
50929
50971
|
const base = `v${pkg.version}`;
|
|
50930
50972
|
try {
|
|
50931
|
-
const info2 = JSON.parse(
|
|
50973
|
+
const info2 = JSON.parse(readFileSync32(resolve20(__dirname, "build-info.json"), "utf-8"));
|
|
50932
50974
|
if (info2?.sha) return `${base} (dev ${info2.sha}${info2.dirty ? ", modified" : ""})`;
|
|
50933
50975
|
} catch {
|
|
50934
50976
|
}
|