@qnroa/qtype 0.0.5 → 0.0.6

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/CHANGELOG.md CHANGED
@@ -13,6 +13,35 @@ can land in any minor bump (`0.x.0`).
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [0.0.6] - 2026-08-24
17
+
18
+ ### Changed
19
+
20
+ - **`QTYPE.md` template documents nested `material/` folders as
21
+ first-class.** The template already-existing `walkMaterial` recurses
22
+ into `material/<category>/<slug>.md`, and `publish build` even uses
23
+ the first path segment as a fallback `type` when frontmatter omits
24
+ it — but the previous wording ("flat `material/` + `assets/` only",
25
+ rule #9) read as a ban on subdirectories, misleading Agent-driven
26
+ authors into flattening large repos. The template now:
27
+ - shows both flat and nested placements in the Directory Layout
28
+ tree, with a one-line note that both are supported and discovery
29
+ is recursive;
30
+ - adds a **Grouping by folder (optional)** section covering the
31
+ recursive-discovery behavior and the first-segment-as-fallback-`type`
32
+ shortcut (`material/code/hello.md` → `type: code` when frontmatter
33
+ is silent);
34
+ - reworks the Naming section to say each path segment (`<slug>`,
35
+ `<category>`) uses the same kebab-case rules;
36
+ - rewrites rule #9 to enumerate the allowed root-level directories
37
+ (`material/`, `material/assets/`, `raw/`) and cross-reference the
38
+ new subfolder section, replacing the misleading "flat only"
39
+ phrasing.
40
+ Applies to both `templates/en/QTYPE.md` and `templates/zh/QTYPE.md`.
41
+ No runtime code changed; existing repos are unaffected until they
42
+ regenerate their `QTYPE.md` via `qtype repo new` or copy the new
43
+ template in.
44
+
16
45
  ## [0.0.5] - 2026-08-22
17
46
 
18
47
  ### Fixed
package/CHANGELOG.zh.md CHANGED
@@ -12,6 +12,29 @@ English: [CHANGELOG.md](https://www.npmjs.com/package/@qnroa/qtype?activeTab=cod
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ## [0.0.6] - 2026-08-24
16
+
17
+ ### 变更
18
+
19
+ - **`QTYPE.md` 模板把嵌套 `material/` 子目录写成一等公民**。
20
+ `walkMaterial` 一直就是递归的,`publish build` 甚至会用首段路径
21
+ 作为 frontmatter 没写 `type` 时的 fallback —— 但之前模板里
22
+ "flat `material/` + `assets/` only"(规则 #9)的措辞读起来像禁止
23
+ 子目录,把 Agent 驱动的作者误导成"再大的仓库也只能平铺"。这次:
24
+ - Directory Layout 目录树里同时画出平铺和嵌套两种放法,并加一行
25
+ "两种都支持,发现是递归的";
26
+ - 新增 **按分类分子目录(可选)** 小节,说明递归发现行为,以及
27
+ 首段路径当 fallback `type` 的捷径(`material/code/hello.md`
28
+ 在 frontmatter 没 `type` 时被视为 `type: code`);
29
+ - 命名节改为"每一段路径(`<slug>`、`<category>`)都用同一套
30
+ kebab-case 规则";
31
+ - 规则 #9 重写为枚举根目录允许的三个位置(`material/` /
32
+ `material/assets/` / `raw/`)并 xref 新的子目录小节,替换掉
33
+ 误导性的"平铺"措辞。
34
+ 同步改动 `templates/en/QTYPE.md` 和 `templates/zh/QTYPE.md`。
35
+ 运行时代码没动;老仓库要拿到新文档需要重跑 `qtype repo new`
36
+ 或手动把新模板拷进去。
37
+
15
38
  ## [0.0.5] - 2026-08-22
16
39
 
17
40
  ### 修复
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qnroa/qtype",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Turn Markdown notes into typing practice — CLI + review + static-site publisher",
5
5
  "keywords": [
6
6
  "typing",
@@ -41,7 +41,8 @@ The whole document is organized into four modules: **Concepts / Format / Operati
41
41
  ├── qtype.config.json
42
42
  ├── material/
43
43
  │ ├── .gitkeep
44
- │ ├── <slug>.md
44
+ │ ├── <slug>.md # flat placement — fine
45
+ │ ├── <category>/<slug>.md # nested placement — also fine
45
46
  │ └── assets/<material-slug>/
46
47
  └── raw/
47
48
  ├── .gitkeep
@@ -49,6 +50,8 @@ The whole document is organized into four modules: **Concepts / Format / Operati
49
50
  └── assets/<raw-slug>/
50
51
  ```
51
52
 
53
+ **Flat and nested placements are both supported.** All `.md` under `material/` are discovered recursively. Choose whichever fits the repo — small repos are usually flat, larger ones group by category folder.
54
+
52
55
  ---
53
56
 
54
57
  ## Format
@@ -231,11 +234,21 @@ sqrt(pi)
231
234
 
232
235
  ### Naming
233
236
 
234
- Material files: `material/<slug>.md`
235
- - kebab-case, ASCII lowercase + hyphens, ≤ 60 chars
237
+ Material files: `material/<slug>.md` — or `material/<category>/<slug>.md` if grouping by folder.
238
+
239
+ - Each path segment (`<slug>`, `<category>`) uses the same rules: kebab-case, ASCII lowercase + hyphens, ≤ 60 chars
236
240
  - Chinese topics: use English translation or pinyin
237
241
  - Collision: append `-2` / `-3`
238
242
 
243
+ ### Grouping by folder (optional)
244
+
245
+ `material/` may contain category subfolders. Two things to know when you use them:
246
+
247
+ - **Discovery is recursive.** All `.md` files under `material/` are picked up regardless of depth. Nested folders don't hide their contents.
248
+ - **The first path segment is a fallback `type`.** When a material's frontmatter omits `type`, the first folder name is used instead — e.g. a file at `material/code/hello.md` with no `type:` line is treated as `type: code`. This is a shortcut for repos organized by type folder; explicit `type:` in frontmatter always wins.
249
+
250
+ Group by folder when the repo has many materials of clearly different subjects (e.g. `skills/`, `experience/`, `projects/`, `code/`). Stay flat when there are only a handful of files — extra folders add friction without payoff.
251
+
239
252
  ### Links
240
253
 
241
254
  - **Markdown link syntax only**, no Wikilinks
@@ -272,7 +285,7 @@ Ingest, Update, Quiz-gen, Cascade, Check, Level-up — semantics as before. Key
272
285
  6. **No Wikilinks**
273
286
  7. **No absolute paths**
274
287
  8. **Never `git commit` / `push`** — the user commits
275
- 9. **No unspec'd directories** — flat `material/` + `assets/` only
288
+ 9. **No unspec'd directories** — only `material/` (may contain category subfolders, see "Grouping by folder"), `material/assets/`, and `raw/` are allowed at the repo root
276
289
  10. **Never fabricate IPA / gloss / translation** — leave blank, report in log
277
290
  11. **One `type` per material** — no mixing
278
291
  12. **No card-level frontmatter** — per-card info lives in markdown structure
@@ -43,8 +43,9 @@ qtype 是一个以 Markdown 为源、以 OS 键盘(含中文 IME)为输入
43
43
  ├── qtype.config.json # 用户可调设置
44
44
  ├── material/ # 你写的素材
45
45
  │ ├── .gitkeep
46
- │ ├── <slug>.md # 一个素材一个文件
47
- └── assets/ # 素材引用的图片
46
+ │ ├── <slug>.md # 平铺放法 —— 可以
47
+ ├── <category>/<slug>.md # 按分类嵌套 —— 也可以
48
+ │ └── assets/ # 素材引用的图片
48
49
  │ └── <material-slug>/
49
50
  └── raw/ # (可选)用户扔进来的原始材料
50
51
  ├── .gitkeep
@@ -52,6 +53,8 @@ qtype 是一个以 Markdown 为源、以 OS 键盘(含中文 IME)为输入
52
53
  └── assets/
53
54
  ```
54
55
 
56
+ **平铺和嵌套都支持**:`material/` 下所有 `.md` 会被递归发现,深几层都能扫到。文件少时平铺就够了,文件多时按分类开子目录更清爽。
57
+
55
58
  ---
56
59
 
57
60
  ## 格式
@@ -259,12 +262,21 @@ sqrt(pi)
259
262
 
260
263
  ### 命名
261
264
 
262
- **素材文件名**:`material/<slug>.md`
265
+ **素材文件名**:`material/<slug>.md` —— 或者按分类嵌套时 `material/<category>/<slug>.md`。
263
266
 
264
- - `<slug>`:主题的 kebab-case,小写,英文字母和短横线,最长 60 字符
267
+ - 每一段路径(`<slug>`、`<category>`)都用同一套规则:kebab-case,小写,英文字母和短横线,最长 60 字符
265
268
  - 中文主题用英译或拼音
266
269
  - 同名冲突:末尾追加 `-2` / `-3`
267
270
 
271
+ ### 按分类分子目录(可选)
272
+
273
+ `material/` 下可以开分类子目录。启用时需要知道两件事:
274
+
275
+ - **发现是递归的**。`material/` 下所有 `.md` 文件不论深度都会被扫到,嵌套目录不会被跳过
276
+ - **首段路径充当 `type` 的 fallback**。如果一个 material 的 frontmatter 没有写 `type`,第一段目录名会被当作 type —— 比如 `material/code/hello.md` 不写 `type:` 会被视为 `type: code`。这是给"按 type 分目录"的仓库的捷径;只要 frontmatter 里显式写了 `type`,永远以 frontmatter 为准。
277
+
278
+ 素材数量多、主题差异明显时(比如 `skills/` / `experience/` / `projects/` / `code/`)用子目录归类;素材只有几个时保持平铺就好,多开一层目录只会增摩擦不增收益。
279
+
268
280
  ### 链接
269
281
 
270
282
  - **只用 Markdown link**,不用 Wikilink
@@ -330,7 +342,7 @@ updated: YYYY-MM-DD
330
342
  6. **不用 Wikilink**
331
343
  7. **不绝对路径**
332
344
  8. **不主动 git commit / push**
333
- 9. **不建规则外的目录**
345
+ 9. **不建规则外的目录**:仓库根下只允许 `material/`(内部可按分类开子目录,见"按分类分子目录")、`material/assets/`、`raw/`
334
346
  10. **不凭空造 IPA / 释义 / 翻译**:不确定的宁可空着
335
347
  11. **一个 material 只有一个 type**:不能混
336
348
  12. **没有 card-level frontmatter**:所有 per-card 信息都用 markdown 结构表达