skill-family-doc-render 0.4.1 → 0.4.5
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 +18 -0
- package/README.md +33 -24
- package/package.json +3 -3
- package/scripts/render-public-site.mjs +32 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# 变更日志
|
|
2
2
|
|
|
3
|
+
## 0.4.5 - 2026-09-10
|
|
4
|
+
|
|
5
|
+
### 变更
|
|
6
|
+
|
|
7
|
+
- 与 `skill-family-docs` 和公开站点的 0.4.5 联合发布对齐版本。渲染器的公开 API、命令行参数与输入合同均没有变化;相同内容输入仍生成相同的站点字节。
|
|
8
|
+
|
|
9
|
+
## 0.4.4 - 2026-09-10
|
|
10
|
+
|
|
11
|
+
### 修复
|
|
12
|
+
|
|
13
|
+
- 修复 `--check --assert-git` 组合调用提前返回的问题。组合命令现在依次检查渲染一致性与 Git 索引跟踪状态,全程不改目标目录、基线或索引。
|
|
14
|
+
- Git 查询失败继续返回工具错误 2;渲染漂移或输出未跟踪返回状态错误 1。单独使用 `--assert-git` 成功后仍按既有合同执行渲染。
|
|
15
|
+
- 帮助和错误文本把 Git 断言准确表述为“已被索引跟踪”,不再误写成“已提交”或“已发布”。
|
|
16
|
+
|
|
17
|
+
### 变更
|
|
18
|
+
|
|
19
|
+
- 将 Foundation 运行依赖精确升级到 0.19.3,继续复用原有路径收容、摘要、原子写和固定文件集发布接口。
|
|
20
|
+
|
|
3
21
|
## 0.4.1 - 2026-09-07
|
|
4
22
|
|
|
5
23
|
### 变更
|
package/README.md
CHANGED
|
@@ -16,51 +16,54 @@ publication APIs. A failure before commit removes staging and leaves the existin
|
|
|
16
16
|
untouched. After commit, or when publication is indeterminate, staging or displaced data may
|
|
17
17
|
remain for diagnosis; the renderer does not guess or roll back.
|
|
18
18
|
|
|
19
|
-
> **Version boundary:** this source tree is version `0.4.
|
|
20
|
-
> official npm registry before treating it as installable. Version 0.4.
|
|
19
|
+
> **Version boundary:** this source tree is version `0.4.5`. Verify that exact version in the
|
|
20
|
+
> official npm registry before treating it as installable. Version 0.4.5 preserves the
|
|
21
21
|
> `markdown-v1`, `editorial`, and `--check-project` behavior introduced in 0.4.0 and aligns the
|
|
22
|
-
> renderer, documentation plugin, and public site at 0.4.
|
|
22
|
+
> renderer, documentation plugin, and public site at 0.4.5 for the joint release.
|
|
23
23
|
|
|
24
24
|
## Install
|
|
25
25
|
|
|
26
26
|
After confirming availability, install this release with an exact version:
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
|
-
npm install --save-exact skill-family-doc-render@0.4.
|
|
29
|
+
npm install --save-exact skill-family-doc-render@0.4.5
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Requires Node.js `>=22.22.2 <23` (aligned with the skill-family foundation packages).
|
|
33
33
|
|
|
34
|
-
Version 0.4.
|
|
35
|
-
`skill-family-contracts@0.
|
|
34
|
+
Version 0.4.5 has exact runtime dependencies on `marked@18.0.11`,
|
|
35
|
+
`skill-family-contracts@0.19.3`, and `skill-family-harness-node@0.19.3`. `marked` supplies the
|
|
36
36
|
Markdown lexer; the renderer applies its own restricted-format validation before passing semantic
|
|
37
37
|
content to the template. The workspace profile check separately uses
|
|
38
|
-
`skill-family-engineering-kit@0.
|
|
38
|
+
`skill-family-engineering-kit@0.19.3`.
|
|
39
39
|
The 0.2.0 baseline format and exit-code changes are breaking changes; existing 0.1.x users
|
|
40
40
|
must re-render their baseline before using `--check`. See the changelog for the full migration
|
|
41
41
|
notes.
|
|
42
42
|
|
|
43
43
|
## CLI
|
|
44
44
|
|
|
45
|
-
Use the exact 0.4.
|
|
45
|
+
Use the exact 0.4.5 CLI for rendering, checks, coverage maintenance, and the Git index assertion:
|
|
46
46
|
|
|
47
47
|
```sh
|
|
48
48
|
# render all repos with a site field (writes to disk)
|
|
49
|
-
npx skill-family-doc-render@0.4.
|
|
49
|
+
npx skill-family-doc-render@0.4.5
|
|
50
50
|
|
|
51
|
-
# drift check only: compare in-memory render against
|
|
52
|
-
npx skill-family-doc-render@0.4.
|
|
51
|
+
# drift check only: compare in-memory render against the on-disk site-baseline.json, write nothing
|
|
52
|
+
npx skill-family-doc-render@0.4.5 --check
|
|
53
53
|
|
|
54
54
|
# render / check a single repo by name
|
|
55
|
-
npx skill-family-doc-render@0.4.
|
|
55
|
+
npx skill-family-doc-render@0.4.5 --repo <name>
|
|
56
56
|
|
|
57
|
-
#
|
|
58
|
-
npx skill-family-doc-render@0.4.
|
|
57
|
+
# assert every rendered file is tracked in the Git index, then render
|
|
58
|
+
npx skill-family-doc-render@0.4.5 --assert-git
|
|
59
|
+
|
|
60
|
+
# run both the drift and Git index tracking checks without writing
|
|
61
|
+
npx skill-family-doc-render@0.4.5 --check --assert-git
|
|
59
62
|
|
|
60
63
|
# inspect or refresh the reviewed product-input snapshot
|
|
61
|
-
npx skill-family-doc-render@0.4.
|
|
62
|
-
npx skill-family-doc-render@0.4.
|
|
63
|
-
npx skill-family-doc-render@0.4.
|
|
64
|
+
npx skill-family-doc-render@0.4.5 --status --repo <name>
|
|
65
|
+
npx skill-family-doc-render@0.4.5 --refresh-coverage --repo <name>
|
|
66
|
+
npx skill-family-doc-render@0.4.5 --check-project --repo <name>
|
|
64
67
|
```
|
|
65
68
|
|
|
66
69
|
The current directory must be the workspace that owns `public-release.json`. From this package's
|
|
@@ -73,14 +76,20 @@ then internal links and resources. It writes nothing. A failure identifies the r
|
|
|
73
76
|
`public-release.json`, the reason, and a copyable `skill-family-docs-render-site` recovery prompt.
|
|
74
77
|
|
|
75
78
|
Exit codes: `0` success; `1` drift/status class — `--check` drift, leak-scan hit, `--assert-git`
|
|
76
|
-
|
|
79
|
+
untracked rendered files, missing/corrupt render baseline, or missing/stale coverage snapshot; `2`
|
|
77
80
|
configuration/tool class — missing/invalid `public-release.json` or `pages.json`, JSON parse
|
|
78
81
|
failures, unreplaced `@TOKEN@` placeholders, invalid `--repo` usage, invalid coverage inputs, or
|
|
79
82
|
Git failure (the message includes the JSON field path). `--check-project` uses the same classes:
|
|
80
83
|
public-safety, coverage, render, link, or resource findings return `1`; invalid input,
|
|
81
84
|
configuration, or tool errors return `2`.
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
Combining `--check` with `--assert-git` first verifies the render against the on-disk baseline,
|
|
86
|
+
then checks that every rendered page, asset, and `.nojekyll` entry is tracked in the Git index.
|
|
87
|
+
The combined command writes neither the target tree, `site-baseline.json`, nor the Git index.
|
|
88
|
+
`site-baseline.json` itself, source Markdown, configuration, and coverage locks are outside the
|
|
89
|
+
Git assertion set. A staged file satisfies the assertion; the command does not claim that the
|
|
90
|
+
file is committed or published. Without `--check`, a successful `--assert-git` preflight is
|
|
91
|
+
followed by the normal rendering write. When several repos are rendered in one run, each repo is
|
|
92
|
+
isolated: a failure in one does not stop the others, and the
|
|
84
93
|
run ends with a summary of successes/failures plus a non-zero exit (2 if any failure was
|
|
85
94
|
configuration-class, otherwise 1).
|
|
86
95
|
|
|
@@ -274,10 +283,10 @@ Foundation packages below, it uses exact `marked@18.0.11` for Markdown tokenizat
|
|
|
274
283
|
Apache-2.0
|
|
275
284
|
|
|
276
285
|
<!-- release-skill:capability:safe-first-command -->
|
|
277
|
-
> **Start here:** run `npx skill-family-doc-render@0.4.
|
|
286
|
+
> **Start here:** run `npx skill-family-doc-render@0.4.5 --check-project --repo <name>` after
|
|
278
287
|
> confirming that exact release in the official registry. From a local checkout, use
|
|
279
288
|
> `node bin/skill-family-doc-render.mjs --check-project --repo <name>`. The check is read-only:
|
|
280
|
-
> it renders in memory, compares against the
|
|
289
|
+
> it renders in memory, compares against the on-disk `site-baseline.json`, writes
|
|
281
290
|
> nothing and touches no network or credentials. The CLI performs no Git writes; only an
|
|
282
291
|
> explicit `--assert-git` performs a read-only query of the Git index.
|
|
283
292
|
|
|
@@ -298,6 +307,6 @@ Apache-2.0
|
|
|
298
307
|
Display help and run a read-only project check:
|
|
299
308
|
|
|
300
309
|
```sh
|
|
301
|
-
npx skill-family-doc-render@0.4.
|
|
302
|
-
npx skill-family-doc-render@0.4.
|
|
310
|
+
npx skill-family-doc-render@0.4.5 --help
|
|
311
|
+
npx skill-family-doc-render@0.4.5 --check-project --repo <name>
|
|
303
312
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skill-family-doc-render",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Config-driven GitHub Pages knowledge-site renderer for skill-family projects (multi-repo capable).",
|
|
5
5
|
"author": "广州市风荷科技有限公司",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"marked": "18.0.11",
|
|
30
|
-
"skill-family-contracts": "0.
|
|
31
|
-
"skill-family-harness-node": "0.
|
|
30
|
+
"skill-family-contracts": "0.19.3",
|
|
31
|
+
"skill-family-harness-node": "0.19.3"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
//
|
|
21
21
|
// 错误分类(退出码语义):
|
|
22
22
|
// exit 1 — 漂移类:--check 检出漂移、覆盖快照缺失或落后、泄漏扫描命中、
|
|
23
|
-
// --assert-git
|
|
23
|
+
// --assert-git 检出未跟踪文件、渲染基线缺失 / 基线 JSON 损坏;
|
|
24
24
|
// exit 2 — 配置或工具类:配置 / JSON / 覆盖输入非法、Git 调用失败、
|
|
25
25
|
// @TOKEN@ 占位符残留、markdown-v1/SVG 输入非法、--repo 参数无效;
|
|
26
26
|
// 其余意外异常(HarnessError 等)原样抛出,CLI 归为 exit 1。
|
|
@@ -514,6 +514,30 @@ async function markdownOutputs(root, repo, dirRel, pagesDoc, tokens) {
|
|
|
514
514
|
return outputs;
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
+
function assertGitTracked(root, repo, targetRel, files) {
|
|
518
|
+
const expected = files.map((f) => `${targetRel}/${f}`);
|
|
519
|
+
let missing = 0;
|
|
520
|
+
for (const f of expected) {
|
|
521
|
+
try {
|
|
522
|
+
execFileSync('git', ['ls-files', '--error-unmatch', f], { cwd: root, stdio: 'pipe' });
|
|
523
|
+
} catch (cause) {
|
|
524
|
+
if (cause?.status === 1) {
|
|
525
|
+
console.error(`[assert-git] ${repo.name}: 未被 Git 索引跟踪(请先 git add): ${f}`);
|
|
526
|
+
missing++;
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
const detail = String(cause?.stderr || cause?.message || '').trim();
|
|
530
|
+
throw configError(
|
|
531
|
+
repo.name,
|
|
532
|
+
`Git 索引查询失败: git ls-files --error-unmatch ${f}${detail ? `: ${detail}` : ''}`,
|
|
533
|
+
cause,
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (missing) throw new RenderError(`[assert-git] ${repo.name}: ${missing} 个渲染文件未被 Git 索引跟踪`, 1);
|
|
538
|
+
console.log(`[assert-git] ${repo.name}: 全部渲染文件均已被 Git 索引跟踪`);
|
|
539
|
+
}
|
|
540
|
+
|
|
517
541
|
// --- 渲染单仓 ---
|
|
518
542
|
async function renderRepo(root, repo, release, leakLiterals, { check, assertGit, inputOnly = false }) {
|
|
519
543
|
const site = repo.site;
|
|
@@ -641,7 +665,7 @@ async function renderRepo(root, repo, release, leakLiterals, { check, assertGit,
|
|
|
641
665
|
const baselineRel = join(targetRel, 'site-baseline.json');
|
|
642
666
|
if (!existsSync(resolve(root, baselineRel))) {
|
|
643
667
|
throw new RenderError(
|
|
644
|
-
`[render-public-site --check] ${repo.name}:
|
|
668
|
+
`[render-public-site --check] ${repo.name}: 未找到磁盘基线 site-baseline.json(请先运行渲染)`,
|
|
645
669
|
1,
|
|
646
670
|
);
|
|
647
671
|
}
|
|
@@ -685,24 +709,12 @@ async function renderRepo(root, repo, release, leakLiterals, { check, assertGit,
|
|
|
685
709
|
);
|
|
686
710
|
}
|
|
687
711
|
console.log(`[render-public-site --check] ${repo.name}: 一致,无漂移`);
|
|
712
|
+
if (assertGit) assertGitTracked(root, repo, targetRel, files);
|
|
688
713
|
return;
|
|
689
714
|
}
|
|
690
715
|
|
|
691
716
|
// assert-git 必须在任何 target 变更前完成,避免门禁失败留下部分替换结果。
|
|
692
|
-
if (assertGit)
|
|
693
|
-
const expected = files.map((f) => `${targetRel}/${f}`);
|
|
694
|
-
let missing = 0;
|
|
695
|
-
for (const f of expected) {
|
|
696
|
-
try {
|
|
697
|
-
execFileSync('git', ['ls-files', '--error-unmatch', f], { cwd: root, stdio: 'pipe' });
|
|
698
|
-
} catch {
|
|
699
|
-
console.error(`[assert-git] ${repo.name}: 未跟踪(需 git add 并提交): ${f}`);
|
|
700
|
-
missing++;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
if (missing) throw new RenderError(`[assert-git] ${repo.name}: ${missing} 个文件未进 Git 快照,站点无法进入发布`, 1);
|
|
704
|
-
console.log(`[assert-git] ${repo.name}: 全部站点文件已在 Git 快照中`);
|
|
705
|
-
}
|
|
717
|
+
if (assertGit) assertGitTracked(root, repo, targetRel, files);
|
|
706
718
|
|
|
707
719
|
// --- 写盘事务化:在目标目录的 canonical parent 内创建 sibling staging,
|
|
708
720
|
// 写入和发布均使用 Foundation 公共目录发布 API。 ---
|
|
@@ -786,9 +798,11 @@ const USAGE_TEXT = `skill-family-doc-render — config-driven GitHub Pages knowl
|
|
|
786
798
|
|
|
787
799
|
Usage:
|
|
788
800
|
skill-family-doc-render render every repo with a site field (writes)
|
|
789
|
-
skill-family-doc-render --check read-only drift check against site-baseline.json
|
|
801
|
+
skill-family-doc-render --check read-only drift check against the on-disk site-baseline.json
|
|
790
802
|
skill-family-doc-render --repo <name> render / check a single repo by name
|
|
791
|
-
skill-family-doc-render --assert-git
|
|
803
|
+
skill-family-doc-render --assert-git assert rendered files are tracked in the Git index, then render
|
|
804
|
+
skill-family-doc-render --check --assert-git
|
|
805
|
+
read-only drift and Git index tracking checks
|
|
792
806
|
skill-family-doc-render --status --repo <name>
|
|
793
807
|
read-only coverage status and Git changes
|
|
794
808
|
skill-family-doc-render --refresh-coverage --repo <name>
|