Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions docs/OPENSPEC.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# OpenSpec Global Standards | 全局开发规范

**Version**: 1.1.0
**Date**: 2025-11-21
**Version**: 1.2.0
**Date**: 2025-11-22
**Project**: Open Wisdom Lab Website
**Status**: Living Document (活文档)

---

## 📋 Table of Contents

- [0. Documentation Architecture](#0-documentation-architecture)
- [1. Introduction](#1-introduction)
- [2. Architecture Standards](#2-architecture-standards)
- [3. Code Organization](#3-code-organization)
Expand All @@ -26,6 +27,49 @@

---

## 0. Documentation Architecture

### 0.1 文档职责划分

本项目有两个核心规范文档,各有侧重:

| 文档 | 位置 | 目标读者 | 主要内容 |
|------|------|---------|----------|
| **CLAUDE.md** | `/CLAUDE.md` | AI 助手 (Claude Code) | 项目快速参考、开发命令、i18n 规范、代码审查清单 |
| **OPENSPEC.md** | `/docs/OPENSPEC.md` | 人类开发者 | 完整架构标准、代码规范、测试规范、部署流程 |

### 0.2 避免重复维护

为避免信息不一致:

1. **技术栈版本** - 以 `package.json` 为准,两文档引用时说明"详见 package.json"
2. **项目结构** - OPENSPEC.md 为权威源,CLAUDE.md 仅保留精简版本
3. **i18n 规范** - 两文档均需保留(AI 助手高频使用),保持同步
4. **组件开发规范** - OPENSPEC.md 为完整版,CLAUDE.md 保留快速参考

### 0.3 更新原则

- **新增规范** → 先更新 OPENSPEC.md,再同步简化版到 CLAUDE.md
- **版本变更** → 更新 package.json,两文档均添加"详见 package.json"引用
- **审查变更** → 每次更新时检查两文档的一致性

### 0.4 相关文档索引

```
docs/
├── OPENSPEC.md # 本文档 - 全局开发规范 (权威源)
├── ROADMAP.md # 产品路线图与开发计划
├── DESIGN_SYSTEM.md # 设计系统规范
├── ARCHITECTURE.md # 系统架构说明
├── DEPLOYMENT.md # 部署流程指南
├── CONSISTENCY_AUDIT.md # 代码一致性审核
├── CONTENT_GAPS.md # 内容缺口分析
├── DEVELOPMENT.md # 开发环境搭建
└── component-props-guide.md # 组件 Props 类型化指南
```

---

## 1. Introduction

### 1.1 Purpose | 目的
Expand Down Expand Up @@ -1479,6 +1523,7 @@ import logo from '~/assets/images/logo.svg';

| Version | Date | Author | Changes |
|---------|------|--------|---------|
| 1.2.0 | 2025-11-22 | Claude | 添加文档架构章节(Section 0),明确 CLAUDE.md 与 OPENSPEC.md 职责划分 |
| 1.1.0 | 2025-11-21 | Claude | 更新技术栈版本,同步 package.json |
| 1.0.0 | 2025-11-19 | Claude | Initial OpenSpec creation |

Expand Down
21 changes: 16 additions & 5 deletions docs/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Product Roadmap 2025-2026 | 产品路线图

**Version**: 1.3.0
**Version**: 1.4.0
**Last Updated**: 2025-11-22
**Project**: Open Wisdom Lab Website
**Related Documents**: [docs/](./docs/) 目录下的所有文档
Expand Down Expand Up @@ -70,22 +70,24 @@
- [x] 移除 6 个未使用组件 (HighlightedPosts, LatestPosts, Button, Card, Pricing, Announcement)
- [x] 优化 PageLayout 移除重复的背景动画组件
- [x] 补充 Note.astro 组件双语翻译
- [x] 移除 9 个 cyber 组件的 'use client' 指令 (消除 sourcemap 警告)

#### Week 3-4: TypeScript 迁移
- [x] 添加类型定义
- [x] 创建 `src/types/` 目录
- [x] 定义 `SiteConfig.ts`
- [x] 定义 `BlogPost.ts`
- [x] 定义 `Navigation.ts`
- [ ] 组件 Props 类型化
- [ ] 为所有组件添加 `export interface Props`
- [x] 组件 Props 类型化 (部分完成)
- [x] 为核心 widgets 组件添加 Props (Hero, Vision, CallToAction)
- [ ] 为剩余 ~19 个组件添加 `export interface Props`
- [ ] 配置重构
- [ ] 创建 `src/config/` 模块化配置

**Deliverables:**
- [x] 完整的开发规范文档
- [ ] 100% TypeScript 覆盖
- [ ] 0 ESLint/TypeScript 错误
- [ ] 100% TypeScript 覆盖 (~80% 已完成)
- [x] 0 ESLint/TypeScript 错误 (构建通过)
- [x] 统一的代码风格

**Metrics:**
Expand Down Expand Up @@ -758,6 +760,15 @@ Week 2:

## 📝 Changelog | 更新日志

### Version 1.4.0 (2025-11-22)
- **文档架构优化**
- 更新 OPENSPEC.md v1.2.0: 添加文档架构章节(Section 0)
- 明确 CLAUDE.md 与 OPENSPEC.md 的职责划分和更新原则
- **构建质量提升**
- 移除 9 个 cyber 组件的 'use client' 指令,消除 sourcemap 警告
- 为核心组件添加 Props 类型定义 (Hero, Vision, CallToAction)
- **构建状态**: 0 errors, 0 warnings, 1 hint

### Version 1.3.0 (2025-11-22)
- **代码质量优化**
- 修复 deprecated API (substr -> substring)
Expand Down
2 changes: 0 additions & 2 deletions src/components/ui/cyber/CyberButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React, { useRef, useState } from 'react';
import { motion, useMotionValue, useSpring } from 'framer-motion';

Expand Down
2 changes: 0 additions & 2 deletions src/components/ui/cyber/CyberCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React, { useRef, useState } from 'react';
import { motion, useMotionValue, useSpring, useTransform } from 'framer-motion';

Expand Down
2 changes: 0 additions & 2 deletions src/components/ui/cyber/FloatingElements.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';
import { motion } from 'framer-motion';

Expand Down
2 changes: 0 additions & 2 deletions src/components/ui/cyber/GlitchText.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React, { useEffect, useState } from 'react';
import { motion } from 'framer-motion';

Expand Down
2 changes: 0 additions & 2 deletions src/components/ui/cyber/GridBackground.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';
import { motion } from 'framer-motion';

Expand Down
2 changes: 0 additions & 2 deletions src/components/ui/cyber/HolographicBorder.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';
import { motion } from 'framer-motion';

Expand Down
2 changes: 0 additions & 2 deletions src/components/ui/cyber/NoiseOverlay.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';

interface NoiseOverlayProps {
Expand Down
2 changes: 0 additions & 2 deletions src/components/ui/cyber/ParallaxSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React, { useRef } from 'react';
import { motion, useScroll, useTransform, useSpring } from 'framer-motion';

Expand Down
2 changes: 0 additions & 2 deletions src/components/ui/cyber/ScrollReveal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React, { useRef } from 'react';
import { motion, useInView, type Variants } from 'framer-motion';

Expand Down
22 changes: 20 additions & 2 deletions src/components/widgets/CallToAction.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
---
import { CyberButton } from '~/components/ui/cyber';

/**
* Call to Action component for conversion points
*
* @component
* @example
* ```astro
* <CallToAction href="#contact" />
* ```
*/
export interface Props {
/** Link destination for the CTA button @default '#contact' */
href?: string;
/** Optional custom class name */
class?: string;
}

const { href = '#contact', class: _className = '' } = Astro.props;
---

<section class="relative bg-white dark:bg-cyber-black border-t-4 border-black dark:border-slate-800">
Expand All @@ -22,7 +40,7 @@ import { CyberButton } from '~/components/ui/cyber';
<div class="dark:hidden">
<a
class="inline-flex items-center justify-center px-8 py-4 font-black text-white bg-black hover:bg-white hover:text-black border-4 border-black text-xl uppercase tracking-wider transition-all shadow-[6px_6px_0px_0px_rgba(0,0,0,0.3)] hover:shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] hover:-translate-y-1"
href="#contact"
href={href}
data-i18n="cta.button"
>
联系我们 →
Expand All @@ -33,7 +51,7 @@ import { CyberButton } from '~/components/ui/cyber';
<div class="hidden dark:block">
<CyberButton
client:visible
href="#contact"
href={href}
variant="neon"
size="lg"
>
Expand Down
16 changes: 16 additions & 0 deletions src/components/widgets/Hero.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
---
import { Icon } from 'astro-icon/components';
import { Picture } from 'astro:assets';

/**
* Hero component for landing pages
*
* @component
* @example
* ```astro
* <Hero />
* ```
*/
export interface Props {
/** Optional custom class name */
class?: string;
}

const { class: _className = '' } = Astro.props;
---

<section>
Expand Down
20 changes: 19 additions & 1 deletion src/components/widgets/Vision.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
---
import { ScrollReveal } from '~/components/ui/cyber';

/**
* Vision component showcasing the lab's vision and core values
*
* @component
* @example
* ```astro
* <Vision id="vision" />
* ```
*/
export interface Props {
/** Section ID for anchor navigation @default 'vision' */
id?: string;
/** Optional custom class name */
class?: string;
}

const { id = 'vision', class: className = '' } = Astro.props;
---

<section class="scroll-mt-16 bg-white dark:bg-cyber-black transition-colors duration-300" id="vision">
<section class={`scroll-mt-16 bg-white dark:bg-cyber-black transition-colors duration-300 ${className}`} id={id}>
<div class="px-4 py-16 mx-auto max-w-6xl lg:px-8 lg:py-20">
<div class="max-w-5xl mx-auto">
<ScrollReveal client:visible variant="slide-up">
Expand Down
Loading