gipity 1.1.7 → 1.1.9
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/agents/agy.js +31 -0
- package/dist/agents/claude-code.js +21 -0
- package/dist/agents/codex.js +21 -0
- package/dist/agents/grok.js +38 -0
- package/dist/agents/types.js +6 -17
- package/dist/capture/sources/agy.js +77 -13
- package/dist/client-context.js +17 -21
- package/dist/commands/add.js +49 -8
- package/dist/commands/brand.js +5 -1
- package/dist/commands/build.js +26 -12
- package/dist/commands/db.js +6 -1
- package/dist/commands/email.js +12 -8
- package/dist/commands/file.js +5 -1
- package/dist/commands/generate.js +25 -30
- package/dist/commands/init.js +3 -2
- package/dist/commands/page-eval.js +11 -3
- package/dist/commands/skill.js +158 -24
- package/dist/commands/uninstall.js +14 -72
- package/dist/commands/upload.js +8 -11
- package/dist/hooks/capture-runner.js +35 -50
- package/dist/index.js +2854 -2002
- package/dist/provider-docs.js +1 -1
- package/dist/relay/diagnostics.js +13 -11
- package/dist/setup.js +83 -2
- package/dist/utils.js +20 -7
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@ import { error as clrError, success, muted } from '../colors.js';
|
|
|
8
8
|
import { printCommandError } from '../helpers/command.js';
|
|
9
9
|
import { withSpinner } from '../progress.js';
|
|
10
10
|
import { guessMime } from '../upload.js';
|
|
11
|
-
import { IMAGE_MODELS_DOC,
|
|
11
|
+
import { IMAGE_MODELS_DOC, VIDEO_MODELS_DOC, TTS_PROVIDER_DESCRIPTIONS } from '../provider-docs.js';
|
|
12
12
|
/** Download a URL and save to a local file, then push it up to the project so
|
|
13
13
|
* the cloud (and anything that mirrors it) immediately matches local disk.
|
|
14
14
|
* Returns the absolute path written, so callers can report where it landed.
|
|
@@ -170,19 +170,14 @@ function readInputImages(paths) {
|
|
|
170
170
|
}
|
|
171
171
|
// ── IMAGE ──────────────────────────────────────────────────────────────
|
|
172
172
|
const imageCommand = new Command('image')
|
|
173
|
-
.description(
|
|
174
|
-
|
|
173
|
+
.description('Generate an image from a text prompt, or edit existing images with --input')
|
|
174
|
+
.addHelpText('after', `
|
|
175
175
|
Models: ${IMAGE_MODELS_DOC}
|
|
176
176
|
|
|
177
177
|
Editing (--input): pass one or more source images and the prompt becomes an edit
|
|
178
178
|
instruction applied to them - "make it night time", "add a hat", "remove the car
|
|
179
179
|
in the background", or compose several inputs together. Editing routes to Gemini
|
|
180
|
-
automatically
|
|
181
|
-
the CLI; the CLI reads the file bytes itself, so there is no base64/argv fiddling.
|
|
182
|
-
|
|
183
|
-
Gemini-specific options:
|
|
184
|
-
--aspect-ratio Control output shape: ${IMAGE_GEMINI_ASPECT_RATIOS}
|
|
185
|
-
--image-size Control resolution: ${IMAGE_GEMINI_SIZES} (default: 1K)
|
|
180
|
+
automatically; the CLI reads the file bytes itself, so there is no base64/argv fiddling.
|
|
186
181
|
|
|
187
182
|
Examples:
|
|
188
183
|
gipity generate image "a cat wearing a top hat"
|
|
@@ -190,7 +185,8 @@ Examples:
|
|
|
190
185
|
gipity generate image "put the person in the first photo into the second scene" --input person.png --input scene.png
|
|
191
186
|
gipity generate image "landscape sunset" --provider gemini --aspect-ratio 16:9 --image-size 2K
|
|
192
187
|
gipity generate image "product photo" --provider openai --model gpt-image-2 --size 1536x1024 --quality high
|
|
193
|
-
gipity generate image "abstract art" --provider bfl --model flux-2-pro -o art.png
|
|
188
|
+
gipity generate image "abstract art" --provider bfl --model flux-2-pro -o art.png
|
|
189
|
+
`)
|
|
194
190
|
.argument('<prompt>', 'Text description of the image, or (with --input) the edit instruction to apply')
|
|
195
191
|
.option('--input <file>', 'Source image to edit/compose (repeatable). With --input the prompt is an edit instruction; routes to Gemini.', (v, acc) => (acc || []).concat(v))
|
|
196
192
|
.option('--provider <provider>', 'Image provider: openai, bfl, or gemini (default: bfl)')
|
|
@@ -248,14 +244,10 @@ Examples:
|
|
|
248
244
|
});
|
|
249
245
|
// ── VIDEO ──────────────────────────────────────────────────────────────
|
|
250
246
|
const videoCommand = new Command('video')
|
|
251
|
-
.description(
|
|
252
|
-
|
|
247
|
+
.description('Generate a short video (up to 8 seconds) from a text prompt using Google Veo')
|
|
248
|
+
.addHelpText('after', `
|
|
253
249
|
Models: ${VIDEO_MODELS_DOC}
|
|
254
250
|
|
|
255
|
-
Options:
|
|
256
|
-
--aspect 16:9 (landscape, default), 9:16 (portrait/vertical), 1:1 (square)
|
|
257
|
-
--resolution 720p (default), 1080p, 4k
|
|
258
|
-
|
|
259
251
|
Tips:
|
|
260
252
|
- Describe the scene, camera movement, lighting, and any dialogue
|
|
261
253
|
- Generation takes 30-120 seconds depending on model
|
|
@@ -264,7 +256,8 @@ Tips:
|
|
|
264
256
|
Examples:
|
|
265
257
|
gipity generate video "a bird flying over a mountain lake at sunset"
|
|
266
258
|
gipity generate video "close-up of coffee being poured" --model veo-3.1-fast-generate-preview
|
|
267
|
-
gipity generate video "vertical dance video" --aspect 9:16 --resolution 1080p -o dance.mp4
|
|
259
|
+
gipity generate video "vertical dance video" --aspect 9:16 --resolution 1080p -o dance.mp4
|
|
260
|
+
`)
|
|
268
261
|
.argument('<prompt>', 'Description of the video scene, action, camera movement, and dialogue')
|
|
269
262
|
.option('--model <model>', 'Veo model: veo-3.1-generate-preview (quality), veo-3.1-fast-generate-preview (speed), veo-3.1-lite-generate-preview (budget)')
|
|
270
263
|
.option('--aspect <ratio>', 'Aspect ratio: 16:9 (landscape), 9:16 (portrait), 1:1 (square)')
|
|
@@ -304,20 +297,20 @@ Examples:
|
|
|
304
297
|
});
|
|
305
298
|
// ── SPEECH ─────────────────────────────────────────────────────────────
|
|
306
299
|
const speechCommand = new Command('speech')
|
|
307
|
-
.description(
|
|
308
|
-
|
|
300
|
+
.description('Generate speech audio from text using text-to-speech')
|
|
301
|
+
.addHelpText('after', `
|
|
309
302
|
Providers: ${Object.entries(TTS_PROVIDER_DESCRIPTIONS).map(([k, v]) => `${k} - ${v}`).join('\n ')}
|
|
310
303
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
When using multi-speaker, format your text as "Name: dialogue" on each line.
|
|
304
|
+
Multi-speaker (--speakers, Gemini only): JSON array like
|
|
305
|
+
[{"name":"Joe","voice":"Kore"},{"name":"Jane","voice":"Puck"}]; format the
|
|
306
|
+
text as "Name: dialogue" on each line.
|
|
315
307
|
|
|
316
308
|
Examples:
|
|
317
309
|
gipity generate speech "Hello, welcome to Gipity!"
|
|
318
310
|
gipity generate speech "こんにちは世界" --provider gemini --voice Kore --language ja-JP
|
|
319
311
|
gipity generate speech "Bonjour le monde" --provider gemini --language fr-FR
|
|
320
|
-
gipity generate speech 'Joe: Hey!\\nJane: Hi there!' --provider gemini --speakers '[{"name":"Joe","voice":"Charon"},{"name":"Jane","voice":"Leda"}]'
|
|
312
|
+
gipity generate speech 'Joe: Hey!\\nJane: Hi there!' --provider gemini --speakers '[{"name":"Joe","voice":"Charon"},{"name":"Jane","voice":"Leda"}]'
|
|
313
|
+
`)
|
|
321
314
|
.argument('<text>', 'Text to convert to speech (max 5000 characters)')
|
|
322
315
|
.option('--provider <provider>', 'TTS provider: elevenlabs (default), openai, or gemini')
|
|
323
316
|
.option('--voice <voice>', 'Voice ID or name (provider-specific)')
|
|
@@ -368,8 +361,8 @@ Examples:
|
|
|
368
361
|
});
|
|
369
362
|
// ── MUSIC ──────────────────────────────────────────────────────────────
|
|
370
363
|
const musicCommand = new Command('music')
|
|
371
|
-
.description(
|
|
372
|
-
|
|
364
|
+
.description('Generate music from a text prompt using AI')
|
|
365
|
+
.addHelpText('after', `
|
|
373
366
|
The model is chosen from the platform's music catalog. Omit --model to use the
|
|
374
367
|
default; pass --model <id> only if you want a specific one (see the catalog with
|
|
375
368
|
\`gipity service call music/models --get\`).
|
|
@@ -382,7 +375,8 @@ Tips:
|
|
|
382
375
|
Examples:
|
|
383
376
|
gipity generate music "chill lo-fi beat for studying"
|
|
384
377
|
gipity generate music "epic orchestral battle theme" --duration 60 -o src/assets/audio/theme.mp3
|
|
385
|
-
gipity generate music "indie pop chorus" --vocals --duration 20
|
|
378
|
+
gipity generate music "indie pop chorus" --vocals --duration 20
|
|
379
|
+
`)
|
|
386
380
|
.argument('<prompt>', 'Text description of the music to generate')
|
|
387
381
|
.option('--duration <seconds>', 'Clip length in seconds (default 30; max depends on the model)', (v) => parseInt(v, 10))
|
|
388
382
|
.option('--model <model>', 'Music model id (default: platform default)')
|
|
@@ -421,8 +415,8 @@ Examples:
|
|
|
421
415
|
});
|
|
422
416
|
// ── SOUND ──────────────────────────────────────────────────────────────
|
|
423
417
|
const soundCommand = new Command('sound')
|
|
424
|
-
.description(
|
|
425
|
-
|
|
418
|
+
.description('Generate a sound effect from a text description using AI')
|
|
419
|
+
.addHelpText('after', `
|
|
426
420
|
Always billed to you (the caller) - the app's service billing_mode does not
|
|
427
421
|
apply to direct generation, so there is never a reason to flip a service to
|
|
428
422
|
owner_pays just to create assets.
|
|
@@ -435,7 +429,8 @@ Tips:
|
|
|
435
429
|
Examples:
|
|
436
430
|
gipity generate sound "cartoon character saying oof"
|
|
437
431
|
gipity generate sound "thunder rolling in the distance" --duration 5
|
|
438
|
-
gipity generate sound "sci-fi laser blast" -o src/assets/sounds/laser.mp3
|
|
432
|
+
gipity generate sound "sci-fi laser blast" -o src/assets/sounds/laser.mp3
|
|
433
|
+
`)
|
|
439
434
|
.argument('<text>', 'Text description of the sound effect (max 1000 characters)')
|
|
440
435
|
.option('--duration <seconds>', 'Clip length in seconds (0.5-30; default: automatic)', (v) => parseFloat(v))
|
|
441
436
|
.option('--influence <n>', 'How closely to follow the prompt, 0.0-1.0 (higher = more literal)', (v) => parseFloat(v))
|
package/dist/commands/init.js
CHANGED
|
@@ -5,6 +5,7 @@ import { getAccountSlug } from '../api.js';
|
|
|
5
5
|
import { getConfig, getConfigPath, saveConfigAt } from '../config.js';
|
|
6
6
|
import { getAuth } from '../auth.js';
|
|
7
7
|
import { slugify, setupProjectTools, SUPPORTED_TOOLS, DEFAULT_TOOLS, DEFAULT_SYNC_IGNORE } from '../setup.js';
|
|
8
|
+
import { AGENT_ADAPTERS } from '../agents/index.js';
|
|
8
9
|
import { success, error as clrError, info, muted, bold } from '../colors.js';
|
|
9
10
|
import { confirm } from '../utils.js';
|
|
10
11
|
import { scanForAdoption, adoptCurrentDir, canAdoptCwd, formatBytes, formatCwdLabel, ADOPT_THRESHOLDS, } from '../adopt-cwd.js';
|
|
@@ -23,7 +24,7 @@ function resolveTools(forFlag) {
|
|
|
23
24
|
}
|
|
24
25
|
export const initCommand = new Command('init')
|
|
25
26
|
.description('Link this directory to a project')
|
|
26
|
-
.addHelpText('after',
|
|
27
|
+
.addHelpText('after', `\nWrites CLAUDE.md/AGENTS.md primer files so your AI coding tool understands Gipity, and installs the Gipity skills + file-sync hooks into the agent CLIs found on this machine (${AGENT_ADAPTERS.map(a => a.displayName).join(', ')}).`)
|
|
27
28
|
.argument('[name]', 'Project name/slug (defaults to current directory name)')
|
|
28
29
|
.option('--agent <guid>', 'Agent GUID to use')
|
|
29
30
|
.option('--no-capture', 'Don\'t record Claude Code sessions in this directory to your Gipity project (sets captureHooks: false in .gipity.json)')
|
|
@@ -177,7 +178,7 @@ Working with an existing Gipity project:
|
|
|
177
178
|
}
|
|
178
179
|
console.log(success(`Wrote primer files: ${primerSummary}.`));
|
|
179
180
|
if (wantsClaude) {
|
|
180
|
-
console.log(success(
|
|
181
|
+
console.log(success(`Ready! Run your coding agent here (${AGENT_ADAPTERS.map(a => a.key).join(', ')}), or \`gipity build\` to launch one with a picker.`));
|
|
181
182
|
// Recording happens by default (however Claude Code is launched), so
|
|
182
183
|
// say so up front - consent should be explicit, not discovered later.
|
|
183
184
|
if (opts.capture === false) {
|
|
@@ -417,7 +417,7 @@ export const pageEvalCommand = new Command('eval')
|
|
|
417
417
|
.option('--wait <ms>', 'Sleep this many ms after DOMContentLoaded before evaluating (lets late async work settle; max 30000). With --wait-for, it elapses AFTER the selector appears - gate, then settle.', '500')
|
|
418
418
|
.option('--wait-for <selector>', `Wait until this CSS selector appears before evaluating, then evaluate (deterministic - beats guessing a --wait). Gate on the state you are ASSERTING, not just a ready flag: '#verdict:not(:empty)' returns the instant the round lands, where a fixed wait snapshots mid-sequence. Same flag on page inspect/screenshot. Max ${WAIT_FOR_MAX_MS}ms (--wait-timeout).`)
|
|
419
419
|
.option('--wait-timeout <ms>', `Max ms to wait for --wait-for before giving up (max ${WAIT_FOR_MAX_MS})`, '5000')
|
|
420
|
-
.option('--timeout <ms>', `How long the script itself may run IN the page. Bare number = MILLISECONDS (so 90s = 90000, NOT 90); or pass an explicit unit that means the same on both this and \`sandbox run --timeout\` — --timeout 90s. Its own await/setTimeout pauses count (default ${EVAL_SCRIPT_BUDGET_MS}, ${EVAL_SCRIPT_BUDGET_CAMERA_MS} with --camera/--fake-media; floor 1000, max ${EVAL_SCRIPT_BUDGET_MAX_MS}). Raise it to trace a sequence that unfolds over time (a game round, an animation). Distinct from --wait, which only sleeps BEFORE the script.`)
|
|
420
|
+
.option('--timeout <ms>', `How long the script itself may run IN the page. Bare number = MILLISECONDS (so 90s = 90000, NOT 90); or pass an explicit unit that means the same on both this and \`sandbox run --timeout\` — --timeout 90s. Its own await/setTimeout pauses count (default ${EVAL_SCRIPT_BUDGET_MS}, ${EVAL_SCRIPT_BUDGET_CAMERA_MS} with --camera/--fake-media; floor 1000 - a bare number under it is rejected as a unit mix-up, a suffixed one just floors; max ${EVAL_SCRIPT_BUDGET_MAX_MS}). Raise it to trace a sequence that unfolds over time (a game round, an animation). Distinct from --wait, which only sleeps BEFORE the script.`)
|
|
421
421
|
.option('--auth', 'Evaluate signed in as you (your Gipity account), so a page behind a Sign-in-with-Gipity login is reachable. Only works for apps using Sign in with Gipity, hosted on *.gipity.ai. Without this flag the page loads as a genuinely anonymous, signed-out visitor — nothing carries over from earlier --auth runs.')
|
|
422
422
|
.option('--restore-db', "Snapshot the app database before the script runs and roll it back after, so a write-path check (click Approve, submit the form, edit a row) leaves the real data untouched. Use this whenever the eval WRITES - it is the undo for driving the deployed app against real project data. Same snapshot/undo standalone: gipity db checkpoint / gipity db restore.")
|
|
423
423
|
.option('--json', 'Output as JSON')
|
|
@@ -483,10 +483,13 @@ export const pageEvalCommand = new Command('eval')
|
|
|
483
483
|
// 90s` means 90 seconds on BOTH commands. A suffixed value is normalized to ms
|
|
484
484
|
// up front, so the rest of this action (and the bare-number guard below) sees a
|
|
485
485
|
// plain ms number and the portable form just works.
|
|
486
|
+
let timeoutHadSuffix = false;
|
|
486
487
|
if (opts.timeout !== undefined) {
|
|
487
488
|
const dur = parseDuration(opts.timeout, 'ms');
|
|
488
|
-
if (dur?.hadSuffix)
|
|
489
|
+
if (dur?.hadSuffix) {
|
|
489
490
|
opts.timeout = String(Math.round(dur.value));
|
|
491
|
+
timeoutHadSuffix = true;
|
|
492
|
+
}
|
|
490
493
|
}
|
|
491
494
|
// A BARE number below the in-page floor is the unit-mixup tell: a real ms
|
|
492
495
|
// budget that small is useless (it just floors to the minimum), so a sub-floor
|
|
@@ -495,7 +498,12 @@ export const pageEvalCommand = new Command('eval')
|
|
|
495
498
|
// an opaque "1s budget" error that never reveals the unit mix-up. Reject it up
|
|
496
499
|
// front, naming the unit AND the portable suffix form, so the fix is one obvious
|
|
497
500
|
// edit instead of a doomed run.
|
|
498
|
-
|
|
501
|
+
//
|
|
502
|
+
// A SUFFIXED value is exempt: `--timeout 400ms` states the unit, so there is no
|
|
503
|
+
// mix-up left to name. Sent through the guard it drew the one answer that is
|
|
504
|
+
// certainly wrong for that caller - "pass --timeout 400s", a 400x jump they
|
|
505
|
+
// never asked for. Let it floor in capScriptBudgetMs like any other small value.
|
|
506
|
+
if (opts.timeout !== undefined && !timeoutHadSuffix) {
|
|
499
507
|
const t = parseInt(opts.timeout, 10);
|
|
500
508
|
if (Number.isFinite(t) && t > 0 && t < EVAL_SCRIPT_BUDGET_MIN_MS) {
|
|
501
509
|
const overMax = t * 1000 > EVAL_SCRIPT_BUDGET_MAX_MS;
|
package/dist/commands/skill.js
CHANGED
|
@@ -16,6 +16,105 @@ function readInstalledKitReadme(name) {
|
|
|
16
16
|
const readme = join(kitDir, 'README.md');
|
|
17
17
|
return existsSync(readme) ? readFileSync(readme, 'utf-8') : null;
|
|
18
18
|
}
|
|
19
|
+
function slugify(title) {
|
|
20
|
+
return title.toLowerCase().replace(/[`*_]/g, '').replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
21
|
+
}
|
|
22
|
+
/** Markdown headings, skipping anything inside a fenced code block (shell
|
|
23
|
+
* comments in examples start with `#` too). A section runs until the next
|
|
24
|
+
* heading at the same or a shallower level, so it carries its subsections. */
|
|
25
|
+
function parseSections(lines) {
|
|
26
|
+
const out = [];
|
|
27
|
+
let fenced = false;
|
|
28
|
+
lines.forEach((line, i) => {
|
|
29
|
+
if (/^\s*(```|~~~)/.test(line)) {
|
|
30
|
+
fenced = !fenced;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (fenced)
|
|
34
|
+
return;
|
|
35
|
+
const m = /^(#{1,6})\s+(.*\S)\s*$/.exec(line);
|
|
36
|
+
if (!m)
|
|
37
|
+
return;
|
|
38
|
+
out.push({ level: m[1].length, title: m[2], slug: slugify(m[2]), start: i + 1, end: lines.length });
|
|
39
|
+
});
|
|
40
|
+
out.forEach((s, i) => {
|
|
41
|
+
const next = out.find((o, j) => j > i && o.level <= s.level);
|
|
42
|
+
if (next)
|
|
43
|
+
s.end = next.start - 1;
|
|
44
|
+
});
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
/** The heading level worth listing in the one-line map: the shallowest level
|
|
48
|
+
* with more than one heading (docs open with a single `# Title`, so that lone
|
|
49
|
+
* H1 is never the useful outline), else the shallowest level present. */
|
|
50
|
+
function outlineLevel(sections) {
|
|
51
|
+
const levels = [...new Set(sections.map(s => s.level))].sort((a, b) => a - b);
|
|
52
|
+
return levels.find(l => sections.filter(s => s.level === l).length > 1) ?? levels[0];
|
|
53
|
+
}
|
|
54
|
+
function sectionText(lines, s) {
|
|
55
|
+
return lines.slice(s.start - 1, s.end).join('\n').replace(/\s+$/, '');
|
|
56
|
+
}
|
|
57
|
+
const MAX_MAPPED_SECTIONS = 12;
|
|
58
|
+
/** One line above every read: how long the doc is and what is in it, with the
|
|
59
|
+
* flag for pulling one part inline. Printed to stdout so it survives an
|
|
60
|
+
* agent's `| head -N`. */
|
|
61
|
+
function mapLine(name, lines, sections) {
|
|
62
|
+
const head = `${bold(name)} ${muted(`· ${lines.length} lines`)}`;
|
|
63
|
+
if (sections.length === 0)
|
|
64
|
+
return head;
|
|
65
|
+
const shown = sections.filter(s => s.level === outlineLevel(sections));
|
|
66
|
+
const names = shown.slice(0, MAX_MAPPED_SECTIONS).map(s => s.slug).join(', ');
|
|
67
|
+
const more = shown.length > MAX_MAPPED_SECTIONS ? `, +${shown.length - MAX_MAPPED_SECTIONS} more (--toc)` : '';
|
|
68
|
+
return `${head} ${muted(`· sections (--section <slug>): ${names}${more}`)}`;
|
|
69
|
+
}
|
|
70
|
+
function tocText(sections) {
|
|
71
|
+
return sections
|
|
72
|
+
.map(s => `${String(s.start).padStart(5)} ${' '.repeat(s.level - 1)}${s.slug}${muted(` - ${s.title}`)}`)
|
|
73
|
+
.join('\n');
|
|
74
|
+
}
|
|
75
|
+
/** Apply --toc / --section / --grep to a doc. Returns the text to print, or
|
|
76
|
+
* null when the filter matched nothing (caller reports it and exits 1). */
|
|
77
|
+
function filterContent(content, sections, opts) {
|
|
78
|
+
const lines = content.split('\n');
|
|
79
|
+
if (opts.toc)
|
|
80
|
+
return tocText(sections);
|
|
81
|
+
let hits = [];
|
|
82
|
+
if (opts.section) {
|
|
83
|
+
const want = slugify(opts.section);
|
|
84
|
+
hits = sections.filter(s => s.slug === want);
|
|
85
|
+
if (hits.length === 0)
|
|
86
|
+
hits = sections.filter(s => s.slug.includes(want));
|
|
87
|
+
}
|
|
88
|
+
else if (opts.grep) {
|
|
89
|
+
let re;
|
|
90
|
+
try {
|
|
91
|
+
re = new RegExp(opts.grep, 'i');
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
throw new Error(`--grep "${opts.grep}" is not a valid regex.`);
|
|
95
|
+
}
|
|
96
|
+
// Deepest matching section per hit: the smallest chunk that still answers
|
|
97
|
+
// the question, rather than the whole chapter it sits in.
|
|
98
|
+
const matched = new Set();
|
|
99
|
+
lines.forEach((line, i) => {
|
|
100
|
+
if (!re.test(line))
|
|
101
|
+
return;
|
|
102
|
+
const owning = sections.filter(s => s.start <= i + 1 && i + 1 <= s.end);
|
|
103
|
+
const deepest = owning[owning.length - 1];
|
|
104
|
+
if (deepest)
|
|
105
|
+
matched.add(deepest);
|
|
106
|
+
});
|
|
107
|
+
hits = sections.filter(s => matched.has(s));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return content;
|
|
111
|
+
}
|
|
112
|
+
if (hits.length === 0)
|
|
113
|
+
return null;
|
|
114
|
+
// Drop sections already contained in an outer hit so nothing prints twice.
|
|
115
|
+
const outer = hits.filter(s => !hits.some(o => o !== s && o.start <= s.start && s.end <= o.end));
|
|
116
|
+
return outer.map(s => sectionText(lines, s)).join('\n\n');
|
|
117
|
+
}
|
|
19
118
|
export const skillCommand = new Command('skill')
|
|
20
119
|
.description('Task docs - read the matching skill before building');
|
|
21
120
|
skillCommand
|
|
@@ -30,43 +129,78 @@ skillCommand
|
|
|
30
129
|
}
|
|
31
130
|
const res = await get(`/skills?agent=${config.agentGuid}`);
|
|
32
131
|
const width = res.data.reduce((m, s) => Math.max(m, s.name.length), 0);
|
|
33
|
-
printList(res.data, opts, 'No skills available.', s => ` ${bold(s.name.padEnd(width))} ${muted(s.description)}`, 'Read
|
|
132
|
+
printList(res.data, opts, 'No skills available.', s => ` ${bold(s.name.padEnd(width))} ${muted(s.description)}`, 'Read with `gipity skill read <name> [<name>...]` (one turn, many docs; `--toc`, `--section <slug>` or `--grep <term>` for one part):');
|
|
34
133
|
}));
|
|
35
134
|
skillCommand
|
|
36
|
-
.command('read <
|
|
37
|
-
.description('Read
|
|
135
|
+
.command('read <names...>')
|
|
136
|
+
.description('Read one or more skills (whole doc, or one part with --toc/--section/--grep)')
|
|
137
|
+
.option('--toc', 'Print the doc outline (section slugs + line numbers) instead of the content')
|
|
138
|
+
.option('--section <slug>', 'Print only this section (slug or heading text; subsections included)')
|
|
139
|
+
.option('--grep <term>', 'Print only the sections matching this term (case-insensitive regex)')
|
|
38
140
|
.option('--json', 'Output as JSON')
|
|
39
|
-
.action((
|
|
141
|
+
.action((names, opts) => run('Read', async () => {
|
|
40
142
|
const { config } = await resolveProjectContext();
|
|
41
143
|
if (!config.agentGuid) {
|
|
42
144
|
console.error(clrError('No agent configured for this project. Run `gipity init` to refresh.'));
|
|
43
145
|
process.exit(1);
|
|
44
146
|
}
|
|
45
147
|
const listRes = await get(`/skills?agent=${config.agentGuid}`);
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
148
|
+
const jsonDocs = [];
|
|
149
|
+
let failed = false;
|
|
150
|
+
let printed = 0;
|
|
151
|
+
for (const name of names) {
|
|
152
|
+
const match = listRes.data.find(s => s.name.toLowerCase() === name.toLowerCase());
|
|
153
|
+
let content;
|
|
154
|
+
let detail;
|
|
155
|
+
let note = null;
|
|
156
|
+
if (match) {
|
|
157
|
+
const res = await get(`/skills/${match.guid}?agent=${config.agentGuid}`);
|
|
158
|
+
content = res.data.content;
|
|
159
|
+
detail = { ...res.data };
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
// No catalog skill — but if a kit by this name is installed, its README is
|
|
163
|
+
// the guidance the agent is after. Surface it instead of dead-ending.
|
|
164
|
+
const readme = readInstalledKitReadme(name);
|
|
165
|
+
if (!readme) {
|
|
166
|
+
console.error(clrError(`Skill "${name}" not found. Run: gipity skill list`));
|
|
167
|
+
failed = true;
|
|
168
|
+
continue;
|
|
58
169
|
}
|
|
59
|
-
|
|
170
|
+
content = readme;
|
|
171
|
+
detail = { name, source: 'kit-readme' };
|
|
172
|
+
note = muted(`No skill doc for "${name}"; showing the installed kit's README (src/packages/${name}/README.md):`);
|
|
60
173
|
}
|
|
61
|
-
|
|
62
|
-
|
|
174
|
+
const lines = content.split('\n');
|
|
175
|
+
const sections = parseSections(lines);
|
|
176
|
+
const filtered = filterContent(content, sections, opts);
|
|
177
|
+
if (filtered === null) {
|
|
178
|
+
const what = opts.section ? `section "${opts.section}"` : `match for "${opts.grep}"`;
|
|
179
|
+
console.error(clrError(`No ${what} in "${name}". Sections: ${sections.map(s => s.slug).join(', ') || '(none)'}`));
|
|
180
|
+
failed = true;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (opts.json) {
|
|
184
|
+
jsonDocs.push({
|
|
185
|
+
...detail,
|
|
186
|
+
content: filtered,
|
|
187
|
+
lines: lines.length,
|
|
188
|
+
sections: sections.map(s => ({ slug: s.slug, title: s.title, level: s.level, line: s.start })),
|
|
189
|
+
});
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (printed > 0)
|
|
193
|
+
console.log(''); // blank line between docs in a multi-name read
|
|
194
|
+
if (note)
|
|
195
|
+
console.log(note);
|
|
196
|
+
console.log(mapLine(name, lines, sections));
|
|
197
|
+
console.log(filtered);
|
|
198
|
+
printed++;
|
|
63
199
|
}
|
|
64
|
-
const res = await get(`/skills/${match.guid}?agent=${config.agentGuid}`);
|
|
65
200
|
if (opts.json) {
|
|
66
|
-
console.log(JSON.stringify(
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
console.log(res.data.content);
|
|
201
|
+
console.log(JSON.stringify(names.length === 1 ? jsonDocs[0] ?? null : jsonDocs, null, 2));
|
|
70
202
|
}
|
|
203
|
+
if (failed)
|
|
204
|
+
process.exit(1);
|
|
71
205
|
}));
|
|
72
206
|
//# sourceMappingURL=skill.js.map
|
|
@@ -12,46 +12,14 @@ import { Command } from 'commander';
|
|
|
12
12
|
import { existsSync, rmSync, unlinkSync, readFileSync, writeFileSync } from 'fs';
|
|
13
13
|
import { homedir, platform as osPlatform } from 'os';
|
|
14
14
|
import { join, resolve } from 'path';
|
|
15
|
-
import { spawnSyncCommand
|
|
15
|
+
import { spawnSyncCommand } from '../platform.js';
|
|
16
16
|
import { post } from '../api.js';
|
|
17
17
|
import { getAuth } from '../auth.js';
|
|
18
18
|
import { confirm, getAutoConfirm } from '../utils.js';
|
|
19
19
|
import { bold, brand, dim, success, error as clrError, muted } from '../colors.js';
|
|
20
20
|
import * as relayState from '../relay/state.js';
|
|
21
21
|
import { planFor, UnsupportedPlatformError } from '../relay/installers.js';
|
|
22
|
-
import {
|
|
23
|
-
/** Remove Gipity's entries from the user-scope Claude Code settings: the
|
|
24
|
-
* plugin enablement, the marketplace registration, and any legacy hook
|
|
25
|
-
* blocks older CLI versions wrote there. Surgical - everything else in the
|
|
26
|
-
* file (the user's own permissions, hooks, other plugins) is untouched. */
|
|
27
|
-
function removeGipityPluginConfig() {
|
|
28
|
-
const settingsPath = join(homedir(), '.claude', 'settings.json');
|
|
29
|
-
if (!existsSync(settingsPath))
|
|
30
|
-
return false;
|
|
31
|
-
let settings;
|
|
32
|
-
try {
|
|
33
|
-
settings = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
let changed = stripGipityHooks(settings);
|
|
39
|
-
if (settings.enabledPlugins && GIPITY_PLUGIN_ID in settings.enabledPlugins) {
|
|
40
|
-
delete settings.enabledPlugins[GIPITY_PLUGIN_ID];
|
|
41
|
-
if (Object.keys(settings.enabledPlugins).length === 0)
|
|
42
|
-
delete settings.enabledPlugins;
|
|
43
|
-
changed = true;
|
|
44
|
-
}
|
|
45
|
-
if (settings.extraKnownMarketplaces?.[GIPITY_MARKETPLACE_NAME]) {
|
|
46
|
-
delete settings.extraKnownMarketplaces[GIPITY_MARKETPLACE_NAME];
|
|
47
|
-
if (Object.keys(settings.extraKnownMarketplaces).length === 0)
|
|
48
|
-
delete settings.extraKnownMarketplaces;
|
|
49
|
-
changed = true;
|
|
50
|
-
}
|
|
51
|
-
if (changed)
|
|
52
|
-
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
53
|
-
return changed;
|
|
54
|
-
}
|
|
22
|
+
import { AGENT_ADAPTERS } from '../agents/index.js';
|
|
55
23
|
/** The install.sh / install.ps1 launcher appends a line to the user's shell rc
|
|
56
24
|
* files putting ~/.gipity/launcher/bin on PATH. Once ~/.gipity is deleted that
|
|
57
25
|
* line points at nothing, so strip it back out - matched by the installer's own
|
|
@@ -212,46 +180,20 @@ export const uninstallCommand = new Command('uninstall')
|
|
|
212
180
|
// 3. Revoke device on server.
|
|
213
181
|
await revokeDeviceBestEffort();
|
|
214
182
|
console.log(`${success('Device revoked on server (or was already revoked).')}`);
|
|
215
|
-
// 4. Remove
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (grokInstallState().exists) {
|
|
226
|
-
spawnSyncCommand(resolveCommand('grok'), ['plugin', 'uninstall', 'gipity', '--confirm'], {
|
|
227
|
-
stdio: 'ignore',
|
|
228
|
-
timeout: 60_000,
|
|
229
|
-
});
|
|
230
|
-
console.log(`${success('Gipity plugin removed from Grok.')}`);
|
|
231
|
-
}
|
|
232
|
-
const agentSkills = agentSkillsState();
|
|
233
|
-
if (agentSkills.skills.length) {
|
|
234
|
-
for (const name of agentSkills.skills) {
|
|
235
|
-
// Only names our manifest recorded - never someone else's skills.
|
|
236
|
-
try {
|
|
237
|
-
rmSync(join(AGENTS_SKILLS_DIR, name), { recursive: true, force: true });
|
|
238
|
-
}
|
|
239
|
-
catch { /* best-effort */ }
|
|
183
|
+
// 4. Remove each detected agent's Gipity integration: the Claude Code
|
|
184
|
+
// plugin enablement + legacy hook blocks, the Grok plugin, and the
|
|
185
|
+
// skills the CLI copied into Codex's/Antigravity's skill roots. Every
|
|
186
|
+
// step is best-effort - none existing is the common case.
|
|
187
|
+
let anyAgentIntegration = false;
|
|
188
|
+
for (const agent of AGENT_ADAPTERS) {
|
|
189
|
+
const note = agent.setup?.uninstall();
|
|
190
|
+
if (note) {
|
|
191
|
+
console.log(`${success(note)}`);
|
|
192
|
+
anyAgentIntegration = true;
|
|
240
193
|
}
|
|
241
|
-
console.log(`${success(`Removed ${agentSkills.skills.length} Gipity skills from ~/.agents/skills.`)}`);
|
|
242
194
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
// Codex's ~/.agents/skills, see setup.ts).
|
|
246
|
-
const agySkills = agySkillsState();
|
|
247
|
-
if (agySkills.skills.length) {
|
|
248
|
-
for (const name of agySkills.skills) {
|
|
249
|
-
try {
|
|
250
|
-
rmSync(join(AGY_SKILLS_DIR, name), { recursive: true, force: true });
|
|
251
|
-
}
|
|
252
|
-
catch { /* best-effort */ }
|
|
253
|
-
}
|
|
254
|
-
console.log(`${success(`Removed ${agySkills.skills.length} Gipity skills from ~/.gemini/config/skills.`)}`);
|
|
195
|
+
if (!anyAgentIntegration) {
|
|
196
|
+
console.log(`${muted('No Gipity entries in any detected coding agent.')}`);
|
|
255
197
|
}
|
|
256
198
|
// 5. Wipe ~/.gipity/ (this also removes the agent-hooks scripts and the
|
|
257
199
|
// agent-skills manifest, which live under it).
|
package/dist/commands/upload.js
CHANGED
|
@@ -15,21 +15,18 @@ import { run } from '../helpers/index.js';
|
|
|
15
15
|
// (Uploading into the project tree with `gipity push` does NOT give a public URL
|
|
16
16
|
// until you deploy; this does.)
|
|
17
17
|
export const uploadCommand = new Command('upload')
|
|
18
|
-
.description(
|
|
19
|
-
|
|
20
|
-
The URL works immediately - no \`gipity deploy\` - and any job or function can
|
|
21
|
-
fetch it. Use it to hand a GPU/CPU job a real input file when testing end-to-end:
|
|
22
|
-
|
|
23
|
-
gipity upload song.mp3
|
|
24
|
-
gipity job submit split-stems --data '{"audio_url":"<printed url>"}'
|
|
25
|
-
|
|
26
|
-
By default the file is PUBLIC: a plain \`media.gipity.ai\` CDN url that resolves
|
|
27
|
-
from anywhere, so a cloud worker can always fetch it. Pass --private for a
|
|
28
|
-
token-signed serve url instead (reachable only by holders of the url).`)
|
|
18
|
+
.description('Upload a file and print a durable public URL (works immediately, no deploy)')
|
|
29
19
|
.argument('<file>', 'Local file to upload')
|
|
30
20
|
.option('--private', 'Store as a private token-signed serve URL instead of a public CDN url')
|
|
31
21
|
.option('--content-type <mime>', 'Override the content type (default: detected from the file extension)')
|
|
32
22
|
.option('--json', 'Output as JSON')
|
|
23
|
+
.addHelpText('after', `
|
|
24
|
+
Public by default (a media.gipity.ai CDN url any job or function can fetch);
|
|
25
|
+
--private mints a token-signed serve url instead. Example:
|
|
26
|
+
|
|
27
|
+
gipity upload song.mp3
|
|
28
|
+
gipity job submit split-stems --data '{"audio_url":"<printed url>"}'
|
|
29
|
+
`)
|
|
33
30
|
.action((file, opts) => run('Upload', async () => {
|
|
34
31
|
const { config } = await resolveProjectContext();
|
|
35
32
|
let size;
|