@namewta/skills-hub 0.1.48 → 0.1.49
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/package.json +1 -1
- package/skills/home/home-project-changelog/SKILL.md +3 -3
- package/skills/home/home-project-changelog/assets/project-changelog.md +7 -7
- package/skills/home/home-project-changelog/assets/worker-brief.md +1 -1
- package/skills/home/home-project-changelog/references/git-ranges.md +3 -0
- package/skills/home/home-project-changelog/references/tools.md +14 -4
- package/skills/home/home-project-changelog/references/workflow.md +2 -2
- package/skills/home/home-project-changelog/references/writing.md +20 -2
- package/skills/home/home-project-changelog/scripts/changelog.mjs +47 -5
- package/skills/home/home-project-changelog/scripts/contract.mjs +46 -2
- package/skills/home/home-project-changelog/scripts/git.mjs +15 -0
- package/skills/home/home-project-changelog/scripts/revision.mjs +231 -0
- package/skills/home/home-project-changelog/scripts/storage.mjs +24 -6
- package/skills/home/home-project-changelog/scripts/summary.mjs +17 -3
- package/skills/home/home-project-changelog/scripts/tasks.mjs +40 -0
- package/skills/home/home-website/SKILL.md +2 -2
- package/skills/home/home-website/assets/website/scripts/inputs.mjs +56 -14
- package/skills/home/home-website/assets/website/scripts/render.mjs +10 -5
- package/skills/home/home-website/assets/website/site/public/home-assets/app.js +69 -99
- package/skills/home/home-website/assets/website/site/public/home-assets/site.css +76 -83
- package/skills/home/home-website/assets/website/site/templates/layout.mjs +27 -15
- package/skills/home/home-website/assets/website/site/templates/ledger.mjs +55 -39
- package/skills/home/home-website/assets/website/site/templates/model.mjs +39 -1
- package/skills/home/home-website/assets/website/site/templates/pages.mjs +39 -57
- package/skills/home/home-website/assets/website/site/templates/project-logs.mjs +26 -10
- package/skills/home/home-website/references/website.md +8 -11
|
@@ -1,53 +1,69 @@
|
|
|
1
|
-
import { categories, distinctRangeLabel, itemId } from './model.mjs';
|
|
2
|
-
import { crumbs, escapeHtml as esc, logPath, projectPath,
|
|
1
|
+
import { activityMonths, categories, distinctRangeLabel, itemId } from './model.mjs';
|
|
2
|
+
import { crumbs, escapeHtml as esc, formatCount, logPath, projectPath, statSummary, symbol } from './layout.mjs';
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
export const
|
|
4
|
+
export const impactLabels = markers => (markers ?? []).map(name => `<span class="impact-tag">${esc(name)}</span>`).join('');
|
|
5
|
+
export const monthLabel = key => key === 'undated' ? '日期未记录' : `${key.slice(0, 4)} 年 ${Number(key.slice(5))} 月`;
|
|
6
6
|
|
|
7
|
-
function row(root, project, period, index) {
|
|
7
|
+
function row(root, project, {period, index}) {
|
|
8
8
|
const item = period.items[index];
|
|
9
|
-
const [category,text,markers] = item ?? [
|
|
10
|
-
(period.baseline ? '
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const [category, text, markers, meta] = item ?? [
|
|
10
|
+
'区间说明', period.note || (period.baseline ? '建立日志记录基线' : '完成本次区间核对'),
|
|
11
|
+
];
|
|
12
|
+
const url = root + logPath(project) + (item ? '#' + itemId(period, index) : '#range-' + period.key);
|
|
13
|
+
const date = meta?.date
|
|
14
|
+
? `<time datetime="${esc(meta.date)}">${esc(meta.date)}</time>`
|
|
15
|
+
: `<a href="${esc(root + logPath(project, period))}" title="查看日志区间">${esc(distinctRangeLabel(project, period))}</a>`;
|
|
16
|
+
return `<li class="ledger-entry" data-kind="${esc(category)}"${item ? ' data-entry' : ''}>
|
|
17
|
+
<span class="type-label">${esc(category)}</span>
|
|
18
|
+
<div><a class="change-cell" href="${esc(url)}">${impactLabels(markers)}${esc(text)}</a>
|
|
19
|
+
<div class="entry-context">${date}${meta?.area ? `<span>${esc(meta.area)}</span>` : ''}</div></div>
|
|
14
20
|
</li>`;
|
|
15
21
|
}
|
|
16
22
|
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
function monthSection(root, month, showProject, undatedAnchors) {
|
|
24
|
+
const {key, groups, changes, commits} = month;
|
|
25
|
+
return `<section class="ledger-window" id="month-${key}" data-month="${key}" aria-labelledby="month-title-${key}">
|
|
26
|
+
${key === 'undated' ? undatedAnchors.map(to => `<span id="window-${esc(to)}" class="legacy-window-anchor" aria-hidden="true"></span>`).join('') : ''}
|
|
27
|
+
<header class="window-head"><h3 id="month-title-${key}">${monthLabel(key)}</h3><span class="window-count">${formatCount(changes)} 项任务 · ${formatCount(commits)} 次 Git 提交</span></header>
|
|
28
|
+
${groups.map(({project, rows, commits: projectCommits}) => {
|
|
29
|
+
const legacy = key === 'undated' && project.legacy;
|
|
30
|
+
return `<section class="ledger-group tone-${project.color}" data-ledger-repo="${esc(project.id)}" data-commits="${projectCommits}" data-repo-name="${esc(project.name)}">
|
|
31
|
+
${showProject ? `<div class="ledger-group-head"><h4><a class="ledger-project" href="${esc(root + projectPath(project))}"><i></i>${esc(project.name)}</a></h4><span class="group-count">${formatCount(projectCommits)} 次 Git 提交</span></div>` : ''}
|
|
32
|
+
${rows.length || legacy ? `<ul class="ledger-lines" role="list">
|
|
33
|
+
${rows.map(item => row(root, project, item)).join('')}
|
|
34
|
+
${legacy ? `<li class="ledger-entry" data-kind="区间说明"><span class="type-label">旧版日志</span><div><p class="legacy-text">${esc(legacy)}</p><a class="entry-context" href="${esc(root + logPath(project))}#legacy">查看旧版原文</a></div></li>` : ''}
|
|
35
|
+
</ul>` : '<p class="commit-only">此月有 Git 提交,暂无任务记录。</p>'}
|
|
36
|
+
</section>`;
|
|
37
|
+
}).join('')}
|
|
25
38
|
</section>`;
|
|
26
39
|
}
|
|
27
40
|
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
export function monthlyLedger(root, projects, {showProject = true, undatedAnchors = []} = {}) {
|
|
42
|
+
const months = activityMonths(projects);
|
|
43
|
+
const monthCount = months.filter(({key}) => key !== 'undated').length;
|
|
44
|
+
const taskCount = months.reduce((total, month) => total + month.changes, 0);
|
|
45
|
+
const projectCount = new Set(months.flatMap(month => month.groups.map(group => group.project.id))).size;
|
|
46
|
+
const hasUndated = months.some(({key}) => key === 'undated');
|
|
47
|
+
const count = monthCount || !hasUndated
|
|
48
|
+
? `${monthCount} 个月${hasUndated ? '及日期未记录条目' : ''}`
|
|
49
|
+
: '日期未记录条目';
|
|
50
|
+
return `<section class="ledger" aria-labelledby="ledger-title"><h2 id="ledger-title">月度明细</h2>
|
|
51
|
+
<div class="ledger-tools"><p class="ledger-count" id="timeline-count" aria-live="polite">${count}${showProject ? ` · ${projectCount} 个项目` : ''} · ${formatCount(taskCount)} 项任务</p>
|
|
52
|
+
${months.length ? `<search class="ledger-filters enhanced-only" aria-label="筛选月度明细">
|
|
53
|
+
<label class="ledger-search">${symbol('search')}<input id="timeline-query" type="search" aria-label="筛选关键词" placeholder="筛选关键词" autocomplete="off"></label>
|
|
54
|
+
${showProject ? `<label><span class="sr">项目</span><select id="timeline-project"><option value="">全部项目</option>${projects.map(p => `<option value="${esc(p.id)}">${esc(p.name)}</option>`).join('')}</select></label>` : ''}
|
|
55
|
+
<label><span class="sr">月份</span><select id="timeline-month"><option value="">全部月份</option>${months.map(({key}) => `<option value="${key}">${monthLabel(key)}</option>`).join('')}</select></label>
|
|
56
|
+
<label><span class="sr">类别</span><select id="timeline-category"><option value="">全部类别</option>${[...categories, '区间说明'].map(c => `<option>${esc(c)}</option>`).join('')}</select></label>
|
|
57
|
+
</search>` : ''}</div>
|
|
58
|
+
${months.map(month => monthSection(root, month, showProject, undatedAnchors)).join('')}
|
|
59
|
+
<div id="timeline-empty" class="empty-panel"${months.length ? ' hidden' : ''}><h3>${months.length ? '没有符合条件的记录' : '暂无月度记录'}</h3>${months.length ? '<button type="button" id="reset-timeline" class="secondary-button enhanced-only">清除筛选</button>' : ''}</div>
|
|
38
60
|
</section>`;
|
|
39
61
|
}
|
|
40
62
|
|
|
41
63
|
export function changelog(root, projects, windows, stats) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
return `${crumbs(root,[['
|
|
45
|
-
${statSummary('site-statistics','
|
|
46
|
-
|
|
47
|
-
<search class="ledger-filters enhanced-only" aria-label="筛选时间线"><label class="ledger-search">${symbol('search')}<input id="timeline-query" type="search" aria-label="筛选变更正文" placeholder="筛选变更正文" autocomplete="off"></label>
|
|
48
|
-
<label><span class="sr">筛选项目</span><select id="timeline-project"><option value="">全部项目</option>${projects.map(p=>`<option value="${p.id}">${esc(p.id)}</option>`).join('')}</select></label>
|
|
49
|
-
<label><span class="sr">筛选类别</span><select id="timeline-category"><option value="">全部类别</option>${[...categories,'区间说明'].map(c=>`<option>${c}</option>`).join('')}</select></label>
|
|
50
|
-
<button type="button" class="ledger-toggle" id="expand-ledger" aria-pressed="false">展开全部</button></search></div>
|
|
51
|
-
${windows.map(window => windowSection(root,window)).join('')}
|
|
52
|
-
<div id="timeline-empty" class="empty-panel"${windows.length ? ' hidden' : ''}><h2>没有匹配的变更记录</h2><p>${windows.length ? '可更换项目、类别或关键词。' : '暂无已保存且可公开的日志区间。'}</p><button type="button" id="reset-timeline" class="secondary-button enhanced-only">清除筛选</button></div></section>`;
|
|
64
|
+
const undatedAnchors = windows.filter(window => window.groups.some(group =>
|
|
65
|
+
group.periods.some(period => !period.commitMonths))).map(window => window.to);
|
|
66
|
+
return `${crumbs(root, [['跨项目变更']])}<header class="page-head"><h1>跨项目变更</h1><p>按月份查看任务与 Git 提交,可按项目、类别及关键词筛选。</p></header>
|
|
67
|
+
${statSummary('site-statistics', '全站累计', stats)}
|
|
68
|
+
${monthlyLedger(root, projects, {undatedAnchors})}`;
|
|
53
69
|
}
|
|
@@ -62,5 +62,43 @@ export function distinctRangeLabel(project, period) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export function itemId(period, index) {
|
|
65
|
-
return 'entry-' + period.key + '-' + (index + 1);
|
|
65
|
+
return period.items[index]?.[3]?.id ?? 'entry-' + period.key + '-' + (index + 1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Tasks use the Git date of the change. A legacy observation window has no known task dates.
|
|
69
|
+
export function activityMonths(projects) {
|
|
70
|
+
const months = new Map();
|
|
71
|
+
function groupAt(key, project) {
|
|
72
|
+
if (!months.has(key)) months.set(key, new Map());
|
|
73
|
+
const month = months.get(key);
|
|
74
|
+
if (!month.has(project.id)) month.set(project.id, {project, commits:0, rows:[]});
|
|
75
|
+
return month.get(project.id);
|
|
76
|
+
}
|
|
77
|
+
for (const project of projects) {
|
|
78
|
+
for (const period of periodsByEnd(project)) {
|
|
79
|
+
if (period.commitMonths) {
|
|
80
|
+
for (const [month, count] of Object.entries(period.commitMonths)) groupAt(month,project).commits += count;
|
|
81
|
+
} else groupAt('undated',project).commits += period.commits;
|
|
82
|
+
period.items.forEach((item, index) => {
|
|
83
|
+
const month = period.commitMonths ? item[3].date.slice(0,7) : 'undated';
|
|
84
|
+
groupAt(month,project).rows.push({period,index});
|
|
85
|
+
});
|
|
86
|
+
if (!period.items.length && (!period.commitMonths || period.baseline)) {
|
|
87
|
+
groupAt('undated',project).rows.push({period,index:-1});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (project.legacy) groupAt('undated',project);
|
|
91
|
+
}
|
|
92
|
+
const keys = [...months.keys()].sort((a,b) => a === b ? 0 : a === 'undated' ? 1 : b === 'undated' ? -1 : b.localeCompare(a));
|
|
93
|
+
return keys.map(key => {
|
|
94
|
+
const groups = [...months.get(key).values()];
|
|
95
|
+
let commits = 0, changes = 0;
|
|
96
|
+
for (const group of groups) {
|
|
97
|
+
const rowDate = ({period,index}) => period.items[index]?.[3]?.date ?? period.to;
|
|
98
|
+
group.rows.sort((a,b) => rowDate(b).localeCompare(rowDate(a)));
|
|
99
|
+
changes += group.rows.filter(row => row.index >= 0).length;
|
|
100
|
+
commits += group.commits;
|
|
101
|
+
}
|
|
102
|
+
return {key,groups,commits,changes};
|
|
103
|
+
});
|
|
66
104
|
}
|
|
@@ -1,35 +1,17 @@
|
|
|
1
|
-
import { categories, distinctRangeLabel, itemId,
|
|
2
|
-
import { arrow, availableGroups, crumbs, escapeHtml as esc, external,
|
|
1
|
+
import { activityMonths, categories, distinctRangeLabel, itemId, periodTitle, statistics, timeline } from './model.mjs';
|
|
2
|
+
import { arrow, availableGroups, categoryBreakdown, crumbs, escapeHtml as esc, external, formatCount, logPath, mark, projectCard, projectChip, projectMetrics, projectPath, statStrip, statSummary, symbol } from './layout.mjs';
|
|
3
|
+
import { impactLabels, monthlyLedger, monthLabel } from './ledger.mjs';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (!byDate.has(period.to)) byDate.set(period.to, []);
|
|
15
|
-
byDate.get(period.to).push(period);
|
|
16
|
-
}
|
|
17
|
-
const x = date => 3 + 94 * Math.min(13, Math.max(0, (Date.parse(date) - Date.parse(chartDay(asOf, -13))) / day)) / 13;
|
|
18
|
-
const bars = periods.filter(period => period.from && period.from !== period.to).map(period => `<i class="range-bar" style="--left:${x(period.from).toFixed(2)}%;--width:${(x(period.to) - x(period.from)).toFixed(2)}%"></i>`).join('');
|
|
19
|
-
const dots = [...byDate].map(([date, same]) => {
|
|
20
|
-
const label = `${project.id},${date},${same.length} 个区间。${periodTitle(same[0])}`;
|
|
21
|
-
return `<a class="plot-point${same[0].baseline ? ' baseline-point' : ''}${same.length > 1 ? ' multiple' : ''}" href="${root}${logPath(project, same[0])}" style="--x:${x(date).toFixed(2)}%" aria-label="${esc(label)}" title="${esc(label)}"><i></i></a>`;
|
|
22
|
-
}).join('');
|
|
23
|
-
return `<div class="chart-lane tone-${project.color}"><a href="${root}${projectPath(project)}" class="lane-name">${project.id}</a><div class="lane-track">${bars}${dots}</div></div>`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function activityChart(root, projects, asOf) {
|
|
27
|
-
if (!asOf) return '';
|
|
28
|
-
const dayLabel = offset => shortDate(chartDay(asOf, offset));
|
|
29
|
-
return `<figure class="activity-figure"><figcaption><span class="chart-label">${symbol('activity')}仓库活动</span><span class="chart-window">${dayLabel(-13)} — ${dayLabel(0)}</span></figcaption>
|
|
30
|
-
<div class="lane-list">${projects.map(project => chartLane(root, project, asOf)).join('')}</div>
|
|
31
|
-
<div class="chart-axis"><span>${dayLabel(-13)}</span><span>${dayLabel(-7)}</span><span>${dayLabel(0)}</span></div>
|
|
32
|
-
<div class="chart-key"><span><i class="key-line"></i>记录区间</span><span><i class="key-dot"></i>区间结束</span><span><i class="key-multi"></i>同日多段</span><span><i class="key-ring"></i>基线</span></div></figure>`;
|
|
5
|
+
function activitySummary(root, projects) {
|
|
6
|
+
const months = activityMonths(projects).filter(({key}) => key !== 'undated').slice(0, 4);
|
|
7
|
+
if (!months.length) return projects.some(project => project.periods.length || project.legacy)
|
|
8
|
+
? `<div class="activity-figure"><p>已有记录保留在变更明细中。</p><a class="text-link" href="${root}changelog/#month-undated">查看变更明细 ${arrow}</a></div>`
|
|
9
|
+
: '';
|
|
10
|
+
const maximum = Math.max(1,...months.map(month => month.changes));
|
|
11
|
+
return `<figure class="activity-figure"><figcaption class="chart-label">近期项目活动</figcaption>
|
|
12
|
+
<table class="activity-table"><thead><tr><th scope="col">月份</th><th scope="col">任务</th><th scope="col">Git 提交</th></tr></thead>
|
|
13
|
+
<tbody>${months.map(({key, changes, commits}) => `<tr><th scope="row"><a href="${root}changelog/#month-${key}">${monthLabel(key)}</a></th><td><span class="activity-value"><i aria-hidden="true" style="--share:${(100*changes/maximum).toFixed(1)}%"></i>${formatCount(changes)}</span></td><td>${formatCount(commits)}</td></tr>`).join('')}</tbody></table>
|
|
14
|
+
<a class="text-link" href="${root}changelog/">查看全部月份 ${arrow}</a></figure>`;
|
|
33
15
|
}
|
|
34
16
|
|
|
35
17
|
function sectionHeading(title, url, label) {
|
|
@@ -37,52 +19,52 @@ function sectionHeading(title, url, label) {
|
|
|
37
19
|
}
|
|
38
20
|
|
|
39
21
|
export function overview(root, projects, windows, stats) {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
<dl class="hero-stats"><div><dt>公开项目</dt><dd>${projects.length}</dd></div><div><dt
|
|
46
|
-
</div>${
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<section class="recent-panel" aria-label="最近变更"><div class="recent-heading"><span class="section-accent"></span><h2>最近变更</h2></div>
|
|
52
|
-
<ol class="recent-list">${recent.map(({project,period}) => `<li class="tone-${project.color}"><a href="${root}${logPath(project,period)}"><div class="recent-meta"><time datetime="${period.to}">${shortDate(period.to)}</time>${projectChip(project)}</div><strong>${esc(periodTitle(period))}</strong><span class="recent-sub">${esc(rangeLabel(period))} · ${intervalCount(period)}</span></a></li>`).join('')}</ol>
|
|
53
|
-
<a class="text-link recent-all" href="${root}changelog/">完整时间线 ${arrow}</a></section></div>`;
|
|
22
|
+
const asOf = timeline(projects)[0]?.period.to;
|
|
23
|
+
const activity = activitySummary(root, projects);
|
|
24
|
+
return `<section class="overview-hero${activity ? '' : ' hero-no-activity'}" aria-labelledby="hero-title"><div class="hero-copy">
|
|
25
|
+
${asOf ? `<div class="hero-date"><i></i>记录截至 <time datetime="${asOf}">${asOf.replaceAll('-', '.')}</time></div>` : ''}
|
|
26
|
+
<h1 id="hero-title">项目进展总览</h1>
|
|
27
|
+
<dl class="hero-stats"><div><dt>公开项目</dt><dd>${formatCount(projects.length)}</dd></div><div><dt>记录区间提交</dt><dd>${formatCount(stats.commits)}</dd></div><div><dt>已记录任务</dt><dd>${formatCount(stats.changes)}</dd></div></dl>
|
|
28
|
+
</div>${activity}</section>
|
|
29
|
+
<section class="home-catalog" aria-label="项目进展">
|
|
30
|
+
${sectionHeading('项目进展', root + 'projects/', '查找项目')}
|
|
31
|
+
<div class="project-grid home-grid">${projects.length ? projects.map(project => projectCard(root, project)).join('') : '<p>暂无公开项目</p>'}</div>
|
|
32
|
+
</section>`;
|
|
54
33
|
}
|
|
55
34
|
|
|
56
35
|
export function catalog(root, projects) {
|
|
57
|
-
return `${crumbs(root,[['项目目录']])}<header class="page-head"><h1>项目目录</h1><p>共 ${projects.length}
|
|
36
|
+
return `${crumbs(root,[['项目目录']])}<header class="page-head"><h1>项目目录</h1><p>共 ${projects.length} 个公开项目。打开项目可按月份查看任务和提交。</p></header>
|
|
58
37
|
<section aria-label="项目筛选"><div class="filter-bar enhanced-only"><div class="filter-pills" aria-label="选择项目分组">${['全部',...availableGroups(projects)].map((g,i) => `<button type="button" data-group-filter="${i ? esc(g) : ''}" aria-pressed="${i === 0}">${esc(g)}</button>`).join('')}</div>
|
|
59
38
|
<label class="field search-field">${symbol('search')}<input id="catalog-query" type="search" aria-label="筛选项目" placeholder="名称、ID 或简介" autocomplete="off"></label></div>
|
|
60
39
|
<p id="catalog-count" class="list-count" aria-live="polite">显示 ${projects.length} 个项目</p><div id="project-grid" class="project-grid catalog-grid">${projects.map(project => projectCard(root,project)).join('')}</div>
|
|
61
40
|
<div class="empty-panel" id="catalog-empty"${projects.length ? ' hidden' : ''}><h2>没有匹配的项目</h2><p>${projects.length ? '换个关键词,或清除当前筛选。' : '暂无已保存且可公开的项目日志。'}</p><button type="button" class="secondary-button enhanced-only" id="reset-catalog">清除筛选</button></div></section>`;
|
|
62
41
|
}
|
|
63
42
|
|
|
64
|
-
function timelineRow(root, project, period) {
|
|
65
|
-
return `<a class="timeline-row" data-repo="${project.id}" href="${root}${logPath(project,period)}">${mark(project,true)}<div class="row-copy"><h3>${esc(distinctRangeLabel(project,period))}</h3><span class="range-caption">${esc(periodTitle(period))}</span></div><span class="row-count">${intervalCount(period)}</span>${arrow}</a>`;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
43
|
function resourceButtons(project) {
|
|
69
44
|
return [[project.docsUrl, '公开文档'], [project.repoUrl, '源代码']].filter(([url]) => url).map(([url, label]) =>
|
|
70
45
|
`<a class="secondary-button" href="${esc(url)}" target="_blank" rel="noopener noreferrer">${label} ${external}</a>`).join('');
|
|
71
46
|
}
|
|
72
47
|
|
|
73
48
|
export function detail(root, project, stats) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<
|
|
77
|
-
${
|
|
78
|
-
<section class="detail-recent"><div class="section-heading"><h2>记录区间</h2><a class="text-link" href="${root}changelog/?repo=${project.id}">在时间线中查看 ${arrow}</a></div>
|
|
79
|
-
${periods.map(period => timelineRow(root,project,period)).join('')}</section>`;
|
|
49
|
+
return `${crumbs(root,[['项目目录','projects/'],[project.name]])}<header class="detail-head tone-${project.color}"><div class="detail-intro">${mark(project)}<div>${project.groups.length ? `<span class="detail-group">${esc(project.groups.join(' · '))}</span>` : ''}<h1>${esc(project.name)}</h1>${project.id !== project.name ? `<span class="repo-id">${esc(project.id)}</span>` : ''}</div></div>
|
|
50
|
+
<p>${esc(project.purpose)}</p>${projectMetrics(project, 'detail-stats', stats)}${categoryBreakdown(stats)}
|
|
51
|
+
<div class="button-row"><a class="secondary-button" href="${root}${logPath(project)}">项目日志原文 ${arrow}</a>${resourceButtons(project)}</div></header>
|
|
52
|
+
${monthlyLedger(root, [project], {showProject:false})}`;
|
|
80
53
|
}
|
|
81
54
|
|
|
82
55
|
function logPeriod(project, period) {
|
|
56
|
+
const groups = categories.map(category => {
|
|
57
|
+
const entries = period.items.map(([type, text, markers, meta], index) => {
|
|
58
|
+
if (type !== category) return '';
|
|
59
|
+
const date = meta?.date ? `<time datetime="${esc(meta.date)}">${esc(meta.date)}</time>` : '';
|
|
60
|
+
const area = meta?.area ? `<span>${esc(meta.area)}</span>` : '';
|
|
61
|
+
return `<li class="log-entry" id="${esc(itemId(period, index))}">${impactLabels(markers)}${esc(text)}${date || area ? `<div class="entry-context">${date}${area}</div>` : ''}</li>`;
|
|
62
|
+
}).join('');
|
|
63
|
+
return entries ? `<section class="category-block"><h3>${category}</h3><ul>${entries}</ul></section>` : '';
|
|
64
|
+
}).join('');
|
|
83
65
|
return `<article id="range-${period.key}" class="log-period tone-${project.color}"><div class="period-heading">${projectChip(project)}<span>${period.baseline ? '基线' : 'Git 区间'}</span></div><h2>${esc(distinctRangeLabel(project,period))}</h2><p class="period-title">${esc(periodTitle(period))}</p>
|
|
84
66
|
${period.note ? `<p class="period-note">${esc(period.note)}</p>` : ''}${statStrip(statistics([period]),'本次提交')}
|
|
85
|
-
${
|
|
67
|
+
${groups}</article>`;
|
|
86
68
|
}
|
|
87
69
|
|
|
88
70
|
export function repositoryLog(root, project, stats) {
|
|
@@ -21,16 +21,19 @@ function tableAt(lines, i) {
|
|
|
21
21
|
}
|
|
22
22
|
function entry(category, body) {
|
|
23
23
|
const markers = [];
|
|
24
|
-
|
|
24
|
+
const dated = /^(\d{4}-\d{2}-\d{2}) · (.+?) · (.+)$/u.exec(body);
|
|
25
|
+
const unescape = value => value.replace(/\\([\[\]])/gu,'$1');
|
|
26
|
+
const meta = dated && validDay(dated[1]) ? {date:dated[1],area:dated[2] === '—' ? null : unescape(dated[2])} : null;
|
|
27
|
+
let text = meta ? dated[3] : body;
|
|
25
28
|
while (true) {
|
|
26
29
|
const match = /^\*\*\[([^\]]+)\]\*\*\s+/u.exec(text);
|
|
27
30
|
if (!match || !tags.includes(match[1])) break;
|
|
28
31
|
markers.push(match[1]);
|
|
29
32
|
text = text.slice(match[0].length);
|
|
30
33
|
}
|
|
31
|
-
return [category,text
|
|
34
|
+
return meta ? [category,unescape(text),markers,meta] : [category,unescape(text),markers];
|
|
32
35
|
}
|
|
33
|
-
function parsePeriod(title, lines) {
|
|
36
|
+
function parsePeriod(title, lines, datedOnly) {
|
|
34
37
|
let group = '', totals = null, originalTable = '', fence = '';
|
|
35
38
|
const items = [], notes = [];
|
|
36
39
|
for (let i=0; i<lines.length; i++) {
|
|
@@ -49,7 +52,9 @@ function parsePeriod(title, lines) {
|
|
|
49
52
|
group = line.slice(4);
|
|
50
53
|
if (!categories.includes(group)) notes.push(line);
|
|
51
54
|
} else if (categories.includes(group) && line.startsWith('- ')) {
|
|
52
|
-
|
|
55
|
+
const task = entry(group,line.slice(2));
|
|
56
|
+
if (datedOnly && !task[3]) notes.push(line);
|
|
57
|
+
else items.push(task);
|
|
53
58
|
} else notes.push(line);
|
|
54
59
|
}
|
|
55
60
|
const from = title[2] ? title[1] : null, to = title[2] ?? title[1];
|
|
@@ -64,15 +69,23 @@ function parsePeriod(title, lines) {
|
|
|
64
69
|
};
|
|
65
70
|
}
|
|
66
71
|
|
|
67
|
-
export function parseMarkdown(body) {
|
|
72
|
+
export function parseMarkdown(body, {datedOnly = false} = {}) {
|
|
68
73
|
const ranges = [], legacy = [];
|
|
69
|
-
let header = null, block = [], fence = '';
|
|
74
|
+
let header = null, block = [], fence = '', comment = false;
|
|
70
75
|
function flush() {
|
|
71
|
-
if (header) ranges.push(parsePeriod(header,block));
|
|
76
|
+
if (header) ranges.push(parsePeriod(header,block,datedOnly));
|
|
72
77
|
else legacy.push(...block);
|
|
73
78
|
block = [];
|
|
74
79
|
}
|
|
75
|
-
|
|
80
|
+
const visibleBody = body.replace(/^\uFEFF/u,'').replace(/^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/u,'');
|
|
81
|
+
for (let line of visibleBody.split(/\r?\n/u)) {
|
|
82
|
+
if (!fence && (comment || /^ {0,3}<!--/u.test(line))) {
|
|
83
|
+
const end = line.indexOf('-->');
|
|
84
|
+
comment = end < 0;
|
|
85
|
+
if (comment) continue;
|
|
86
|
+
line = line.slice(end + 3);
|
|
87
|
+
if (!line.trim()) continue;
|
|
88
|
+
}
|
|
76
89
|
const fenceStart = /^\s*(\x60{3,}|~{3,})/u.exec(line);
|
|
77
90
|
if (fenceStart) {
|
|
78
91
|
if (!fence) fence = fenceStart[1];
|
|
@@ -100,14 +113,17 @@ export function parseMarkdown(body) {
|
|
|
100
113
|
|
|
101
114
|
export function publicProject(project) {
|
|
102
115
|
return {
|
|
103
|
-
schemaVersion:
|
|
116
|
+
schemaVersion:2,id:project.id,name:project.name,purpose:project.purpose,headCommits:project.headCommits,
|
|
104
117
|
groups:project.groups, ...(project.docsUrl ? {docsUrl:project.docsUrl} : {}), ...(project.repoUrl ? {repoUrl:project.repoUrl} : {}),
|
|
105
118
|
stats:statistics(project.periods),
|
|
106
119
|
ranges:project.periods.map(period=>({
|
|
107
120
|
key:period.key,from:period.from,to:period.to,baseline:!!period.baseline,
|
|
108
121
|
stats:statistics([period]),
|
|
109
122
|
notes:period.notes ?? (period.note ? [period.note] : []),
|
|
110
|
-
|
|
123
|
+
commitMonths:period.commitMonths ?? null,
|
|
124
|
+
entries:period.items.map(([category,text,markers=[],meta],i)=>({
|
|
125
|
+
key:itemId(period,i),category,text,markers,date:meta?.date ?? null,area:meta?.area ?? null,
|
|
126
|
+
})),
|
|
111
127
|
})),
|
|
112
128
|
...(project.legacy ? {legacy:project.legacy} : {}),
|
|
113
129
|
};
|
|
@@ -51,26 +51,23 @@ git diff --no-index -- "$atlasSite/site" "$atlasNew/site"
|
|
|
51
51
|
|
|
52
52
|
- 公开集合取当前登记、`changelogs/state.json` 中成功保存的记录和展示配置。已保存且匹配正文的零项基线有公开区间。排除无状态、仅 Markdown、撤登、`hidden: true` 或 `showChangelog: false` 的项目。目录、详情、日志、搜索、JSON 和统计使用同一集合。
|
|
53
53
|
- 分组仅公开与 `publicGroups` 同名的登记值。源码与文档入口取站主明确提供的 HTTPS 地址。本机路径、内部引用和原始状态留在 Home。
|
|
54
|
-
- `changelogs/<id>.md`
|
|
55
|
-
- `dist/data/catalog.json`
|
|
54
|
+
- 先按日期、区间提交数和类别数量匹配 `changelogs/<id>.md` 的成功段。新日志再逐项核对区间 `ledger.tasks` 的日期、模块、类别、标记和正文。正式数据只从成功记录和相符的 Markdown 构建。成功段有 pending、正文缺失或任务不一致时,刷新报错并保留上次制品。历史补记保留在原文页。
|
|
55
|
+
- `dist/data/catalog.json` 提供 `schemaVersion: 2`、全站统计、各项目的任务量、区间提交数和 `headCommits`,以及按任务与提交月份聚合的 `months` 和按采集截止日聚合的 `windows`。月份未知的旧记录使用 `month: null`。
|
|
56
|
+
- `dist/data/projects/<id>.json` 提供 `headCommits`、项目统计及 `ranges[]`。每段有日期、`stats` 和 `commitMonths`。公开 `entries[]` 含 `key/category/area/date/text/markers`,旧条目的日期与模块可为 `null`。新任务的键在排序后保持稳定。更改模块、类别或正文会改变键。项目私有提交 OID、证据和游标只保存在 Home。
|
|
56
57
|
|
|
57
58
|
## 时间线与统计
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
首页可直接看到公开项目数、已记录的独立任务和区间 Git 提交数。项目卡片在进入详情前就显示已记录任务和仓库累计提交。累计取最新成功节点的可达历史数,未能核实时显示未知;从某个起点开始记录时,累计提交可以大于区间提交数。
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
跨项目页与项目详情按任务完成提交的月份倒序列出全部明细。每月 Git 提交按该月实际提交计数,包含没有单列任务的提交。一个提交完成多个任务时,任务数可以大于提交数。项目、月份、类别和关键词可组合筛选,关键词也能匹配模块。筛选显示命中任务数,月度提交保留所示项目在该月的完整提交量。
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
旧日志缺少逐条日期时,页面单列“日期未记录”并链接到可核实的原区间。全站原有观测窗口仍可从公开 JSON 读取。首窗截至最早的截止日,后续窗口从上一次截止日的次日开始。窗口统计和任务月统计分别服务于采集回顾与实际变更查询。
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
| ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
|
|
67
|
-
| 3 | 2 | 1 | 0 | 0 | 0 | 4 | 1 |
|
|
68
|
-
|
|
69
|
-
新增取 0 到该段功能条数之间的整数。没有功能的核实段为 0。有功能且缺少新增列的段显示“未单列”。范围内任一段未单列时,新增合计也显示“未单列”,公开 JSON 的 `added` 为 `null`。现有日志可直接构建,补齐精确新增数据时再按证据修订原段。
|
|
66
|
+
功能可含新增和预期行为变更。新日志用功能任务的 `added` 标志计算精确新增数;旧日志继续支持统计表尾部的 `新增` 列,取 0 至该段功能条数。范围含未单列新增的功能时,公开 JSON 中的 `added` 为 `null`。
|
|
70
67
|
|
|
71
68
|
## 更新和安全切换
|
|
72
69
|
|
|
73
|
-
完成一批登记或 Git 日志保存后,从真实 Home 根调用 `node .agents/home/website/scripts/site.mjs refresh
|
|
70
|
+
完成一批登记或 Git 日志保存后,从真实 Home 根调用 `node .agents/home/website/scripts/site.mjs refresh`。修订成功区间、补记、网站展示设置或模板后也用该命令。只读查询、同节点无变化和仅清除 pending 回执没有新的展示内容。正常批次更新时独立报告各仓保存结果和网站结果。
|
|
74
71
|
|
|
75
72
|
刷新按网站目录串行。构建候选在 `.cache/`,核对页面、链接和索引后才替换 `dist/`。上一个完整产物保留于 `.cache/previous-dist/`。重新构建可加 `--force`。构建输入仅使用 Home 登记、日志和站点工程,安装完成后无需子仓可用。
|
|
76
73
|
|