@giftsofprometheus/cli 0.7.2 → 0.8.0
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/README.md +13 -8
- package/dist/index.js +104 -40
- package/dist/render.js +289 -0
- package/package.json +11 -2
- package/skills/giftsofprometheus/SKILL.md +3 -1
- package/skills/history.json +10 -0
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://giftsofprometheus.com/?utm_source=github&utm_medium=readme&utm_campaign=cli"><img alt="Дары Прометея:
|
|
2
|
+
<a href="https://giftsofprometheus.com/?utm_source=github&utm_medium=readme&utm_campaign=cli"><img alt="Дары Прометея: мировые знания об ИИ на русском" src=".github/assets/banner.jpg" width="100%"></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
# Дары Прометея CLI:
|
|
5
|
+
# Дары Прометея CLI: мировые знания об ИИ на русском для вас и вашего AI-агента
|
|
6
6
|
|
|
7
|
-
**[Дары Прометея](https://giftsofprometheus.com/?utm_source=github&utm_medium=readme&utm_campaign=cli)** —
|
|
7
|
+
**[Дары Прометея](https://giftsofprometheus.com/?utm_source=github&utm_medium=readme&utm_campaign=cli)** — мировые знания об ИИ на русском: доклады о разработке с AI-агентами, RAG, evals, MCP и AI-продуктах с русскими названиями, подробными описаниями с TL;DR, главами с таймкодами, профилями спикеров и полными транскриптами.
|
|
8
8
|
|
|
9
9
|
Этот CLI открывает каталог для терминала и AI-агентов: Claude Code, Codex, Cursor и других. Агент сам подберёт доклады под вашу задачу, прочитает транскрипт и сохранит полезное в избранное вашего аккаунта на [giftsofprometheus.com](https://giftsofprometheus.com/?utm_source=github&utm_medium=readme&utm_campaign=cli).
|
|
10
10
|
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
## Зачем это нужно
|
|
19
19
|
|
|
20
|
-
- **Мировой опыт AI-инженерии на русском.**
|
|
20
|
+
- **Мировой опыт AI-инженерии на русском.** Доклады о кодинг-агентах, RAG, evals, MCP и архитектуре агентов от команд, которые делают это в продакшене. Не нужно смотреть часовые видео на английском или китайском, чтобы понять, стоит ли доклад вашего времени.
|
|
21
21
|
- **Ответ под вашу задачу, а не список ссылок.** Опишите агенту, над чем работаете. Он найдёт доклады, прочитает транскрипты и перескажет, что из них применимо у вас.
|
|
22
22
|
- **Один аккаунт для сайта и агента.** Что агент сохранил, появится в [избранном на сайте](https://giftsofprometheus.com/account?utm_source=github&utm_medium=readme&utm_campaign=cli). Интересы, которые вы указали [на сайте](https://giftsofprometheus.com/welcome?utm_source=github&utm_medium=readme&utm_campaign=cli), агент учитывает в подборке.
|
|
23
23
|
|
|
24
|
-
Удобнее читать глазами? Всё то же самое есть на [giftsofprometheus.com](https://giftsofprometheus.com/?utm_source=github&utm_medium=readme&utm_campaign=cli): [подбор докладов за минуту](https://giftsofprometheus.com/welcome?utm_source=github&utm_medium=readme&utm_campaign=cli), [персональная лента](https://giftsofprometheus.com/for-you?utm_source=github&utm_medium=readme&utm_campaign=cli)
|
|
24
|
+
Удобнее читать глазами? Всё то же самое есть на [giftsofprometheus.com](https://giftsofprometheus.com/?utm_source=github&utm_medium=readme&utm_campaign=cli): [подбор докладов за минуту](https://giftsofprometheus.com/welcome?utm_source=github&utm_medium=readme&utm_campaign=cli), [персональная лента](https://giftsofprometheus.com/for-you?utm_source=github&utm_medium=readme&utm_campaign=cli) [спикеры](https://giftsofprometheus.com/speakers?utm_source=github&utm_medium=readme&utm_campaign=cli), [статьи об AI-агентах](https://giftsofprometheus.com/articles?utm_source=github&utm_medium=readme&utm_campaign=cli) и [календарь AI-конференций, митапов и хакатонов](https://giftsofprometheus.com/events?utm_source=github&utm_medium=readme&utm_campaign=cli).
|
|
25
25
|
|
|
26
26
|
## Установка
|
|
27
27
|
|
|
@@ -91,7 +91,7 @@ npx skills add giftsofprometheus/giftsofprometheus-cli
|
|
|
91
91
|
|
|
92
92
|
## Что есть в каталоге
|
|
93
93
|
|
|
94
|
-
**Конференции:** [AI Engineer World's Fair 2026](https://giftsofprometheus.com/events/ai-engineer-world-s-fair-2026?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer World's Fair 2025](https://giftsofprometheus.com/events/ai-engineer-world-s-fair-2025?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer Europe 2026](https://giftsofprometheus.com/events/ai-engineer-europe-2026?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer World's Fair 2024](https://giftsofprometheus.com/events/ai-engineer-world-s-fair-2024?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer Code 2025](https://giftsofprometheus.com/events/ai-engineer-code-2025?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer Summit 2025](https://giftsofprometheus.com/events/ai-engineer-summit-2025?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer Summit 2023](https://giftsofprometheus.com/events/ai-engineer-summit-2023?utm_source=github&utm_medium=readme&utm_campaign=cli), [BAAI Conference 2026 · 北京智源大会](https://giftsofprometheus.com/events/baai-conference-2026?utm_source=github&utm_medium=readme&utm_campaign=cli), [Apsara Conference 2026 · 云栖大会](https://giftsofprometheus.com/events/apsara-conference-2026?utm_source=github&utm_medium=readme&utm_campaign=cli).
|
|
94
|
+
**Конференции:** [AI Engineer World's Fair 2026](https://giftsofprometheus.com/events/ai-engineer-world-s-fair-2026?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer World's Fair 2025](https://giftsofprometheus.com/events/ai-engineer-world-s-fair-2025?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer Europe 2026](https://giftsofprometheus.com/events/ai-engineer-europe-2026?utm_source=github&utm_medium=readme&utm_campaign=cli), [Agentic Dev Conf 2026](https://giftsofprometheus.com/events/agentic-dev-conf-2026?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer Code 2026](https://giftsofprometheus.com/events/ai-engineer-code-2026?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer New York 2026](https://giftsofprometheus.com/events/ai-engineer-new-york-2026?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer NYC 2026 Online Talks](https://giftsofprometheus.com/events/ai-engineer-nyc-2026-online-talks?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer World's Fair 2024](https://giftsofprometheus.com/events/ai-engineer-world-s-fair-2024?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer Code 2025](https://giftsofprometheus.com/events/ai-engineer-code-2025?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer Summit 2025](https://giftsofprometheus.com/events/ai-engineer-summit-2025?utm_source=github&utm_medium=readme&utm_campaign=cli), [AI Engineer Summit 2023](https://giftsofprometheus.com/events/ai-engineer-summit-2023?utm_source=github&utm_medium=readme&utm_campaign=cli), [BAAI Conference 2026 · 北京智源大会](https://giftsofprometheus.com/events/baai-conference-2026?utm_source=github&utm_medium=readme&utm_campaign=cli), [Apsara Conference 2026 · 云栖大会](https://giftsofprometheus.com/events/apsara-conference-2026?utm_source=github&utm_medium=readme&utm_campaign=cli).
|
|
95
95
|
|
|
96
96
|
**Темы:**
|
|
97
97
|
|
|
@@ -109,7 +109,7 @@ npx skills add giftsofprometheus/giftsofprometheus-cli
|
|
|
109
109
|
|
|
110
110
|
## Команды
|
|
111
111
|
|
|
112
|
-
С флагом `--json` любая команда печатает компактный JSON
|
|
112
|
+
Без флагов команды печатают текст для человека: списки докладов с номерами и ссылками, транскрипт с главами и таймкодами, подсказку со следующей командой. С флагом `--json` любая команда печатает компактный JSON: так CLI вызывают агенты. Ошибка тогда выглядит как `{"error":{"message","status","code","nextStep"}}`, а код выхода — 1: `code` и `nextStep` приходят от сервиса, когда он их знает. После обрыва соединения или ответа 502, 503 или 504 от прокси CLI сам повторяет запрос два раза.
|
|
113
113
|
|
|
114
114
|
| Команда | Что делает | Аккаунт |
|
|
115
115
|
|---|---|---|
|
|
@@ -118,18 +118,22 @@ npx skills add giftsofprometheus/giftsofprometheus-cli
|
|
|
118
118
|
| `talks list [--page n]` | Каталог по страницам | |
|
|
119
119
|
| `talks get <slug-или-id>` | Доклад с описанием, спикерами (компания и должность), темами и видео | |
|
|
120
120
|
| `talks content <slug-или-id> [--rec-id UUID] [--from время] [--to время] [--outline]` | Транскрипт на языке доклада: целиком, отрезок (`--from 12:30 --to 18:00`) или только спикеры и главы (`--outline`) | ✓ |
|
|
121
|
+
| `talks similar <slug-или-id>` | До четырёх похожих докладов, у каждого причина | |
|
|
122
|
+
| `talks react <slug-или-id> like\|dislike\|not-interested\|clear [--rec-id UUID]` | Отметить, понравился ли доклад; учитывается в подборке | ✓ |
|
|
121
123
|
| `favorites list [--page n] [--limit n]` | Ваше избранное | ✓ |
|
|
122
124
|
| `favorites add <slug-или-id>` / `remove` | Добавить в избранное или убрать | ✓ |
|
|
123
125
|
| `profile get` | Ваши интересы и текущая задача | ✓ |
|
|
124
126
|
| `profile update [--interest тема=уровень] [--remove-interest тема] [--query-text текст]` | Изменить интересы (`high`, `interested`, `not_interested`) или текущую задачу; остальное не меняется | ✓ |
|
|
125
127
|
| `feed` | Подборка по вашему профилю | ✓ |
|
|
126
|
-
| `request <путь>` | GET-запрос только на чтение к `/api/knowledge/…` или `/api/account
|
|
128
|
+
| `request <путь>` | GET-запрос только на чтение к `/api/knowledge/…` или `/api/account/…`; печатает ответ сервиса как JSON | ✓ |
|
|
127
129
|
| `onboarding topics` | Темы для выбора интересов | |
|
|
128
130
|
| `onboarding deck [--interest тема=уровень] [--query-text текст]` | Новый черновик по темам (`interested`, `not_interested`) и до 8 пронумерованных докладов для оценки | |
|
|
129
131
|
| `onboarding react <номер>=like\|dislike\|skip…` | Оценить доклады из колоды по номерам и получить рекомендации, к которым они ведут | |
|
|
130
132
|
| `onboarding finish [--query-text текст]` | Сохранить черновик в аккаунт | ✓ |
|
|
131
133
|
| `login [--start\|--wait]`, `logout`, `whoami`, `doctor` | Вход, выход, текущий аккаунт, проверка настройки. `login --start` сразу печатает ссылку и код, `login --wait` ждёт подтверждения | |
|
|
132
134
|
| `skill [--path]` | Skill для агента | |
|
|
135
|
+
| `skill update [--force]` | Обновить установленные копии skill до версии CLI | |
|
|
136
|
+
| `skill personalize --file <путь>` | Добавить ваши темы в описание skill | ✓ |
|
|
133
137
|
|
|
134
138
|
## Настройки
|
|
135
139
|
|
|
@@ -137,6 +141,7 @@ npx skills add giftsofprometheus/giftsofprometheus-cli
|
|
|
137
141
|
|---|---|---|
|
|
138
142
|
| `GIFTSOFPROMETHEUS_URL` | `https://giftsofprometheus.com` | Адрес сервиса. HTTP без TLS разрешён только для `localhost` |
|
|
139
143
|
| `XDG_CONFIG_HOME` | `~/.config` | Где хранится сессия; относительный путь игнорируется |
|
|
144
|
+
| `NO_COLOR` | не задана | Любое значение отключает жирный и приглушённый текст в выводе |
|
|
140
145
|
|
|
141
146
|
## Разработка
|
|
142
147
|
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,8 @@ import { randomUUID } from 'node:crypto';
|
|
|
9
9
|
import { createRequire } from 'node:module';
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
11
|
import { mergeSkill, newerVersion, personalDescription, skillDescription, skillHash, tailTopics } from './skill-files.js';
|
|
12
|
+
import * as text from './render.js';
|
|
13
|
+
import { printable } from './render.js';
|
|
12
14
|
const { version } = z.object({ version: z.string() }).parse(createRequire(import.meta.url)('../package.json'));
|
|
13
15
|
const program = new Command();
|
|
14
16
|
const base = (process.env.GIFTSOFPROMETHEUS_URL || 'https://giftsofprometheus.com').replace(/\/$/, '');
|
|
@@ -58,9 +60,6 @@ class ApiError extends Error {
|
|
|
58
60
|
this.nextStep = nextStep;
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
|
-
// Server text reaches a terminal: remove control characters so a response cannot inject ANSI or OSC escape sequences
|
|
62
|
-
// oxlint-disable-next-line no-control-regex -- matching control characters is the purpose of this function
|
|
63
|
-
const printable = (value) => value.replace(/[\u0000-\u001f\u007f-\u009f]/g, '');
|
|
64
63
|
// A fresh 0600 file renamed into place: a secret never lands in an existing file with loose permissions or behind a symlink
|
|
65
64
|
async function saveJson(file, value) {
|
|
66
65
|
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
@@ -88,6 +87,8 @@ async function readState(file, schema) {
|
|
|
88
87
|
return null;
|
|
89
88
|
}
|
|
90
89
|
}
|
|
90
|
+
// Set when a command returns a response it could not check; the text form then shows it as JSON instead of reading it
|
|
91
|
+
let unchecked = false;
|
|
91
92
|
async function request(path, method = 'GET', body, authenticated = true) {
|
|
92
93
|
if (!path.startsWith('/') || path.includes('\\'))
|
|
93
94
|
throw new ApiError(`Invalid API path: pass a full path starting with ${publicApi.join(', ')}, e.g. /api/knowledge/profile`);
|
|
@@ -143,17 +144,42 @@ async function request(path, method = 'GET', body, authenticated = true) {
|
|
|
143
144
|
// Two repeats after a gateway error or a connection failure: a deploy switch or a dropped keep-alive connection passes in seconds
|
|
144
145
|
const RETRY_DELAYS_MS = [500, 1500];
|
|
145
146
|
const GATEWAY_STATUSES = new Set([502, 503, 504]);
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
/** A renderer that checks the shape first, so a service change shows the JSON instead of crashing the command */
|
|
148
|
+
const view = (schema, format) => (value, ...args) => {
|
|
149
|
+
const parsed = schema.safeParse(value);
|
|
150
|
+
try {
|
|
151
|
+
return parsed.success ? format(parsed.data, ...args) : null;
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
// Next-step hints go to stderr after the output, so a person reads them last and stdout stays the result
|
|
158
|
+
const hints = [];
|
|
159
|
+
/** `human` replaces the line for a person; null shows nothing, when the text output already says it */
|
|
160
|
+
const hint = (json, human = json) => hints.push({ json, human: human === null ? null : printable(human) });
|
|
161
|
+
// JSON.stringify escapes C0 control characters but not DEL and C1; a person's terminal would interpret those
|
|
162
|
+
// oxlint-disable-next-line no-control-regex -- matching control characters is the purpose of this expression
|
|
163
|
+
const escapeC1 = (json) => json.replace(/[\u007f-\u009f]/g, c => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`);
|
|
164
|
+
// With --json: one JSON document for agents. Without it: text for a person, or indented JSON where a command has no text form
|
|
165
|
+
function out(value, render, args) {
|
|
166
|
+
const json = program.opts().json;
|
|
167
|
+
console.log(json ? JSON.stringify(value) : ((unchecked ? null : render?.(value, ...args)) ?? escapeC1(JSON.stringify(value, null, 2))));
|
|
168
|
+
for (const line of hints.splice(0)) {
|
|
169
|
+
if (json)
|
|
170
|
+
console.error(line.json);
|
|
171
|
+
else if (line.human !== null)
|
|
172
|
+
console.error(text.dim(line.human));
|
|
173
|
+
}
|
|
148
174
|
}
|
|
149
175
|
// What an agent must do on 401. It is in the error itself, so an agent without the skill also knows to sign the user in
|
|
150
176
|
const SIGN_IN_STEPS = 'Sign the user in: run `login --start` with the same launcher and --json, give the user verificationUrl and userCode in one line, run `login --wait` (it waits for the confirmation), then repeat this command.';
|
|
151
177
|
const interactive = () => !program.opts().json && Boolean(process.stdin.isTTY && process.stderr.isTTY);
|
|
152
|
-
function run(fn) {
|
|
178
|
+
function run(fn, render) {
|
|
153
179
|
return async (...args) => {
|
|
154
180
|
try {
|
|
155
181
|
try {
|
|
156
|
-
out(await fn(...args));
|
|
182
|
+
out(await fn(...args), render, args);
|
|
157
183
|
}
|
|
158
184
|
catch (e) {
|
|
159
185
|
// A person in a terminal is taken through the browser confirmation and gets the answer, instead of an error to act on
|
|
@@ -162,15 +188,18 @@ function run(fn) {
|
|
|
162
188
|
const device = await startLogin();
|
|
163
189
|
console.error(`Sign-in needed. Open ${verificationUrl(device.userCode)} and confirm the code ${device.userCode}`);
|
|
164
190
|
await waitLogin(device);
|
|
165
|
-
|
|
191
|
+
console.error(text.signedIn({ signedIn: true }));
|
|
192
|
+
out(await fn(...args), render, args);
|
|
166
193
|
}
|
|
167
194
|
}
|
|
168
195
|
catch (e) {
|
|
196
|
+
hints.length = 0;
|
|
169
197
|
const message = e instanceof Error ? e.message : 'Unknown error';
|
|
170
198
|
const status = e instanceof ApiError ? e.status : 1;
|
|
171
199
|
const code = e instanceof ApiError ? e.code : undefined;
|
|
172
|
-
// On 401 the CLI's own steps win: they say how to sign in from an agent, which the service cannot know
|
|
173
|
-
const
|
|
200
|
+
// On 401 the CLI's own steps win: they say how to sign in from an agent, which the service cannot know. A person runs login
|
|
201
|
+
const signIn = program.opts().json ? SIGN_IN_STEPS : `sign in with ${cmd()} login, then repeat this command`;
|
|
202
|
+
const nextStep = status === 401 ? signIn : e instanceof ApiError ? e.nextStep : undefined;
|
|
174
203
|
if (program.opts().json)
|
|
175
204
|
console.log(JSON.stringify({ error: { message, status, ...(code ? { code } : {}), ...(nextStep ? { nextStep } : {}) } }));
|
|
176
205
|
else {
|
|
@@ -195,6 +224,18 @@ const updateCommand = /[\\/]pnpm[\\/]global[\\/]/.test(packageRoot)
|
|
|
195
224
|
: /[\\/]\.bun[\\/]install[\\/]global[\\/]/.test(packageRoot)
|
|
196
225
|
? 'bun add -g @giftsofprometheus/cli@latest'
|
|
197
226
|
: 'npm install -g @giftsofprometheus/cli@latest';
|
|
227
|
+
// The command a person typed, so a hint can be pasted back as is
|
|
228
|
+
const detectedLauncher = /[\\/]_npx[\\/]/.test(packageRoot)
|
|
229
|
+
? 'npx @giftsofprometheus/cli'
|
|
230
|
+
: /[\\/]bunx-[^\\/]*[\\/]/.test(packageRoot)
|
|
231
|
+
? 'bunx @giftsofprometheus/cli'
|
|
232
|
+
: /[\\/]dlx[\\/]/.test(packageRoot)
|
|
233
|
+
? 'pnpm dlx @giftsofprometheus/cli'
|
|
234
|
+
: 'giftsofprometheus';
|
|
235
|
+
// --json output keeps the commands it has always named: agents follow them, and the skill says how to run the CLI
|
|
236
|
+
const jsonLauncher = /[\\/]_npx[\\/]/.test(packageRoot) ? 'npx @giftsofprometheus/cli' : 'giftsofprometheus';
|
|
237
|
+
const cmd = () => (program.opts().json ? jsonLauncher : detectedLauncher);
|
|
238
|
+
const context = { launcher: detectedLauncher, base };
|
|
198
239
|
const shortPath = (path) => (path.startsWith(homedir()) ? '~' + path.slice(homedir().length) : path);
|
|
199
240
|
async function fetchLatest() {
|
|
200
241
|
try {
|
|
@@ -376,6 +417,8 @@ async function login(options) {
|
|
|
376
417
|
return loginPrompt(device);
|
|
377
418
|
}
|
|
378
419
|
console.error(`Open ${verificationUrl(device.userCode)} and confirm the code ${device.userCode}`);
|
|
420
|
+
if (!program.opts().json)
|
|
421
|
+
console.error(text.dim('Waiting for the confirmation…'));
|
|
379
422
|
return waitLogin(device);
|
|
380
423
|
}
|
|
381
424
|
async function waitLogin(device) {
|
|
@@ -437,7 +480,10 @@ program
|
|
|
437
480
|
.description('Authorize this CLI in a browser')
|
|
438
481
|
.option('--start', 'print the confirmation link and code, then exit; finish with login --wait')
|
|
439
482
|
.option('--wait', 'wait for the confirmation of a login started with --start')
|
|
440
|
-
.action(run(login
|
|
483
|
+
.action(run(login, value => {
|
|
484
|
+
const prompt = text.loginPromptSchema.safeParse(value);
|
|
485
|
+
return prompt.success ? text.loginPrompt(context, prompt.data) : view(text.signedInSchema, text.signedIn)(value);
|
|
486
|
+
}));
|
|
441
487
|
program
|
|
442
488
|
.command('logout')
|
|
443
489
|
.description('Revoke this CLI session')
|
|
@@ -460,11 +506,11 @@ program
|
|
|
460
506
|
}
|
|
461
507
|
await unlink(credentials).catch(() => { });
|
|
462
508
|
return { signedOut: true };
|
|
463
|
-
}));
|
|
509
|
+
}, () => 'Signed out.'));
|
|
464
510
|
program
|
|
465
511
|
.command('whoami')
|
|
466
512
|
.description('Show the current account')
|
|
467
|
-
.action(run(() => request('/api/account/me')));
|
|
513
|
+
.action(run(() => request('/api/account/me'), view(text.accountSchema, text.account)));
|
|
468
514
|
program
|
|
469
515
|
.command('doctor')
|
|
470
516
|
.description('Check configuration, server and authorization')
|
|
@@ -493,7 +539,7 @@ program
|
|
|
493
539
|
skills: skills.map(skill => ({ path: skill.path, status: skill.status, version: skill.version })),
|
|
494
540
|
nextStep: !reachable ? 'Check GIFTSOFPROMETHEUS_URL and server availability' : !authenticated ? 'Run giftsofprometheus login' : null,
|
|
495
541
|
};
|
|
496
|
-
}));
|
|
542
|
+
}, view(text.doctorSchema, value => text.doctor(context, value))));
|
|
497
543
|
program
|
|
498
544
|
.command('ask')
|
|
499
545
|
.description('Find relevant passages in talk transcripts')
|
|
@@ -512,7 +558,7 @@ program
|
|
|
512
558
|
if (options.perTalk !== undefined)
|
|
513
559
|
params.set('perTalk', number.parse(options.perTalk));
|
|
514
560
|
return request(`/api/knowledge/passages?${params}`);
|
|
515
|
-
}));
|
|
561
|
+
}, view(text.passagesSchema, value => text.passages(context, value))));
|
|
516
562
|
/** The service takes one to three texts of up to 200 characters; a plain message tells an agent what to drop */
|
|
517
563
|
function askQueries(values) {
|
|
518
564
|
const queries = values.map(value => value.trim());
|
|
@@ -535,10 +581,12 @@ const contentShape = z.object({ transcript: z.array(z.object({ startMs: z.number
|
|
|
535
581
|
const talks = program.command('talks').description('Browse talks');
|
|
536
582
|
talks
|
|
537
583
|
.command('list')
|
|
584
|
+
.description('List published talks, page by page')
|
|
538
585
|
.option('--page <page>', 'page number', '1')
|
|
539
|
-
.action(run((options) => request(`/api/knowledge/talks?page=${encodeURIComponent(options.page)}`, 'GET', undefined, false)));
|
|
586
|
+
.action(run((options) => request(`/api/knowledge/talks?page=${encodeURIComponent(options.page)}`, 'GET', undefined, false), view(text.pageSchema, value => text.talkPage(context, value, page => `talks list --page ${page}`, 'No talks on this page.'))));
|
|
540
587
|
talks
|
|
541
588
|
.command('search')
|
|
589
|
+
.description('Search published talks by title, summary, speaker or topic')
|
|
542
590
|
.argument('<query>')
|
|
543
591
|
.option('--page <page>', 'page number', '1')
|
|
544
592
|
.action(run((query, options) => {
|
|
@@ -546,21 +594,24 @@ talks
|
|
|
546
594
|
if (!query.trim())
|
|
547
595
|
throw new ApiError('Empty search query. To browse the catalog, use: giftsofprometheus talks list');
|
|
548
596
|
return request(`/api/knowledge/talks?q=${encodeURIComponent(query)}&page=${encodeURIComponent(options.page)}`);
|
|
549
|
-
})
|
|
550
|
-
//
|
|
551
|
-
|
|
597
|
+
}, view(text.pageSchema, (value, query) => text.talkPage(context,
|
|
598
|
+
// Search is public: with an expired session the service answers it as anonymous and accepts that recId only from
|
|
599
|
+
// the site, and the response does not say which it was. A person opens a found talk without one
|
|
600
|
+
{ ...value, recId: undefined }, page => `talks search --page ${page} -- ${shellQuote(query)}`, `Nothing found. Search the transcripts instead: ${cmd()} ask -- ${shellQuote(query)}`))));
|
|
552
601
|
talks
|
|
553
602
|
.command('get')
|
|
603
|
+
.description('Show one talk: summary, speakers, topics and links')
|
|
554
604
|
.argument('<slug-or-id>')
|
|
555
605
|
.action(run(async (id) => {
|
|
556
606
|
const talk = await resolveTalk(id);
|
|
557
607
|
// The next step after the summary is the transcript; stdout stays the talk's JSON
|
|
558
608
|
const signedIn = Boolean(await stored());
|
|
559
|
-
|
|
609
|
+
hint(`Next: the full transcript — ${cmd()} talks content ${talk.slug}${signedIn ? '' : ' (asks you to sign in in the browser first)'}`);
|
|
560
610
|
return talk;
|
|
561
|
-
}));
|
|
611
|
+
}, view(text.talkSchema, value => text.talkDetails(context, value))));
|
|
562
612
|
talks
|
|
563
613
|
.command('content')
|
|
614
|
+
.description('Read the transcript with chapters and timestamps; requires login')
|
|
564
615
|
.argument('<slug-or-id>')
|
|
565
616
|
.option('--rec-id <recId>', 'recId of the list the talk came from (feed, search or similar)')
|
|
566
617
|
.option('--from <time>', 'keep transcript segments that start at or after this time: seconds, m:ss or h:mm:ss')
|
|
@@ -575,7 +626,13 @@ talks
|
|
|
575
626
|
const talk = await resolveTalk(id);
|
|
576
627
|
const raw = await request(`/api/knowledge/talks/${encodeURIComponent(String(talk.slug))}/content${query}`, 'POST');
|
|
577
628
|
const whole = !options.outline && options.from === undefined && options.to === undefined;
|
|
578
|
-
const
|
|
629
|
+
const parsed = whole ? null : contentShape.safeParse(raw);
|
|
630
|
+
if (parsed && !parsed.success) {
|
|
631
|
+
if (program.opts().json)
|
|
632
|
+
throw parsed.error;
|
|
633
|
+
unchecked = true;
|
|
634
|
+
}
|
|
635
|
+
const content = parsed?.success ? parsed.data : null;
|
|
579
636
|
// A range keeps the chapters, so an agent still sees where it is in the talk
|
|
580
637
|
const result = content === null
|
|
581
638
|
? raw
|
|
@@ -583,11 +640,12 @@ talks
|
|
|
583
640
|
? { ...content, transcript: undefined, transcriptSegments: content.transcript.length }
|
|
584
641
|
: { ...content, transcript: content.transcript.filter(segment => segment.startMs >= from && segment.startMs < to) };
|
|
585
642
|
// After the transcript: talks like this one, or saving it if the user found it useful
|
|
586
|
-
|
|
643
|
+
hint(`Next: similar talks — ${cmd()} talks similar ${talk.slug}; save it if the user asks — ${cmd()} favorites add ${talk.slug}`, `Next: similar talks — ${cmd()} talks similar ${talk.slug}; save to favorites — ${cmd()} favorites add ${talk.slug}${options.recId ? ` --rec-id ${options.recId}` : ''}`);
|
|
587
644
|
return result;
|
|
588
|
-
}));
|
|
645
|
+
}, (value, _, options) => view(options.outline ? text.outlineSchema : text.contentSchema, text.transcript)(value)));
|
|
589
646
|
talks
|
|
590
647
|
.command('similar')
|
|
648
|
+
.description('Up to four talks like this one, each with a reason')
|
|
591
649
|
.argument('<slug-or-id>')
|
|
592
650
|
.action(run(async (id) => {
|
|
593
651
|
const talk = await resolveTalk(id);
|
|
@@ -597,9 +655,9 @@ talks
|
|
|
597
655
|
.loose()
|
|
598
656
|
.parse(await request(`/api/knowledge/talks/${encodeURIComponent(String(talk.slug))}/similar`));
|
|
599
657
|
if (result.recId)
|
|
600
|
-
|
|
658
|
+
hint(`Next: open one with ${cmd()} talks content <slug> --rec-id ${result.recId}`, null);
|
|
601
659
|
return result;
|
|
602
|
-
}));
|
|
660
|
+
}, view(text.listSchema, value => text.talkList(context, value, 'No similar talks yet.'))));
|
|
603
661
|
const reactionTypes = { like: 'like', dislike: 'dislike', 'not-interested': 'not_interested', clear: 'clear_reaction' };
|
|
604
662
|
talks
|
|
605
663
|
.command('react')
|
|
@@ -610,24 +668,30 @@ talks
|
|
|
610
668
|
.action(run(async (id, reaction, options) => {
|
|
611
669
|
const type = z.enum(['like', 'dislike', 'not-interested', 'clear']).parse(reaction);
|
|
612
670
|
return event(id, reactionTypes[type], options.recId);
|
|
613
|
-
}));
|
|
671
|
+
}, (_, id, reaction) => reaction === 'clear' ? `Cleared the reaction to ${printable(id)}.` : `Recorded: ${printable(reaction)} for ${printable(id)}.`));
|
|
614
672
|
const favorites = program.command('favorites').description('Manage bookmarks');
|
|
615
673
|
favorites
|
|
616
674
|
.command('list')
|
|
675
|
+
.description('List saved talks')
|
|
617
676
|
.option('--page <page>', 'page number', '1')
|
|
618
677
|
.option('--limit <limit>', 'page size, max 50', '20')
|
|
619
|
-
.action(run((o) => request(`/api/knowledge/favorites?page=${encodeURIComponent(o.page)}&limit=${encodeURIComponent(o.limit)}`)));
|
|
678
|
+
.action(run((o) => request(`/api/knowledge/favorites?page=${encodeURIComponent(o.page)}&limit=${encodeURIComponent(o.limit)}`), view(text.pageSchema, (value, o) => text.talkPage(context, value, page => `favorites list --page ${page} --limit ${shellQuote(o.limit)}`, `No favorites yet. Save a talk with: ${cmd()} favorites add <slug>`))));
|
|
620
679
|
favorites
|
|
621
680
|
.command('add')
|
|
681
|
+
.description('Save a talk to favorites')
|
|
622
682
|
.argument('<slug-or-id>')
|
|
623
683
|
.option('--rec-id <recId>', 'recId of the list the talk came from')
|
|
624
|
-
.action(run((id, options) => event(id, 'bookmark', options.recId)));
|
|
684
|
+
.action(run((id, options) => event(id, 'bookmark', options.recId), (_, id) => `Saved ${printable(id)} to favorites.`));
|
|
625
685
|
favorites
|
|
626
686
|
.command('remove')
|
|
687
|
+
.description('Remove a talk from favorites')
|
|
627
688
|
.argument('<slug-or-id>')
|
|
628
|
-
.action(run((id) => event(id, 'unbookmark')));
|
|
689
|
+
.action(run((id) => event(id, 'unbookmark'), (_, id) => `Removed ${printable(id)} from favorites.`));
|
|
629
690
|
const profile = program.command('profile').description('Read or update interests');
|
|
630
|
-
profile
|
|
691
|
+
profile
|
|
692
|
+
.command('get')
|
|
693
|
+
.description('Show interests and the current task')
|
|
694
|
+
.action(run(() => request('/api/knowledge/profile'), view(text.profileSchema, text.profile)));
|
|
631
695
|
const levels = z.enum(['high', 'interested', 'not_interested']);
|
|
632
696
|
// The service omits the slug of a deleted topic; such interests are dropped on update
|
|
633
697
|
const currentProfile = z.object({ interests: z.array(z.object({ topic: z.string().optional(), level: levels })), queryText: z.string() });
|
|
@@ -656,7 +720,7 @@ profile
|
|
|
656
720
|
.option('--interest <topic=level>', 'set a topic to high, interested or not_interested; repeatable', collect, [])
|
|
657
721
|
.option('--remove-interest <topic>', 'remove a topic; repeatable', collect, [])
|
|
658
722
|
.option('--query-text <text>', 'replace the current task; an empty string clears it')
|
|
659
|
-
.action(run(updateProfile));
|
|
723
|
+
.action(run(updateProfile, () => `Profile updated. See it with: ${cmd()} profile get`));
|
|
660
724
|
const draftLevels = z.enum(['interested', 'not_interested']);
|
|
661
725
|
const reactions = z.enum(['like', 'dislike']);
|
|
662
726
|
const draftSchema = z.object({
|
|
@@ -753,27 +817,27 @@ onboarding
|
|
|
753
817
|
.description('List topics to match interests against; no account needed')
|
|
754
818
|
.action(run(async () => z
|
|
755
819
|
.object({ topics: z.array(z.object({ slug: z.string(), title: z.string(), section: z.string().nullable() })) })
|
|
756
|
-
.parse(await request('/api/knowledge/topics', 'GET', undefined, false))));
|
|
820
|
+
.parse(await request('/api/knowledge/topics', 'GET', undefined, false)), view(text.topicsSchema, text.topicTree)));
|
|
757
821
|
onboarding
|
|
758
822
|
.command('deck')
|
|
759
823
|
.description('Start a new draft from topic choices and get up to 8 numbered talks to judge; no account needed')
|
|
760
824
|
.option('--interest <topic=level>', 'set a topic to interested or not_interested; repeatable', collect, [])
|
|
761
825
|
.option('--query-text <text>', 'what the user is working on now; saved with the draft on finish')
|
|
762
|
-
.action(run(onboardingDeck));
|
|
826
|
+
.action(run(onboardingDeck, view(text.deckSchema, value => text.deck(context, value))));
|
|
763
827
|
onboarding
|
|
764
828
|
.command('react')
|
|
765
829
|
.description('Judge deck cards by number and get the recommendations they lead to; no account needed')
|
|
766
830
|
.argument('<answers...>', 'card=like|dislike|skip, e.g. 1=like 3=dislike')
|
|
767
|
-
.action(run(onboardingReact));
|
|
831
|
+
.action(run(onboardingReact, view(text.previewSchema, value => text.preview(context, value))));
|
|
768
832
|
onboarding
|
|
769
833
|
.command('finish')
|
|
770
834
|
.description('Save the draft to the signed-in account')
|
|
771
835
|
.option('--query-text <text>', 'replace the query text kept in the draft')
|
|
772
|
-
.action(run(onboardingFinish));
|
|
836
|
+
.action(run(onboardingFinish, () => `Saved to your account. Recommendations: ${cmd()} feed`));
|
|
773
837
|
program
|
|
774
838
|
.command('feed')
|
|
775
839
|
.description('Get personalized recommendations')
|
|
776
|
-
.action(run(() => request('/api/knowledge/feed')));
|
|
840
|
+
.action(run(() => request('/api/knowledge/feed'), view(text.listSchema, value => text.talkList(context, value, `No recommendations yet. Build a profile with: ${cmd()} onboarding topics`))));
|
|
777
841
|
program
|
|
778
842
|
.command('request')
|
|
779
843
|
.description('Make an authenticated GET request to a Knowledge API path, e.g. /api/knowledge/profile')
|
|
@@ -790,7 +854,7 @@ skill
|
|
|
790
854
|
.command('update')
|
|
791
855
|
.description('Replace installed copies of the skill that are older than this CLI; a custom description is kept')
|
|
792
856
|
.option('--force', 'also replace copies that were edited by hand')
|
|
793
|
-
.action(run((options) => updateSkills(Boolean(options.force))));
|
|
857
|
+
.action(run((options) => updateSkills(Boolean(options.force)), view(text.skillUpdateSchema, value => text.skillUpdate(context, value))));
|
|
794
858
|
const profileTopics = z.object({
|
|
795
859
|
interests: z.array(z.object({ topic: z.string().optional(), level: z.enum(['high', 'interested', 'not_interested']) })),
|
|
796
860
|
topics: z.array(z.object({ slug: z.string(), title: z.string(), section: z.string().nullable() })),
|
|
@@ -844,7 +908,7 @@ async function personalizeSkill(o) {
|
|
|
844
908
|
path: file,
|
|
845
909
|
topics,
|
|
846
910
|
reason: e instanceof Error ? e.message : 'Write failed',
|
|
847
|
-
command: `${
|
|
911
|
+
command: `${cmd()} skill personalize --file ${shellQuote(file)}`,
|
|
848
912
|
};
|
|
849
913
|
}
|
|
850
914
|
return { personalized: true, changed: true, path: file, topics };
|
|
@@ -853,7 +917,7 @@ skill
|
|
|
853
917
|
.command('personalize')
|
|
854
918
|
.description("Add the user's topics (ten words at most) to the description of the skill copy at --file; requires login")
|
|
855
919
|
.requiredOption('--file <path>', 'SKILL.md of the loaded skill, or its folder')
|
|
856
|
-
.action(run(personalizeSkill));
|
|
920
|
+
.action(run(personalizeSkill, view(text.personalizeSchema, text.personalize)));
|
|
857
921
|
// The daily check runs after the command, so it never delays or breaks its output; doctor and skill report the same state themselves
|
|
858
922
|
let skipNotice = false;
|
|
859
923
|
program.hook('preAction', (_, action) => {
|
package/dist/render.js
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
// Text a person reads in a terminal. With --json the CLI prints the service's JSON instead; that output is the agents' contract
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
// Server text reaches a terminal: remove control characters so a response cannot inject ANSI or OSC escape sequences
|
|
4
|
+
// oxlint-disable-next-line no-control-regex -- matching control characters is the purpose of this function
|
|
5
|
+
export const printable = (value) => value.replace(/[\u0000-\u001f\u007f-\u009f]/g, '');
|
|
6
|
+
/** Like printable, but keeps line breaks: talk summaries are Markdown paragraphs and lists */
|
|
7
|
+
const clean = (value) => value
|
|
8
|
+
.split(/\r?\n/)
|
|
9
|
+
.map(line => printable(line).replace(/\*\*(.+?)\*\*/g, (_, inner) => bold(inner)))
|
|
10
|
+
.join('\n');
|
|
11
|
+
const color = Boolean(process.stdout.isTTY) && !process.env.NO_COLOR && process.env.TERM !== 'dumb';
|
|
12
|
+
const style = (code) => (text) => (color ? `\u001b[${code}m${text}\u001b[0m` : text);
|
|
13
|
+
export const bold = style('1');
|
|
14
|
+
export const dim = style('2');
|
|
15
|
+
/** 75 s → 1:15, 3725 s → 1:02:05 */
|
|
16
|
+
export function clock(ms) {
|
|
17
|
+
const total = Math.max(0, Math.floor(ms / 1000));
|
|
18
|
+
const [h, m, s] = [Math.floor(total / 3600), Math.floor((total % 3600) / 60), total % 60];
|
|
19
|
+
const two = (n) => String(n).padStart(2, '0');
|
|
20
|
+
return h ? `${h}:${two(m)}:${two(s)}` : `${m}:${two(s)}`;
|
|
21
|
+
}
|
|
22
|
+
const minutes = (ms) => `${Math.max(1, Math.round(ms / 60_000))} min`;
|
|
23
|
+
const days = (seconds) => {
|
|
24
|
+
const n = Math.round(seconds / 86_400);
|
|
25
|
+
return n >= 1 ? `${n} day${n === 1 ? '' : 's'}` : `${Math.max(1, Math.round(seconds / 3600))} h`;
|
|
26
|
+
};
|
|
27
|
+
const speaker = z.object({ name: z.string(), organization: z.string().nullish(), jobTitle: z.string().nullish() });
|
|
28
|
+
export const talkSchema = z.object({
|
|
29
|
+
slug: z.string(),
|
|
30
|
+
title: z.string(),
|
|
31
|
+
description: z.string().nullish(),
|
|
32
|
+
speakers: z.array(speaker).default([]),
|
|
33
|
+
topics: z.array(z.object({ title: z.string() })).default([]),
|
|
34
|
+
event: z.object({ name: z.string() }).nullish(),
|
|
35
|
+
durationMs: z.number().nullish(),
|
|
36
|
+
publication: z.object({ url: z.string().nullish() }).nullish(),
|
|
37
|
+
reason: z.string().nullish(),
|
|
38
|
+
bookmarked: z.boolean().nullish(),
|
|
39
|
+
});
|
|
40
|
+
const talkUrl = (context, slug) => `${context.base}/talks/${encodeURIComponent(slug)}`;
|
|
41
|
+
const people = (talk) => talk.speakers.map(s => (s.organization ? `${s.name} (${s.organization})` : s.name)).join(', ');
|
|
42
|
+
const meta = (talk) => [people(talk), talk.event?.name, talk.durationMs ? minutes(talk.durationMs) : null].filter(Boolean).join(' · ');
|
|
43
|
+
/** The first paragraph of the summary is its TL;DR sentence */
|
|
44
|
+
const tldr = (talk) => talk.description?.split(/\n\s*\n/)[0]?.trim() ?? '';
|
|
45
|
+
function card(context, talk, n) {
|
|
46
|
+
const lines = [`${dim(`${n}.`)} ${bold(printable(talk.title))}${talk.bookmarked ? dim(' ★ saved') : ''}`];
|
|
47
|
+
const details = meta(talk);
|
|
48
|
+
if (details)
|
|
49
|
+
lines.push(` ${dim(printable(details))}`);
|
|
50
|
+
if (tldr(talk))
|
|
51
|
+
lines.push(` ${printable(tldr(talk))}`);
|
|
52
|
+
if (talk.reason)
|
|
53
|
+
lines.push(` ${dim('Why:')} ${printable(talk.reason)}`);
|
|
54
|
+
lines.push(` ${dim(talkUrl(context, talk.slug))}`);
|
|
55
|
+
return lines.join('\n');
|
|
56
|
+
}
|
|
57
|
+
const cards = (context, items) => items.map((talk, i) => card(context, talk, i + 1)).join('\n\n');
|
|
58
|
+
const recId = z.uuid().optional();
|
|
59
|
+
/** A list with a recId attributes what the user opens or saves from it to that list */
|
|
60
|
+
const opened = (context, id) => id ? [`open one: ${context.launcher} talks content <slug> --rec-id ${id}`, `save one: ${context.launcher} favorites add <slug> --rec-id ${id}`] : [];
|
|
61
|
+
export const pageSchema = z.object({ items: z.array(talkSchema), page: z.number(), totalPages: z.number(), total: z.number().optional(), recId });
|
|
62
|
+
/** A page of talks with a hint for the next one; `next` builds the command for a page number */
|
|
63
|
+
export function talkPage(context, value, next, empty) {
|
|
64
|
+
if (!value.items.length)
|
|
65
|
+
return empty;
|
|
66
|
+
const footer = [`Page ${value.page} of ${value.totalPages}${value.total === undefined ? '' : ` · ${value.total} talks`}`];
|
|
67
|
+
if (value.page < value.totalPages)
|
|
68
|
+
footer.push(`next: ${context.launcher} ${next(value.page + 1)}`);
|
|
69
|
+
return [cards(context, value.items), '', dim(footer.join(' · ')), ...opened(context, value.recId).map(dim)].join('\n');
|
|
70
|
+
}
|
|
71
|
+
export const listSchema = z.object({ items: z.array(talkSchema), recId });
|
|
72
|
+
export function talkList(context, value, empty) {
|
|
73
|
+
return value.items.length ? [cards(context, value.items), '', ...opened(context, value.recId).map(dim)].join('\n').trimEnd() : empty;
|
|
74
|
+
}
|
|
75
|
+
export function talkDetails(context, talk) {
|
|
76
|
+
const lines = [bold(printable(talk.title))];
|
|
77
|
+
const details = [talk.event?.name, talk.durationMs ? minutes(talk.durationMs) : null].filter(Boolean).join(' · ');
|
|
78
|
+
if (details)
|
|
79
|
+
lines.push(dim(printable(details)));
|
|
80
|
+
for (const s of talk.speakers)
|
|
81
|
+
lines.push(dim(printable([s.name, s.jobTitle, s.organization].filter(Boolean).join(', '))));
|
|
82
|
+
if (talk.topics.length)
|
|
83
|
+
lines.push(dim(`Topics: ${printable(talk.topics.map(t => t.title).join(', '))}`));
|
|
84
|
+
if (talk.description)
|
|
85
|
+
lines.push('', clean(talk.description));
|
|
86
|
+
lines.push('', `${dim('Page:')} ${talkUrl(context, talk.slug)}`);
|
|
87
|
+
if (talk.publication?.url)
|
|
88
|
+
lines.push(`${dim('Video:')} ${printable(talk.publication.url)}`);
|
|
89
|
+
return lines.join('\n');
|
|
90
|
+
}
|
|
91
|
+
const chapter = z.object({ title: z.string(), startMs: z.number() });
|
|
92
|
+
const contentBase = z.object({ title: z.string(), speakers: z.array(speaker).default([]), chapters: z.array(chapter).default([]) });
|
|
93
|
+
export const contentSchema = contentBase.extend({ transcript: z.array(z.object({ startMs: z.number(), text: z.string() })) });
|
|
94
|
+
export const outlineSchema = contentBase.extend({ transcriptSegments: z.number() });
|
|
95
|
+
/** Transcript lines with a heading where each chapter starts; an outline lists the chapters only */
|
|
96
|
+
export function transcript(value) {
|
|
97
|
+
const lines = [bold(printable(value.title))];
|
|
98
|
+
const names = value.speakers.map(s => [s.name, s.jobTitle, s.organization].filter(Boolean).join(', '));
|
|
99
|
+
if (names.length)
|
|
100
|
+
lines.push(dim(printable(names.join('; '))));
|
|
101
|
+
if (!('transcript' in value)) {
|
|
102
|
+
lines.push('', ...value.chapters.map(c => `${dim(clock(c.startMs).padStart(8))} ${printable(c.title)}`));
|
|
103
|
+
lines.push('', dim(`${value.transcriptSegments} transcript segments`));
|
|
104
|
+
return lines.join('\n');
|
|
105
|
+
}
|
|
106
|
+
const chapters = [...value.chapters].sort((a, b) => a.startMs - b.startMs);
|
|
107
|
+
let next = 0;
|
|
108
|
+
for (const segment of value.transcript) {
|
|
109
|
+
let heading;
|
|
110
|
+
while (next < chapters.length && (chapters[next]?.startMs ?? Infinity) <= segment.startMs)
|
|
111
|
+
heading = chapters[next++];
|
|
112
|
+
if (heading)
|
|
113
|
+
lines.push('', bold(`## ${printable(heading.title)}`));
|
|
114
|
+
lines.push(`${dim(`[${clock(segment.startMs)}]`)} ${printable(segment.text)}`);
|
|
115
|
+
}
|
|
116
|
+
if (!value.transcript.length)
|
|
117
|
+
lines.push('', 'No transcript segments in this range.');
|
|
118
|
+
return lines.join('\n');
|
|
119
|
+
}
|
|
120
|
+
export const passagesSchema = z.object({
|
|
121
|
+
recId,
|
|
122
|
+
items: z.array(z.object({
|
|
123
|
+
talk: talkSchema,
|
|
124
|
+
passages: z.array(z.object({ startMs: z.number(), chapter: z.string().nullish(), text: z.string(), url: z.string() })),
|
|
125
|
+
})),
|
|
126
|
+
});
|
|
127
|
+
export function passages(context, value) {
|
|
128
|
+
if (!value.items.length)
|
|
129
|
+
return 'Nothing found. Try other wording or another language.';
|
|
130
|
+
return value.items
|
|
131
|
+
.map((item, i) => {
|
|
132
|
+
const lines = [`${dim(`${i + 1}.`)} ${bold(printable(item.talk.title))}`];
|
|
133
|
+
if (meta(item.talk))
|
|
134
|
+
lines.push(` ${dim(printable(meta(item.talk)))}`);
|
|
135
|
+
for (const passage of item.passages) {
|
|
136
|
+
lines.push('', ` ${dim(`[${clock(passage.startMs)}]${passage.chapter ? ` ${printable(passage.chapter)}` : ''}`)}`);
|
|
137
|
+
lines.push(` ${printable(passage.text)}`);
|
|
138
|
+
lines.push(` ${dim(printable(passage.url))}`);
|
|
139
|
+
}
|
|
140
|
+
return lines.join('\n');
|
|
141
|
+
})
|
|
142
|
+
.concat(value.recId ? [opened(context, value.recId).map(dim).join('\n')] : [])
|
|
143
|
+
.join('\n\n');
|
|
144
|
+
}
|
|
145
|
+
const topicSchema = z.object({ slug: z.string(), title: z.string(), section: z.string().nullable() });
|
|
146
|
+
export const topicsSchema = z.object({ topics: z.array(topicSchema) });
|
|
147
|
+
/** Sections first, each followed by its subtopics */
|
|
148
|
+
export function topicTree(value) {
|
|
149
|
+
const sections = value.topics.filter(t => !t.section);
|
|
150
|
+
const orphans = value.topics.filter(t => t.section && !sections.some(s => s.slug === t.section));
|
|
151
|
+
const row = (t, indent) => `${indent}${printable(t.title)} ${dim(printable(t.slug))}`;
|
|
152
|
+
const lines = [];
|
|
153
|
+
for (const section of sections) {
|
|
154
|
+
lines.push(bold(row(section, '')));
|
|
155
|
+
for (const topic of value.topics.filter(t => t.section === section.slug))
|
|
156
|
+
lines.push(row(topic, ' '));
|
|
157
|
+
lines.push('');
|
|
158
|
+
}
|
|
159
|
+
lines.push(...orphans.map(t => row(t, '')));
|
|
160
|
+
return lines.join('\n').trimEnd();
|
|
161
|
+
}
|
|
162
|
+
export const profileSchema = z.object({
|
|
163
|
+
interests: z.array(z.object({ topic: z.string().optional(), level: z.enum(['high', 'interested', 'not_interested']) })),
|
|
164
|
+
queryText: z.string(),
|
|
165
|
+
topics: z.array(topicSchema).default([]),
|
|
166
|
+
});
|
|
167
|
+
const levelNames = { high: 'Very interested', interested: 'Interested', not_interested: 'Not interested' };
|
|
168
|
+
export function profile(value) {
|
|
169
|
+
const titles = new Map(value.topics.map(t => [t.slug, t.title]));
|
|
170
|
+
const lines = [`${bold('Current task:')} ${value.queryText.trim() ? printable(value.queryText) : dim('not set')}`];
|
|
171
|
+
for (const level of ['high', 'interested', 'not_interested']) {
|
|
172
|
+
const topics = value.interests.flatMap(i => (i.level === level && i.topic ? [printable(titles.get(i.topic) ?? i.topic)] : []));
|
|
173
|
+
if (topics.length)
|
|
174
|
+
lines.push('', bold(`${levelNames[level]}:`), ...topics.map(t => ` ${t}`));
|
|
175
|
+
}
|
|
176
|
+
if (!value.interests.length)
|
|
177
|
+
lines.push('', dim('No interests yet. Set them with: profile update --interest <topic>=interested'));
|
|
178
|
+
return lines.join('\n');
|
|
179
|
+
}
|
|
180
|
+
export const doctorSchema = z.object({
|
|
181
|
+
base: z.string(),
|
|
182
|
+
reachable: z.boolean(),
|
|
183
|
+
authenticated: z.boolean(),
|
|
184
|
+
configPath: z.string(),
|
|
185
|
+
update: z.object({ installed: z.boolean(), current: z.string(), latest: z.string().nullable(), available: z.boolean(), command: z.string() }),
|
|
186
|
+
skills: z.array(z.object({ path: z.string(), status: z.string(), version: z.string().nullable() })),
|
|
187
|
+
nextStep: z.string().nullable(),
|
|
188
|
+
});
|
|
189
|
+
export function doctor(context, value) {
|
|
190
|
+
// ok, a problem, or plain information
|
|
191
|
+
const row = (state, label, detail) => `${state === null ? ' ' : state ? 'ok' : '!!'} ${label.padEnd(8)}${detail}`;
|
|
192
|
+
const cli = value.update.available ? `${value.update.current}; ${value.update.latest} is available: ${value.update.command}` : value.update.current;
|
|
193
|
+
const lines = [
|
|
194
|
+
row(value.reachable, 'Service', `${value.base}${value.reachable ? '' : ' is unreachable'}`),
|
|
195
|
+
row(value.authenticated, 'Account', value.authenticated ? 'signed in' : 'not signed in'),
|
|
196
|
+
row(null, 'Session', value.configPath),
|
|
197
|
+
row(!value.update.available, 'CLI', cli),
|
|
198
|
+
];
|
|
199
|
+
if (!value.skills.length)
|
|
200
|
+
lines.push(row(null, 'Skill', 'not installed in any agent'));
|
|
201
|
+
for (const skill of value.skills)
|
|
202
|
+
lines.push(row(skill.status !== 'outdated', 'Skill', `${skill.path}: ${skill.status}`));
|
|
203
|
+
// The JSON names the installed command; a person gets the one that ran the CLI
|
|
204
|
+
if (value.nextStep)
|
|
205
|
+
lines.push('', `Next: ${value.reachable && !value.authenticated ? `run ${context.launcher} login` : value.nextStep}`);
|
|
206
|
+
return lines.join('\n');
|
|
207
|
+
}
|
|
208
|
+
export const loginPromptSchema = z.object({ verificationUrl: z.string(), userCode: z.string(), expiresIn: z.number() });
|
|
209
|
+
export function loginPrompt(context, value) {
|
|
210
|
+
return [
|
|
211
|
+
`Open ${value.verificationUrl}`,
|
|
212
|
+
`and confirm the code ${bold(value.userCode)} within ${Math.ceil(value.expiresIn / 60)} min.`,
|
|
213
|
+
`Then run: ${context.launcher} login --wait`,
|
|
214
|
+
].join('\n');
|
|
215
|
+
}
|
|
216
|
+
export const signedInSchema = z.object({ signedIn: z.literal(true), expiresIn: z.number().optional() });
|
|
217
|
+
export function signedIn(value) {
|
|
218
|
+
return `Signed in.${value.expiresIn ? ` The session lasts ${days(value.expiresIn)}.` : ''}`;
|
|
219
|
+
}
|
|
220
|
+
export const accountSchema = z.object({ email: z.string() });
|
|
221
|
+
export const account = (value) => `Signed in as ${bold(printable(value.email))}`;
|
|
222
|
+
// Onboarding cards are already shortened by the CLI: names and titles as strings, the summary's first paragraph
|
|
223
|
+
const briefSchema = z.object({
|
|
224
|
+
slug: z.string(),
|
|
225
|
+
title: z.string(),
|
|
226
|
+
summary: z.string().nullable(),
|
|
227
|
+
speakers: z.array(z.string()),
|
|
228
|
+
event: z.string().nullable(),
|
|
229
|
+
reason: z.string().optional(),
|
|
230
|
+
});
|
|
231
|
+
const fromBrief = (t) => ({
|
|
232
|
+
slug: t.slug,
|
|
233
|
+
title: t.title,
|
|
234
|
+
description: t.summary,
|
|
235
|
+
speakers: t.speakers.map(name => ({ name })),
|
|
236
|
+
topics: [],
|
|
237
|
+
event: t.event ? { name: t.event } : null,
|
|
238
|
+
reason: t.reason,
|
|
239
|
+
});
|
|
240
|
+
export const deckSchema = z.object({ deck: z.array(briefSchema.extend({ n: z.number() })) });
|
|
241
|
+
export function deck(context, value) {
|
|
242
|
+
if (!value.deck.length)
|
|
243
|
+
return 'No talks for these topics. Try other topics.';
|
|
244
|
+
return `${value.deck.map(t => card(context, fromBrief(t), t.n)).join('\n\n')}\n\n${dim(`Judge the talks by number: ${context.launcher} onboarding react 1=like 2=dislike`)}`;
|
|
245
|
+
}
|
|
246
|
+
export const previewSchema = z.object({
|
|
247
|
+
preview: z.array(briefSchema),
|
|
248
|
+
answered: z.array(z.object({ n: z.number(), reaction: z.string().optional() })),
|
|
249
|
+
unanswered: z.array(z.number()),
|
|
250
|
+
});
|
|
251
|
+
export function preview(context, value) {
|
|
252
|
+
const lines = [
|
|
253
|
+
bold('Recommendations for these answers:'),
|
|
254
|
+
'',
|
|
255
|
+
value.preview.length ? cards(context, value.preview.map(fromBrief)) : 'None yet: like a few more talks.',
|
|
256
|
+
'',
|
|
257
|
+
];
|
|
258
|
+
if (value.unanswered.length)
|
|
259
|
+
lines.push(dim(`Not judged yet: ${value.unanswered.join(', ')}`));
|
|
260
|
+
lines.push(dim(`Save to the account: ${context.launcher} onboarding finish`));
|
|
261
|
+
return lines.join('\n');
|
|
262
|
+
}
|
|
263
|
+
export const skillUpdateSchema = z.object({
|
|
264
|
+
version: z.string(),
|
|
265
|
+
updated: z.array(z.object({ path: z.string(), from: z.string().nullable() })),
|
|
266
|
+
unchanged: z.array(z.object({ path: z.string(), status: z.string() })),
|
|
267
|
+
});
|
|
268
|
+
export function skillUpdate(context, value) {
|
|
269
|
+
const lines = value.updated.map(s => `Updated ${s.path}${s.from ? ` from ${s.from}` : ''} to ${value.version}`);
|
|
270
|
+
for (const s of value.unchanged)
|
|
271
|
+
lines.push(s.status === 'modified'
|
|
272
|
+
? `Kept ${s.path}: edited by hand; replace it with ${context.launcher} skill update --force`
|
|
273
|
+
: `Kept ${s.path}: ${s.status === 'linked' ? 'linked to this CLI' : 'already current'}`);
|
|
274
|
+
return lines.length ? lines.join('\n') : 'No installed copies of the skill found.';
|
|
275
|
+
}
|
|
276
|
+
export const personalizeSchema = z.object({
|
|
277
|
+
personalized: z.boolean(),
|
|
278
|
+
changed: z.boolean().optional(),
|
|
279
|
+
path: z.string(),
|
|
280
|
+
topics: z.array(z.string()),
|
|
281
|
+
reason: z.string().optional(),
|
|
282
|
+
command: z.string().optional(),
|
|
283
|
+
});
|
|
284
|
+
export function personalize(value) {
|
|
285
|
+
if (!value.personalized)
|
|
286
|
+
return `Could not write ${value.path}: ${printable(value.reason ?? '')}\nRun in your terminal: ${value.command ?? ''}`;
|
|
287
|
+
const topics = value.topics.length ? value.topics.map(printable).join(', ') : 'no topics yet';
|
|
288
|
+
return value.changed ? `Added your topics to ${value.path}: ${topics}` : `${value.path} already lists your topics: ${topics}`;
|
|
289
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@giftsofprometheus/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "World AI knowledge in Russian for you and your AI agent: search AI engineering talks, read transcripts and find production best practices from the shell, Claude Code, Codex or Cursor",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"agent-skills",
|
|
6
7
|
"agents",
|
|
7
8
|
"ai",
|
|
9
|
+
"ai-agents",
|
|
10
|
+
"ai-engineering",
|
|
8
11
|
"claude-code",
|
|
9
12
|
"cli",
|
|
10
13
|
"codex",
|
|
11
14
|
"conference-talks",
|
|
15
|
+
"cursor",
|
|
16
|
+
"evals",
|
|
17
|
+
"llm",
|
|
18
|
+
"mcp",
|
|
19
|
+
"rag",
|
|
20
|
+
"russian",
|
|
12
21
|
"skill",
|
|
13
22
|
"transcripts"
|
|
14
23
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: giftsofprometheus
|
|
3
|
-
description: Find AI
|
|
3
|
+
description: Find AI engineering talks from conferences around the world with Russian summaries, read their full transcripts, and manage the signed-in user's favorites, interests and personal feed through the giftsofprometheus CLI, and build a starting profile in the chat. Use when the user asks for talks, speakers or transcripts on an AI engineering topic, or wants to save, list or remove favorites on Gifts of Prometheus.
|
|
4
4
|
allowed-tools: Bash(giftsofprometheus:*), Bash(npx -y @giftsofprometheus/cli:*), Bash(pnpm dlx @giftsofprometheus/cli:*), Bash(bunx @giftsofprometheus/cli:*)
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -14,6 +14,8 @@ Run `command -v giftsofprometheus`. If it is missing, run every command below as
|
|
|
14
14
|
|
|
15
15
|
Use only the CLI. Do not call the site's API with `curl`, `fetch` or a script, even for public data: the service refuses any client other than the site and the CLI with `cli_required`, and its rules on `recId`, sign-in and feedback live in the CLI and this skill. For a path that no command covers, use `request` (see Read).
|
|
16
16
|
|
|
17
|
+
Pass `--json` to every command, as in the examples below: without it the CLI prints text for a person, not JSON.
|
|
18
|
+
|
|
17
19
|
Then run `giftsofprometheus --json doctor`:
|
|
18
20
|
|
|
19
21
|
- `reachable: false`: the service is unavailable; report it and stop.
|
package/skills/history.json
CHANGED
|
@@ -78,5 +78,15 @@
|
|
|
78
78
|
"version": "0.7.2",
|
|
79
79
|
"hash": "0cfc2507e6015d09",
|
|
80
80
|
"description": "description: Find AI conference talks (AI Engineer, BAAI, Apsara and others) with Russian summaries, read their full transcripts, and manage the signed-in user's favorites, interests and personal feed through the giftsofprometheus CLI, and build a starting profile in the chat. Use when the user asks for talks, speakers or transcripts on an AI engineering topic, or wants to save, list or remove favorites on Gifts of Prometheus."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"version": "0.7.3",
|
|
84
|
+
"hash": "0cfc2507e6015d09",
|
|
85
|
+
"description": "description: Find AI engineering talks from conferences around the world with Russian summaries, read their full transcripts, and manage the signed-in user's favorites, interests and personal feed through the giftsofprometheus CLI, and build a starting profile in the chat. Use when the user asks for talks, speakers or transcripts on an AI engineering topic, or wants to save, list or remove favorites on Gifts of Prometheus."
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"version": "0.8.0",
|
|
89
|
+
"hash": "205118d2b9a4eb48",
|
|
90
|
+
"description": "description: Find AI engineering talks from conferences around the world with Russian summaries, read their full transcripts, and manage the signed-in user's favorites, interests and personal feed through the giftsofprometheus CLI, and build a starting profile in the chat. Use when the user asks for talks, speakers or transcripts on an AI engineering topic, or wants to save, list or remove favorites on Gifts of Prometheus."
|
|
81
91
|
}
|
|
82
92
|
]
|