Files
git-learn/openspec/changes/knowledge-index-panel/specs/knowledge-linking/spec.md
T

36 lines
1.8 KiB
Markdown

## ADDED Requirements
### Requirement: Tag-based related entries
The system SHALL display a list of all unique tags across all knowledge entries. When a user clicks a tag, the system SHALL show only the entries that have that tag, and within each displayed entry, highlight the clicked tag.
#### Scenario: Clicking a tag filters entries
- **WHEN** user clicks the "Claude Code" tag
- **THEN** only entries tagged with "Claude Code" are displayed, and the tag is visibly active/selected
#### Scenario: Clicking the same tag again deselects
- **WHEN** user clicks an already-selected tag
- **THEN** the tag filter is removed and all entries are displayed again
#### Scenario: Entry has no tags
- **WHEN** a knowledge entry has no tags in its YAML frontmatter
- **THEN** the entry is displayed without any tag badges and is not matched by any tag filter click
#### Scenario: Multiple entries share a tag
- **WHEN** two or more entries share the same tag
- **THEN** clicking that tag shows all matching entries simultaneously
### Requirement: Related entries section
For each knowledge entry, the system SHALL display a "相关内容" (Related Content) section showing links to other entries that share at least one tag with the current entry.
#### Scenario: Entry has related entries
- **WHEN** entry A has tags ["Claude Code", "TypeScript"] and entry B has tags ["Claude Code", "React"]
- **THEN** under entry A, entry B is shown as related content (matching on "Claude Code")
#### Scenario: Entry has no related entries
- **WHEN** an entry's tags do not match any other entry's tags
- **THEN** no "相关内容" section is displayed for that entry
#### Scenario: Entry has no tags
- **WHEN** an entry has an empty tags array
- **THEN** no "相关内容" section is displayed and the entry is not included in any other entry's related content