Reorganize workspace and archive skill artifacts

This commit is contained in:
zhuyongxin
2026-05-20 11:39:30 +08:00
parent 0e0275d46a
commit f45122dafb
83 changed files with 9733 additions and 15 deletions
@@ -0,0 +1,46 @@
## Context
当前知识索引页面是由 `scripts/update-knowledge-index.sh` 生成的单文件静态 HTML。过滤状态分散在三个 UI 来源:
- `#search-input`:全文搜索词。
- `.tag-badge.active`:激活标签筛选。
- `#year-filter`:年份筛选。
过滤统一在 `applyFilters()` 中执行。上一轮年份筛选设计已经确认:生成脚本是模板真理源,不能只修改生成后的 `knowledge-index.html`。
## Design
新增一个清空筛选按钮,放在搜索框下方的筛选行中,与年份筛选同级。
点击按钮时执行 `clearFilters()`:
1. 将 `#search-input.value` 置空。
2. 将 `#year-filter.value` 置空。
3. 移除所有 `.tag-badge.active`。
4. 调用 `applyFilters()` 重新渲染列表。
`clearFilters()` 是统一清空入口。未来新增任何筛选器时,必须同时接入 `applyFilters()` 和 `clearFilters()`,避免“能筛选但不能一键清空”的状态漂移。
## OpenSpec Alignment
- 执行入口仍是 OpenSpec tasks/specs。
- devflow 上下文只用于确认现有过滤模型和生成脚本真理源。
- Phase 2 已确认采用“未来扩展”语义:清空按钮应清除所有当前支持的筛选器,未来新增筛选器也必须接入统一 `clearFilters()`。
## Edge Cases
- 没有筛选条件时点击:保持全部条目展示,不报错。
- 没有条目时点击:保持空状态,不报错。
- 标签过滤由多个 active badge 组成:必须全部取消。
- 清空后搜索高亮应消失,因为搜索词为空。
## Validation
- 静态验证:HTML 中存在 `clear-filters` 按钮和 `clearFilters()` 函数。
- 脚本验证:`scripts/update-knowledge-index.sh` 能重建 `knowledge-index.html`。
- 浏览器/人工验证:输入搜索词、选择年份、点击标签后,点击“清空筛选”恢复全部条目。
## Architecture Review
输入是搜索框、年份下拉框和标签 badge 的 UI 状态;处理入口是 `clearFilters()` 清空状态后调用 `applyFilters()`;输出是重新渲染后的完整条目列表。主要架构风险是未来新增筛选器时只接入 `applyFilters()`,忘记接入 `clearFilters()`,因此 `clearFilters()` 必须被记录为统一清空入口。实现必须改 `scripts/update-knowledge-index.sh`,再重建 `knowledge-index.html`,避免生成物和模板漂移。
@@ -0,0 +1,32 @@
## Why
知识库索引已经支持搜索、标签筛选和年份筛选。多个筛选条件可以组合生效,但用户清空条件时需要分别清空搜索框、取消所有激活标签、将年份切回“全部年份”。随着筛选维度增加,缺少“一键清空所有筛选”会让用户难以快速回到完整列表。
## What Changes
- 在 `knowledge-index.html` 中新增“清空筛选”按钮。
- 点击按钮时同时清空:搜索词、激活标签、年份筛选。
- 清空后重新渲染全部知识条目。
- 没有任何筛选条件时,按钮可以保留可点击,点击后保持全部条目展示。
- 更新 `scripts/update-knowledge-index.sh`,确保重建索引后按钮功能不会丢失。
## Devflow Context Used
- `devflow/glossary/CONTEXT.md` 定义了“索引面板”和“年份筛选”。
- `devflow/projects/2026-05-19-add-year-filter/add-year-filter-design.md` 明确 `applyFilters()` 是合并年份、标签、搜索过滤的单一入口。
- `devflow/projects/2026-05-19-add-year-filter/add-year-filter-acceptance.md` 记录了生成脚本是页面真理源,因此必须修改 `scripts/update-knowledge-index.sh` 并重建 `knowledge-index.html`。
## Capabilities
### New Capabilities
- `knowledge-filtering`: 用户可以一键清空搜索、标签和年份筛选,恢复完整知识条目列表。
### Modified Capabilities
- `knowledge-index-panel`: 页面在搜索/筛选区域增加“清空筛选”操作。
## Impact
- 修改 `scripts/update-knowledge-index.sh` 的 HTML 模板、样式和前端 JS。
- 重新生成 `knowledge-index.html`。
- 不修改任何 `knowledge_*/` 内容。
- 不引入外部依赖。
@@ -0,0 +1,33 @@
## ADDED Requirements
### Requirement: Clear all active filters
The knowledge index SHALL provide a control that clears all currently supported filtering state and restores the full entry list. Future filters added to the index SHALL be wired into the same clear-filters behavior.
#### Scenario: Clearing all currently supported filters
- **WHEN** the user has entered a search term
- **AND** selected a year
- **AND** activated one or more tag filters
- **WHEN** the user clicks the clear filters control
- **THEN** the search input is empty
- **AND** the year filter is set to all years
- **AND** no tag badge is active
- **AND** all entries are displayed again
#### Scenario: Clicking clear when no filters are active
- **WHEN** no search, year, or tag filter is active
- **WHEN** the user clicks the clear filters control
- **THEN** all entries remain displayed
- **AND** no error is shown
#### Scenario: Clearing removes search highlighting
- **WHEN** search highlighting is visible because of a search term
- **WHEN** the user clicks the clear filters control
- **THEN** search highlighting is removed from rendered entries
#### Scenario: Empty index remains stable
- **WHEN** the index has no entries
- **WHEN** the user clicks the clear filters control
- **THEN** the empty state remains visible
- **AND** no error is shown
@@ -0,0 +1,25 @@
## 1. OpenSpec 产物
- [x] 1.1 创建 `add-clear-filters` 变更提案
- [x] 1.2 编写清空筛选设计说明
- [x] 1.3 编写清空筛选 spec
## 2. 前端交互
- [x] 2.1 在筛选区域增加“清空筛选”按钮
- [x] 2.2 实现 `clearFilters()`,清空搜索、年份和标签激活状态
- [x] 2.3 将按钮点击绑定到 `clearFilters()`
- [x] 2.4 确保清空后调用 `applyFilters()` 恢复完整列表
## 3. 生成脚本
- [x] 3.1 修改 `scripts/update-knowledge-index.sh` 中的 HTML 模板、样式和 JS
- [x] 3.2 重新生成 `knowledge-index.html`
## 4. 验证与归档
- [x] 4.1 静态验证 HTML 包含按钮和函数
- [x] 4.2 脚本验证生成脚本能成功重建页面
- [ ] 4.3 浏览器/人工验证组合筛选后可一键清空
- [x] 4.4 将结果回填到 `devflow/projects/`