Skip to content

Commit 2491954

Browse files
xkcodingclaude
andcommitted
docs: 更新项目文档并归档 OpenSpec proposal
- 更新 README.md,添加特性列表和配置说明 - 完善 openspec/project.md 项目上下文 - 归档 add-source-link-and-license proposal - 创建 post-details spec Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent af5cd52 commit 2491954

6 files changed

Lines changed: 135 additions & 11 deletions

File tree

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22

33
xkcoding 的代码成长日记 - 基于 [Astro](https://astro.build/) + [AstroPaper](https://github.com/satnaing/astro-paper) 主题构建。
44

5+
## 特性
6+
7+
- 🚀 基于 Astro 5.x 构建,性能优异
8+
- 🎨 基于 AstroPaper 主题定制,简洁美观
9+
- 🔍 Pagefind 全文搜索
10+
- 📖 目录侧边栏(TOC)
11+
- 🖼️ 文章封面图 & 动态 OG 图片
12+
- 📝 查看原文(跳转 GitHub raw 文件)
13+
- ⚖️ CC BY-NC-SA 4.0 协议声明
14+
- 🌙 深色模式支持
15+
516
## 技术栈
617

718
- **框架**: Astro 5.x
819
- **主题**: AstroPaper
20+
- **样式**: Tailwind CSS 4.x
921
- **搜索**: Pagefind
1022
- **部署**: GitHub Pages + GitHub Actions
1123

@@ -36,11 +48,27 @@ pnpm run preview
3648
│ ├── data/blog/ # 博客文章 (Markdown)
3749
│ ├── layouts/ # 布局组件
3850
│ ├── pages/ # 页面路由
51+
│ ├── utils/ # 工具函数
3952
│ └── config.ts # 站点配置
53+
├── openspec/ # OpenSpec 规范文档
4054
├── astro.config.ts # Astro 配置
4155
└── package.json
4256
```
4357

58+
## 配置说明
59+
60+
站点配置位于 `src/config.ts`,主要配置项:
61+
62+
- `website`: 站点 URL
63+
- `author`: 作者信息
64+
- `showToc`: 是否显示目录
65+
- `dynamicOgImage`: 是否启用动态 OG 图片
66+
- `editPost`: 编辑文章链接配置
67+
- `viewSource`: 查看原文链接配置
68+
- `license`: 协议声明配置
69+
4470
## License
4571

46-
MIT
72+
文章内容采用 [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh-hans) 协议
73+
74+
代码采用 MIT 协议

openspec/changes/add-source-link-and-license/proposal.md renamed to openspec/changes/archive/2026-01-20-add-source-link-and-license/proposal.md

File renamed without changes.

openspec/changes/add-source-link-and-license/specs/post-details/spec.md renamed to openspec/changes/archive/2026-01-20-add-source-link-and-license/specs/post-details/spec.md

File renamed without changes.

openspec/changes/add-source-link-and-license/tasks.md renamed to openspec/changes/archive/2026-01-20-add-source-link-and-license/tasks.md

File renamed without changes.

openspec/project.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,60 @@
11
# Project Context
22

33
## Purpose
4-
[Describe your project's purpose and goals]
4+
xkcoding 的个人技术博客,记录代码成长历程、技术分享和学习笔记。
55

66
## Tech Stack
7-
- [List your primary technologies]
8-
- [e.g., TypeScript, React, Node.js]
7+
- **框架**: Astro 5.x
8+
- **主题**: 基于 AstroPaper 定制
9+
- **样式**: Tailwind CSS 4.x
10+
- **搜索**: Pagefind (静态搜索)
11+
- **部署**: GitHub Pages + GitHub Actions
12+
- **包管理**: pnpm
913

1014
## Project Conventions
1115

1216
### Code Style
13-
[Describe your code style preferences, formatting rules, and naming conventions]
17+
- 使用 Prettier 格式化代码
18+
- 组件文件使用 PascalCase 命名 (如 `ViewSource.astro`)
19+
- 工具函数使用 camelCase 命名 (如 `getPath.ts`)
20+
- 中文注释,英文变量名
1421

1522
### Architecture Patterns
16-
[Document your architectural decisions and patterns]
23+
- Astro 组件位于 `src/components/`
24+
- 布局组件位于 `src/layouts/`
25+
- 博客文章位于 `src/data/blog/`(Markdown 格式)
26+
- 全局配置位于 `src/config.ts`
27+
- 工具函数位于 `src/utils/`
1728

1829
### Testing Strategy
19-
[Explain your testing approach and requirements]
30+
- 依赖 TypeScript 类型检查
31+
- 使用 `pnpm run build` 验证构建
32+
- 通过 GitHub Actions CI 自动检查
2033

2134
### Git Workflow
22-
[Describe your branching strategy and commit conventions]
35+
- 主分支: `master`
36+
- 功能分支: `feature/xxx`
37+
- 提交信息使用中文,格式: `类型: 描述`
38+
- feat: 新功能
39+
- fix: 修复
40+
- style: 样式调整
41+
- docs: 文档更新
42+
- chore: 其他
2343

2444
## Domain Context
25-
[Add domain-specific knowledge that AI assistants need to understand]
45+
- 博客文章使用 Markdown 编写,支持 frontmatter 配置
46+
- 支持动态 OG 图片生成
47+
- 支持文章封面图(用户设置 ogImage 时显示)
48+
- 支持目录(TOC)侧边栏
49+
- 支持 CC BY-NC-SA 4.0 协议声明
50+
- 支持查看原文(跳转 GitHub raw 文件)
2651

2752
## Important Constraints
28-
[List any technical, business, or regulatory constraints]
53+
- 保持与 AstroPaper 主题的兼容性
54+
- 图片资源优先使用 WebP 格式
55+
- 文章 URL 使用日期格式(如 /2024-01-01-title)
2956

3057
## External Dependencies
31-
[Document key external services, APIs, or systems]
58+
- GitHub API: 用于部署和 raw 文件访问
59+
- Creative Commons: CC 协议徽章图片
60+
- Google Fonts: 字体资源
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# post-details Specification
2+
3+
## Purpose
4+
TBD - created by archiving change add-source-link-and-license. Update Purpose after archive.
5+
## Requirements
6+
### Requirement: View Source Link
7+
8+
The system SHALL provide a "View Source" link on article detail pages that opens the raw Markdown file in the GitHub repository (blob view, not edit mode).
9+
10+
#### Scenario: User clicks View Source link
11+
12+
- **WHEN** user clicks the "View Source" link on an article page
13+
- **THEN** a new tab opens with the GitHub blob URL for the article's Markdown file
14+
- **AND** the URL format is `https://github.com/{owner}/{repo}/blob/{branch}/{filePath}`
15+
16+
#### Scenario: View Source link visibility
17+
18+
- **WHEN** `SITE.viewSource.enabled` is `true`
19+
- **THEN** the View Source link is displayed on the article page
20+
- **WHEN** `SITE.viewSource.enabled` is `false`
21+
- **THEN** the View Source link is hidden
22+
23+
### Requirement: CC License Declaration
24+
25+
The system SHALL display a Creative Commons license declaration (CC BY-NC-SA 4.0) at the bottom of each article's content area.
26+
27+
#### Scenario: License display position
28+
29+
- **WHEN** an article page is rendered
30+
- **THEN** the CC license declaration appears after the article content
31+
- **AND** before the share links section
32+
33+
#### Scenario: License content elements
34+
35+
- **WHEN** the license component is rendered
36+
- **THEN** it displays:
37+
- The CC BY-NC-SA 4.0 license icon/badge
38+
- A brief license description in Chinese
39+
- A link to the full license text on Creative Commons website
40+
41+
#### Scenario: License visibility control
42+
43+
- **WHEN** `SITE.license.enabled` is `true`
44+
- **THEN** the license declaration is displayed
45+
- **WHEN** `SITE.license.enabled` is `false`
46+
- **THEN** the license declaration is hidden
47+
48+
### Requirement: Configuration Options
49+
50+
The system SHALL provide configuration options in `src/config.ts` for View Source and License features.
51+
52+
#### Scenario: viewSource configuration
53+
54+
- **WHEN** configuring the View Source feature
55+
- **THEN** the following options are available:
56+
- `enabled`: boolean to show/hide the link
57+
- `text`: display text for the link (default: "查看原文")
58+
- `url`: base URL for the repository blob path
59+
60+
#### Scenario: license configuration
61+
62+
- **WHEN** configuring the License feature
63+
- **THEN** the following options are available:
64+
- `enabled`: boolean to show/hide the license
65+
- `type`: license type identifier (e.g., "CC BY-NC-SA 4.0")
66+
- `url`: URL to the full license text
67+

0 commit comments

Comments
 (0)