@giftsofprometheus/cli 0.8.0 → 0.8.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/README.md CHANGED
@@ -49,6 +49,8 @@ giftsofprometheus feed # подборка по ва
49
49
 
50
50
  Для транскриптов, избранного и ленты нужен бесплатный аккаунт: [войдите на сайте](https://giftsofprometheus.com/login?utm_source=github&utm_medium=readme&utm_campaign=cli) по ссылке из письма, без пароля. `login` подключает к этому аккаунту устройство через подтверждение в браузере, токены копировать не нужно. Сессия живёт 30 дней и хранится в `$XDG_CONFIG_HOME/giftsofprometheus/credentials.json` (по умолчанию `~/.config/giftsofprometheus/`), читать её можете только вы. В [кабинете](https://giftsofprometheus.com/account?utm_source=github&utm_medium=readme&utm_campaign=cli) видны все подключённые устройства, любое можно отключить. `giftsofprometheus logout` отключает текущее.
51
51
 
52
+ В той же папке лежит `client.json` со случайным идентификатором установки. CLI отправляет его заголовком `X-Client-Id`, чтобы сервис считал запросы без входа одним клиентом в аналитике. С аккаунтом он не связан, удалите файл, чтобы получить новый.
53
+
52
54
  ## Для AI-агентов: Claude Code, Codex, Cursor
53
55
 
54
56
  В репозитории есть skill: он объясняет агенту, когда и как пользоваться CLI. Поставить его можно через [skills](https://skills.sh):
package/dist/index.js CHANGED
@@ -26,6 +26,29 @@ const pendingLogin = join(directory, 'login.json');
26
26
  const onboardingDraft = join(directory, 'onboarding.json');
27
27
  // When the daily update check last ran and what npm reported then
28
28
  const updateState = join(directory, 'update.json');
29
+ // A random id of this installation, sent as X-Client-Id so the service counts a guest CLI as one client in its analytics
30
+ const clientFile = join(directory, 'client.json');
31
+ let clientId;
32
+ /** Created once; a config folder that cannot be written only drops the header, it never fails a command */
33
+ function installationId() {
34
+ clientId ??= (async () => {
35
+ try {
36
+ const parsed = z.object({ id: z.uuid() }).safeParse(JSON.parse(await readFile(clientFile, 'utf8')));
37
+ if (parsed.success)
38
+ return parsed.data.id;
39
+ }
40
+ catch { }
41
+ const id = randomUUID();
42
+ try {
43
+ await saveJson(clientFile, { id });
44
+ return id;
45
+ }
46
+ catch {
47
+ return null;
48
+ }
49
+ })();
50
+ return clientId;
51
+ }
29
52
  const credentialsSchema = z.object({ base: z.string(), token: z.string() });
30
53
  /** Only a missing file means "no session"; a file that cannot be read or parsed may still hold a valid session */
31
54
  async function storedAny() {
@@ -102,6 +125,9 @@ async function request(path, method = 'GET', body, authenticated = true) {
102
125
  const headers = new Headers({ 'Content-Type': 'application/json', 'X-Knowledge-Client': 'agent', 'User-Agent': `giftsofprometheus/${version}` });
103
126
  if (credential)
104
127
  headers.set('Authorization', `Bearer ${credential.token}`);
128
+ const installation = await installationId();
129
+ if (installation)
130
+ headers.set('X-Client-Id', installation);
105
131
  for (let attempt = 1;; attempt++) {
106
132
  let response;
107
133
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giftsofprometheus/cli",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
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
6
  "agent-skills",
@@ -88,5 +88,10 @@
88
88
  "version": "0.8.0",
89
89
  "hash": "205118d2b9a4eb48",
90
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."
91
+ },
92
+ {
93
+ "version": "0.8.1",
94
+ "hash": "205118d2b9a4eb48",
95
+ "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."
91
96
  }
92
97
  ]