@namewta/skills-hub 0.1.51 → 0.1.52
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 +2 -2
- package/skills/home/home-project-changelog/references/schema.md +1 -0
- package/skills/home/home-project-changelog/references/tools.md +1 -0
- package/skills/home/home-project-changelog/scripts/changelog.mjs +8 -1
- package/skills/home/home-project-changelog/scripts/contract.mjs +2 -1
- package/skills/home/home-website/SKILL.md +2 -2
- package/skills/home/home-website/assets/website/scripts/inputs.mjs +7 -0
- package/skills/home/home-website/assets/website/scripts/render.mjs +5 -3
- package/skills/home/home-website/assets/website/site/public/home-assets/app.js +30 -29
- package/skills/home/home-website/assets/website/site/public/home-assets/site.css +44 -54
- package/skills/home/home-website/assets/website/site/templates/favicon.png +0 -0
- package/skills/home/home-website/assets/website/site/templates/layout.mjs +11 -4
- package/skills/home/home-website/assets/website/site/templates/ledger.mjs +41 -45
- package/skills/home/home-website/assets/website/site/templates/model.mjs +30 -9
- package/skills/home/home-website/assets/website/site/templates/pages.mjs +17 -48
- package/skills/home/home-website/assets/website/site/templates/project-logs.mjs +1 -0
- package/skills/home/home-website/references/website.md +5 -5
- package/skills/home/home-website/scripts/activate.mjs +2 -1
- package/skills/home/home-website/scripts/init.mjs +20 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: home-project-changelog
|
|
3
|
-
description: 把指定项目的 Git 变更拆成可独立验收的最小任务,生成带日期、模块、类别、提交依据和周期统计的 changelog。用于查看、续写或重新细化一个或多个项目的历史区间,供 Home
|
|
3
|
+
description: 把指定项目的 Git 变更拆成可独立验收的最小任务,生成带日期、模块、类别、提交依据和周期统计的 changelog。用于查看、续写或重新细化一个或多个项目的历史区间,供 Home 展示站按采集区间和项目读取。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Home 项目变更日志
|
|
@@ -12,6 +12,6 @@ description: 把指定项目的 Git 变更拆成可独立验收的最小任务
|
|
|
12
12
|
- **细化已有日志**按[调整已有区间](references/workflow.md#调整已有区间)用 `reopen` 重开原 Git 区间,用 `revise` 更新指定区间的任务。
|
|
13
13
|
- **恢复或迁移**按[写入与恢复](references/tools.md#写入与恢复)核对磁盘上的项目 JSON。旧的双文件资料按[一次性迁移](references/tools.md#一次性迁移)处理。
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
首次默认完整历史,允许明确指定起点或只建基线。后续按成功游标续写。一次执行同步采集多仓时,共用一个 `collectionAt`。同一跟踪来源的同节点空跑返回零增量。重型任务按项目或冻结批次[并行取证](references/workflow.md#使用已有派遣方法),由主 Agent 复核、合并候选并写入。
|
|
16
16
|
|
|
17
17
|
参阅[数据契约](references/schema.md)、[项目 JSON 示例](assets/project-changelog.example.json)和[派遣任务模板](assets/worker-brief.md)。登记、路由和派遣分别沿用 `home-setup`、`home-route`、`home-workflow` 和 `home-tasks`。目标项目提交、发布或部署按该项目的事实和流程处理。
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
| `initialization` | 必填,复用项目初始化意图,参与唯一范围计算 |
|
|
26
26
|
| `previousRangeId` | 必填,前一成功区间 ID,初次写入为 `null` |
|
|
27
27
|
| `from`、`to` | 必填,B/H 节点。节点含完整 `commit`、Git 提交者时间 `committedAt` 和实际观测时间 `observedAt`。全历史与基线的 `from` 为 `null` |
|
|
28
|
+
| `collectionAt` | 当次采集的 UTC 时间。多仓同一次执行共用此值,旧记录可省略。时间与补录或修订的写入时间分别记录。 |
|
|
28
29
|
| `freshness` | 必填,`local`、`remote-observed` 或 `remote-cache` |
|
|
29
30
|
| `displayDates` | 必填,按 `timezone` 换算的 `from`、`to`,格式为 `YYYY-MM-DD`。基线或部分旧全历史记录的 `from` 可为 `null` |
|
|
30
31
|
| `coverage` | 必填,实际采集为 `complete`,只建立基线为 `not-backfilled` |
|
|
@@ -41,6 +41,7 @@ node scripts/changelog.mjs evidence --snapshot TMP_DIR/snapshot.json --commit FU
|
|
|
41
41
|
| `base` | `from` 的完整提交 OID 或 `refs/tags/…` |
|
|
42
42
|
| `tracking` | `{kind:"remote-branch",remote:"主远端名",ref:"refs/heads/分支"}`、`{kind:"local-branch",ref:"refs/heads/分支"}` 或 `{kind:"revision",ref:"完整OID或refs/tags/…"}` |
|
|
43
43
|
| `timezone` | Home 的 IANA 时区。缺省沿用上次记录,首次使用当前执行机时区 |
|
|
44
|
+
| `collectionAt` | 同一次多仓采集共用的 UTC 时间,格式如 `2026-12-03T07:00:00.000Z`。单仓省略时采用本次 Git 节点的观测时间。 |
|
|
44
45
|
| `offline` | `true` 时使用已保存同源引用对应的现有远端跟踪缓存 |
|
|
45
46
|
| `completeHistory` | `true` 时允许联网获取完整历史,目标仍为本次已观察的 H |
|
|
46
47
|
| `changeReason` | 同仓跟踪引用发生明确变化时,记实际决定 |
|
|
@@ -17,7 +17,10 @@ import { taskLedger } from './tasks.mjs';
|
|
|
17
17
|
|
|
18
18
|
function checkSelection(selection, view) {
|
|
19
19
|
expectKeys(selection, ['tracking', 'mode', 'base', 'timezone', 'offline', 'completeHistory',
|
|
20
|
-
'changeReason', 'rebaselineReason'], 'ARGUMENT', '选择文件包含未知字段或格式无效。');
|
|
20
|
+
'changeReason', 'rebaselineReason', 'collectionAt'], 'ARGUMENT', '选择文件包含未知字段或格式无效。');
|
|
21
|
+
requireThat(selection.collectionAt === undefined || (isInstant(selection.collectionAt) &&
|
|
22
|
+
new Date(selection.collectionAt).toISOString() === selection.collectionAt),
|
|
23
|
+
'ARGUMENT', 'collectionAt 需要标准 UTC 时间,例如 2026-12-03T07:00:00.000Z。');
|
|
21
24
|
requireThat(selection.tracking === undefined || validTracking(selection.tracking), 'ARGUMENT', '跟踪引用无效。');
|
|
22
25
|
for (const key of ['offline', 'completeHistory']) {
|
|
23
26
|
requireThat(selection[key] === undefined || typeof selection[key] === 'boolean', 'ARGUMENT', `${key} 使用布尔值。`);
|
|
@@ -50,6 +53,7 @@ export function freeze(home, route, selection = {}) {
|
|
|
50
53
|
const base = selection.mode === 'from' ? resolveInitialBase(source, selection.base, target.freshness) : null;
|
|
51
54
|
return {
|
|
52
55
|
formatVersion: 1, homeRoot: store.root, repoId: route.repoId, binding: source.binding, selection, timezone, base,
|
|
56
|
+
collectionAt: selection.collectionAt ?? new Date(target.observedAt).toISOString(),
|
|
53
57
|
expectedProjectRevision: revisionOf(view.project), ...target,
|
|
54
58
|
};
|
|
55
59
|
}
|
|
@@ -63,6 +67,8 @@ function checkFrozen(frozen, view) {
|
|
|
63
67
|
checkSelection(frozen.selection, view);
|
|
64
68
|
const { tracking, binding, freshness, selection } = frozen;
|
|
65
69
|
requireThat((selection.mode === 'from' ? isOid(frozen.base) : frozen.base === null)
|
|
70
|
+
&& (frozen.collectionAt === undefined ? selection.collectionAt === undefined
|
|
71
|
+
: frozen.collectionAt === (selection.collectionAt ?? new Date(frozen.observedAt).toISOString()))
|
|
66
72
|
&& (!selection.tracking || sameTracking(selection.tracking, tracking))
|
|
67
73
|
&& (tracking.kind === 'remote-branch' ? tracking.remote === binding?.remote?.name
|
|
68
74
|
&& freshness === (selection.offline ? 'remote-cache' : 'remote-observed') : freshness === 'local'),
|
|
@@ -121,6 +127,7 @@ function collect(frozen, view, git) {
|
|
|
121
127
|
const record = {
|
|
122
128
|
kind, sourceIdentity, tracking, initialization, previousRangeId: previous?.rangeId ?? null,
|
|
123
129
|
from, to, freshness,
|
|
130
|
+
...(frozen.collectionAt && {collectionAt:frozen.collectionAt}),
|
|
124
131
|
...(historyStart ? { firstCommitAt: historyStart } : {}),
|
|
125
132
|
...(changeReason ? { changeReason, previousSourceIdentity: previous.sourceIdentity } : {}),
|
|
126
133
|
displayDates: { from: startTime ? dateAt(startTime, timezone) : null, to: dateAt(to.observedAt, timezone), timezone },
|
|
@@ -121,6 +121,7 @@ function validRecord(id, entry, previous, initialization, saved) {
|
|
|
121
121
|
|| !validPoint(entry.to) || !isLine(entry.sourceIdentity) || !validTracking(entry.tracking)
|
|
122
122
|
|| entry.rangeId !== rangeIdFor(id, entry) || entry.previousRangeId !== (previous?.rangeId ?? null)
|
|
123
123
|
|| !isInstant(entry.generatedAt) || (saved ? !isInstant(entry.savedAt) : entry.savedAt !== null)
|
|
124
|
+
|| (hasOwn(entry, 'collectionAt') && !(isInstant(entry.collectionAt) && new Date(entry.collectionAt).toISOString() === entry.collectionAt))
|
|
124
125
|
|| !['remote-observed', 'remote-cache', 'local'].includes(entry.freshness)) return false;
|
|
125
126
|
if (entry.tracking.kind === 'remote-branch' ? entry.freshness === 'local' : entry.freshness !== 'local') return false;
|
|
126
127
|
const complete = ['delta', 'full-history'].includes(entry.kind);
|
|
@@ -175,7 +176,7 @@ export function validateProjectFile(project, id) {
|
|
|
175
176
|
let previous = null;
|
|
176
177
|
for (const range of project.ranges) {
|
|
177
178
|
expectKeys(range, ['kind', 'sourceIdentity', 'tracking', 'initialization', 'previousRangeId', 'from', 'to',
|
|
178
|
-
'freshness', 'firstCommitAt', 'changeReason', 'previousSourceIdentity', 'displayDates', 'coverage', 'stats',
|
|
179
|
+
'freshness', 'firstCommitAt', 'collectionAt', 'changeReason', 'previousSourceIdentity', 'displayDates', 'coverage', 'stats',
|
|
179
180
|
'rangeId', 'ledger', 'legacy', 'generatedAt', 'savedAt', 'notes', 'revisionRequest'], 'PROJECT_FORMAT', message);
|
|
180
181
|
requireThat(validRecord(id, range, previous, project.initialization, true)
|
|
181
182
|
&& !ids.has(range.rangeId)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: home-website
|
|
3
|
-
description: 创建、刷新、预览或部署 Home 的多项目静态展示站。首次启用或显式激活时调用 home-project-changelog
|
|
3
|
+
description: 创建、刷新、预览或部署 Home 的多项目静态展示站。首次启用或显式激活时调用 home-project-changelog 补采展示范围内缺失或有增量的日志,构建后可按采集区间、项目、关键词与类别查看任务、Git 提交和文本行增删。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Home 项目展示站
|
|
@@ -17,7 +17,7 @@ description: 创建、刷新、预览或部署 Home 的多项目静态展示站
|
|
|
17
17
|
|
|
18
18
|
激活回执为 `needs-analysis` 时,按 `review` 中的冻结区间调用 `home-project-changelog` 取证、整理并保存。所有可补采项目处理后重跑激活。同一节点复用已有日志。配置了明确项目范围时,补采和展示均采用该范围。
|
|
19
19
|
|
|
20
|
-
站点从 `repos.json` 的 `projectNames`
|
|
20
|
+
站点从 `repos.json` 的 `projectNames` 读取首选名称,目录、区间明细、日志和搜索共用该名称。发布范围按稳定 ID 配置。仅有日志的项目可用 `projectIds` 显式纳入。
|
|
21
21
|
|
|
22
22
|
每仓的 `.agents/home/website/changelogs/<repo-id>.json` 保存成功区间、任务与提交统计。编辑该文件的展示文字和补记可直接重建。网站链接提供从源文件导出的[公开 JSON](references/website.md#公开字段与数据来源)。
|
|
23
23
|
|
|
@@ -99,6 +99,9 @@ function publicText(value, privateValues) {
|
|
|
99
99
|
const publicMarkers = ['破坏性', '安全', '弃用', '移除', '回退'];
|
|
100
100
|
const oid = value => typeof value === 'string' && /^[0-9a-f]{40}(?:[0-9a-f]{24})?$/u.test(value);
|
|
101
101
|
const oidList = values => Array.isArray(values) && values.every(oid) && new Set(values).size === values.length;
|
|
102
|
+
const lineCount = value => value == null || Number.isSafeInteger(value) && value >= 0;
|
|
103
|
+
const collectionTime = value => typeof value === 'string' && Number.isFinite(Date.parse(value))
|
|
104
|
+
&& new Date(value).toISOString() === value;
|
|
102
105
|
const notesList = value => Array.isArray(value) && value.every(note => typeof note === 'string' && note.trim());
|
|
103
106
|
const validEntry = entry => plain(entry) && categories.includes(entry.category) && line(entry.text)
|
|
104
107
|
&& Array.isArray(entry.markers) && entry.markers.every(marker => publicMarkers.includes(marker));
|
|
@@ -126,6 +129,8 @@ function readProject(id, saved) {
|
|
|
126
129
|
|| !plain(dates) || !validDay(dates.to) || (dates.from !== null && (!validDay(dates.from) || dates.from > dates.to))
|
|
127
130
|
|| !Number.isSafeInteger(count) || (baseline ? (dates.from !== null || count !== 0) : count <= 0)
|
|
128
131
|
|| (head !== null && (!Number.isSafeInteger(head) || head < count))
|
|
132
|
+
|| (range.collectionAt !== undefined && !collectionTime(range.collectionAt))
|
|
133
|
+
|| !lineCount(range.stats.linesAdded) || !lineCount(range.stats.linesDeleted)
|
|
129
134
|
|| range.notes !== undefined && !notesList(range.notes)
|
|
130
135
|
|| Object.hasOwn(range,'ledger') === Object.hasOwn(range,'legacy')) fail('成功区间');
|
|
131
136
|
rangeIds.add(range.rangeId);
|
|
@@ -175,6 +180,8 @@ function publicPeriods(project, text) {
|
|
|
175
180
|
: (Object.hasOwn(range.legacy,'added') ? range.legacy.added : features.length ? null : 0);
|
|
176
181
|
return {
|
|
177
182
|
key:pair+'-'+occurrence,from,to,items,notes,note:notes.join('\n'),commits:range.stats.rangeCommitCount,added,
|
|
183
|
+
collectionAt:range.collectionAt, timezone:range.displayDates.timezone,
|
|
184
|
+
linesAdded:range.stats.linesAdded ?? null, linesDeleted:range.stats.linesDeleted ?? null,
|
|
178
185
|
coverage:range.coverage,baseline:range.coverage === 'not-backfilled',commitMonths:range.ledger?.commitMonths,
|
|
179
186
|
};
|
|
180
187
|
}).reverse();
|
|
@@ -21,6 +21,7 @@ export function render(website, run, model) {
|
|
|
21
21
|
const {title,base,projects} = model;
|
|
22
22
|
const windows = observationWindows(projects);
|
|
23
23
|
const stats = statistics(projects.flatMap(project => project.periods));
|
|
24
|
+
const favicon = fs.readFileSync(path.join(website,'site/templates/favicon.png')).toString('base64');
|
|
24
25
|
const source = path.join(run,'src');
|
|
25
26
|
const dist = path.join(run,'dist');
|
|
26
27
|
fs.cpSync(path.join(website,'site/.vitepress'),path.join(source,'.vitepress'),{recursive:true});
|
|
@@ -28,7 +29,7 @@ export function render(website, run, model) {
|
|
|
28
29
|
const shape = {
|
|
29
30
|
title, base, outDir:dist, lang:'zh-CN', cleanUrls:true, appearance:false, lastUpdated:false, mpa:true,
|
|
30
31
|
head:[
|
|
31
|
-
['link',{rel:'icon',href:'data
|
|
32
|
+
['link',{rel:'icon',type:'image/png',href:'data:image/png;base64,'+favicon}],
|
|
32
33
|
['link',{rel:'stylesheet',href:base+'home-assets/site.css'}],
|
|
33
34
|
['script',{src:base+'home-assets/start.js'}],
|
|
34
35
|
['script',{defer:'',src:base+'home-assets/search-index.js'}],
|
|
@@ -66,8 +67,9 @@ export function render(website, run, model) {
|
|
|
66
67
|
const catalogData = {schemaVersion:2,stats,projects:[],months:activityMonths(projects).map(({key,changes,commits,groups}) => ({
|
|
67
68
|
month:key === 'undated' ? null : key,changes,commits,
|
|
68
69
|
projects:groups.map(({project,commits,rows}) => ({id:project.id,commits,changes:rows.filter(row=>row.index >= 0).length})),
|
|
69
|
-
})),windows:windows.map(({from,to,groups,rangeCount,stats}) => ({
|
|
70
|
-
from, to,
|
|
70
|
+
})),windows:windows.map(({key,from,to,at,fromAt,groups,rangeCount,stats}) => ({
|
|
71
|
+
key, from, to, collectionAt:at ?? null, previousCollectionAt:fromAt ?? null,
|
|
72
|
+
projects:groups.map(({project}) => project.id), rangeCount, stats,
|
|
71
73
|
}))};
|
|
72
74
|
const expectedData = new Map();
|
|
73
75
|
for (const project of projects) {
|
|
@@ -77,25 +77,25 @@
|
|
|
77
77
|
const input = one('#timeline-query');
|
|
78
78
|
if (!input) return;
|
|
79
79
|
const project = one('#timeline-project');
|
|
80
|
-
const
|
|
80
|
+
const range = one('#timeline-window');
|
|
81
81
|
const category = one('#timeline-category');
|
|
82
82
|
const reset = one('#reset-timeline');
|
|
83
|
-
const fields = [['repo', project], ['
|
|
83
|
+
const fields = [['repo', project], ['window', range], ['category', category], ['q', input]].filter(([, field]) => field);
|
|
84
84
|
const number = value => value == null ? '未核实' : value.toLocaleString('zh-CN');
|
|
85
|
+
const lineMetrics = ['linesAdded', 'linesDeleted'];
|
|
85
86
|
function statFields(container) {
|
|
86
87
|
return {
|
|
87
|
-
|
|
88
|
-
commits: container.querySelector('[data-commit-count]'),
|
|
88
|
+
metrics: new Map([...container.querySelectorAll('[data-metric]')].map(element => [element.dataset.metric, element])),
|
|
89
89
|
categories: [...container.querySelectorAll('[data-category-count]')],
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
const
|
|
92
|
+
const windows = all('.ledger-window').map(section => {
|
|
93
93
|
const header = section.querySelector('header');
|
|
94
94
|
const groups = [...section.querySelectorAll('.ledger-group')].map(group => ({
|
|
95
95
|
group,
|
|
96
96
|
id: group.dataset.ledgerRepo,
|
|
97
97
|
projectText: normalize(group.dataset.ledgerRepo + ' ' + group.dataset.repoName),
|
|
98
|
-
|
|
98
|
+
metrics: JSON.parse(group.dataset.totals),
|
|
99
99
|
stats: statFields(group.querySelector('summary')),
|
|
100
100
|
rows: [...group.querySelectorAll('.ledger-entry')].map(row => ({
|
|
101
101
|
row,
|
|
@@ -104,12 +104,12 @@
|
|
|
104
104
|
task: row.hasAttribute('data-entry'),
|
|
105
105
|
})),
|
|
106
106
|
}));
|
|
107
|
-
const toggle = header?.querySelector('[data-
|
|
107
|
+
const toggle = header?.querySelector('[data-window-toggle]');
|
|
108
108
|
function updateToggle() {
|
|
109
109
|
if (!toggle) return;
|
|
110
110
|
const allOpen = groups.every(({group}) => group.hidden || group.open);
|
|
111
111
|
toggle.textContent = allOpen ? '收起全部' : '展开全部';
|
|
112
|
-
toggle.setAttribute('aria-label', toggle.dataset.
|
|
112
|
+
toggle.setAttribute('aria-label', toggle.dataset.windowLabel + ',' + toggle.textContent + '项目任务');
|
|
113
113
|
toggle.setAttribute('aria-expanded', String(allOpen));
|
|
114
114
|
}
|
|
115
115
|
toggle?.addEventListener('click', () => {
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
updateToggle();
|
|
119
119
|
});
|
|
120
120
|
for (const {group} of groups) group.addEventListener('toggle', updateToggle);
|
|
121
|
-
return {section, key:section.dataset.
|
|
121
|
+
return {section, key:section.dataset.window, groups, stats:header && statFields(header), updateToggle};
|
|
122
122
|
});
|
|
123
123
|
let savedOpen = null;
|
|
124
124
|
|
|
@@ -130,24 +130,25 @@
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
function updateStats(stats, counts,
|
|
134
|
-
stats.
|
|
135
|
-
stats.
|
|
133
|
+
function updateStats(stats, counts, values) {
|
|
134
|
+
stats.metrics.get('changes').textContent = number([...counts.values()].reduce((total, count) => total + count, 0));
|
|
135
|
+
for (const key of lineMetrics) stats.metrics.get(key).textContent = number(values[key]);
|
|
136
136
|
for (const element of stats.categories) element.textContent = number(counts.get(element.dataset.categoryCount) ?? 0);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
function render() {
|
|
140
140
|
const tokens = normalize(input.value).split(/\s+/u).filter(Boolean);
|
|
141
|
-
const filtering = Boolean(project?.value ||
|
|
142
|
-
if (filtering && !savedOpen) savedOpen = new Map(
|
|
141
|
+
const filtering = Boolean(project?.value || range.value || category.value || tokens.length);
|
|
142
|
+
if (filtering && !savedOpen) savedOpen = new Map(windows.flatMap(entry =>
|
|
143
143
|
entry.groups.map(({group}) => [group, group.open])));
|
|
144
144
|
const projects = new Set();
|
|
145
|
-
let
|
|
146
|
-
for (const entry of
|
|
147
|
-
let groups = 0, entries = 0
|
|
148
|
-
const
|
|
145
|
+
let visibleWindows = 0, tasks = 0;
|
|
146
|
+
for (const entry of windows) {
|
|
147
|
+
let groups = 0, entries = 0;
|
|
148
|
+
const totals = Object.fromEntries(lineMetrics.map(key => [key, 0]));
|
|
149
|
+
const windowCounts = new Map();
|
|
149
150
|
for (const group of entry.groups) {
|
|
150
|
-
const matchesScope = (!project?.value || project.value === group.id) && (!
|
|
151
|
+
const matchesScope = (!project?.value || project.value === group.id) && (!range.value || range.value === entry.key);
|
|
151
152
|
const visible = group.rows.filter(item => {
|
|
152
153
|
item.row.hidden = !matchesScope || (category.value !== '' && category.value !== item.category)
|
|
153
154
|
|| !tokens.every(token => item.text.includes(token) || group.projectText.includes(token));
|
|
@@ -165,26 +166,26 @@
|
|
|
165
166
|
if (!item.task) continue;
|
|
166
167
|
entries++;
|
|
167
168
|
counts.set(item.category, (counts.get(item.category) ?? 0) + 1);
|
|
168
|
-
|
|
169
|
+
windowCounts.set(item.category, (windowCounts.get(item.category) ?? 0) + 1);
|
|
170
|
+
}
|
|
171
|
+
updateStats(group.stats, counts, group.metrics);
|
|
172
|
+
for (const key of lineMetrics) {
|
|
173
|
+
const sum = totals[key] + group.metrics[key];
|
|
174
|
+
totals[key] = totals[key] == null || group.metrics[key] == null || !Number.isSafeInteger(sum) ? null : sum;
|
|
169
175
|
}
|
|
170
|
-
updateStats(group.stats, counts, group.commits);
|
|
171
|
-
commits = commits == null || group.commits == null || !Number.isSafeInteger(commits + group.commits)
|
|
172
|
-
? null : commits + group.commits;
|
|
173
176
|
}
|
|
174
177
|
entry.section.hidden = groups === 0;
|
|
175
178
|
entry.updateToggle();
|
|
176
179
|
if (!groups) continue;
|
|
177
|
-
|
|
178
|
-
else dated++;
|
|
180
|
+
visibleWindows++;
|
|
179
181
|
tasks += entries;
|
|
180
|
-
if (entry.stats) updateStats(entry.stats,
|
|
182
|
+
if (entry.stats) updateStats(entry.stats, windowCounts, totals);
|
|
181
183
|
}
|
|
182
184
|
if (!filtering) savedOpen = null;
|
|
183
185
|
reset.hidden = !filtering;
|
|
184
|
-
const monthCount = dated ? `${dated} 个月${undated ? '及日期未记录条目' : ''}` : undated ? '日期未记录条目' : '0 个月';
|
|
185
186
|
const projectCount = project ? ` · ${projects.size} 个项目` : '';
|
|
186
|
-
one('#timeline-count').textContent = `${
|
|
187
|
-
one('#timeline-empty').hidden =
|
|
187
|
+
one('#timeline-count').textContent = `${visibleWindows} 个区间${projectCount} · ${number(tasks)} 项任务`;
|
|
188
|
+
one('#timeline-empty').hidden = visibleWindows > 0;
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
for (const [key, field] of fields) field.addEventListener(field === input ? 'input' : 'change', () => {
|
|
@@ -44,7 +44,7 @@ h1, h2, h3 { color: var(--ink); }
|
|
|
44
44
|
.main-content { min-height: calc(100vh - 189px); padding-block: 32px 62px; }
|
|
45
45
|
:where(h2,article,section,[id]) { scroll-margin-top: 92px; }
|
|
46
46
|
.masthead { position: sticky; z-index: 10; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); }
|
|
47
|
-
.mast-inner, .brand, .main-nav, .mast-tools, .search-open, .icon-button, .text-link, .button-row, .primary-button, .secondary-button, .section-heading, .hero-date, .
|
|
47
|
+
.mast-inner, .brand, .main-nav, .mast-tools, .search-open, .icon-button, .text-link, .button-row, .primary-button, .secondary-button, .section-heading, .hero-date, .card-top, .card-foot, .project-chip, .footer-inner, .field, .filter-pills, .period-heading, .detail-intro, .crumbs { display: flex; align-items: center; }
|
|
48
48
|
.mast-inner { height: 70px; gap: clamp(20px, 4vw, 62px); }
|
|
49
49
|
.brand { color: var(--ink); gap: 12px; white-space: nowrap; font-family: var(--serif); font-size: 26px; font-weight: 700; letter-spacing: -.055em; }
|
|
50
50
|
.brand-stamp { position: relative; display: inline-block; width: 32px; height: 32px; border-radius: 9px; background: #162840; }
|
|
@@ -76,7 +76,7 @@ kbd { font: 11px/1.4 var(--mono); border: 1px solid var(--line); border-radius:
|
|
|
76
76
|
.sym-activity::after { content:""; display:block; width:3px; height:6px; position:absolute; bottom:2px; left:1px; background:currentColor; box-shadow:6px -4px currentColor,12px -1px currentColor; }
|
|
77
77
|
.sym-book { border:1.5px solid; border-radius:2px; }
|
|
78
78
|
.sym-book::after { content:""; position:absolute; inset:0 45% 0 auto; border-left:1px solid; }
|
|
79
|
-
.overview-hero { position:relative;
|
|
79
|
+
.overview-hero { position:relative; text-align:center; padding: clamp(28px,5vw,56px) 20px; border-radius:16px; border:1px solid #273a52; background:radial-gradient(ellipse at 93% 0%, #31465c 0%, transparent 57%),linear-gradient(110deg,#101e33,#1c3045); color:#f8f5ee; }
|
|
80
80
|
.overview-hero::before { content:""; position:absolute; inset:0; pointer-events:none; background-image:radial-gradient(#d5c4a117 .8px,transparent .8px); background-size:14px 14px; mask-image:linear-gradient(90deg,transparent 2%,black 100%); }
|
|
81
81
|
.overview-hero>* { position:relative; }
|
|
82
82
|
.hero-date { color:#e4c48c; gap:8px; font-size:12px; letter-spacing:.04em; }
|
|
@@ -84,15 +84,8 @@ kbd { font: 11px/1.4 var(--mono); border: 1px solid var(--line); border-radius:
|
|
|
84
84
|
.hero-date time, .repo-id, .card-foot time, .period-heading>span:last-child { font-family:var(--mono); }
|
|
85
85
|
.hero-copy h1 { color:#fcf8ef; font:700 clamp(36px,3.5vw,51px)/1.18 var(--serif); letter-spacing:.03em; margin:13px 0 10px; }
|
|
86
86
|
.hero-copy>p { color:#d3dce5; font-size:15px; }
|
|
87
|
-
.hero-
|
|
88
|
-
.hero-
|
|
89
|
-
.hero-stats>div:first-child { padding-left:0; } .hero-stats>div:last-child { border:none; padding-right:0; }
|
|
90
|
-
.hero-stats dd { color:#f7e8ce; font:500 clamp(34px,3.5vw,53px)/1.15 var(--serif); font-variant-numeric:lining-nums tabular-nums; }
|
|
91
|
-
.hero-stats dt { color:#ccd5df; font-size:13px; }
|
|
92
|
-
.activity-figure { min-width:0; border:1px solid #9bafbd48; background:#0c1c2c5e; padding:16px 20px 12px; border-radius:11px; color:#d5dfe9; }
|
|
93
|
-
.activity-figure figcaption { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
|
|
94
|
-
.chart-label { font-weight:650; font-size:14px; gap:8px; color:#f6ecd9; }
|
|
95
|
-
.key-multi { width:5px; height:5px; margin:0 2px; border-radius:50%; background:#d8b77f; outline:1px solid #d8b77f; outline-offset:1px; }
|
|
87
|
+
.hero-date { justify-content:center; }
|
|
88
|
+
.hero-link { color:#f2ce91; text-decoration:underline; text-underline-offset:4px; }
|
|
96
89
|
.section-heading { justify-content:space-between; gap:12px; margin-bottom:16px; }
|
|
97
90
|
.section-heading h2 { font-size:24px; letter-spacing:-.04em; }
|
|
98
91
|
.text-link { background:none; border:0; padding:0; width:fit-content; gap:8px; font-weight:600; color:var(--gold); font-size:13px; }
|
|
@@ -180,8 +173,7 @@ kbd { font: 11px/1.4 var(--mono); border: 1px solid var(--line); border-radius:
|
|
|
180
173
|
.detail-head>p { color:var(--text); }
|
|
181
174
|
.button-row { gap:10px; flex-wrap:wrap; } .button-row:not(:empty) { margin-top:18px; }
|
|
182
175
|
.external-arrow { font-size:16px;line-height:1; }
|
|
183
|
-
.
|
|
184
|
-
.detail-stats dt,.stat-strip dt { color:var(--muted); font-size:12px; }
|
|
176
|
+
.stat-strip dt { color:var(--muted); font-size:12px; }
|
|
185
177
|
.empty-book { display:inline-grid; place-items:center; background:var(--soft); width:40px; height:40px; border-radius:10px; margin-bottom:10px; }
|
|
186
178
|
.log-layout { display:grid; grid-template-columns:225px minmax(0,1fr); gap:28px; align-items:start; }
|
|
187
179
|
.log-index { position:sticky; top:90px; border-left:2px solid var(--line); padding-left:13px; }
|
|
@@ -193,13 +185,21 @@ kbd { font: 11px/1.4 var(--mono); border: 1px solid var(--line); border-radius:
|
|
|
193
185
|
.period-heading { justify-content:space-between; font-size:11px; }
|
|
194
186
|
.log-period h2 { font:600 clamp(18px,2.5vw,26px)/1.5 var(--mono); margin:9px 0; }
|
|
195
187
|
.period-title { color:var(--text); } .period-note { margin-top:10px; padding:8px 12px; border-left:2px solid var(--gold); background:var(--gold-soft); font-size:13px; }
|
|
196
|
-
.stat-strip { display:
|
|
197
|
-
.stat-strip
|
|
188
|
+
.stat-strip { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%, 10rem),1fr)); gap:1px; margin:16px 0; text-align:center; }
|
|
189
|
+
.stat-strip > div { min-width:0; border-block:1px solid var(--line); padding:clamp(8px,1.6vw,18px) 6px; }
|
|
190
|
+
.stat-strip dt { font-weight:600; }
|
|
191
|
+
.stat-strip dd { font:600 clamp(1.35rem,3vw,2.3rem)/1.15 var(--mono); color:var(--ink); margin-top:5px; overflow-wrap:anywhere; }
|
|
192
|
+
.stat-strip :is([data-stat="commits"],[data-stat="lines-added"],[data-stat="lines-deleted"]) dd { font-size:clamp(1.7rem,4vw,3rem); }
|
|
193
|
+
.stat-strip [data-stat="lines-added"] dd, .measure-linesAdded b { color:var(--line-add); }
|
|
194
|
+
.stat-strip [data-stat="lines-deleted"] dd, .measure-linesDeleted b { color:var(--line-delete); }
|
|
195
|
+
.log-period .stat-strip [data-stat] dd { font-size:clamp(1.25rem,2.7vw,2rem); }
|
|
196
|
+
:root { --line-add:#176254; --line-delete:#9b444a; }
|
|
197
|
+
:root[data-theme="dark"] { --line-add:#8be0c9; --line-delete:#f5a7a3; }
|
|
198
198
|
.stat-strip dt { overflow-wrap:anywhere; }
|
|
199
199
|
.stat-summary { margin:10px 0 24px; padding:18px 24px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
|
|
200
|
-
.stat-summary h2 { font-
|
|
201
|
-
.stat-summary p { color:var(--muted); font-size:12px; margin-top:
|
|
202
|
-
.stat-summary .stat-strip { margin:
|
|
200
|
+
.stat-summary h2 { font:700 clamp(1.2rem,2vw,1.55rem)/1.3 var(--serif); text-align:center; margin:0; }
|
|
201
|
+
.stat-summary p { color:var(--muted); font-size:12px; margin-top:7px; text-align:center; }
|
|
202
|
+
.stat-summary .stat-strip { margin:14px 0; }
|
|
203
203
|
.category-block { margin-top:12px; } .category-block h3 { font-size:14px; } .category-block ul,.sample-sheet ol { padding-left:1.5em; }.category-block li { font-size:14px; }
|
|
204
204
|
#demo-status { color:var(--gold); }.demo-footnote { margin-top:15px; }.demo-panel input { accent-color:var(--gold); }
|
|
205
205
|
dialog { color:var(--text); width:min(590px,calc(100vw - 28px)); max-height:min(650px,82vh); padding:0; border-radius:12px; border:1px solid var(--line); background:var(--surface); box-shadow:0 24px 90px #09132459; margin: min(15vh,115px) auto auto; }
|
|
@@ -216,17 +216,17 @@ dialog::backdrop { background:#111c2b80; backdrop-filter:blur(3px); }
|
|
|
216
216
|
.search-help { display:flex; gap:16px;border-top:1px solid var(--line); }
|
|
217
217
|
mark { background:var(--gold-soft);color:var(--ink);border-radius:2px; }
|
|
218
218
|
@media (max-width:1040px) {
|
|
219
|
-
.wrap { width:calc(100% - 56px); }
|
|
219
|
+
.wrap { width:calc(100% - 56px); }
|
|
220
220
|
}
|
|
221
221
|
@media (max-width:780px) {
|
|
222
222
|
.wrap { width:calc(100% - 34px); }.mast-inner { gap:20px; height:60px; }.main-nav { gap:15px; }
|
|
223
|
-
.search-open kbd { display:none; }
|
|
223
|
+
.search-open kbd { display:none; }
|
|
224
224
|
.log-layout { grid-template-columns:170px minmax(0,1fr);gap:16px; }.stat-strip dt { font-size:10px; }
|
|
225
225
|
}
|
|
226
226
|
@media (max-width:600px) {
|
|
227
227
|
.wrap { width:calc(100% - 32px); }.mast-inner { height:auto;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 6px; }.brand { min-height:51px;font-size:24px;min-width:0;width:fit-content;max-width:100%;overflow-wrap:anywhere; }.brand-stamp { width:30px;height:30px; }.mast-tools { grid-column:2;grid-row:1; }.main-nav { grid-column:1 / -1;grid-row:2;gap:24px; }.main-nav a { min-height:37px;font-size:13px; }.main-nav a[aria-current]::after { height:2px; }
|
|
228
228
|
.mast-tools { gap:7px; }.search-open { min-height:32px; }.theme-button { width:33px; height:33px; }.main-content { padding-block:17px 36px; }
|
|
229
|
-
.overview-hero {
|
|
229
|
+
.overview-hero { padding:28px 16px; border-radius:12px; }.hero-copy h1 { font-size:45px;margin:8px 0; }.hero-copy>p { font-size:13px; }.hero-date { font-size:11px; }
|
|
230
230
|
.home-grid { gap:10px; }.project-card { padding:13px 12px 10px; }.card-top { gap:5px; }.group-tag {padding:0 4px;font-size:10px;}.project-mark { width:33px;height:33px;border-radius:8px; }.motif { transform:scale(.86); }.project-card h3 { font-size:23px; margin-top:10px; }.project-card p { font-size:12px; }.card-foot { font-size:10px; }.catalog-grid { gap:10px; }
|
|
231
231
|
.crumbs { margin-bottom:15px; }.page-head { padding-bottom:17px; }.page-head h1 { font-size:35px; }.page-head p { font-size:13px; }.field {width:100%;}.filter-bar { gap:10px;padding:12px 0; }.filter-pills button { padding:4px 8px; }
|
|
232
232
|
.log-layout,.demo-layout { grid-template-columns:1fr; }.log-index { position:static;display:flex;gap:9px;flex-wrap:wrap;align-items:center; }.log-index h2 { margin:0; }.log-index a { margin:0;padding:4px 6px;background:var(--soft);border-radius:4px; }.log-index a span { display:none; }.log-period { padding:16px;scroll-margin-top:100px; }
|
|
@@ -238,7 +238,7 @@ mark { background:var(--gold-soft);color:var(--ink);border-radius:2px; }
|
|
|
238
238
|
.mast-tools .search-open > span:not(.symbol) { display:none; }
|
|
239
239
|
}
|
|
240
240
|
@media (max-width:360px) {
|
|
241
|
-
.home-grid,.catalog-grid { grid-template-columns:1fr; }
|
|
241
|
+
.home-grid,.catalog-grid { grid-template-columns:1fr; }
|
|
242
242
|
}
|
|
243
243
|
@media (max-width:600px) {
|
|
244
244
|
.log-index { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
|
|
@@ -258,7 +258,7 @@ mark { background:var(--gold-soft);color:var(--ink);border-radius:2px; }
|
|
|
258
258
|
.ledger-search:focus-within { outline:2px solid var(--focus); outline-offset:1px; }
|
|
259
259
|
.ledger-window { margin:16px 0 23px; border:1px solid var(--line); border-radius:8px; background:var(--surface); }
|
|
260
260
|
.ledger-window:target { border-color:var(--focus); }
|
|
261
|
-
.window-head, .ledger-group-head { display:grid; grid-template-columns:minmax(
|
|
261
|
+
.window-head, .ledger-group-head { display:grid; grid-template-columns:minmax(13rem,1.1fr) minmax(15rem,.9fr) minmax(0,1.2fr); align-items:center; gap:8px 12px; padding:12px 16px; }
|
|
262
262
|
.window-head { background:var(--soft); border-radius:7px; }
|
|
263
263
|
.ledger-window > header { border-bottom:1px solid var(--line); }
|
|
264
264
|
.ledger-group + .ledger-group { border-top:1px solid var(--line); }
|
|
@@ -273,15 +273,17 @@ mark { background:var(--gold-soft);color:var(--ink);border-radius:2px; }
|
|
|
273
273
|
.ledger-group[open] .ledger-heading::before { transform:rotate(45deg); }
|
|
274
274
|
.ledger-disclosure:focus-visible { outline-offset:-3px; }
|
|
275
275
|
.ledger-disclosure:hover { background:var(--soft); }
|
|
276
|
-
.ledger-categories, .ledger-totals {
|
|
277
|
-
.ledger-categories { justify-content:
|
|
276
|
+
.ledger-categories, .ledger-totals { font-variant-numeric:tabular-nums; }
|
|
277
|
+
.ledger-categories { display:flex; align-items:center; flex-wrap:wrap; justify-content:flex-end; gap:4px 12px; font-size:.8rem; }
|
|
278
278
|
.ledger-categories > span { display:inline-flex; align-items:center; gap:3px; white-space:nowrap; }
|
|
279
279
|
.ledger-categories > span::before { content:""; width:6px; height:6px; flex:none; border-radius:2px; background:var(--kind); margin-inline-end:1px; }
|
|
280
|
-
.ledger-totals {
|
|
281
|
-
.ledger-
|
|
282
|
-
.ledger-
|
|
283
|
-
.
|
|
284
|
-
.
|
|
280
|
+
.ledger-totals { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); color:var(--muted); gap:8px; text-align:center; }
|
|
281
|
+
.ledger-measure { display:grid; gap:3px; min-width:0; font-size:.73rem; }
|
|
282
|
+
.ledger-measure b { font:650 clamp(.92rem,1.45vw,1.24rem)/1.1 var(--mono); overflow-wrap:anywhere; }
|
|
283
|
+
.ledger-group-head .ledger-measure b { font-size:.95rem; }
|
|
284
|
+
.ledger-categories b, .measure-changes b { color:var(--ink); }
|
|
285
|
+
.interval-toggle { align-items:center; min-height:32px; padding:2px 8px; font:600 .75rem/1.5 var(--sans); color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:5px; }
|
|
286
|
+
.interval-toggle:hover { border-color:var(--focus); }
|
|
285
287
|
.ledger-group-body { padding:4px 16px 10px; }
|
|
286
288
|
.ledger-project { color:var(--gold); display:inline-block; margin-top:4px; font-size:.8rem; text-decoration:underline; text-underline-offset:3px; }
|
|
287
289
|
.ledger-lines { list-style:none; padding:0; margin:0; }
|
|
@@ -292,43 +294,29 @@ mark { background:var(--gold-soft);color:var(--ink);border-radius:2px; }
|
|
|
292
294
|
.log-entry { scroll-margin-top:100px; }
|
|
293
295
|
.log-entry:target { background:var(--gold-soft); outline:2px solid var(--gold-soft); color:var(--ink); }
|
|
294
296
|
.legacy-text,.period-note { white-space:pre-line; overflow-wrap:anywhere; }
|
|
295
|
-
@media (max-width:
|
|
297
|
+
@media (max-width:760px) {
|
|
296
298
|
.ledger-tools { align-items:flex-start; padding:5px 0 10px; }
|
|
297
299
|
.ledger-count { width:100%; }
|
|
298
300
|
.enhanced .ledger-filters.enhanced-only { width:100%; gap:5px; }
|
|
299
301
|
.ledger-search input { width:96px; }
|
|
300
302
|
.ledger-filters select { max-width:135px; padding-inline:5px; }
|
|
301
|
-
.window-head, .ledger-group-head { grid-template-columns:minmax(0,1fr)
|
|
302
|
-
.ledger-categories {
|
|
303
|
-
.ledger-totals { gap:
|
|
303
|
+
.window-head, .ledger-group-head { grid-template-columns:minmax(0,1fr); padding:10px; }
|
|
304
|
+
.ledger-categories { justify-content:flex-start; gap:4px 9px; }
|
|
305
|
+
.ledger-totals { gap:5px; padding-block:6px; border-block:1px solid var(--line); }
|
|
306
|
+
.stat-strip { grid-template-columns:repeat(2,minmax(0,1fr)); }
|
|
307
|
+
.stat-summary { padding-inline:12px; }
|
|
304
308
|
.ledger-window { margin:10px 0 16px; }
|
|
305
309
|
.ledger-group-body { padding-inline:10px; }
|
|
306
310
|
.log-entry { scroll-margin-top:110px; }
|
|
307
311
|
}
|
|
308
312
|
.home-catalog { margin-top: 32px; }
|
|
309
|
-
.activity-trend { display:block; width:100%; height:auto; }
|
|
310
|
-
.activity-trend line { stroke:#9bafbd45; }
|
|
311
|
-
.activity-trend text { fill:#d5dfe9; font:12px var(--mono); }
|
|
312
|
-
.activity-trend path { fill:none; stroke:var(--chart); stroke-width:2; stroke-linejoin:round; }
|
|
313
|
-
.activity-trend circle { fill:var(--chart); }
|
|
314
|
-
.trend-legend { display:flex; flex-wrap:wrap; gap:5px 14px; list-style:none; padding:0; margin:8px 0; font-size:.8rem; }
|
|
315
|
-
.trend-legend a::before { content:""; display:inline-block; width:12px; height:3px; background:var(--chart); margin-inline-end:5px; vertical-align:middle; }
|
|
316
|
-
.trend-data { font-size:.78rem; }
|
|
317
|
-
.trend-data summary { cursor:pointer; }
|
|
318
|
-
.trend-data table { width:100%; font-variant-numeric:tabular-nums; }
|
|
319
|
-
.trend-data :is(th,td) { text-align:end; }
|
|
320
|
-
.trend-data th:first-child { text-align:start; }
|
|
321
313
|
.ledger-entry[data-entry] { display:grid; grid-template-columns:auto minmax(0,1fr); gap:10px; align-items:baseline; }
|
|
322
314
|
.ledger-entry[hidden] { display:none; }
|
|
323
315
|
.task-category { font-size:.76rem; font-weight:600; color:var(--ink); background:color-mix(in srgb,var(--kind) 14%,transparent); border-inline-start:3px solid var(--kind); border-radius:3px; padding:1px 6px; }
|
|
324
|
-
.
|
|
325
|
-
.chart-note { margin-block:5px; }
|
|
326
|
-
.activity-figure .text-link { color: #e4c48c; margin-top: 7px; }
|
|
327
|
-
.card-stats, .detail-stats { display: flex; flex-wrap: wrap; gap: 10px clamp(16px, 4vw, 36px); }
|
|
316
|
+
.card-stats { display: flex; flex-wrap: wrap; gap: 10px clamp(16px, 4vw, 36px); }
|
|
328
317
|
.card-stats { margin: 1px 0 13px; }
|
|
329
318
|
.card-stats dt { font-size: 11px; color: var(--muted); }
|
|
330
|
-
.card-stats dd
|
|
331
|
-
.detail-stats dd { font-size: 26px; }
|
|
319
|
+
.card-stats dd { color: var(--ink); font: 600 20px/1.4 var(--mono); }
|
|
332
320
|
[data-kind="功能"] { --kind:var(--gold); }
|
|
333
321
|
[data-kind="修复"] { --kind:#6383a4; } [data-kind="重构"] { --kind:#9a7ca0; }
|
|
334
322
|
[data-kind="优化"] { --kind:#559588; } [data-kind="维护"] { --kind:#87917c; }
|
|
@@ -353,10 +341,12 @@ mark { background:var(--gold-soft);color:var(--ink);border-radius:2px; }
|
|
|
353
341
|
#home-statistics { margin-top:20px; }
|
|
354
342
|
.ledger { margin-top: 24px; }
|
|
355
343
|
.ledger > h2 { font: 700 24px/1.4 var(--serif); }
|
|
356
|
-
.legacy-window-anchor { display: block; }
|
|
357
344
|
.commit-only { color:var(--muted); font-size:.8rem; margin-block:6px; }
|
|
358
345
|
|
|
359
346
|
@media (max-width: 600px) {
|
|
360
347
|
.home-catalog { margin-top: 22px; }
|
|
361
|
-
|
|
348
|
+
}
|
|
349
|
+
@media (min-width:761px) and (max-width:1040px) {
|
|
350
|
+
.window-head, .ledger-group-head { grid-template-columns:minmax(0,1fr) minmax(15rem,1.1fr); }
|
|
351
|
+
.ledger-categories { grid-column:1 / -1; justify-content:flex-start; }
|
|
362
352
|
}
|
|
@@ -74,13 +74,20 @@ export function categoryBreakdown(stats) {
|
|
|
74
74
|
${stats.added != null && stats.byCategory?.['功能'] > 0 ? `<div><dt>功能中新增</dt><dd>${formatCount(stats.added)}</dd></div>` : ''}</dl>`;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
export function statStrip(stats, commitLabel = '记录区间提交') {
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
export function statStrip(stats, commitLabel = '记录区间提交', {headCommits} = {}) {
|
|
78
|
+
const metrics = [
|
|
79
|
+
['commits', commitLabel, stats.commits],
|
|
80
|
+
['lines-added', '新增代码行', stats.linesAdded],
|
|
81
|
+
['lines-deleted', '删除代码行', stats.linesDeleted],
|
|
82
|
+
['changes', '已记录任务', stats.changes],
|
|
83
|
+
];
|
|
84
|
+
if (headCommits != null && headCommits !== stats.commits) metrics.push(['head-commits', '仓库累计提交', headCommits]);
|
|
85
|
+
return `<dl class="stat-strip">${metrics.map(([key,label,value]) =>
|
|
86
|
+
`<div data-stat="${key}"><dt>${label}</dt><dd>${formatCount(value)}</dd></div>`).join('')}</dl>${categoryBreakdown(stats)}`;
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
export function statSummary(id, title, stats, scope) {
|
|
83
|
-
return `<section class="stat-summary" id="${id}" aria-labelledby="${id}-title"><h2 id="${id}-title">${title}</h2>${scope ? `<p>${scope}</p>` : ''}${statStrip(stats)}
|
|
90
|
+
return `<section class="stat-summary" id="${id}" aria-labelledby="${id}-title"><h2 id="${id}-title">${title}</h2>${scope ? `<p>${scope}</p>` : ''}${statStrip(stats)}<p class="metric-scope">代码行按各区间首尾的 Git 文本差异统计,含配置和文档。</p></section>`;
|
|
84
91
|
}
|
|
85
92
|
|
|
86
93
|
export function intervalCount(period) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { categories, itemId, statistics, windowLabel } from './model.mjs';
|
|
2
2
|
import { crumbs, escapeHtml as esc, formatCount, logPath, projectPath, statSummary, symbol } from './layout.mjs';
|
|
3
3
|
|
|
4
|
-
export const monthLabel = key => key === 'undated' ? '日期未记录' : `${key.slice(0, 4)} 年 ${Number(key.slice(5))} 月`;
|
|
5
|
-
|
|
6
4
|
function row(root, project, {period, index}) {
|
|
7
5
|
const item = period.items[index];
|
|
8
6
|
const [category, text, markers, meta] = item ?? [
|
|
@@ -13,66 +11,64 @@ function row(root, project, {period, index}) {
|
|
|
13
11
|
${item ? `<span class="task-category">${esc(category)}</span>` : ''}<a class="change-cell" href="${esc(url)}">${esc(text)}</a></li>`;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const totals = [
|
|
15
|
+
['changes', '任务'], ['linesAdded', '新增代码行'], ['linesDeleted', '删除代码行'],
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
function ledgerStats(stats) {
|
|
19
|
+
return `<span class="ledger-totals">${totals.map(([key, label]) => `<span class="ledger-measure measure-${key}"><span>${label}</span><b data-metric="${key}">${formatCount(stats[key])}</b></span>`).join('')}</span>
|
|
20
|
+
<span class="ledger-categories">${categories.map(category => `<span data-kind="${category}">${category} <b data-category-count="${category}">${formatCount(stats.byCategory?.[category])}</b></span>`).join('')}</span>`;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
function groupDetails(root, key,
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
23
|
+
function groupDetails(root, key, {project, periods}, showProject, label) {
|
|
24
|
+
const id = `window-${key}-${project.id}`;
|
|
25
|
+
const stats = statistics(periods);
|
|
26
|
+
const rows = periods.flatMap(period => {
|
|
27
|
+
const tasks = period.items.map((item, index) => ({period,index}));
|
|
28
|
+
if (period.note || period.baseline || !tasks.length) tasks.push({period,index:-1});
|
|
29
|
+
return tasks;
|
|
30
|
+
});
|
|
31
|
+
const {linesAdded, linesDeleted} = stats;
|
|
32
|
+
return `<details class="ledger-group tone-${project.color}" data-ledger-repo="${esc(project.id)}" data-repo-name="${esc(project.name)}" data-totals="${esc(JSON.stringify({linesAdded, linesDeleted}))}">
|
|
26
33
|
<summary class="${showProject ? 'ledger-group-head' : 'window-head'} ledger-disclosure" id="${esc(id)}">
|
|
27
|
-
<span class="ledger-heading">${showProject ? `<i></i>${esc(project.name)}` :
|
|
28
|
-
${ledgerStats(
|
|
34
|
+
<span class="ledger-heading">${showProject ? `<i></i>${esc(project.name)}` : esc(label)}</span>
|
|
35
|
+
${ledgerStats(stats)}
|
|
29
36
|
</summary>
|
|
30
|
-
<div class="ledger-group-body" id="${esc(id)}-tasks"
|
|
37
|
+
<div class="ledger-group-body" id="${esc(id)}-tasks"><ul class="ledger-lines" role="list">
|
|
31
38
|
${rows.map(item => row(root, project, item)).join('')}
|
|
32
|
-
|
|
33
|
-
</ul>` : '<p class="commit-only">此月暂无任务记录。</p>'}
|
|
34
|
-
${showProject ? `<a class="ledger-project" href="${esc(root + projectPath(project))}">查看项目</a>` : ''}
|
|
35
|
-
</div>
|
|
39
|
+
</ul>${showProject ? `<a class="ledger-project" href="${esc(root + projectPath(project))}">查看项目</a>` : ''}</div>
|
|
36
40
|
</details>`;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
function
|
|
40
|
-
const {key, groups} =
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
${showProject ? `<header class="window-head"><div class="ledger-heading"><h3 id="${labelId}">${
|
|
45
|
-
${groups.map(group => groupDetails(root, key, group, showProject)).join('')}
|
|
43
|
+
function windowSection(root, window, showProject) {
|
|
44
|
+
const {key, groups} = window;
|
|
45
|
+
const label = window.label ?? windowLabel(window);
|
|
46
|
+
const labelId = showProject ? `window-title-${key}` : `window-${key}-${groups[0].project.id}`;
|
|
47
|
+
return `<section class="ledger-window" id="window-${esc(key)}" data-window="${esc(key)}" aria-labelledby="${esc(labelId)}">
|
|
48
|
+
${showProject ? `<header class="window-head"><div class="ledger-heading"><h3 id="${esc(labelId)}">${esc(label)}</h3><button type="button" class="interval-toggle enhanced-only" data-window-toggle data-window-label="${esc(label)}" aria-label="${esc(label)},展开全部项目任务" aria-expanded="false" aria-controls="${esc(groups.map(({project}) => `window-${key}-${project.id}-tasks`).join(' '))}">展开全部</button></div>${ledgerStats(window.stats)}</header>` : ''}
|
|
49
|
+
${groups.map(group => groupDetails(root, key, group, showProject, label)).join('')}
|
|
46
50
|
</section>`;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
export function
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const count = monthCount || !hasUndated
|
|
56
|
-
? `${monthCount} 个月${hasUndated ? '及日期未记录条目' : ''}`
|
|
57
|
-
: '日期未记录条目';
|
|
58
|
-
return `<section class="ledger" aria-labelledby="ledger-title"><h2 id="ledger-title">月度明细</h2>
|
|
59
|
-
<div class="ledger-tools"><p class="ledger-count" id="timeline-count" aria-live="polite">${count}${showProject ? ` · ${projectCount} 个项目` : ''} · ${formatCount(taskCount)} 项任务</p>
|
|
60
|
-
${months.length ? `<search class="ledger-filters enhanced-only" aria-label="筛选月度明细">
|
|
53
|
+
export function rangeLedger(root, projects, windows, {showProject = true} = {}) {
|
|
54
|
+
const taskCount = windows.reduce((total, window) => total + window.stats.changes, 0);
|
|
55
|
+
const projectCount = new Set(windows.flatMap(window => window.groups.map(group => group.project.id))).size;
|
|
56
|
+
return `<section class="ledger" aria-labelledby="ledger-title"><h2 id="ledger-title">区间明细</h2>
|
|
57
|
+
<div class="ledger-tools"><p class="ledger-count" id="timeline-count" aria-live="polite">${windows.length} 个区间${showProject ? ` · ${projectCount} 个项目` : ''} · ${formatCount(taskCount)} 项任务</p>
|
|
58
|
+
${windows.length ? `<search class="ledger-filters enhanced-only" aria-label="筛选区间明细">
|
|
61
59
|
<label class="ledger-search">${symbol('search')}<input id="timeline-query" type="search" aria-label="筛选关键词" placeholder="筛选关键词" autocomplete="off"></label>
|
|
62
60
|
${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>` : ''}
|
|
63
|
-
<label><span class="sr"
|
|
61
|
+
<label><span class="sr">区间</span><select id="timeline-window"><option value="">全部区间</option>${windows.map(window => `<option value="${esc(window.key)}">${esc(window.label ?? windowLabel(window))}</option>`).join('')}</select></label>
|
|
64
62
|
<label><span class="sr">类别</span><select id="timeline-category"><option value="">全部类别</option>${[...categories, '区间说明'].map(c => `<option>${esc(c)}</option>`).join('')}</select></label>
|
|
65
|
-
<button type="button" id="reset-timeline" class="
|
|
63
|
+
<button type="button" id="reset-timeline" class="interval-toggle" hidden>清除筛选</button>
|
|
66
64
|
</search>` : ''}</div>
|
|
67
|
-
${
|
|
68
|
-
<div id="timeline-empty" class="empty-panel"${
|
|
65
|
+
${windows.map(window => windowSection(root, window, showProject)).join('')}
|
|
66
|
+
<div id="timeline-empty" class="empty-panel"${windows.length ? ' hidden' : ''}><h3>${windows.length ? '没有符合条件的记录' : '暂无区间记录'}</h3></div>
|
|
69
67
|
</section>`;
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
export function changelog(root, projects, windows, stats) {
|
|
73
|
-
|
|
74
|
-
group.periods.some(period => !period.commitMonths))).map(window => window.to);
|
|
75
|
-
return `${crumbs(root, [['跨项目变更']])}<header class="page-head"><h1>跨项目变更</h1><p>按月份查看任务与 Git 提交,可按项目、类别及关键词筛选。</p></header>
|
|
71
|
+
return `${crumbs(root, [['跨项目变更']])}<header class="page-head"><h1>跨项目变更</h1><p>按采集区间查看各项目的任务和 Git 变更。</p></header>
|
|
76
72
|
${statSummary('site-statistics', '全站累计', stats)}
|
|
77
|
-
${
|
|
73
|
+
${rangeLedger(root, projects, windows)}`;
|
|
78
74
|
}
|
|
@@ -34,6 +34,8 @@ export function statistics(periods) {
|
|
|
34
34
|
return {
|
|
35
35
|
changes,
|
|
36
36
|
commits: sum(period => period.commits),
|
|
37
|
+
linesAdded: sum(period => period.linesAdded),
|
|
38
|
+
linesDeleted: sum(period => period.linesDeleted),
|
|
37
39
|
byCategory: changes === null ? null : Object.fromEntries(categories.map(category => [
|
|
38
40
|
category, sum(period => period.items.filter(([type]) => type === category).length),
|
|
39
41
|
])),
|
|
@@ -42,23 +44,42 @@ export function statistics(periods) {
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
export function observationWindows(projects) {
|
|
45
|
-
const
|
|
47
|
+
const batches = new Map();
|
|
46
48
|
for (const {project, period} of timeline(projects)) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
const key = period.collectionAt ?? period.to;
|
|
50
|
+
if (!batches.has(key)) {
|
|
51
|
+
const to = period.collectionAt ? executionDate(period.collectionAt, period.timezone).slice(0, 10) : period.to;
|
|
52
|
+
batches.set(key, {key, to, at:period.collectionAt, timezone:period.timezone, byProject:new Map()});
|
|
53
|
+
}
|
|
54
|
+
const groups = batches.get(key).byProject;
|
|
49
55
|
if (!groups.has(project.id)) groups.set(project.id, {project, periods:[]});
|
|
50
56
|
groups.get(project.id).periods.push(period);
|
|
51
57
|
}
|
|
52
|
-
const
|
|
53
|
-
return
|
|
54
|
-
const previous =
|
|
55
|
-
const
|
|
56
|
-
const groups = [...byEnd.get(to).values()];
|
|
58
|
+
const ordered = [...batches.values()].sort((a,b) => b.to.localeCompare(a.to) || b.key.localeCompare(a.key));
|
|
59
|
+
return ordered.map(({byProject, ...batch}, index) => {
|
|
60
|
+
const previous = ordered[index + 1];
|
|
61
|
+
const groups = [...byProject.values()];
|
|
57
62
|
const periods = groups.flatMap(group => group.periods);
|
|
58
|
-
|
|
63
|
+
const from = previous?.to ?? periods.map(period => period.from).filter(Boolean).sort()[0] ?? null;
|
|
64
|
+
return {...batch, from, fromAt:previous?.at, fromTimezone:previous?.timezone, groups, rangeCount:periods.length, stats:statistics(periods)};
|
|
59
65
|
});
|
|
60
66
|
}
|
|
61
67
|
|
|
68
|
+
function executionDate(value, timezone = 'UTC') {
|
|
69
|
+
const parts = new Intl.DateTimeFormat('sv-SE', {
|
|
70
|
+
timeZone:timezone, dateStyle:'short', timeStyle:'medium',
|
|
71
|
+
}).formatToParts(new Date(value));
|
|
72
|
+
return parts.map(part => part.value).join('');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function windowLabel(window) {
|
|
76
|
+
const {from,to,at,fromAt,timezone,fromTimezone} = window;
|
|
77
|
+
const sameDay = from === to;
|
|
78
|
+
const end = sameDay && at ? executionDate(at,timezone) : to;
|
|
79
|
+
const start = sameDay && fromAt ? executionDate(fromAt,fromTimezone) : from;
|
|
80
|
+
return start && start !== end ? start + ' 至 ' + end : '截至 ' + end;
|
|
81
|
+
}
|
|
82
|
+
|
|
62
83
|
export function periodTitle(period) {
|
|
63
84
|
return period.items[0]?.[1] ?? (period.baseline ? '建立日志记录基线' : '完成本次区间核对');
|
|
64
85
|
}
|
|
@@ -1,60 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { arrow, availableGroups,
|
|
3
|
-
import {
|
|
1
|
+
import { categories, distinctRangeLabel, itemId, periodTitle, statistics, timeline, windowLabel } from './model.mjs';
|
|
2
|
+
import { arrow, availableGroups, crumbs, escapeHtml as esc, external, formatCount, logPath, mark, projectCard, projectChip, projectPath, statStrip, statSummary, symbol } from './layout.mjs';
|
|
3
|
+
import { rangeLedger } from './ledger.mjs';
|
|
4
4
|
|
|
5
5
|
const dataPath = (root, project) => esc(`${root}data/projects/${project.id}.json`);
|
|
6
6
|
|
|
7
|
-
function activitySeries({project, values}, months, maximum) {
|
|
8
|
-
const points = values.map((value, i) => value == null ? null : [50 + i * 116, 150 - 130 * value / maximum]);
|
|
9
|
-
const line = points.map((point, i) => point ? (points[i - 1] ? 'L' : 'M') + point.join(' ') : '').join(' ');
|
|
10
|
-
return `<g class="tone-${project.color}" data-series="${esc(project.id)}"><path d="${line}"/>
|
|
11
|
-
${points.map((point, i) => point ? `<circle cx="${point[0]}" cy="${point[1]}" r="3.5"><title>${esc(project.name)} · ${monthLabel(months[i].key)} · ${values[i]} 次提交</title></circle>` : '').join('')}</g>`;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function activitySummary(root, projects) {
|
|
15
|
-
const dated = activityMonths(projects).filter(({key}) => key !== 'undated');
|
|
16
|
-
const latest = dated[0]?.key;
|
|
17
|
-
if (!latest) return `<section class="activity-figure" aria-labelledby="activity-title"><h2 id="activity-title" class="chart-label">项目提交趋势</h2><p>暂无按月核实的 Git 提交。</p><a class="text-link" href="${root}changelog/">查看变更明细 ${arrow}</a></section>`;
|
|
18
|
-
const end = new Date(`${latest}-01T00:00:00Z`);
|
|
19
|
-
const months = Array.from({length:4}, (_, index) => {
|
|
20
|
-
const month = new Date(end);
|
|
21
|
-
month.setUTCMonth(end.getUTCMonth() - 3 + index);
|
|
22
|
-
const key = month.toISOString().slice(0, 7);
|
|
23
|
-
return {key, groups:dated.find(entry => entry.key === key)?.groups ?? []};
|
|
24
|
-
});
|
|
25
|
-
const series = projects.map(project => ({
|
|
26
|
-
project,
|
|
27
|
-
values:months.map(({groups}) => groups.find(group => group.project.id === project.id)?.commits ?? null),
|
|
28
|
-
}));
|
|
29
|
-
const maximum = Math.max(1, ...series.flatMap(({values}) => values.map(value => value ?? 0)));
|
|
30
|
-
return `<figure class="activity-figure"><figcaption class="chart-label">项目提交趋势 <small>每月 Git 提交</small></figcaption>
|
|
31
|
-
<svg class="activity-trend" viewBox="0 0 436 180" role="img" aria-label="各项目最近四个月的 Git 提交量,共用纵轴">
|
|
32
|
-
${[0, Math.ceil(maximum / 2), maximum].filter((value,i,a) => a.indexOf(value) === i).map(value => {
|
|
33
|
-
const y = 150 - 130 * value / maximum;
|
|
34
|
-
return `<line x1="48" x2="405" y1="${y}" y2="${y}"/><text x="42" y="${y+4}" text-anchor="end">${formatCount(value)}</text>`;
|
|
35
|
-
}).join('')}
|
|
36
|
-
${months.map(({key},i) => `<text x="${50+i*116}" y="172" text-anchor="middle">${key.slice(2).replace('-', '.')}</text>`).join('')}
|
|
37
|
-
${series.map(item => activitySeries(item, months, maximum)).join('')}
|
|
38
|
-
</svg>
|
|
39
|
-
<ul class="trend-legend" role="list">${series.map(({project}) => `<li class="tone-${project.color}"><a href="${esc(root+projectPath(project))}">${esc(project.name)}</a></li>`).join('')}</ul>
|
|
40
|
-
<details class="trend-data"><summary>查看各月提交数</summary><table><thead><tr><th>项目</th>${months.map(({key}) => `<th><time datetime="${key}">${key.slice(2).replace('-', '.')}</time></th>`).join('')}</tr></thead>
|
|
41
|
-
<tbody>${series.map(({project,values}) => `<tr><th scope="row">${esc(project.name)}</th>${values.map(value => `<td>${value == null ? '—' : formatCount(value)}</td>`).join('')}</tr>`).join('')}</tbody></table><p class="chart-note">— 表示无月度数据</p></details>
|
|
42
|
-
<a class="text-link" href="${root}changelog/">查看全部月份 ${arrow}</a></figure>`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
7
|
function sectionHeading(title, url, label) {
|
|
46
8
|
return `<div class="section-heading"><h2>${title}</h2><a class="text-link" href="${url}">${label} ${arrow}</a></div>`;
|
|
47
9
|
}
|
|
48
10
|
|
|
49
11
|
export function overview(root, projects, stats) {
|
|
50
12
|
const asOf = timeline(projects)[0]?.period.to;
|
|
51
|
-
const activity = activitySummary(root, projects);
|
|
52
13
|
return `<section class="overview-hero" aria-labelledby="hero-title"><div class="hero-copy">
|
|
53
14
|
${asOf ? `<div class="hero-date"><i></i>记录截至 <time datetime="${asOf}">${asOf.replaceAll('-', '.')}</time></div>` : ''}
|
|
54
15
|
<h1 id="hero-title">项目进展总览</h1>
|
|
55
|
-
<
|
|
56
|
-
</div
|
|
57
|
-
|
|
16
|
+
<p>${formatCount(projects.length)} 个公开项目 · <a class="hero-link" href="${root}changelog/">浏览变更区间 ${arrow}</a></p>
|
|
17
|
+
</div></section>
|
|
18
|
+
${statSummary('home-statistics','全站累计',stats)}
|
|
58
19
|
<section class="home-catalog" aria-label="项目进展">
|
|
59
20
|
${sectionHeading('项目进展', root + 'projects/', '查找项目')}
|
|
60
21
|
<div class="project-grid home-grid">${projects.length ? projects.map(project => projectCard(root, project)).join('') : '<p>暂无公开项目</p>'}</div>
|
|
@@ -62,7 +23,7 @@ export function overview(root, projects, stats) {
|
|
|
62
23
|
}
|
|
63
24
|
|
|
64
25
|
export function catalog(root, projects) {
|
|
65
|
-
return `${crumbs(root,[['项目目录']])}<header class="page-head"><h1>项目目录</h1><p>共 ${projects.length}
|
|
26
|
+
return `${crumbs(root,[['项目目录']])}<header class="page-head"><h1>项目目录</h1><p>共 ${projects.length} 个公开项目。打开项目可按采集区间查看任务和提交。</p></header>
|
|
66
27
|
<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>
|
|
67
28
|
<label class="field search-field">${symbol('search')}<input id="catalog-query" type="search" aria-label="筛选项目" placeholder="名称、ID 或简介" autocomplete="off"></label></div>
|
|
68
29
|
<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>
|
|
@@ -77,10 +38,18 @@ function resourceButtons(project) {
|
|
|
77
38
|
export function detail(root, project, stats, projects = []) {
|
|
78
39
|
const relatives = projects.filter(other => other.parent === project.id || other.id === project.parent);
|
|
79
40
|
const related = relatives.map(other => `<a class="secondary-button" href="${esc(root + projectPath(other))}">${other.id === project.parent ? '父项目' : '子模块'} · ${esc(other.name)}</a>`).join('');
|
|
41
|
+
const windows = project.periods.map((period,index) => {
|
|
42
|
+
const previous = project.periods[index+1];
|
|
43
|
+
const {key, from, to, collectionAt:at, timezone} = period;
|
|
44
|
+
const label = at && from === to
|
|
45
|
+
? windowLabel({from,to,at,timezone,fromAt:previous?.collectionAt,fromTimezone:previous?.timezone})
|
|
46
|
+
: distinctRangeLabel(project,period);
|
|
47
|
+
return {key, label, groups:[{project, periods:[period]}], stats:statistics([period])};
|
|
48
|
+
});
|
|
80
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>
|
|
81
|
-
<p>${esc(project.purpose)}</p>${
|
|
50
|
+
<p>${esc(project.purpose)}</p>${statStrip(stats, '记录区间提交', {headCommits:project.headCommits})}
|
|
82
51
|
<div class="button-row"><a class="secondary-button" href="${dataPath(root, project)}">项目日志 JSON ${arrow}</a><a class="secondary-button" href="${root}${logPath(project)}">按区间浏览日志 ${arrow}</a>${resourceButtons(project)}${related}</div></header>
|
|
83
|
-
${
|
|
52
|
+
${rangeLedger(root, [project], windows, {showProject:false})}`;
|
|
84
53
|
}
|
|
85
54
|
|
|
86
55
|
function logPeriod(project, period) {
|
|
@@ -13,6 +13,7 @@ export function publicProject(project) {
|
|
|
13
13
|
stats:statistics(project.periods),
|
|
14
14
|
ranges:project.periods.map(period=>({
|
|
15
15
|
key:period.key,from:period.from,to:period.to,baseline:period.baseline,coverage:period.coverage,
|
|
16
|
+
collectionAt:period.collectionAt ?? null,
|
|
16
17
|
stats:statistics([period]),
|
|
17
18
|
notes:period.notes ?? (period.note ? [period.note] : []),
|
|
18
19
|
commitMonths:period.commitMonths ?? null,
|
|
@@ -56,13 +56,13 @@ npm --prefix .agents/home/website run preview
|
|
|
56
56
|
|
|
57
57
|
## 时间线与统计
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
首页和跨项目页突出记录区间的 Git 提交、新增代码行、删除代码行和任务总量,五类任务单独列出。项目卡片显示仓库累计提交和任务数。仓库累计来自最新已记录 HEAD 的可达历史。
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
跨项目明细按实际采集批次合并同一次运行的各仓日志。每次激活为当次写入的日志区间共用 `collectionAt`,同一天多次采集可按时间区分。旧日志按已保存的截止日归组。相邻执行之间以此前截止时间为起点,首次从可核实的最早起点展示。无增量的检查复用原记录。项目详情使用该仓保存的区间,可展开任务并进入对应原文。
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
区间及项目明细依次显示任务数、新增代码行、删除代码行、功能、修复、重构、优化、维护。跨项目页与项目详情的 Git 提交数集中在顶部汇总。筛选按关键词、项目、区间和类别组合,任务数与分类数随匹配结果更新,代码行取可见项目区间的完整统计。新增和删除代码行取各成功区间首尾的 Git 文本差异,包含配置和文档。缺统计时使用 `null`,页面显示“未核实”。任务中的新增功能数沿用 `added`,独立于代码行统计。
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
公开目录 `windows` 包含区间键、执行时间和统计。已有 `months` 和分仓 `commitMonths` 可供数据读者使用。
|
|
66
66
|
|
|
67
67
|
## 更新和安全切换
|
|
68
68
|
|
|
@@ -72,7 +72,7 @@ npm --prefix .agents/home/website run preview
|
|
|
72
72
|
|
|
73
73
|
## 更新已有模板
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
初始化或激活时,程序逐个比对本机文件与已识别的发布模板。完整匹配的文件可自动升级。回执用 `updated` 列出自动升级的路径,用 `conflicts` 列出已有修改的文件。需要为有修改的站点脚本或页面合并更新时,在临时 Home 生成一份可比较的模板。下面以 PowerShell 为例。
|
|
76
76
|
|
|
77
77
|
~~~powershell
|
|
78
78
|
$website = (Resolve-Path .agents/home/website).Path
|
|
@@ -32,6 +32,7 @@ function ensureBuildDependencies(website) {
|
|
|
32
32
|
|
|
33
33
|
export async function activate(home, title) {
|
|
34
34
|
if (!home) throw Error('激活网站需要 --home HOME。');
|
|
35
|
+
const collectionAt = new Date().toISOString();
|
|
35
36
|
const requested = path.resolve(home);
|
|
36
37
|
const entry = fs.lstatSync(requested);
|
|
37
38
|
if (!entry.isDirectory() || entry.isSymbolicLink()) throw Error('Home 根路径须为普通目录。');
|
|
@@ -70,7 +71,7 @@ export async function activate(home, title) {
|
|
|
70
71
|
const route = parent
|
|
71
72
|
? routeSubmodule(root,registry,id,{parent,submodulePath},{localPaths,branchOnly:true})
|
|
72
73
|
: routeRepo(root,byId.get(id),{localPaths,branchOnly:true});
|
|
73
|
-
const plan = snapshot(root,freeze(root,route));
|
|
74
|
+
const plan = snapshot(root,freeze(root,route,{collectionAt}));
|
|
74
75
|
if (plan.status === 'no-changes') { checked.push(id); continue; }
|
|
75
76
|
if (plan.status !== 'ready') throw Error('未知 Git 取证状态 '+plan.status);
|
|
76
77
|
work ??= fs.mkdtempSync(path.join(os.tmpdir(),'home-website-review-'));
|
|
@@ -41,6 +41,24 @@ const comparisonTemplates = new Map([
|
|
|
41
41
|
['site/templates/pages.mjs',['8cd03cc0ceb81f938ea238710278ca372e1bc46731aee3746a4cf04b345222cb']],
|
|
42
42
|
]);
|
|
43
43
|
|
|
44
|
+
const monthlyTemplates = new Map([
|
|
45
|
+
['scripts/inputs.mjs','04468bc1cfd31245dbaef867faa3d41ef022518ffb18f36183d0c033e24e21dd'],
|
|
46
|
+
['scripts/render.mjs','52346d79a642525014b0ba87af788af46f9285d96befa3b9ee1ec7a1df70f6ae'],
|
|
47
|
+
['site/templates/model.mjs','23fcc2844ce78d957e02b6858447b4c84ecc4c5585c96a7dec04098637251867'],
|
|
48
|
+
['site/templates/layout.mjs','66a2d762092465dc105def8bdb47c69431c1411265fbcd2e11601508b033b78b'],
|
|
49
|
+
['site/templates/ledger.mjs','5fe4ddbd289bc77a80a31d62aeac29a4ce0afa2dd46ce7c9e432716fea5d3db5'],
|
|
50
|
+
['site/templates/pages.mjs','324d41c43f96c00cc2cfc4e1717c5f1a0be7757c9487cfb55d2b6f4207b85c21'],
|
|
51
|
+
['site/templates/project-logs.mjs','70b4e7ac4dc21e9e6c93ac15cc58882afac84191e7b1bb7be8d79ce85487524f'],
|
|
52
|
+
['site/public/home-assets/app.js','d355c9ec67e595fe304679b4a9e9ff9382affe337dbdfec8915dd75c974c9a86'],
|
|
53
|
+
['site/public/home-assets/site.css','8cf8c0f1ed1f2856afb284a7d1bb94721c0c2229497ec213165ed50519fc68dc'],
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
const intervalTemplates = new Map([
|
|
57
|
+
['site/templates/ledger.mjs','48160e54a7eb6fe1495764871b3831083e7902877ad7d9972b3f84f1b46fd9a3'],
|
|
58
|
+
['site/public/home-assets/app.js','a17773b19894df20e470bb5ef446b7d935dcc4a97c2d5038f3e9db1fdbd91268'],
|
|
59
|
+
['site/public/home-assets/site.css','2c0fd2446fbf4c3ed5fa32919959acae8ae43297f54c046d450f149d377306fd'],
|
|
60
|
+
]);
|
|
61
|
+
|
|
44
62
|
const normalized = bytes => bytes.toString('utf8').replace(/\r\n/gu,'\n');
|
|
45
63
|
|
|
46
64
|
function updatePristine(target, before, expected, mode) {
|
|
@@ -97,7 +115,8 @@ function initialize(home, title) {
|
|
|
97
115
|
const before = fs.readFileSync(target);
|
|
98
116
|
if (expected.equals(before) || previousTemplates.has(label) && normalized(expected) === normalized(before)) {
|
|
99
117
|
existing.push(label);
|
|
100
|
-
} else if ([previousTemplates
|
|
118
|
+
} else if ([previousTemplates, dashboardTemplates, monthlyTemplates, intervalTemplates].map(templates => templates.get(label))
|
|
119
|
+
.concat(comparisonTemplates.get(label) ?? []).includes(createHash('sha256').update(normalized(before)).digest('hex'))) {
|
|
101
120
|
updatePristine(target,before,expected,current.mode);
|
|
102
121
|
updated.push(label);
|
|
103
122
|
} else {
|