gipity 1.1.28 → 1.1.29
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/workflow.js +16 -6
- package/dist/index.js +135 -123
- package/package.json +1 -1
package/dist/commands/skill.js
CHANGED
|
@@ -107,18 +107,29 @@ function filterContent(content, sections, opts) {
|
|
|
107
107
|
return { text: tocText(sections) };
|
|
108
108
|
let hits = [];
|
|
109
109
|
let note;
|
|
110
|
-
if (opts.section) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
110
|
+
if (opts.section?.length) {
|
|
111
|
+
// Repeatable: each --section adds its section(s), in the order asked for.
|
|
112
|
+
const notes = [];
|
|
113
|
+
for (const asked of opts.section) {
|
|
114
|
+
const want = slugify(asked);
|
|
115
|
+
let found = sections.filter(s => s.slug === want);
|
|
116
|
+
if (found.length === 0)
|
|
117
|
+
found = sections.filter(s => s.slug.includes(want));
|
|
118
|
+
if (found.length === 0) {
|
|
119
|
+
const closest = closestSection(sections, want);
|
|
120
|
+
if (closest) {
|
|
121
|
+
found = [closest];
|
|
122
|
+
notes.push(`No section "${asked}"; showing the closest match "${closest.slug}" (all slugs: --toc).`);
|
|
123
|
+
}
|
|
120
124
|
}
|
|
125
|
+
if (found.length === 0)
|
|
126
|
+
notes.push(`No section "${asked}" (all slugs: --toc).`);
|
|
127
|
+
for (const f of found)
|
|
128
|
+
if (!hits.includes(f))
|
|
129
|
+
hits.push(f);
|
|
121
130
|
}
|
|
131
|
+
if (notes.length)
|
|
132
|
+
note = notes.join(' ');
|
|
122
133
|
}
|
|
123
134
|
else if (opts.grep) {
|
|
124
135
|
let re;
|
|
@@ -165,7 +176,7 @@ skillCommand
|
|
|
165
176
|
.command('read <names...>')
|
|
166
177
|
.description('Read one or more skills (whole doc, or one part with --toc/--section/--grep)')
|
|
167
178
|
.option('--toc', 'Print the doc outline (section slugs + line numbers) instead of the content')
|
|
168
|
-
.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')
|
|
179
|
+
.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', (v, prev = []) => [...prev, v])
|
|
169
180
|
.option('--grep <term>', 'Print only the sections matching this term (case-insensitive regex)')
|
|
170
181
|
.option('--json', 'Output as JSON')
|
|
171
182
|
.action((names, opts) => run('Read', async () => {
|
|
@@ -200,7 +211,7 @@ skillCommand
|
|
|
200
211
|
const sections = parseSections(lines);
|
|
201
212
|
const filtered = filterContent(content, sections, opts);
|
|
202
213
|
if (filtered === null) {
|
|
203
|
-
const what = opts.section ? `section
|
|
214
|
+
const what = opts.section?.length ? `section ${opts.section.map(x => `"${x}"`).join(' / ')}` : `match for "${opts.grep}"`;
|
|
204
215
|
console.error(clrError(`No ${what} in "${name}". Sections: ${sections.map(s => s.slug).join(', ') || '(none)'}`));
|
|
205
216
|
failed = true;
|
|
206
217
|
continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
-
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
3
|
+
import { isAbsolute, join, resolve } from 'path';
|
|
4
4
|
import { get, post, put, del } from '../api.js';
|
|
5
5
|
import { getConfig, requireConfig, getProjectRoot } from '../config.js';
|
|
6
6
|
import { pushFile } from '../sync.js';
|
|
@@ -312,10 +312,20 @@ steps:
|
|
|
312
312
|
then return { summary, needs_attention } where needs_attention is a list of short strings.
|
|
313
313
|
tools: [memory, db_query]
|
|
314
314
|
`;
|
|
315
|
+
/** Read a workflow YAML from disk: an absolute path, a path from the cwd, or
|
|
316
|
+
* a project-relative one. The text is sent to the server, so the file need not
|
|
317
|
+
* be synced (a probe in tmp/ works). */
|
|
318
|
+
function readWorkflowYaml(from) {
|
|
319
|
+
const candidates = isAbsolute(from) ? [from] : [resolve(from), ...(getProjectRoot() ? [join(getProjectRoot(), from)] : [])];
|
|
320
|
+
const found = candidates.find((p) => existsSync(p));
|
|
321
|
+
if (!found)
|
|
322
|
+
throw new Error(`No workflow file at ${from}.`);
|
|
323
|
+
return readFileSync(found, 'utf-8');
|
|
324
|
+
}
|
|
315
325
|
workflowCommand
|
|
316
326
|
.command('create')
|
|
317
327
|
.description('Create a workflow from a YAML file in the project (e.g. workflows/foo.yaml)')
|
|
318
|
-
.option('--from <path>', '
|
|
328
|
+
.option('--from <path>', 'Workflow YAML file (any local path, e.g. workflows/foo.yaml)')
|
|
319
329
|
.option('--heartbeat', `Scaffold ${HEARTBEAT_PATH} (a daily check-in that keeps notes in project memory) and create it`)
|
|
320
330
|
.option('--name <name>', 'Override the name in the YAML')
|
|
321
331
|
.option('--json', 'Output as JSON')
|
|
@@ -339,7 +349,7 @@ workflowCommand
|
|
|
339
349
|
await pushFile(local);
|
|
340
350
|
}
|
|
341
351
|
const body = {
|
|
342
|
-
|
|
352
|
+
config_yaml: readWorkflowYaml(from),
|
|
343
353
|
project_guid: config.projectGuid,
|
|
344
354
|
};
|
|
345
355
|
if (opts.name)
|
|
@@ -352,14 +362,14 @@ workflowCommand
|
|
|
352
362
|
.command('edit <name>')
|
|
353
363
|
.alias('update')
|
|
354
364
|
.description('Update a workflow from a YAML file')
|
|
355
|
-
.requiredOption('--from <path>', '
|
|
365
|
+
.requiredOption('--from <path>', 'Workflow YAML file (any local path, e.g. workflows/foo.yaml)')
|
|
356
366
|
.option('--json', 'Output as JSON')
|
|
357
367
|
.action((name, _opts, cmd) => run('Edit', async () => {
|
|
358
368
|
const opts = mergedOpts(cmd);
|
|
359
369
|
const config = requireConfig();
|
|
360
370
|
const wf = await resolveWorkflow(name);
|
|
361
371
|
await put(`/workflows/${wf.short_guid}`, {
|
|
362
|
-
|
|
372
|
+
config_yaml: readWorkflowYaml(opts.from),
|
|
363
373
|
project_guid: config.projectGuid,
|
|
364
374
|
});
|
|
365
375
|
printResult(`Updated "${wf.name}" from ${opts.from}.`, opts, { updated: wf.name });
|
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((resolve20) => {
|
|
3983
3983
|
rl2.question(question, (answer) => {
|
|
3984
3984
|
rl2.close();
|
|
3985
|
-
|
|
3985
|
+
resolve20(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((resolve20) => {
|
|
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
|
+
resolve20(answer);
|
|
4032
4032
|
});
|
|
4033
4033
|
});
|
|
4034
4034
|
}
|
|
4035
4035
|
function pickOne(label2, max, defaultIdx = 1) {
|
|
4036
|
-
return new Promise((
|
|
4036
|
+
return new Promise((resolve20, 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 resolve20(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 resolve20(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(resolve20, reject) {
|
|
5424
|
+
promiseResolve = resolve20;
|
|
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((resolve20, reject) => {
|
|
5455
|
+
if (stream._duplexState & DESTROYED) return resolve20({ value: void 0, done: true });
|
|
5456
5456
|
stream.once("close", function() {
|
|
5457
5457
|
if (err) reject(err);
|
|
5458
|
-
else
|
|
5458
|
+
else resolve20({ 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((resolve20) => {
|
|
5503
|
+
state.drains.push({ writes, resolve: resolve20 });
|
|
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((resolve20, reject) => {
|
|
5609
5609
|
return pipeline(...streams, (err) => {
|
|
5610
5610
|
if (err) return reject(err);
|
|
5611
|
-
|
|
5611
|
+
resolve20();
|
|
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(resolve20, reject) {
|
|
6267
6267
|
if (error2) {
|
|
6268
6268
|
return reject(error2);
|
|
6269
6269
|
}
|
|
6270
6270
|
if (entryStream) {
|
|
6271
|
-
|
|
6271
|
+
resolve20({ value: entryStream, done: false });
|
|
6272
6272
|
entryStream = null;
|
|
6273
6273
|
return;
|
|
6274
6274
|
}
|
|
6275
|
-
promiseResolve =
|
|
6275
|
+
promiseResolve = resolve20;
|
|
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((resolve20, reject) => {
|
|
6304
|
+
if (extract3.destroyed) return resolve20({ value: void 0, done: true });
|
|
6305
6305
|
extract3.once("close", function() {
|
|
6306
6306
|
if (err) reject(err);
|
|
6307
|
-
else
|
|
6307
|
+
else resolve20({ 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((resolve20) => {
|
|
6709
6709
|
let out = "";
|
|
6710
6710
|
let settled = false;
|
|
6711
6711
|
const done = (v7) => {
|
|
6712
6712
|
if (!settled) {
|
|
6713
6713
|
settled = true;
|
|
6714
|
-
|
|
6714
|
+
resolve20(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((resolve20, 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", () => resolve20());
|
|
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
|
|
34371
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
34372
34372
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
34373
|
-
import { dirname as dirname16, resolve as
|
|
34373
|
+
import { dirname as dirname16, resolve as resolve19 } 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((resolve20, 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", () => resolve20());
|
|
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((resolve20, 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", () => resolve20(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((resolve20, 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(resolve20, 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((resolve20) => setTimeout(resolve20, 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: resolve20, 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 = resolve20(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((resolve20) => {
|
|
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 resolve20();
|
|
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((resolve20) => setTimeout(resolve20, 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,12 +46499,12 @@ 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 resolve16 } from "path";
|
|
46492
46504
|
import { homedir as homedir17 } from "os";
|
|
46493
46505
|
|
|
46494
46506
|
// src/updater/state.ts
|
|
46495
|
-
import { readFileSync as
|
|
46507
|
+
import { readFileSync as readFileSync25, writeFileSync as writeFileSync17, mkdirSync as mkdirSync16, existsSync as existsSync20 } from "fs";
|
|
46496
46508
|
import { join as join24 } from "path";
|
|
46497
46509
|
import { homedir as homedir16 } from "os";
|
|
46498
46510
|
var GIPITY_DIR = join24(homedir16(), ".gipity");
|
|
@@ -46517,7 +46529,7 @@ function ensureDir() {
|
|
|
46517
46529
|
function readState() {
|
|
46518
46530
|
if (!existsSync20(STATE_FILE)) return { ...DEFAULT_STATE };
|
|
46519
46531
|
try {
|
|
46520
|
-
return { ...DEFAULT_STATE, ...JSON.parse(
|
|
46532
|
+
return { ...DEFAULT_STATE, ...JSON.parse(readFileSync25(STATE_FILE, "utf-8")) };
|
|
46521
46533
|
} catch {
|
|
46522
46534
|
return { ...DEFAULT_STATE };
|
|
46523
46535
|
}
|
|
@@ -46529,7 +46541,7 @@ function writeState(state) {
|
|
|
46529
46541
|
function readSettings() {
|
|
46530
46542
|
if (!existsSync20(SETTINGS_FILE)) return { ...DEFAULT_SETTINGS };
|
|
46531
46543
|
try {
|
|
46532
|
-
return { ...DEFAULT_SETTINGS, ...JSON.parse(
|
|
46544
|
+
return { ...DEFAULT_SETTINGS, ...JSON.parse(readFileSync25(SETTINGS_FILE, "utf-8")) };
|
|
46533
46545
|
} catch {
|
|
46534
46546
|
return { ...DEFAULT_SETTINGS };
|
|
46535
46547
|
}
|
|
@@ -46566,7 +46578,7 @@ function localVersion() {
|
|
|
46566
46578
|
const pkgPath = join25(LOCAL_PKG_DIR, "package.json");
|
|
46567
46579
|
if (!existsSync21(pkgPath)) return null;
|
|
46568
46580
|
try {
|
|
46569
|
-
return JSON.parse(
|
|
46581
|
+
return JSON.parse(readFileSync26(pkgPath, "utf-8")).version ?? null;
|
|
46570
46582
|
} catch {
|
|
46571
46583
|
return null;
|
|
46572
46584
|
}
|
|
@@ -46574,7 +46586,7 @@ function localVersion() {
|
|
|
46574
46586
|
function shimVersion() {
|
|
46575
46587
|
try {
|
|
46576
46588
|
const url = new URL("../../package.json", import.meta.url);
|
|
46577
|
-
return JSON.parse(
|
|
46589
|
+
return JSON.parse(readFileSync26(url, "utf-8")).version;
|
|
46578
46590
|
} catch {
|
|
46579
46591
|
return "unknown";
|
|
46580
46592
|
}
|
|
@@ -46664,7 +46676,7 @@ var doctorCommand = new Command("doctor").description("Check install + environme
|
|
|
46664
46676
|
if (env.claude.installed && !env.claude.authenticated) {
|
|
46665
46677
|
console.log(`${muted(" ")} ${warning("Claude Code is not logged in. Run `claude auth login` and sign in.")}`);
|
|
46666
46678
|
}
|
|
46667
|
-
if (existsSync21(
|
|
46679
|
+
if (existsSync21(resolve16(process.cwd(), ".codex", "hooks.json"))) {
|
|
46668
46680
|
console.log(`${muted("codex hooks ")} ${warning("written")} - session capture needs a one-time approval: run /hooks inside Codex in this project`);
|
|
46669
46681
|
}
|
|
46670
46682
|
const buildReady = env.node.ok && env.gipity.logged_in;
|
|
@@ -46891,13 +46903,13 @@ var updateCommand = new Command("update").description("Update the CLI").option("
|
|
|
46891
46903
|
init_api();
|
|
46892
46904
|
init_utils();
|
|
46893
46905
|
init_colors();
|
|
46894
|
-
import { existsSync as existsSync25, readFileSync as
|
|
46906
|
+
import { existsSync as existsSync25, readFileSync as readFileSync29, unlinkSync as unlinkSync9 } from "fs";
|
|
46895
46907
|
import { spawn as spawn2 } from "child_process";
|
|
46896
46908
|
|
|
46897
46909
|
// src/relay/daemon.ts
|
|
46898
46910
|
init_platform();
|
|
46899
46911
|
init_config();
|
|
46900
|
-
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync19, existsSync as existsSync24, readFileSync as
|
|
46912
|
+
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
46913
|
import { stat, readFile } from "fs/promises";
|
|
46902
46914
|
import { createInterface as createInterface2 } from "readline";
|
|
46903
46915
|
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 +47680,13 @@ function parseVersion(out) {
|
|
|
47668
47680
|
return m ? m[0] : void 0;
|
|
47669
47681
|
}
|
|
47670
47682
|
function runProbe(cmd, args) {
|
|
47671
|
-
return new Promise((
|
|
47683
|
+
return new Promise((resolve20) => {
|
|
47672
47684
|
let out = "";
|
|
47673
47685
|
let settled = false;
|
|
47674
47686
|
const done = (s) => {
|
|
47675
47687
|
if (!settled) {
|
|
47676
47688
|
settled = true;
|
|
47677
|
-
|
|
47689
|
+
resolve20(s);
|
|
47678
47690
|
}
|
|
47679
47691
|
};
|
|
47680
47692
|
let child;
|
|
@@ -47813,13 +47825,13 @@ function agentUpdateInProgress() {
|
|
|
47813
47825
|
return inProgress;
|
|
47814
47826
|
}
|
|
47815
47827
|
function execCapture(argv2, timeoutMs, signal) {
|
|
47816
|
-
return new Promise((
|
|
47828
|
+
return new Promise((resolve20) => {
|
|
47817
47829
|
let output = "";
|
|
47818
47830
|
let settled = false;
|
|
47819
47831
|
const done = (ok) => {
|
|
47820
47832
|
if (!settled) {
|
|
47821
47833
|
settled = true;
|
|
47822
|
-
|
|
47834
|
+
resolve20({ ok, output });
|
|
47823
47835
|
}
|
|
47824
47836
|
};
|
|
47825
47837
|
let child;
|
|
@@ -48020,8 +48032,8 @@ var SessionPool = class {
|
|
|
48020
48032
|
const done = new Promise((r) => {
|
|
48021
48033
|
markDone = r;
|
|
48022
48034
|
});
|
|
48023
|
-
return new Promise((
|
|
48024
|
-
const turn = { onMessage: p.onMessage, resolve:
|
|
48035
|
+
return new Promise((resolve20, reject) => {
|
|
48036
|
+
const turn = { onMessage: p.onMessage, resolve: resolve20, reject, interruptRequested: false, wasHot, done, markDone };
|
|
48025
48037
|
session.current = turn;
|
|
48026
48038
|
session.state = "running";
|
|
48027
48039
|
session.lastActivityAt = Date.now();
|
|
@@ -48476,10 +48488,10 @@ async function heartbeatLoop(ctx) {
|
|
|
48476
48488
|
}
|
|
48477
48489
|
await Promise.race([
|
|
48478
48490
|
sleep4(HEARTBEAT_INTERVAL_MS, ctx.abort.signal),
|
|
48479
|
-
new Promise((
|
|
48491
|
+
new Promise((resolve20) => {
|
|
48480
48492
|
heartbeatPoke = () => {
|
|
48481
48493
|
heartbeatPoke = null;
|
|
48482
|
-
|
|
48494
|
+
resolve20();
|
|
48483
48495
|
};
|
|
48484
48496
|
})
|
|
48485
48497
|
]);
|
|
@@ -48523,9 +48535,9 @@ async function dispatchLoop(ctx, opts) {
|
|
|
48523
48535
|
while (inflight.size >= MAX_CONCURRENT_DISPATCHES && !ctx.abort.signal.aborted) {
|
|
48524
48536
|
await Promise.race([
|
|
48525
48537
|
...inflight,
|
|
48526
|
-
new Promise((
|
|
48527
|
-
if (ctx.abort.signal.aborted) return
|
|
48528
|
-
ctx.abort.signal.addEventListener("abort", () =>
|
|
48538
|
+
new Promise((resolve20) => {
|
|
48539
|
+
if (ctx.abort.signal.aborted) return resolve20();
|
|
48540
|
+
ctx.abort.signal.addEventListener("abort", () => resolve20(), { once: true });
|
|
48529
48541
|
})
|
|
48530
48542
|
]);
|
|
48531
48543
|
}
|
|
@@ -49224,7 +49236,7 @@ async function resolveCwdForProject(d) {
|
|
|
49224
49236
|
const configPath = join29(path5, ".gipity.json");
|
|
49225
49237
|
if (existsSync24(configPath)) {
|
|
49226
49238
|
try {
|
|
49227
|
-
const cfg = JSON.parse(
|
|
49239
|
+
const cfg = JSON.parse(readFileSync28(configPath, "utf-8"));
|
|
49228
49240
|
if (cfg.projectGuid === d.project_guid) return { cwd: path5, bootstrapped: false };
|
|
49229
49241
|
log2("warn", "project dir exists but guid mismatch - using it anyway", {
|
|
49230
49242
|
path: path5,
|
|
@@ -49314,7 +49326,7 @@ async function killRunningForConv(convGuid) {
|
|
|
49314
49326
|
}
|
|
49315
49327
|
}
|
|
49316
49328
|
const graceTimers = [];
|
|
49317
|
-
const escalate = new Promise((
|
|
49329
|
+
const escalate = new Promise((resolve20) => {
|
|
49318
49330
|
const t = setTimeout(() => {
|
|
49319
49331
|
for (const e of matches) {
|
|
49320
49332
|
log2("warn", "previous dispatch ignored SIGTERM - escalating to SIGKILL", { conv: convGuid });
|
|
@@ -49323,7 +49335,7 @@ async function killRunningForConv(convGuid) {
|
|
|
49323
49335
|
} catch {
|
|
49324
49336
|
}
|
|
49325
49337
|
}
|
|
49326
|
-
|
|
49338
|
+
resolve20();
|
|
49327
49339
|
}, KILL_GRACE_MS);
|
|
49328
49340
|
graceTimers.push(t);
|
|
49329
49341
|
});
|
|
@@ -49334,7 +49346,7 @@ async function killRunningForConv(convGuid) {
|
|
|
49334
49346
|
}
|
|
49335
49347
|
async function spawnSync2(cwd, timeoutMs, onSpawn) {
|
|
49336
49348
|
const cmd = process.env.GIPITY_RELAY_CLAUDE_CMD || resolveCommand("gipity");
|
|
49337
|
-
return new Promise((
|
|
49349
|
+
return new Promise((resolve20, reject) => {
|
|
49338
49350
|
const child = spawnCommand(cmd, ["sync", "--json"], {
|
|
49339
49351
|
cwd,
|
|
49340
49352
|
env: childEnv(),
|
|
@@ -49374,7 +49386,7 @@ async function spawnSync2(cwd, timeoutMs, onSpawn) {
|
|
|
49374
49386
|
child.on("exit", (code) => finish(() => {
|
|
49375
49387
|
if (code === 0) {
|
|
49376
49388
|
log2("info", "sync done", { cwd, stdoutLen });
|
|
49377
|
-
|
|
49389
|
+
resolve20();
|
|
49378
49390
|
} else {
|
|
49379
49391
|
reject(new Error(`gipity sync exited ${code}${stderrBuf ? `: ${stderrBuf.trim().slice(0, 300)}` : ""}`));
|
|
49380
49392
|
}
|
|
@@ -49386,7 +49398,7 @@ async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
49386
49398
|
const cmd = process.env.GIPITY_RELAY_CLAUDE_CMD || resolveCommand("gipity");
|
|
49387
49399
|
const fullArgs = streamJson ? [...args, "--output-format", "stream-json", "--verbose", "--include-partial-messages"] : [...args];
|
|
49388
49400
|
const env = streamJson ? childEnv({ GIPITY_CONVERSATION_GUID: d.conversation_guid, GIPITY_CAPTURE: "off" }) : childEnv({ GIPITY_CONVERSATION_GUID: d.conversation_guid });
|
|
49389
|
-
return new Promise((
|
|
49401
|
+
return new Promise((resolve20, reject) => {
|
|
49390
49402
|
const child = spawnCommand(cmd, fullArgs, { cwd, env, stdio: ["ignore", "pipe", "pipe"] });
|
|
49391
49403
|
let resolveExited = () => {
|
|
49392
49404
|
};
|
|
@@ -49573,7 +49585,7 @@ async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
49573
49585
|
void postProgress(d.conversation_guid, buildProgressPayload(false));
|
|
49574
49586
|
if (ownQueue) await q.close();
|
|
49575
49587
|
cleanup();
|
|
49576
|
-
|
|
49588
|
+
resolve20({
|
|
49577
49589
|
exitCode: code ?? 1,
|
|
49578
49590
|
killed,
|
|
49579
49591
|
runtimeLimit,
|
|
@@ -49588,10 +49600,10 @@ async function runDispatchSync(d, cwd) {
|
|
|
49588
49600
|
let killed = false;
|
|
49589
49601
|
try {
|
|
49590
49602
|
await spawnSync2(cwd, PROJECT_SYNC_TIMEOUT_MS, (child) => {
|
|
49591
|
-
const exited = new Promise((
|
|
49603
|
+
const exited = new Promise((resolve20) => {
|
|
49592
49604
|
child.once("exit", (_code, signal) => {
|
|
49593
49605
|
if (signal === "SIGTERM") killed = true;
|
|
49594
|
-
|
|
49606
|
+
resolve20();
|
|
49595
49607
|
});
|
|
49596
49608
|
});
|
|
49597
49609
|
running.set(d.short_guid, { child, convGuid: d.conversation_guid, exited });
|
|
@@ -49622,18 +49634,18 @@ function killDispatch(shortGuid) {
|
|
|
49622
49634
|
return false;
|
|
49623
49635
|
}
|
|
49624
49636
|
function sleep4(ms2, signal) {
|
|
49625
|
-
return new Promise((
|
|
49626
|
-
if (signal?.aborted) return
|
|
49637
|
+
return new Promise((resolve20) => {
|
|
49638
|
+
if (signal?.aborted) return resolve20();
|
|
49627
49639
|
let onAbort = null;
|
|
49628
49640
|
const t = setTimeout(() => {
|
|
49629
49641
|
if (onAbort && signal) signal.removeEventListener("abort", onAbort);
|
|
49630
|
-
|
|
49642
|
+
resolve20();
|
|
49631
49643
|
}, ms2);
|
|
49632
49644
|
if (signal) {
|
|
49633
49645
|
onAbort = () => {
|
|
49634
49646
|
clearTimeout(t);
|
|
49635
49647
|
signal.removeEventListener("abort", onAbort);
|
|
49636
|
-
|
|
49648
|
+
resolve20();
|
|
49637
49649
|
};
|
|
49638
49650
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
49639
49651
|
}
|
|
@@ -49807,7 +49819,7 @@ relayCommand.command("stop").description("Stop the background service").option("
|
|
|
49807
49819
|
console.log(muted("Background service isn't running."));
|
|
49808
49820
|
return;
|
|
49809
49821
|
}
|
|
49810
|
-
const pid = parseInt(
|
|
49822
|
+
const pid = parseInt(readFileSync29(pidPath, "utf-8").trim(), 10);
|
|
49811
49823
|
if (!pid || isNaN(pid)) {
|
|
49812
49824
|
console.error(error("PID file is empty or malformed."));
|
|
49813
49825
|
process.exit(1);
|
|
@@ -49956,7 +49968,7 @@ relayCommand.command("revoke").description("Revoke and forget this device").acti
|
|
|
49956
49968
|
}
|
|
49957
49969
|
const pidPath = getDaemonPidPath();
|
|
49958
49970
|
if (existsSync25(pidPath)) {
|
|
49959
|
-
const pid = parseInt(
|
|
49971
|
+
const pid = parseInt(readFileSync29(pidPath, "utf-8").trim(), 10);
|
|
49960
49972
|
if (pid && !isNaN(pid)) {
|
|
49961
49973
|
try {
|
|
49962
49974
|
process.kill(pid, "SIGTERM");
|
|
@@ -49975,7 +49987,7 @@ relayCommand.command("log").description("Tail the service log").option("-n, --li
|
|
|
49975
49987
|
}
|
|
49976
49988
|
const lines = parseInt(opts.lines, 10) || 100;
|
|
49977
49989
|
try {
|
|
49978
|
-
const all =
|
|
49990
|
+
const all = readFileSync29(path5, "utf-8").split("\n");
|
|
49979
49991
|
const tail2 = all.slice(-lines - 1).join("\n");
|
|
49980
49992
|
process.stdout.write(tail2);
|
|
49981
49993
|
} catch (err) {
|
|
@@ -50151,9 +50163,9 @@ init_api();
|
|
|
50151
50163
|
init_auth();
|
|
50152
50164
|
init_utils();
|
|
50153
50165
|
init_colors();
|
|
50154
|
-
import { existsSync as existsSync26, rmSync as rmSync4, unlinkSync as unlinkSync10, readFileSync as
|
|
50166
|
+
import { existsSync as existsSync26, rmSync as rmSync4, unlinkSync as unlinkSync10, readFileSync as readFileSync30, writeFileSync as writeFileSync20 } from "fs";
|
|
50155
50167
|
import { homedir as homedir20, platform as osPlatform4 } from "os";
|
|
50156
|
-
import { join as join30, resolve as
|
|
50168
|
+
import { join as join30, resolve as resolve18 } from "path";
|
|
50157
50169
|
init_agents();
|
|
50158
50170
|
function removeInstallerPathLines() {
|
|
50159
50171
|
if (osPlatform4() === "win32") return [];
|
|
@@ -50164,7 +50176,7 @@ function removeInstallerPathLines() {
|
|
|
50164
50176
|
if (!existsSync26(rc2)) continue;
|
|
50165
50177
|
let text;
|
|
50166
50178
|
try {
|
|
50167
|
-
text =
|
|
50179
|
+
text = readFileSync30(rc2, "utf-8");
|
|
50168
50180
|
} catch {
|
|
50169
50181
|
continue;
|
|
50170
50182
|
}
|
|
@@ -50186,7 +50198,7 @@ function tildify2(p) {
|
|
|
50186
50198
|
return p === home || p.startsWith(home + "/") ? "~" + p.slice(home.length) : p;
|
|
50187
50199
|
}
|
|
50188
50200
|
function resolveCliPath2() {
|
|
50189
|
-
return
|
|
50201
|
+
return resolve18(process.argv[1] ?? "gipity");
|
|
50190
50202
|
}
|
|
50191
50203
|
async function stopDaemon() {
|
|
50192
50204
|
if (!isDaemonRunning()) return;
|
|
@@ -50470,7 +50482,7 @@ gmailCommand.command("reply").description("Reply to a Gmail thread. Get thread-i
|
|
|
50470
50482
|
}));
|
|
50471
50483
|
|
|
50472
50484
|
// src/commands/text.ts
|
|
50473
|
-
import { readFileSync as
|
|
50485
|
+
import { readFileSync as readFileSync31 } from "fs";
|
|
50474
50486
|
init_colors();
|
|
50475
50487
|
|
|
50476
50488
|
// src/helpers/text-analysis.ts
|
|
@@ -50625,10 +50637,10 @@ function areAnagrams(a, b7) {
|
|
|
50625
50637
|
|
|
50626
50638
|
// src/commands/text.ts
|
|
50627
50639
|
function resolveInput(args, opts) {
|
|
50628
|
-
if (opts.file) return
|
|
50640
|
+
if (opts.file) return readFileSync31(opts.file, "utf-8");
|
|
50629
50641
|
if (args.length) return args.join(" ");
|
|
50630
50642
|
try {
|
|
50631
|
-
return
|
|
50643
|
+
return readFileSync31(0, "utf-8");
|
|
50632
50644
|
} catch {
|
|
50633
50645
|
return "";
|
|
50634
50646
|
}
|
|
@@ -50924,11 +50936,11 @@ function installOutputTrace(label2) {
|
|
|
50924
50936
|
installOutputTrace("index");
|
|
50925
50937
|
var __dirname = dirname16(fileURLToPath4(import.meta.url));
|
|
50926
50938
|
installNetworking();
|
|
50927
|
-
var pkg = JSON.parse(
|
|
50939
|
+
var pkg = JSON.parse(readFileSync32(resolve19(__dirname, "../package.json"), "utf-8"));
|
|
50928
50940
|
function versionLabel() {
|
|
50929
50941
|
const base = `v${pkg.version}`;
|
|
50930
50942
|
try {
|
|
50931
|
-
const info2 = JSON.parse(
|
|
50943
|
+
const info2 = JSON.parse(readFileSync32(resolve19(__dirname, "build-info.json"), "utf-8"));
|
|
50932
50944
|
if (info2?.sha) return `${base} (dev ${info2.sha}${info2.dirty ? ", modified" : ""})`;
|
|
50933
50945
|
} catch {
|
|
50934
50946
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.29",
|
|
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",
|