@itradingai/aiwiki 0.2.9 → 0.2.10

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
@@ -24,17 +24,6 @@ AIWiki 是一个开源的 Agent-first AI 知识库 CLI。你把文章链接、
24
24
  - 处理摘要
25
25
  - Obsidian 审阅入口
26
26
 
27
- ## 30 秒上手
28
-
29
- ```bash
30
- npx @itradingai/aiwiki@latest setup
31
- aiwiki agent list
32
- aiwiki agent install
33
- aiwiki prompt agent
34
- ```
35
-
36
- 然后把 `入库 <url>` 发给宿主 Agent。
37
-
38
27
  ## 直接发给 AI 帮你安装
39
28
 
40
29
  如果你希望让 Codex、Claude Code、QClaw、OpenClaw 等 AI 直接帮你完成安装和配置,可以把下面这段话原样发给它,记得改成你自己的知识库路径:
@@ -59,7 +48,18 @@ aiwiki prompt agent
59
48
  - 如果还差手动步骤,明确告诉我下一步怎么做
60
49
  ```
61
50
 
62
- ## 让宿主 Agent 学会 AIWiki
51
+ ## 手动安装
52
+
53
+ ```bash
54
+ npx @itradingai/aiwiki@latest setup
55
+ aiwiki agent list
56
+ aiwiki agent install
57
+ aiwiki prompt agent
58
+ ```
59
+
60
+ 然后把 `入库 <url>` 发给宿主 Agent。
61
+
62
+ ## 让宿主 Agent 直接安装 AIWiki
63
63
 
64
64
  初始化知识库后,先扫一遍本机支持的宿主 Agent:
65
65
 
@@ -188,6 +188,7 @@ aiwiki doctor
188
188
 
189
189
  ## 最新动态
190
190
 
191
+ - `2026-05-13`:更新了本地 Markdown 导入的命名规则,明确优先使用文件标题或文件名生成外部文件名,不优先从正文反推标题,并调整了 README 中的入口顺序和手动安装说明。
191
192
  - `2026-05-12`:公开前口径收口,统一 README、npm 元数据和公开文档入口。
192
193
  - `2026-05-09`:完成 npm 公开发布准备,补齐发布前的 README 与交付信息,并让 CLI 版本号与 `package.json` / 发布包保持一致,便于安装、排查与版本确认。
193
194
  - `2026-05-08`:完成中文化体验收口,包括默认生成中文 prompt、中文状态输出、中文目标描述,以及 README 和使用文档的中文本地化。
package/dist/src/app.js CHANGED
@@ -4,7 +4,7 @@ import path from "node:path";
4
4
  import { createInterface } from "node:readline/promises";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { flagBool, flagString, parseArgs } from "./args.js";
7
- import { ingestFile, ingestPayload } from "./ingest.js";
7
+ import { deriveFileTitle, ingestFile, ingestPayload } from "./ingest.js";
8
8
  import { CliError, writeLine } from "./output.js";
9
9
  import { confirmInit, directorySummary, doctor, exists, initWorkspace, promptForSetup, promptForInitPath, readConfig, resolveWorkspace, setDefaultWorkspace, statusSummary } from "./workspace.js";
10
10
  export async function runCli(argv, streams = { stdout: process.stdout, stderr: process.stderr }) {
@@ -163,7 +163,7 @@ export async function runCli(argv, streams = { stdout: process.stdout, stderr: p
163
163
  source: {
164
164
  kind: "url",
165
165
  url,
166
- title: path.basename(contentFile),
166
+ title: deriveFileTitle(contentFile),
167
167
  content_format: "markdown",
168
168
  content,
169
169
  fetcher: "content-file",
@@ -51,7 +51,7 @@ export async function ingestFile(rootPath, filePath) {
51
51
  schema_version: "aiwiki.agent_payload.v1",
52
52
  source: {
53
53
  kind: "file",
54
- title: path.basename(filePath),
54
+ title: deriveFileTitle(filePath),
55
55
  content_format: "markdown",
56
56
  content,
57
57
  fetcher: "local-file",
@@ -65,6 +65,9 @@ export async function ingestFile(rootPath, filePath) {
65
65
  }
66
66
  });
67
67
  }
68
+ export function deriveFileTitle(filePath) {
69
+ return path.basename(filePath, path.extname(filePath));
70
+ }
68
71
  async function chooseLongTermTargets(root, slug, runId, warnings) {
69
72
  return {
70
73
  raw: await chooseLongTermTarget(root, "02-raw/articles", `${slug}.md`, runId, warnings),
package/dist/src/paths.js CHANGED
@@ -16,14 +16,16 @@ export function relativePath(root, target) {
16
16
  }
17
17
  export function slugify(value) {
18
18
  const source = value?.trim() || "item";
19
- const ascii = source
19
+ const normalized = source
20
20
  .normalize("NFKD")
21
- .replace(/[^\w\s-]/g, "")
21
+ .replace(/\p{M}/gu, "");
22
+ const slug = normalized
23
+ .replace(/[^\p{L}\p{N}\s-]/gu, "")
22
24
  .trim()
23
25
  .toLowerCase()
24
26
  .replace(/[-\s_]+/g, "-")
25
27
  .replace(/^-+|-+$/g, "");
26
- return ascii || "item";
28
+ return slug || "item";
27
29
  }
28
30
  export function appendRunIdBeforeExt(fileName, runId) {
29
31
  const ext = path.extname(fileName);
package/docs/USAGE.md CHANGED
@@ -272,6 +272,11 @@ type "F:\knowledge_data\payload.json" | aiwiki ingest-agent --stdin
272
272
  aiwiki ingest-file --file "F:\knowledge_data\article.md"
273
273
  ```
274
274
 
275
+ 命名规则:
276
+ - 本地 `md` 导入时,AIWiki 优先使用文件标题或文件名生成外部文件名。
277
+ - 不会优先从正文内容里的 `# 一级标题` 反推文件名,避免整理后的文件名失去来源可追踪性。
278
+ - 如果文件名本身没有语义,才会继续回退到更弱的兜底命名。
279
+
275
280
  链接加正文文件:
276
281
 
277
282
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itradingai/aiwiki",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "type": "module",
5
5
  "description": "Agent-first AI knowledge base CLI for turning articles, links and notes into Obsidian-ready source cards, topics, outlines and reusable knowledge assets.",
6
6
  "license": "MIT",