@giftsofprometheus/cli 0.2.0 → 0.2.1

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/index.js CHANGED
@@ -361,7 +361,26 @@ const draftSchema = z.object({
361
361
  reactions: z.array(z.object({ talkId: z.number().int().positive(), reaction: reactions })),
362
362
  queryText: z.string().optional(),
363
363
  });
364
- const card = z.object({ id: z.number().int().positive(), slug: z.string() }).loose();
364
+ const card = z.object({
365
+ id: z.number().int().positive(),
366
+ slug: z.string(),
367
+ title: z.string(),
368
+ description: z.string().nullish(),
369
+ speakers: z.array(z.object({ name: z.string() })).default([]),
370
+ topics: z.array(z.object({ title: z.string() })).default([]),
371
+ event: z.object({ name: z.string() }).nullish(),
372
+ });
373
+ // A card keeps what an agent shows in a list: the summary's first paragraph, without the bullets, links and media fields
374
+ function brief(t) {
375
+ return {
376
+ slug: t.slug,
377
+ title: t.title,
378
+ summary: t.description?.split(/\n\s*\n/)[0]?.trim() ?? null,
379
+ speakers: t.speakers.map(s => s.name),
380
+ topics: t.topics.map(s => s.title),
381
+ event: t.event?.name ?? null,
382
+ };
383
+ }
365
384
  async function currentDraft() {
366
385
  const draft = await readState(onboardingDraft, draftSchema);
367
386
  if (!draft)
@@ -380,7 +399,7 @@ async function onboardingDeck(o) {
380
399
  const draft = { base, draftId: randomUUID(), interests: [...interests].map(([topic, level]) => ({ topic, level })), deck: [], reactions: [] };
381
400
  const { deck } = z.object({ deck: z.array(card) }).parse(await request('/api/knowledge/onboarding/deck', 'POST', { interests: draft.interests }, false));
382
401
  await saveJson(onboardingDraft, { ...draft, deck: deck.map(t => t.id), ...(o.queryText?.trim() ? { queryText: o.queryText.trim() } : {}) });
383
- return { draftId: draft.draftId, deck: deck.map((t, i) => ({ n: i + 1, ...t })) };
402
+ return { draftId: draft.draftId, deck: deck.map((t, i) => ({ n: i + 1, ...brief(t) })) };
384
403
  }
385
404
  // Answers refer to card numbers from `deck`, so an agent can pass the user's reply ("1, 4 yes, 3 no") without looking up IDs
386
405
  async function onboardingReact(answers) {
@@ -403,7 +422,7 @@ async function onboardingReact(answers) {
403
422
  .parse(await request('/api/knowledge/onboarding/preview', 'POST', { interests: next.interests, reactions: next.reactions, shownTalkIds: next.deck }, false));
404
423
  await saveJson(onboardingDraft, next);
405
424
  return {
406
- preview,
425
+ preview: preview.map(t => ({ ...brief(t), reason: t.reason })),
407
426
  answered: draft.deck.flatMap((id, i) => (chosen.has(id) ? [{ n: i + 1, reaction: chosen.get(id) }] : [])),
408
427
  unanswered: draft.deck.flatMap((id, i) => (chosen.has(id) ? [] : [i + 1])),
409
428
  };
@@ -411,7 +430,7 @@ async function onboardingReact(answers) {
411
430
  async function onboardingFinish(o) {
412
431
  const draft = await currentDraft();
413
432
  if (!(await stored()))
414
- throw new ApiError('Not signed in: run giftsofprometheus login, then onboarding finish again. The draft is kept', 401);
433
+ throw new ApiError('Not signed in: run giftsofprometheus login --start, give the user the link, run login --wait, then onboarding finish again. The draft is kept', 401);
415
434
  const queryText = o.queryText?.trim() || draft.queryText;
416
435
  z.object({ saved: z.literal(true) }).parse(await request('/api/knowledge/onboarding', 'POST', {
417
436
  draftId: draft.draftId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giftsofprometheus/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Search AI conference talks, read transcripts, and manage your Gifts of Prometheus favorites from the shell or an AI agent",
5
5
  "keywords": [
6
6
  "agents",
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: giftsofprometheus
3
3
  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.
4
- allowed-tools: Bash(giftsofprometheus:*)
4
+ allowed-tools: Bash(giftsofprometheus:*), Bash(npx -y @giftsofprometheus/cli:*)
5
5
  ---
6
6
 
7
7
  # Gifts of Prometheus
@@ -10,7 +10,7 @@ allowed-tools: Bash(giftsofprometheus:*)
10
10
 
11
11
  ## Setup
12
12
 
13
- Run `command -v giftsofprometheus`. If it is missing, ask the user to install it as described in https://github.com/timurkhakhalev/giftsofprometheus-cli#install. Then run `giftsofprometheus --json doctor`:
13
+ Run `command -v giftsofprometheus`. If it is missing, run every command below as `npx -y @giftsofprometheus/cli` with the same arguments instead of `giftsofprometheus`, and mention once that a permanent install is described in https://github.com/timurkhakhalev/giftsofprometheus-cli#install. Then run `giftsofprometheus --json doctor`:
14
14
 
15
15
  - `reachable: false`: the service is unavailable; report it and stop.
16
16
  - `authenticated: false`: search, talk metadata and onboarding still work. Sign in only when a command needs it (see Sign in).
@@ -46,14 +46,15 @@ giftsofprometheus --json profile get # interests and curre
46
46
 
47
47
  ## Onboarding
48
48
 
49
- Offer it when `profile get` returns `needsOnboarding: true`, or when the user is not signed in and asks what to watch. It takes a minute and needs no account until the last step; the user fills in nothing, they answer in the chat.
49
+ Run it when the user asks for onboarding. Offer it when `profile get` returns `needsOnboarding: true`, or when the user is not signed in and asks what to watch. It takes a minute and needs no account until the last step; the user fills in nothing, they answer in the chat.
50
50
 
51
51
  1. Ask two or three short questions in one message: what they are building or working on, their level, what they do not want to see.
52
52
  2. Run `giftsofprometheus --json onboarding topics` and match the answers to topic slugs: what they work on → `interested`, what they do not want → `not_interested`. Use only topics their answers support.
53
53
  3. Run `giftsofprometheus --json onboarding deck --interest <slug>=interested --interest <slug>=not_interested --query-text '<what they are building, in their words>'`. It starts a new draft and returns up to 8 cards with numbers `n`.
54
- 4. Show the cards as a numbered list: title and one short line each. Ask which are useful and which miss, for example "1, 4 yes, 3 no". Unmentioned cards stay unjudged.
55
- 5. Run `giftsofprometheus --json onboarding react 1=like 4=like 3=dislike` with the numbers from the reply (`skip` takes an answer back). Show the returned `preview` with each `reason`, so the user sees what changed.
56
- 6. Run `giftsofprometheus --json onboarding finish` to save the draft to the account. On status 401, sign in (see Sign in) and run `finish` again; the draft is kept locally until it is saved.
54
+ 4. Show the cards as a numbered list: the title and the `summary` in one short line each. Ask which are useful and which miss, for example "1, 4 yes, 3 no". Unmentioned cards stay unjudged.
55
+ 5. Run `giftsofprometheus --json onboarding react 1=like 4=like 3=dislike` with the numbers from the reply (`skip` takes an answer back). Show the returned `preview` (title and `reason`), so the user sees what changed.
56
+ 6. Save the draft: if `doctor` showed `authenticated: false`, sign in first yourself (see Sign in): run `login --start`, give the user the link and code, run `login --wait`. Never ask the user to run the login command. Then run `giftsofprometheus --json onboarding finish`. On status 401, sign in the same way and run it again; the draft is kept locally until it is saved.
57
+ 7. Run `giftsofprometheus --json feed` and show the recommendations with their `reason`. Mention that the same feed is on https://giftsofprometheus.com/for-you.
57
58
 
58
59
  Pass only what the user said. The draft holds at most 8 reactions and the levels `interested` and `not_interested`; the user can raise a topic to `high` later with `profile update`.
59
60