lumina-wiki 0.0.1 → 0.3.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 (48) hide show
  1. package/README.md +380 -0
  2. package/bin/lumina.js +194 -21
  3. package/package.json +50 -3
  4. package/src/installer/banner.js +83 -0
  5. package/src/installer/commands.js +945 -0
  6. package/src/installer/fs.js +277 -0
  7. package/src/installer/manifest.js +293 -0
  8. package/src/installer/prompts.js +263 -0
  9. package/src/installer/template-engine.js +191 -0
  10. package/src/installer/update-check.js +83 -0
  11. package/src/scripts/lint.mjs +1135 -0
  12. package/src/scripts/reset.mjs +232 -0
  13. package/src/scripts/schemas.mjs +419 -0
  14. package/src/scripts/wiki.mjs +1626 -0
  15. package/src/skills/core/ask/SKILL.md +236 -0
  16. package/src/skills/core/check/SKILL.md +240 -0
  17. package/src/skills/core/edit/SKILL.md +192 -0
  18. package/src/skills/core/ingest/SKILL.md +286 -0
  19. package/src/skills/core/init/SKILL.md +199 -0
  20. package/src/skills/core/reset/SKILL.md +220 -0
  21. package/src/skills/packs/reading/chapter-ingest/SKILL.md +138 -0
  22. package/src/skills/packs/reading/character-track/SKILL.md +150 -0
  23. package/src/skills/packs/reading/plot-recap/SKILL.md +223 -0
  24. package/src/skills/packs/reading/theme-map/SKILL.md +165 -0
  25. package/src/skills/packs/research/discover/SKILL.md +51 -0
  26. package/src/skills/packs/research/prefill/SKILL.md +54 -0
  27. package/src/skills/packs/research/setup/SKILL.md +59 -0
  28. package/src/skills/packs/research/survey/SKILL.md +49 -0
  29. package/src/templates/.cursor/rules/lumina.mdc +13 -0
  30. package/src/templates/.env.example +14 -0
  31. package/src/templates/AGENTS.md +7 -0
  32. package/src/templates/CLAUDE.md +7 -0
  33. package/src/templates/GEMINI.md +7 -0
  34. package/src/templates/README.md +209 -0
  35. package/src/templates/_lumina/config/lumina.config.yaml +77 -0
  36. package/src/templates/_lumina/schema/cross-reference-packs.md +43 -0
  37. package/src/templates/_lumina/schema/graph-packs.md +57 -0
  38. package/src/templates/_lumina/schema/page-templates.md +212 -0
  39. package/src/tools/_env.py +82 -0
  40. package/src/tools/discover.py +246 -0
  41. package/src/tools/extract_pdf.py +190 -0
  42. package/src/tools/fetch_arxiv.py +262 -0
  43. package/src/tools/fetch_deepxiv.py +263 -0
  44. package/src/tools/fetch_s2.py +357 -0
  45. package/src/tools/fetch_wikipedia.py +239 -0
  46. package/src/tools/init_discovery.py +486 -0
  47. package/src/tools/prepare_source.py +440 -0
  48. package/src/tools/requirements.txt +18 -0
package/README.md ADDED
@@ -0,0 +1,380 @@
1
+ <p align="center">
2
+ <img src="assets/lumina-logo.png" width="250" alt="Lumina-Wiki Logo">
3
+ </p>
4
+
5
+ # Lumina-Wiki
6
+
7
+ > **Where Knowledge Starts to Glow.**
8
+ >
9
+ > The LLM-maintained Knowledge Artifact for Technical Research.
10
+
11
+ Lumina-Wiki is a ready-to-use implementation of the **[LLM-Wiki vision](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)** articulated by **Andrej Karpathy, founding member of OpenAI and former Director of AI at Tesla.**
12
+
13
+ <p align="center">
14
+ <img alt="License" src="https://img.shields.io/badge/License-MIT-blue.svg"/>
15
+ <img alt="Node.js" src="https://img.shields.io/badge/Node.js-%3E%3D20-blue.svg"/>
16
+ <img alt="Python" src="https://img.shields.io/badge/Python-3.9+-yellow.svg"/>
17
+ <img alt="Skills" src="https://img.shields.io/badge/Skills-14-purple.svg"/>
18
+ <br>
19
+ <img alt="Powered by" src="https://img.shields.io/badge/Powered%20by-grey?style=flat"/>
20
+ <img alt="Claude" src="https://img.shields.io/badge/-Claude%20Code-orange?style=flat"/>
21
+ <img alt="Codex" src="https://img.shields.io/badge/-Codex-blueviolet?style=flat"/>
22
+ <img alt="Gemini" src="https://img.shields.io/badge/-Gemini-4285F4?style=flat"/>
23
+ </p>
24
+
25
+ <p align="center">
26
+ <a href="#english">English</a> • <a href="#vietnamese">Tiếng Việt</a>
27
+ </p>
28
+
29
+ ---
30
+
31
+ <a name="english"></a>
32
+ ***English README***
33
+
34
+ ## 1. The Core Workflow
35
+
36
+ Lumina-Wiki operates on a simple principle: separate your raw materials from the AI's structured knowledge.
37
+
38
+ ```text
39
+ +-------------------------+ /lumi-ingest +---------------------------+
40
+ | YOUR INPUT | ---------------------> | THE AGENT'S BRAIN |
41
+ | (raw/ folder) | | (wiki/ folder) |
42
+ | | <--------------------- | |
43
+ | - my-paper.pdf | /lumi-ask | - my-paper.md (summary) |
44
+ | - my-notes.txt | | - concept-a.md |
45
+ +-------------------------+ +---------------------------+
46
+ ```
47
+
48
+ 1. **You Provide:** Place your documents (PDFs, notes) into the `raw/` directory.
49
+ 2. **The Agent Builds:** Use commands in your AI chat (like `/lumi-ingest`) to make the agent read from `raw/` and build a structured, interlinked wiki in the `wiki/` directory.
50
+ 3. **You Query:** Ask questions (using `/lumi-ask`) against the agent's "brain" in `wiki/`, receiving faster and more context-aware answers.
51
+
52
+ ## 2. Getting Started
53
+
54
+ ### **Step 1: Install**
55
+ Install the wiki workspace into your current project with one command:
56
+
57
+ ```bash
58
+ npx lumina-wiki install
59
+ ```
60
+ > **Note for Windows Users:** For the best experience, it is recommended to [enable Developer Mode](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) to allow the installer to use symlinks correctly. If Developer Mode is off, the installer will fall back to copying skill files, which is functional but less ideal for updates.
61
+
62
+ The installer will guide you through a quick setup, including selecting optional **Packs** like `research` and `reading`.
63
+
64
+ ### **Step 2 (Optional): Configure the Research Pack**
65
+ If you installed the `research` pack, some skills need API keys to search online. Run the setup skill to configure them. In your AI chat window:
66
+
67
+ > **You:**
68
+ > `/lumi-setup`
69
+
70
+ The agent will guide you through an interactive setup to save your keys to a local `.env` file.
71
+
72
+ ## 3. Your First Commands (Core Skills)
73
+
74
+ Interact with your wiki using these commands in your AI chat interface (Gemini CLI, Claude, etc.).
75
+
76
+ **Phase 1: Ingestion & Building**
77
+ - `/lumi-init`: Scans the `raw/` directory and performs an initial build of the wiki.
78
+ - `/lumi-ingest [path/to/file]`: Processes a single new document and integrates it into the knowledge base.
79
+
80
+ **Phase 2: Query & Maintenance**
81
+ - `/lumi-ask [your question]`: Asks a question against the entire knowledge base in `wiki/`.
82
+ - `/lumi-edit [path/to/wiki/page]`: Requests a change or correction to a specific wiki page.
83
+ - `/lumi-check`: Lints the wiki for errors (broken links, etc.).
84
+
85
+ *Additional skills may be available if you installed optional packs like `research` or `reading`.*
86
+
87
+ ---
88
+
89
+ ## 4. The Workspace Directory Guide
90
+
91
+ Lumina creates a workspace with a clear purpose for each directory.
92
+
93
+ ### **Primary Folders (Your Daily Workspace)**
94
+
95
+ | Path | Purpose | Managed By |
96
+ | :--- | :--- | :--- |
97
+ | **`raw/`** | **Your Immutable Input Library.** The agent **only reads** from here. | **You** |
98
+ | `raw/sources/` | Place your primary documents (PDFs, articles) here. | You |
99
+ | `raw/notes/` | Your personal, unstructured notes and ideas. | You |
100
+ | `raw/assets/` | Images or other assets for your notes. | You |
101
+ | `raw/discovered/`| *(Research Pack)* Papers found by `/lumi-discover` are saved here. | Agent |
102
+ | **`wiki/`** | **The Agent's Brain.** The agent **writes** structured knowledge here. | **Agent** |
103
+ | `wiki/sources/` | AI-generated summaries for each document in `raw/sources`. | Agent |
104
+ | `wiki/concepts/` | Core ideas and definitions are extracted into individual pages. | Agent |
105
+ | `wiki/people/` | Profiles of authors, researchers, etc. | Agent |
106
+ | `wiki/outputs/` | Detailed answers from `/lumi-ask` are saved here for reference. | Agent |
107
+ | `wiki/index.md` | The main table of contents for your wiki. | Agent |
108
+ | `...` | *(Other entity folders like `foundations/`, `characters/` appear with packs)* | Agent |
109
+
110
+
111
+ ### **System Folders (Managed by Lumina)**
112
+
113
+ | Path | Purpose | Managed By |
114
+ | :--- | :--- | :--- |
115
+ | **`_lumina/`** | The core engine, scripts, and configuration for the wiki. | **System** |
116
+ | **`.agents/`** | Contains all the `skills` that the agent can use. | **System** |
117
+ | `...` | *(Other dotfiles like `.claude/`, `.gitignore`)* | **System** |
118
+
119
+ **Note:** You generally do not need to modify the System Folders.
120
+
121
+ ---
122
+
123
+ ## 5. Available Skills and Tools (v0.1)
124
+
125
+ <details>
126
+ <summary>Click to see the full list of available Skills and the Tools that power them.</summary>
127
+
128
+ ### Skills (User Commands)
129
+
130
+ These are the commands you can use in your chat with the AI.
131
+
132
+ | Pack | Skill | Purpose |
133
+ | :--- | :--- | :--- |
134
+ | **Core** | `/lumi-init` | Initializes the wiki from all files in `raw/`. |
135
+ | | `/lumi-ingest` | Processes a single new document into the wiki. |
136
+ | | `/lumi-ask` | Asks a question against the entire knowledge base. |
137
+ | | `/lumi-edit` | Requests a manual edit to a wiki page. |
138
+ | | `/lumi-check` | Lints the wiki for errors (broken links, etc.). |
139
+ | | `/lumi-reset` | Safely resets parts of the wiki. |
140
+ | **Research**| `/lumi-discover` | Discovers and ranks relevant research papers. |
141
+ | | `/lumi-survey` | Creates a survey/summary from existing knowledge. |
142
+ | | `/lumi-prefill` | Seeds the wiki with foundational concepts to avoid duplicates. |
143
+ | | `/lumi-setup` | Helps configure API keys for research tools. |
144
+ | **Reading** | `/lumi-chapter-ingest`| Ingests a book chapter by chapter. |
145
+ | | `/lumi-character-track`| Tracks characters and their relationships in a story. |
146
+ | | `/lumi-theme-map` | Identifies and maps out themes in a narrative. |
147
+ | | `/lumi-plot-recap` | Provides a progressive recap of the plot. |
148
+
149
+ ### Tools (The Engine Under the Hood)
150
+
151
+ These are the scripts that the agent's skills use to perform actions.
152
+
153
+ | Location | Tool | Role |
154
+ | :--- | :--- | :--- |
155
+ | **`_lumina/scripts/`** | `wiki.mjs` | **The Core Engine.** Handles all write/edit/link operations in `wiki/`. |
156
+ | | `lint.mjs` | Linter used by `/lumi-check` to find errors. |
157
+ | | `reset.mjs` | The script for safely deleting content. |
158
+ | | `schemas.mjs` | The single source of truth for all wiki structures and rules. |
159
+ | **`_lumina/tools/`** | `discover.py` | *(Research Pack)* Powers the `/lumi-discover` skill. |
160
+ | | `fetch_*.py` | *(Research Pack)* A set of tools to fetch data from APIs like ArXiv, Wikipedia, etc. |
161
+
162
+ </details>
163
+
164
+ ---
165
+
166
+ ## 6. What's Coming Next
167
+
168
+ The current release is **v0.2** (preview). The full plan lives in [`ROADMAP.md`](./ROADMAP.md). Headline items:
169
+
170
+ **v1.0.0 — First Stable**
171
+ - **Daily search & fetch** — watchlist queries (`_lumina/config/watchlist.yml`) run on a cadence; new arXiv / Semantic Scholar hits land in `raw/discovered/<date>/` automatically.
172
+ - New `/lumi-daily` skill to triage what landed since last run.
173
+ - Stability lock for the v0.1 surface (CLI flags, exit codes, schema field names).
174
+ - Cross-platform CI matrix (macOS + Linux + Windows, Node 20 + 22).
175
+
176
+ **v2.0.0 — Research Pack Source Expansion**
177
+ - **New paper sources:** OpenAlex, Unpaywall, CORE (Priority 1) → OpenReview, Hugging Face Papers, Papers With Code (Priority 2) → Crossref, DOAJ, research-blog RSS (Priority 3).
178
+ - **Paper ranking:** new `/lumi-rank` skill surfacing influential-citation count, field-normalized citation rank, Scite support/contrast tally, and Altmetric attention — all into a `ranking:` block on the paper's frontmatter.
179
+
180
+ **Want to help?** Pick any unchecked item in `ROADMAP.md`, open an issue to claim it, then send a PR. Source fetchers all follow the same pattern in `src/tools/` (CLI + JSON, no async, exit codes `0/2/3`) so they're a friendly first contribution. See the local-dev steps below.
181
+
182
+ ---
183
+
184
+ ## 7. Contributing & License
185
+
186
+ <details>
187
+ <summary>🛠️ Local Development (for contributors)</summary>
188
+
189
+ If you want to contribute to the `lumina-wiki` installer itself:
190
+ ```bash
191
+ # 1. Clone & Install Dependencies
192
+ git clone https://github.com/tronghieu/lumina-wiki.git
193
+ cd lumina-wiki
194
+ npm ci
195
+
196
+ # 2. Run Tests
197
+ npm run test:all
198
+ ```
199
+ </details>
200
+
201
+ **License:** [MIT](LICENSE) © Lưu Trọng Hiếu.
202
+
203
+ ---
204
+ ---
205
+
206
+ <a name="vietnamese"></a>
207
+ ***README Tiếng Việt***
208
+
209
+ > **Where Knowledge Starts to Glow.**
210
+ >
211
+ > Khối Tri thức được duy trì bởi LLM dành cho nghiên cứu kỹ thuật.
212
+
213
+ ## 1. Luồng làm việc cốt lõi
214
+
215
+ Lumina-Wiki hoạt động dựa trên một nguyên tắc đơn giản: tách biệt tài liệu thô của bạn khỏi khối kiến thức có cấu trúc của AI.
216
+
217
+ ```text
218
+ +-------------------------+ /lumi-ingest +---------------------------+
219
+ | ĐẦU VÀO CỦA BẠN | ---------------------> | BỘ NÃO CỦA AGENT |
220
+ | (Thư mục raw/) | | (Thư mục wiki/) |
221
+ | | <--------------------- | |
222
+ | - bai-bao.pdf | /lumi-ask | - bai-bao.md (tóm tắt) |
223
+ | - ghi-chu.txt | | - khai-niem-a.md |
224
+ +-------------------------+ +---------------------------+
225
+ ```
226
+
227
+ 1. **Bạn Cung cấp:** Đặt các tài liệu (PDF, ghi chú) của bạn vào thư mục `raw/`.
228
+ 2. **Agent Xây dựng:** Sử dụng các lệnh trong cuộc hội thoại với AI (như `/lumi-ingest`) để yêu cầu agent đọc từ `raw/` và xây dựng một wiki có cấu trúc, liên kết chặt chẽ trong thư mục `wiki/`.
229
+ 3. **Bạn Khai thác:** Đặt câu hỏi (sử dụng `/lumi-ask`) trực tiếp vào "bộ não" của agent trong `wiki/` để nhận được câu trả lời nhanh và phù hợp với ngữ cảnh hơn.
230
+
231
+ ## 2. Bắt đầu
232
+
233
+ ### **Bước 1: Cài đặt**
234
+ Cài đặt không gian làm việc wiki vào dự án hiện tại của bạn bằng một lệnh duy nhất:
235
+
236
+ ```bash
237
+ npx lumina-wiki install
238
+ ```
239
+ > **Lưu ý cho người dùng Windows:** Để có trải nghiệm tốt nhất, bạn nên [bật Chế độ nhà phát triển (Developer Mode)](https://learn.microsoft.com/vi-vn/windows/apps/get-started/enable-your-device-for-development) để trình cài đặt có thể sử dụng symlink một cách chính xác. Nếu Developer Mode bị tắt, trình cài đặt sẽ chuyển sang sao chép các file skill; chức năng vẫn hoạt động nhưng sẽ không lý tưởng bằng cho việc cập nhật.
240
+
241
+ Trình cài đặt sẽ hướng dẫn bạn qua một vài bước thiết lập nhanh, bao gồm cả việc lựa chọn các **Gói (Packs)** tùy chọn như `research` (nghiên cứu) và `reading` (đọc hiểu).
242
+
243
+ ### **Bước 2 (Tùy chọn): Cấu hình Gói Research**
244
+ Nếu bạn đã cài đặt gói `research`, một số kỹ năng sẽ cần API key để tìm kiếm trực tuyến. Hãy chạy kỹ năng setup để cấu hình chúng. Trong cuộc trò chuyện với AI:
245
+
246
+ > **Bạn:**
247
+ > `/lumi-setup`
248
+
249
+ Agent sẽ hướng dẫn bạn qua một quy trình cài đặt tương tác để lưu các key của bạn vào file `.env` cục bộ.
250
+
251
+ ## 3. Các lệnh đầu tiên của bạn (Kỹ năng cốt lõi)
252
+
253
+ Tương tác với wiki của bạn bằng cách sử dụng các lệnh này trong giao diện trò chuyện với AI Agent (ví dụ: Gemini CLI, Claude, v.v.).
254
+
255
+ **Giai đoạn 1: Nạp và Xây dựng kiến thức**
256
+ - `/lumi-init`: Quét thư mục `raw/` và thực hiện xây dựng wiki lần đầu.
257
+ - `/lumi-ingest [đường/dẫn/tới/file]`: Xử lý một tài liệu mới và tích hợp nó vào cơ sở kiến thức.
258
+
259
+ **Giai đoạn 2: Khai thác và Bảo trì**
260
+ - `/lumi-ask [câu hỏi của bạn]`: Đặt câu hỏi dựa trên toàn bộ cơ sở kiến thức trong `wiki/`.
261
+ - `/lumi-edit [đường/dẫn/tới/trang/wiki]`: Yêu cầu thay đổi hoặc sửa lỗi cho một trang wiki cụ thể.
262
+ - `/lumi-check`: Kiểm tra toàn bộ wiki để tìm lỗi (liên kết hỏng, trang mồ côi, v.v.).
263
+
264
+ *Các kỹ năng bổ sung có thể có sẵn nếu bạn đã cài đặt các gói tùy chọn như `research` hoặc `reading`.*
265
+
266
+ ---
267
+
268
+ ## 4. Hướng dẫn cấu trúc thư mục
269
+
270
+ Lumina tạo ra một không gian làm việc với mục đích rõ ràng cho từng thư mục.
271
+
272
+ ### **Thư mục chính (Không gian làm việc hàng ngày của bạn)**
273
+
274
+ | Đường dẫn | Mục đích | Quản lý bởi |
275
+ | :--- | :--- | :--- |
276
+ | **`raw/`** | **Thư viện đầu vào bất biến của bạn.** Agent **chỉ đọc** từ đây. | **Bạn** |
277
+ | `raw/sources/` | Đặt các tài liệu chính của bạn (PDF, bài báo) tại đây. | Bạn |
278
+ | `raw/notes/` | Các ghi chú, ý tưởng cá nhân chưa có cấu trúc của bạn. | Bạn |
279
+ | `raw/assets/` | Hình ảnh hoặc các tài sản khác cho ghi chú của bạn. | Bạn |
280
+ | `raw/discovered/`| *(Gói Research)* Các bài báo do `/lumi-discover` tìm thấy sẽ được lưu ở đây. | Agent |
281
+ | **`wiki/`** | **Bộ não của Agent.** Agent **ghi** kiến thức có cấu trúc vào đây. | **Agent** |
282
+ | `wiki/sources/` | Các bản tóm tắt do AI tạo cho mỗi tài liệu trong `raw/sources`. | Agent |
283
+ | `wiki/concepts/` | Các ý tưởng, định nghĩa cốt lõi được trích xuất thành các trang riêng lẻ. | Agent |
284
+ | `wiki/people/` | Hồ sơ của các tác giả, nhà nghiên cứu, v.v. | Agent |
285
+ | `wiki/outputs/` | Các câu trả lời chi tiết từ `/lumi-ask` được lưu lại để tham khảo. | Agent |
286
+ | `wiki/index.md` | Bảng mục lục chính cho toàn bộ wiki của bạn. | Agent |
287
+ | `...` | *(Các thư mục thực thể khác như `foundations/`, `characters/` xuất hiện cùng các gói)* | Agent |
288
+
289
+
290
+ ### **Thư mục hệ thống (Do Lumina quản lý)**
291
+
292
+ | Đường dẫn | Mục đích | Quản lý bởi |
293
+ | :--- | :--- | :--- |
294
+ | **`_lumina/`** | Engine cốt lõi, script và cấu hình cho wiki. | **Hệ thống** |
295
+ | **`.agents/`** | Chứa tất cả các `skills` (kỹ năng) mà agent có thể sử dụng. | **Hệ thống** |
296
+ | `...` | *(Các file ẩn khác như `.claude/`, `.gitignore`)* | **Hệ thống** |
297
+
298
+ **Lưu ý:** Bạn thường không cần phải sửa đổi các Thư mục hệ thống.
299
+
300
+ ---
301
+
302
+ ## 5. Các Kỹ năng và Công cụ có sẵn (v0.1)
303
+
304
+ <details>
305
+ <summary>Nhấn để xem danh sách đầy đủ các Kỹ năng và Công cụ hỗ trợ.</summary>
306
+
307
+ ### Skills (Lệnh người dùng)
308
+
309
+ Đây là những lệnh bạn có thể sử dụng khi trò chuyện với AI.
310
+
311
+ | Gói | Skill | Mục đích |
312
+ | :--- | :--- | :--- |
313
+ | **Core** | `/lumi-init` | Khởi tạo wiki từ tất cả các file trong `raw/`. |
314
+ | | `/lumi-ingest` | Xử lý một tài liệu mới và đưa vào wiki. |
315
+ | | `/lumi-ask` | Đặt câu hỏi dựa trên toàn bộ cơ sở kiến thức. |
316
+ | | `/lumi-edit` | Yêu cầu chỉnh sửa thủ công một trang wiki. |
317
+ | | `/lumi-check` | Kiểm tra lỗi trong wiki (liên kết hỏng, v.v.). |
318
+ | | `/lumi-reset` | Xóa các phần của wiki một cách an toàn. |
319
+ | **Research**| `/lumi-discover` | Khám phá và xếp hạng các bài báo nghiên cứu liên quan. |
320
+ | | `/lumi-survey` | Tạo một bài tổng quan/khảo sát từ kiến thức hiện có. |
321
+ | | `/lumi-prefill` | Tạo trước các khái niệm nền tảng để tránh trùng lặp. |
322
+ | | `/lumi-setup` | Giúp cấu hình API key cho các công cụ nghiên cứu. |
323
+ | **Reading** | `/lumi-chapter-ingest`| Nạp kiến thức sách theo từng chương. |
324
+ | | `/lumi-character-track`| Theo dõi các nhân vật và mối quan hệ của họ trong truyện. |
325
+ | | `/lumi-theme-map` | Xác định và lập bản đồ các chủ đề trong một câu chuyện. |
326
+ | | `/lumi-plot-recap` | Cung cấp một bản tóm tắt tuần tự của cốt truyện. |
327
+
328
+ ### Tools (Engine chạy nền)
329
+
330
+ Đây là các script mà kỹ năng của agent sử dụng để thực hiện hành động.
331
+
332
+ | Vị trí | Tool | Vai trò |
333
+ | :--- | :--- | :--- |
334
+ | **`_lumina/scripts/`** | `wiki.mjs` | **Engine cốt lõi.** Xử lý tất cả các hoạt động ghi/sửa/liên kết trong `wiki/`. |
335
+ | | `lint.mjs` | Trình kiểm tra lỗi được `/lumi-check` sử dụng. |
336
+ | | `reset.mjs` | Script để xóa nội dung một cách an toàn. |
337
+ | | `schemas.mjs` | Nguồn chân lý duy nhất cho tất cả các cấu trúc và quy tắc của wiki. |
338
+ | **`_lumina/tools/`** | `discover.py` | *(Gói Research)* Cung cấp sức mạnh cho kỹ năng `/lumi-discover`. |
339
+ | | `fetch_*.py` | *(Gói Research)* Một bộ công cụ để lấy dữ liệu từ các API như ArXiv, Wikipedia, v.v. |
340
+
341
+ </details>
342
+
343
+ ---
344
+
345
+ ## 6. Lộ trình sắp tới
346
+
347
+ Phiên bản hiện tại là **v0.2** (preview). Kế hoạch đầy đủ ở [`ROADMAP.md`](./ROADMAP.md). Những hạng mục chính:
348
+
349
+ **v1.0.0 — Bản ổn định đầu tiên**
350
+ - **Daily search & fetch** — watchlist (`_lumina/config/watchlist.yml`) chạy theo lịch; paper mới từ arXiv / Semantic Scholar tự động đáp xuống `raw/discovered/<ngày>/`.
351
+ - Skill mới `/lumi-daily` để triage những gì vừa thu thập kể từ lần chạy trước.
352
+ - Khoá ổn định bề mặt v0.1 (CLI flags, exit codes, tên trường schema).
353
+ - CI matrix đa nền tảng (macOS + Linux + Windows, Node 20 + 22).
354
+
355
+ **v2.0.0 — Mở rộng nguồn paper cho Research Pack**
356
+ - **Nguồn paper mới:** OpenAlex, Unpaywall, CORE (Ưu tiên 1) → OpenReview, Hugging Face Papers, Papers With Code (Ưu tiên 2) → Crossref, DOAJ, RSS từ các blog research lab (Ưu tiên 3).
357
+ - **Đánh giá paper:** skill mới `/lumi-rank` đưa các chỉ số influential-citation count, xếp hạng theo lĩnh vực, Scite support/contrast, và Altmetric vào block `ranking:` trong frontmatter.
358
+
359
+ **Muốn đóng góp?** Chọn bất kỳ hạng mục chưa tick trong `ROADMAP.md`, mở issue để nhận, rồi gửi PR. Các fetcher nguồn paper đều tuân theo cùng pattern trong `src/tools/` (CLI + JSON, không async, exit codes `0/2/3`) nên rất phù hợp cho lần contribute đầu tiên. Xem hướng dẫn dev cục bộ bên dưới.
360
+
361
+ ---
362
+
363
+ ## 7. Đóng góp & Giấy phép
364
+
365
+ <details>
366
+ <summary>🛠️ Phát triển cục bộ (dành cho người đóng góp)</summary>
367
+
368
+ Nếu bạn muốn đóng góp cho trình cài đặt `lumina-wiki`:
369
+ ```bash
370
+ # 1. Clone & Cài đặt Dependencies
371
+ git clone https://github.com/tronghieu/lumina-wiki.git
372
+ cd lumina-wiki
373
+ npm ci
374
+
375
+ # 2. Chạy Tests
376
+ npm run test:all
377
+ ```
378
+ </details>
379
+
380
+ **Giấy phép:** [MIT](LICENSE) © Lưu Trọng Hiếu.
package/bin/lumina.js CHANGED
@@ -1,32 +1,205 @@
1
1
  #!/usr/bin/env node
2
- // lumina-wiki v0.0.1 — name-claim stub.
3
- // The real installer ships in v0.1.0+.
2
+ /**
3
+ * lumina-wiki CLI entry point.
4
+ * Exposes `lumina` and `lumi` bin aliases.
5
+ *
6
+ * Commands:
7
+ * lumina install — scaffold or upgrade a Lumina Wiki workspace
8
+ * lumina uninstall — remove Lumina-managed files (preserve wiki/ and raw/)
9
+ * lumina --version — print version + optional update check
10
+ * lumina --help — print usage
11
+ *
12
+ * Flags (all commands):
13
+ * --directory <path> — installation directory (defaults to current directory)
14
+ * --cwd <path> — backward-compat alias for --directory
15
+ * --yes, -y — accept all defaults (non-interactive / CI)
16
+ * --no-update — skip npm registry version check
17
+ * --re-link — recompute symlink/junction/copy strategy
18
+ * --packs <list> — comma-separated pack list for non-interactive install
19
+ * --ide-targets <list> — comma-separated IDE target list for non-interactive install
20
+ *
21
+ * Exit codes: 0 success, 1 user error, 2 filesystem error, 3 upgrade incompatibility
22
+ */
4
23
 
5
- const pkg = {
6
- name: 'lumina-wiki',
7
- version: '0.0.1',
8
- repo: 'https://github.com/tronghieu/lumina-wiki',
9
- };
24
+ import { createRequire } from 'node:module';
25
+ import { dirname, resolve } from 'node:path';
26
+ import { fileURLToPath } from 'node:url';
10
27
 
11
- const cmd = process.argv[2];
28
+ const __filename = fileURLToPath(import.meta.url);
29
+ const __dirname = dirname(__filename);
12
30
 
13
- const banner = `
14
- lumina-wiki v${pkg.version}
31
+ // Load package.json synchronously (tiny; needed for --version immediately)
32
+ const require = createRequire(import.meta.url);
33
+ let PKG;
34
+ try {
35
+ PKG = require('../package.json');
36
+ } catch {
37
+ PKG = { version: '0.0.0', name: 'lumina-wiki' };
38
+ }
15
39
 
16
- Karpathy's LLM-Wiki vision — domain-agnostic, multi-IDE wiki scaffolder.
40
+ // ---------------------------------------------------------------------------
41
+ // Program setup
42
+ // ---------------------------------------------------------------------------
17
43
 
18
- This is a name-claim placeholder. The real installer is on the way.
44
+ async function handleVersionOptionIfPresent(argv) {
45
+ if (!argv.includes('--version') && !argv.includes('-v')) return false;
19
46
 
20
- Track progress: ${pkg.repo}
47
+ process.stdout.write(PKG.version + '\n');
21
48
 
22
- When v0.1.0 lands you'll be able to run:
23
- npx lumina-wiki@latest install
24
- `;
49
+ if (!argv.includes('--no-update') && process.env.LUMINA_NO_UPDATE_CHECK !== '1') {
50
+ try {
51
+ const { checkForUpdate } = await import('../src/installer/update-check.js');
52
+ const latest = await checkForUpdate(PKG.version);
53
+ if (latest) {
54
+ let yellow = (s) => s;
55
+ if (process.stdout.isTTY && !process.env.NO_COLOR) {
56
+ try {
57
+ const pc = (await import('picocolors')).default;
58
+ yellow = pc.yellow;
59
+ } catch (_) {}
60
+ }
61
+ console.log(yellow(`\n Update available: ${PKG.version} -> ${latest}`));
62
+ console.log(` Run: npx lumina-wiki@latest install\n`);
63
+ }
64
+ } catch (_) {
65
+ // Silent failure — never block --version
66
+ }
67
+ }
25
68
 
26
- if (cmd === '--version' || cmd === '-v') {
27
- console.log(pkg.version);
28
- process.exit(0);
69
+ return true;
29
70
  }
30
71
 
31
- console.log(banner);
32
- process.exit(0);
72
+ const handledVersion = await handleVersionOptionIfPresent(process.argv);
73
+ if (handledVersion) process.exit(0);
74
+
75
+ const { Command, Option } = await import('commander');
76
+ const program = new Command();
77
+
78
+ program
79
+ .name('lumina')
80
+ .description('Lumina Wiki — domain-agnostic, multi-IDE wiki scaffolder')
81
+ .helpOption('-h, --help', 'display help')
82
+ .addHelpText('after', `
83
+ Exit codes:
84
+ 0 success
85
+ 1 user error (bad flag, missing prereq)
86
+ 2 filesystem error (permission denied, path outside cwd)
87
+ 3 upgrade incompatibility (manifest references unknown pack)
88
+
89
+ Flags applicable to all commands:
90
+ --directory <path> installation directory (defaults to current directory)
91
+ --yes, -y accept all defaults; non-interactive (CI use)
92
+ --no-update skip npm registry version check
93
+ --re-link recompute symlink/junction/copy strategy from platform
94
+ --packs <list> install packs: core,research,reading
95
+ --ide-targets <list> target CLIs: claude_code,codex,gemini_cli,qwen,iflow,cursor,generic
96
+ codex covers all AGENTS.md-compatible CLIs
97
+ (Codex, Amp, Crush, Goose, Auggie, OpenCode, etc.)
98
+
99
+ Examples:
100
+ npx lumina-wiki install
101
+ lumina install --yes
102
+ lumina install --yes --packs core,research,reading --ide-targets claude_code,codex
103
+ lumina install --directory /path/to/project
104
+ lumina uninstall
105
+ lumina --version
106
+ `);
107
+
108
+ // ---------------------------------------------------------------------------
109
+ // Global options
110
+ // ---------------------------------------------------------------------------
111
+ program
112
+ .option('--directory <path>', 'installation directory', process.cwd())
113
+ .addOption(new Option('--cwd <path>', 'alias for --directory').hideHelp())
114
+ .option('-y, --yes', 'accept all defaults (non-interactive)')
115
+ .option('--no-update', 'skip npm registry version check')
116
+ .option('--re-link', 'recompute symlink strategy from current platform capabilities');
117
+
118
+ // ---------------------------------------------------------------------------
119
+ // --version / -v — print immediately then do async update check
120
+ // ---------------------------------------------------------------------------
121
+ program
122
+ .option('-v, --version', 'print version and check for updates');
123
+
124
+
125
+ // ---------------------------------------------------------------------------
126
+ // install subcommand
127
+ // ---------------------------------------------------------------------------
128
+ program
129
+ .command('install')
130
+ .description('scaffold or upgrade a Lumina Wiki workspace')
131
+ .option('--directory <path>', 'installation directory')
132
+ .addOption(new Option('--cwd <path>', 'alias for --directory').hideHelp())
133
+ .option('-y, --yes', 'accept all defaults')
134
+ .option('--no-update', 'skip update check')
135
+ .option('--re-link', 'recompute symlink strategy')
136
+ .option('--packs <list>', 'comma-separated packs to install: core,research,reading')
137
+ .option('--ide-targets <list>', 'comma-separated IDE targets')
138
+ .addOption(new Option('--project-name <name>', 'override auto-derived project name').hideHelp())
139
+ .option('--communication-language <language>', 'language agents use when talking to the user')
140
+ .option('--document-output-language <language>', 'language used for wiki documents')
141
+ .action(async (cmdOpts) => {
142
+ const globalOpts = program.opts();
143
+ const mergedDir = cmdOpts.directory ?? cmdOpts.cwd ?? globalOpts.directory ?? globalOpts.cwd ?? process.cwd();
144
+ const mergedYes = cmdOpts.yes ?? globalOpts.yes ?? false;
145
+ const mergedReLink = cmdOpts.reLink ?? globalOpts.reLink ?? false;
146
+ const mergedNoUpdate = cmdOpts.noUpdate ?? globalOpts.noUpdate ?? false;
147
+
148
+ try {
149
+ const { displayBanner } = await import('../src/installer/banner.js');
150
+ await displayBanner();
151
+ const { installCommand } = await import('../src/installer/commands.js');
152
+ await installCommand({
153
+ directory: resolve(mergedDir),
154
+ yes: Boolean(mergedYes),
155
+ reLink: Boolean(mergedReLink),
156
+ noUpdate: Boolean(mergedNoUpdate),
157
+ packs: cmdOpts.packs,
158
+ ideTargets: cmdOpts.ideTargets,
159
+ projectName: cmdOpts.projectName,
160
+ communicationLang: cmdOpts.communicationLanguage,
161
+ documentOutputLang: cmdOpts.documentOutputLanguage,
162
+ });
163
+ } catch (err) {
164
+ const isPermError = err.code === 'EACCES' || err.code === 'EPERM';
165
+ const isRangeError = err instanceof RangeError;
166
+ console.error(`[error] ${err.message}`);
167
+ if (process.env.DEBUG) console.error(err.stack);
168
+ process.exit(isPermError || isRangeError || err.code === 2 ? 2 : 1);
169
+ }
170
+ });
171
+
172
+ // ---------------------------------------------------------------------------
173
+ // uninstall subcommand
174
+ // ---------------------------------------------------------------------------
175
+ program
176
+ .command('uninstall')
177
+ .description('remove Lumina-managed files (wiki/ and raw/ are preserved)')
178
+ .option('--directory <path>', 'installation directory')
179
+ .addOption(new Option('--cwd <path>', 'alias for --directory').hideHelp())
180
+ .option('-y, --yes', 'skip confirmation prompt')
181
+ .action(async (cmdOpts) => {
182
+ const globalOpts = program.opts();
183
+ const mergedDir = cmdOpts.directory ?? cmdOpts.cwd ?? globalOpts.directory ?? globalOpts.cwd ?? process.cwd();
184
+ const mergedYes = cmdOpts.yes ?? globalOpts.yes ?? false;
185
+
186
+ try {
187
+ const { uninstallCommand } = await import('../src/installer/commands.js');
188
+ await uninstallCommand({
189
+ cwd: resolve(mergedDir),
190
+ yes: Boolean(mergedYes),
191
+ });
192
+ } catch (err) {
193
+ console.error(`[error] ${err.message}`);
194
+ if (process.env.DEBUG) console.error(err.stack);
195
+ process.exit(2);
196
+ }
197
+ });
198
+
199
+ // ---------------------------------------------------------------------------
200
+ // Parse argv
201
+ // ---------------------------------------------------------------------------
202
+ program.parseAsync(process.argv).catch((err) => {
203
+ console.error(`[error] ${err.message}`);
204
+ process.exit(1);
205
+ });