@atypica-ai/cli 0.1.0-alpha.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.
Files changed (63) hide show
  1. package/README.md +231 -0
  2. package/README.zh-CN.md +227 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +108 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/auth.d.ts +3 -0
  7. package/dist/commands/auth.js +76 -0
  8. package/dist/commands/auth.js.map +1 -0
  9. package/dist/commands/pulse.d.ts +3 -0
  10. package/dist/commands/pulse.js +170 -0
  11. package/dist/commands/pulse.js.map +1 -0
  12. package/dist/commands/self-update.d.ts +2 -0
  13. package/dist/commands/self-update.js +20 -0
  14. package/dist/commands/self-update.js.map +1 -0
  15. package/dist/lib/api.d.ts +15 -0
  16. package/dist/lib/api.js +48 -0
  17. package/dist/lib/api.js.map +1 -0
  18. package/dist/lib/auth.d.ts +4 -0
  19. package/dist/lib/auth.js +51 -0
  20. package/dist/lib/auth.js.map +1 -0
  21. package/dist/lib/config.d.ts +7 -0
  22. package/dist/lib/config.js +59 -0
  23. package/dist/lib/config.js.map +1 -0
  24. package/dist/lib/constants.d.ts +5 -0
  25. package/dist/lib/constants.js +6 -0
  26. package/dist/lib/constants.js.map +1 -0
  27. package/dist/lib/errors.d.ts +9 -0
  28. package/dist/lib/errors.js +19 -0
  29. package/dist/lib/errors.js.map +1 -0
  30. package/dist/lib/json.d.ts +1 -0
  31. package/dist/lib/json.js +9 -0
  32. package/dist/lib/json.js.map +1 -0
  33. package/dist/lib/open.d.ts +1 -0
  34. package/dist/lib/open.js +23 -0
  35. package/dist/lib/open.js.map +1 -0
  36. package/dist/lib/output.d.ts +16 -0
  37. package/dist/lib/output.js +104 -0
  38. package/dist/lib/output.js.map +1 -0
  39. package/dist/lib/pulse.d.ts +9 -0
  40. package/dist/lib/pulse.js +140 -0
  41. package/dist/lib/pulse.js.map +1 -0
  42. package/dist/lib/update.d.ts +7 -0
  43. package/dist/lib/update.js +115 -0
  44. package/dist/lib/update.js.map +1 -0
  45. package/dist/tests/api.test.d.ts +1 -0
  46. package/dist/tests/api.test.js +23 -0
  47. package/dist/tests/api.test.js.map +1 -0
  48. package/dist/tests/auth.test.d.ts +1 -0
  49. package/dist/tests/auth.test.js +10 -0
  50. package/dist/tests/auth.test.js.map +1 -0
  51. package/dist/tests/config.test.d.ts +1 -0
  52. package/dist/tests/config.test.js +26 -0
  53. package/dist/tests/config.test.js.map +1 -0
  54. package/dist/tests/pulse-render.test.d.ts +1 -0
  55. package/dist/tests/pulse-render.test.js +63 -0
  56. package/dist/tests/pulse-render.test.js.map +1 -0
  57. package/dist/tests/update.test.d.ts +1 -0
  58. package/dist/tests/update.test.js +20 -0
  59. package/dist/tests/update.test.js.map +1 -0
  60. package/dist/types.d.ts +51 -0
  61. package/dist/types.js +2 -0
  62. package/dist/types.js.map +1 -0
  63. package/package.json +32 -0
package/README.md ADDED
@@ -0,0 +1,231 @@
1
+ ![head-image](./head-image.webp)
2
+
3
+ # Atypica CLI
4
+
5
+ **Use the terminal to see what the world is talking about.**
6
+
7
+ [atypica.ai](https://atypica.ai) is an AI agent for business research.
8
+ This CLI is the official command-line client for the **Pulse** API, and Pulse is only the first step in the broader atypica product roadmap.
9
+ Pulse tracks how attention moves across the web so you can spot signals worth following before they fade.
10
+
11
+ **Who it’s for**
12
+
13
+ - **Creators** — find timely topics with real momentum
14
+ - **Researchers** — follow domains like AI, global news, or business
15
+ - **Developers & agents** — pipe trend data into scripts and automation
16
+
17
+ Simplified Chinese: [README.zh-CN.md](./README.zh-CN.md)
18
+
19
+ ---
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ npm install -g @atypica-ai/cli
25
+ ```
26
+
27
+ Or with pnpm:
28
+
29
+ ```bash
30
+ pnpm add -g @atypica-ai/cli
31
+ ```
32
+
33
+ Requires **Node.js 20+**.
34
+
35
+ ---
36
+
37
+ ## 30-second quick start
38
+
39
+ ```bash
40
+ atypica auth login # sign in and save your API key
41
+ atypica pulse list --limit 5 --locale zh-CN # latest Chinese trending items
42
+ atypica pulse get 3396 # one pulse by ID (replace with a real ID)
43
+ ```
44
+
45
+ Check auth without logging in again:
46
+
47
+ ```bash
48
+ atypica auth status
49
+ ```
50
+
51
+ If you already have a key and prefer not to use saved config:
52
+
53
+ ```bash
54
+ export ATYPICA_API_KEY="atypica_xxx"
55
+ atypica pulse list --limit 5
56
+ ```
57
+
58
+ ---
59
+
60
+ ## What this CLI does (v1)
61
+
62
+ - Reads Pulse data from `https://atypica.ai/api` (override with `ATYPICA_BASE_URL`)
63
+ - Walks you through creating a **Personal API Key** and stores it locally
64
+ - **Human-readable** tables by default, plus stable **`--json`** for scripts
65
+ - Optional **version check** and **`atypica self-update`**
66
+
67
+ ---
68
+
69
+ ## Commands
70
+
71
+ List pulses:
72
+
73
+ ```bash
74
+ atypica pulse list --limit 5 --locale en-US
75
+ ```
76
+
77
+ Faster list (skip extra source lookups):
78
+
79
+ ```bash
80
+ atypica pulse list --limit 20 --page 2 --no-source-enrich
81
+ ```
82
+
83
+ Filter by category and sort:
84
+
85
+ ```bash
86
+ atypica pulse list --category "AI Tech" --order-by heatScore
87
+ ```
88
+
89
+ List categories:
90
+
91
+ ```bash
92
+ atypica pulse categories --locale en-US
93
+ ```
94
+
95
+ Fetch one pulse:
96
+
97
+ ```bash
98
+ atypica pulse get 193
99
+ ```
100
+
101
+ Machine-readable output:
102
+
103
+ ```bash
104
+ atypica pulse list --limit 3 --json
105
+ ```
106
+
107
+ Help:
108
+
109
+ ```bash
110
+ atypica help
111
+ atypica auth help
112
+ atypica pulse help
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Agent & automation
118
+
119
+ The CLI is meant to be called from other tools and agents.
120
+
121
+ - Use **`--json`** whenever something else will parse the output
122
+ - Use **`--no-update-check`** in CI to avoid extra stderr noise
123
+ - Prefer **environment variables** over interactive login in automation:
124
+
125
+ ```bash
126
+ ATYPICA_API_KEY="atypica_xxx" \
127
+ ATYPICA_BASE_URL="https://atypica.ai/api" \
128
+ atypica pulse list --limit 10 --json --no-update-check
129
+ ```
130
+
131
+ - Set explicit **`--limit`**, **`--locale`**, and **`--order-by`** when you need repeatable results
132
+ - **Non-zero exit code** means failure (including missing or invalid auth)
133
+
134
+ ---
135
+
136
+ ## Updates
137
+
138
+ The CLI runs a **non-blocking** update check during normal use.
139
+
140
+ Manual upgrade:
141
+
142
+ ```bash
143
+ atypica self-update
144
+ atypica self-update --yes
145
+ ```
146
+
147
+ Skip the check for one run:
148
+
149
+ ```bash
150
+ atypica pulse list --no-update-check
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Configuration
156
+
157
+ Default config file:
158
+
159
+ - macOS / Linux: `~/.config/atypica/config.json`
160
+ - If `XDG_CONFIG_HOME` is set: `$XDG_CONFIG_HOME/atypica/config.json`
161
+
162
+ Environment variables (override saved config at runtime):
163
+
164
+ | Variable | Purpose |
165
+ |----------|---------|
166
+ | `ATYPICA_API_KEY` | Personal API key |
167
+ | `ATYPICA_BASE_URL` | API base (default below) |
168
+ | `ATYPICA_UPDATE_CHECK=0` | Disable update check |
169
+
170
+ Default base URL:
171
+
172
+ ```text
173
+ https://atypica.ai/api
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Example output
179
+
180
+ ```bash
181
+ $ atypica pulse list --limit 3 --locale en-US
182
+ ID Category Locale Date Heat Delta Source Title Summary
183
+ ---- ----------- ------ ---------- ------ ------ ------------------------------ --------------------------------- ---------------------------------
184
+ 2918 Global News en-US 2026-04-12 453.20 +7.40 https://x.com/.../status/123 US Pilot Rescue Uranium Claim Rescue claim triggers new debate…
185
+ 2940 AI Business en-US 2026-04-12 262.90 - https://twitter.com/.../456 OpenAI Codex plugin for Claude New plugin connects Claude tools…
186
+ 3396 AI Tech en-US 2026-04-12 323.67 +4.08 - bitnet.cpp: Microsoft 1-bit AI… 1-bit inference benchmark update…
187
+
188
+ Page 1/28 · Total 278 · PageSize 3 · Prev no · Next yes
189
+ Tip: atypica pulse list --page 2 --limit 3
190
+ ```
191
+
192
+ ```bash
193
+ $ atypica pulse get 3396 --json
194
+ {
195
+ "id": 3396,
196
+ "title": "bitnet.cpp: Microsoft 1-bit AI inference",
197
+ "content": "...",
198
+ "category": "AI Tech",
199
+ "locale": "en-US",
200
+ "heatScore": 323.6711869385739,
201
+ "heatDelta": null,
202
+ "createdAt": "2026-04-10T14:00:39.241Z",
203
+ "posts": []
204
+ }
205
+ ```
206
+
207
+ ---
208
+
209
+ ## Development
210
+
211
+ ```bash
212
+ npm install
213
+ npm run build
214
+ npm test
215
+ node dist/cli.js help
216
+ ```
217
+
218
+ (You can use `pnpm install` / `pnpm run build` / `pnpm test` if you prefer.)
219
+
220
+ ---
221
+
222
+ ## Documentation
223
+
224
+ - Pulse: `https://atypica.ai/docs/pulse`
225
+ - Developer hub: `https://atypica.ai/docs`
226
+
227
+ ---
228
+
229
+ ## Agent skill
230
+
231
+ This repo includes [`SKILL.md`](./SKILL.md) for agents that need to call atypica APIs—point your agent tooling at that file for prompts and conventions.
@@ -0,0 +1,227 @@
1
+ ![head-image](./head-image.webp)
2
+
3
+ # Atypica CLI
4
+
5
+ > 用命令行捕捉「世界正在讨论什么」。
6
+
7
+ [atypica.ai](https://atypica.ai) 是一个做商业研究的 AI 智能体。
8
+ `atypica` CLI 是其 **Pulse API** 的官方命令行客户端,而 **Pulse** 只是整个产品能力的第一步。
9
+ Pulse 会持续追踪全网内容的热度变化,帮你更快看到值得跟进的趋势信号。
10
+
11
+ **适合谁用**
12
+
13
+ - **内容创作者** — 找当下有热度、值得写的选题
14
+ - **研究者** — 跟踪特定领域(如 AI、全球新闻、商业)的动向
15
+ - **开发者 / Agent** — 把热点数据接进脚本与自动化流程
16
+
17
+ 英文主文档:[README.md](./README.md)
18
+
19
+ ---
20
+
21
+ ## 安装
22
+
23
+ ```bash
24
+ npm install -g @atypica-ai/cli
25
+ ```
26
+
27
+ 或使用 pnpm:
28
+
29
+ ```bash
30
+ pnpm add -g @atypica-ai/cli
31
+ ```
32
+
33
+ 需要 **Node.js 20+**。
34
+
35
+ ---
36
+
37
+ ## 30 秒上手
38
+
39
+ ```bash
40
+ atypica auth login # 登录,保存 API Key
41
+ atypica pulse list --limit 5 --locale zh-CN # 查看最新中文热点
42
+ atypica pulse get 3396 # 查看某条热点详情(请换成真实 ID)
43
+ ```
44
+
45
+ 查看当前登录状态:
46
+
47
+ ```bash
48
+ atypica auth status
49
+ ```
50
+
51
+ 若已有 Key、不想写入本机配置文件,可用环境变量:
52
+
53
+ ```bash
54
+ export ATYPICA_API_KEY="atypica_xxx"
55
+ atypica pulse list --limit 5
56
+ ```
57
+
58
+ ---
59
+
60
+ ## CLI 能做什么(v1)
61
+
62
+ - 从 `https://atypica.ai/api` 读取 Pulse 数据(可用 `ATYPICA_BASE_URL` 覆盖)
63
+ - 引导你创建 **Personal API Key** 并保存在本机
64
+ - 默认输出**人类可读表格**,脚本场景使用稳定的 **`--json`**
65
+ - 可选**版本检查**与 **`atypica self-update` 自更新**
66
+
67
+ ---
68
+
69
+ ## 常用命令
70
+
71
+ 列出热点:
72
+
73
+ ```bash
74
+ atypica pulse list --limit 5 --locale en-US
75
+ ```
76
+
77
+ 更快列出(关闭来源补充查询):
78
+
79
+ ```bash
80
+ atypica pulse list --limit 20 --page 2 --no-source-enrich
81
+ ```
82
+
83
+ 按分类筛选、排序:
84
+
85
+ ```bash
86
+ atypica pulse list --category "AI Tech" --order-by heatScore
87
+ ```
88
+
89
+ 列出分类:
90
+
91
+ ```bash
92
+ atypica pulse categories --locale en-US
93
+ ```
94
+
95
+ 查看单条:
96
+
97
+ ```bash
98
+ atypica pulse get 193
99
+ ```
100
+
101
+ 给脚本用(JSON):
102
+
103
+ ```bash
104
+ atypica pulse list --limit 3 --json
105
+ ```
106
+
107
+ 帮助:
108
+
109
+ ```bash
110
+ atypica help
111
+ atypica auth help
112
+ atypica pulse help
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Agent 与自动化
118
+
119
+ - 需要被程序解析时,请加 **`--json`**
120
+ - CI 里建议加 **`--no-update-check`**,减少 stderr 干扰
121
+ - 自动化场景优先用**环境变量**,不要交互式登录:
122
+
123
+ ```bash
124
+ ATYPICA_API_KEY="atypica_xxx" \
125
+ ATYPICA_BASE_URL="https://atypica.ai/api" \
126
+ atypica pulse list --limit 10 --json --no-update-check
127
+ ```
128
+
129
+ - 需要结果可复现时,请显式指定 **`--limit`**、**`--locale`**、**`--order-by`** 等
130
+ - **非 0 退出码** 表示失败(含未配置或无效 Key)
131
+
132
+ ---
133
+
134
+ ## 更新
135
+
136
+ 日常使用时会**非阻塞**检查新版本。手动升级:
137
+
138
+ ```bash
139
+ atypica self-update
140
+ atypica self-update --yes
141
+ ```
142
+
143
+ 单次运行跳过检查:
144
+
145
+ ```bash
146
+ atypica pulse list --no-update-check
147
+ ```
148
+
149
+ ---
150
+
151
+ ## 配置
152
+
153
+ 默认配置文件路径:
154
+
155
+ - macOS / Linux:`~/.config/atypica/config.json`
156
+ - 若设置了 `XDG_CONFIG_HOME`:`$XDG_CONFIG_HOME/atypica/config.json`
157
+
158
+ 环境变量(运行时覆盖本地配置):
159
+
160
+ | 变量 | 作用 |
161
+ |------|------|
162
+ | `ATYPICA_API_KEY` | 个人 API Key |
163
+ | `ATYPICA_BASE_URL` | API 根地址(默认见下) |
164
+ | `ATYPICA_UPDATE_CHECK=0` | 关闭更新检查 |
165
+
166
+ 默认 API 根地址:
167
+
168
+ ```text
169
+ https://atypica.ai/api
170
+ ```
171
+
172
+ ---
173
+
174
+ ## 示例输出
175
+
176
+ ```bash
177
+ $ atypica pulse list --limit 3 --locale en-US
178
+ ID Category Locale Date Heat Delta Source Title Summary
179
+ ---- ----------- ------ ---------- ------ ------ ------------------------------ --------------------------------- ---------------------------------
180
+ 2918 Global News en-US 2026-04-12 453.20 +7.40 https://x.com/.../status/123 US Pilot Rescue Uranium Claim Rescue claim triggers new debate…
181
+ 2940 AI Business en-US 2026-04-12 262.90 - https://twitter.com/.../456 OpenAI Codex plugin for Claude New plugin connects Claude tools…
182
+ 3396 AI Tech en-US 2026-04-12 323.67 +4.08 - bitnet.cpp: Microsoft 1-bit AI… 1-bit inference benchmark update…
183
+
184
+ Page 1/28 · Total 278 · PageSize 3 · Prev no · Next yes
185
+ Tip: atypica pulse list --page 2 --limit 3
186
+ ```
187
+
188
+ ```bash
189
+ $ atypica pulse get 3396 --json
190
+ {
191
+ "id": 3396,
192
+ "title": "bitnet.cpp: Microsoft 1-bit AI inference",
193
+ "content": "...",
194
+ "category": "AI Tech",
195
+ "locale": "en-US",
196
+ "heatScore": 323.6711869385739,
197
+ "heatDelta": null,
198
+ "createdAt": "2026-04-10T14:00:39.241Z",
199
+ "posts": []
200
+ }
201
+ ```
202
+
203
+ ---
204
+
205
+ ## 本地开发
206
+
207
+ ```bash
208
+ npm install
209
+ npm run build
210
+ npm test
211
+ node dist/cli.js help
212
+ ```
213
+
214
+ (也可使用 `pnpm install` / `pnpm run build` / `pnpm test`。)
215
+
216
+ ---
217
+
218
+ ## 文档链接
219
+
220
+ - Pulse:`https://atypica.ai/docs/pulse`
221
+ - 开发者文档:`https://atypica.ai/docs`
222
+
223
+ ---
224
+
225
+ ## Agent 技能说明
226
+
227
+ 仓库中的 [`SKILL.md`](./SKILL.md) 供 Agent 引用:若你在做会调用 atypica API 的智能体,可直接让工具读取该文件。
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+ import { readFile } from "node:fs/promises";
3
+ import { fileURLToPath } from "node:url";
4
+ import { dirname, join } from "node:path";
5
+ import { printAuthHelp, runAuthCommand } from "./commands/auth.js";
6
+ import { printPulseHelp, runPulseCommand } from "./commands/pulse.js";
7
+ import { runSelfUpdateCommand } from "./commands/self-update.js";
8
+ import { resolveConfig } from "./lib/config.js";
9
+ import { CliError } from "./lib/errors.js";
10
+ import { maybeNotifyForUpdates } from "./lib/update.js";
11
+ import { printError, printInfo } from "./lib/output.js";
12
+ async function readVersion() {
13
+ const currentDir = dirname(fileURLToPath(import.meta.url));
14
+ const pkgPath = join(currentDir, "..", "package.json");
15
+ const content = await readFile(pkgPath, "utf8");
16
+ return JSON.parse(content).version;
17
+ }
18
+ function extractGlobalFlags(argv) {
19
+ const args = [];
20
+ let json = false;
21
+ let updateCheck = true;
22
+ for (const arg of argv) {
23
+ if (arg === "--json") {
24
+ json = true;
25
+ continue;
26
+ }
27
+ if (arg === "--no-update-check") {
28
+ updateCheck = false;
29
+ continue;
30
+ }
31
+ args.push(arg);
32
+ }
33
+ return {
34
+ context: { json, updateCheck },
35
+ args,
36
+ };
37
+ }
38
+ function printHelp() {
39
+ printInfo("atypica CLI");
40
+ printInfo("");
41
+ printInfo("Usage:");
42
+ printInfo(" atypica <command> <subcommand> [options]");
43
+ printInfo("");
44
+ printInfo("Core commands:");
45
+ printInfo(" auth Configure and inspect Personal API Key access");
46
+ printInfo(" pulse Query Pulse categories, lists, and details");
47
+ printInfo(" self-update Print or run the recommended upgrade command");
48
+ printInfo(" help Show global or command-specific help");
49
+ printInfo("");
50
+ printInfo("Global flags:");
51
+ printInfo(" --json Output machine-readable JSON when supported");
52
+ printInfo(" --no-update-check Disable the background version check for this run");
53
+ printInfo("");
54
+ printInfo("Examples:");
55
+ printInfo(" atypica auth login");
56
+ printInfo(" atypica pulse list --limit 5 --locale en-US");
57
+ printInfo(" atypica pulse get 3396 --json --no-update-check");
58
+ printInfo("");
59
+ printInfo("Agent tips:");
60
+ printInfo(" - Use `--json` for downstream parsing");
61
+ printInfo(" - Prefer env-based auth in automation: `ATYPICA_API_KEY=... atypica pulse list --json`");
62
+ printInfo(" - Run `atypica pulse help` or `atypica auth help` for detailed command help");
63
+ }
64
+ async function main() {
65
+ const version = await readVersion();
66
+ const { context, args } = extractGlobalFlags(process.argv.slice(2));
67
+ const [command, ...rest] = args;
68
+ if (!command || command === "help" || command === "--help" || command === "-h") {
69
+ const [maybeSubcommand] = rest;
70
+ if (maybeSubcommand === "auth") {
71
+ printAuthHelp();
72
+ return;
73
+ }
74
+ if (maybeSubcommand === "pulse") {
75
+ printPulseHelp();
76
+ return;
77
+ }
78
+ printHelp();
79
+ return;
80
+ }
81
+ if (command === "--version" || command === "-v" || command === "version") {
82
+ printInfo(version);
83
+ return;
84
+ }
85
+ const config = resolveConfig();
86
+ if (context.updateCheck && config.updateCheck !== false) {
87
+ void maybeNotifyForUpdates(version, config);
88
+ }
89
+ if (command === "auth") {
90
+ await runAuthCommand(rest, context);
91
+ return;
92
+ }
93
+ if (command === "pulse") {
94
+ await runPulseCommand(rest, context);
95
+ return;
96
+ }
97
+ if (command === "self-update") {
98
+ await runSelfUpdateCommand(rest, context);
99
+ return;
100
+ }
101
+ throw new CliError(`Unknown command: ${command}`);
102
+ }
103
+ main().catch((error) => {
104
+ const { context } = extractGlobalFlags(process.argv.slice(2));
105
+ printError(error, context);
106
+ process.exit(error instanceof CliError ? error.code : 1);
107
+ });
108
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAi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@@
1
+ import { CliContext } from "../types.js";
2
+ export declare function printAuthHelp(): void;
3
+ export declare function runAuthCommand(args: string[], context: CliContext): Promise<void>;
@@ -0,0 +1,76 @@
1
+ import { API_KEY_URL, DOCS_URL } from "../lib/constants.js";
2
+ import { loadConfig, resolveConfig, saveConfig } from "../lib/config.js";
3
+ import { promptForApiKey } from "../lib/auth.js";
4
+ import { printInfo, printJson } from "../lib/output.js";
5
+ export function printAuthHelp() {
6
+ printInfo("Usage:");
7
+ printInfo(" atypica auth login");
8
+ printInfo(" atypica auth status");
9
+ printInfo(" atypica auth logout");
10
+ printInfo("");
11
+ printInfo("Commands:");
12
+ printInfo(" login Start interactive API key setup and validate the key");
13
+ printInfo(" status Show whether auth is configured and where it comes from");
14
+ printInfo(" logout Remove the saved local API key");
15
+ printInfo("");
16
+ printInfo("Notes:");
17
+ printInfo(" - `ATYPICA_API_KEY` overrides the saved local config");
18
+ printInfo(` - Generate keys at ${API_KEY_URL}`);
19
+ printInfo(` - API docs: ${DOCS_URL}`);
20
+ }
21
+ export async function runAuthCommand(args, context) {
22
+ const [subcommand] = args;
23
+ if (!subcommand || subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
24
+ printAuthHelp();
25
+ return;
26
+ }
27
+ if (subcommand === "login") {
28
+ const config = resolveConfig();
29
+ const apiKey = await promptForApiKey(config);
30
+ saveConfig({
31
+ ...loadConfig(),
32
+ apiKey,
33
+ });
34
+ if (context.json) {
35
+ printJson({ success: true, configured: true });
36
+ return;
37
+ }
38
+ printInfo("API key saved.");
39
+ printInfo(`Manage keys: ${API_KEY_URL}`);
40
+ return;
41
+ }
42
+ if (subcommand === "status") {
43
+ const config = resolveConfig();
44
+ const configured = Boolean(config.apiKey);
45
+ const payload = {
46
+ configured,
47
+ source: process.env.ATYPICA_API_KEY ? "env" : configured ? "config" : "none",
48
+ baseUrl: config.baseUrl,
49
+ docsUrl: DOCS_URL,
50
+ apiKeyUrl: API_KEY_URL,
51
+ };
52
+ if (context.json) {
53
+ printJson(payload);
54
+ return;
55
+ }
56
+ printInfo(`Configured: ${configured ? "yes" : "no"}`);
57
+ printInfo(`Source: ${payload.source}`);
58
+ printInfo(`Base URL: ${payload.baseUrl}`);
59
+ return;
60
+ }
61
+ if (subcommand === "logout") {
62
+ const fileConfig = loadConfig();
63
+ saveConfig({
64
+ ...fileConfig,
65
+ apiKey: undefined,
66
+ });
67
+ if (context.json) {
68
+ printJson({ success: true, configured: false });
69
+ return;
70
+ }
71
+ printInfo("Saved API key removed from local config.");
72
+ return;
73
+ }
74
+ printAuthHelp();
75
+ }
76
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,UAAU,aAAa;IAC3B,SAAS,CAAC,QAAQ,CAAC,CAAC;IACpB,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAClC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IACnC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,SAAS,CAAC,WAAW,CAAC,CAAC;IACvB,SAAS,CAAC,gEAAgE,CAAC,CAAC;IAC5E,SAAS,CAAC,mEAAmE,CAAC,CAAC;IAC/E,SAAS,CAAC,0CAA0C,CAAC,CAAC;IACtD,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,SAAS,CAAC,QAAQ,CAAC,CAAC;IACpB,SAAS,CAAC,wDAAwD,CAAC,CAAC;IACpE,SAAS,CAAC,wBAAwB,WAA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AAS,EAAE,WAAW;SACvB,CAAC;QAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,SAAS,CAAC,OAAO,CAAC,CAAC;YACnB,OAAO;QACT,CAAC;QAED,SAAS,CAAC,eAAe,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACtD,SAAS,CAAC,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,SAAS,CAAC,aAAa,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1C,OAAO;IACT,CAAC;IAED,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,UAAU,EAAE,CAAC;QAChC,UAAU,CAAC;YACT,GAAG,UAAU;YACb,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;YAChD,OAAO;QACT,CAAC;QAED,SAAS,CAAC,0CAA0C,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IAED,aAAa,EAAE,CAAC;AAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { CliContext } from "../types.js";
2
+ export declare function printPulseHelp(): void;
3
+ export declare function runPulseCommand(args: string[], context: CliContext): Promise<void>;