feat(docs): add sidebar resizing and update Claude Code workflow

- Add sidebar width resizing functionality with persistence and bounds checking
- Update Claude Code documentation to reflect current command changes (remove deprecated /commit and /review, add /diff and plugin workflow)
- Remove Husky pre-commit hook boilerplate to simplify setup
- Update Vue component type annotations from TypeScript to plain JavaScript for consistency
- Regenerate sitemap with updated timestamps
This commit is contained in:
sanbuphy
2026-03-23 17:36:13 +08:00
parent c50b4377fe
commit e2796ea75d
6 changed files with 233 additions and 66 deletions
@@ -366,7 +366,7 @@ https://docs.claude.com/en/docs/claude-code/slash-commands
| claude -c | 继续最近的一次会话 | `claude -c` |
| claude -r | 恢复上一段会话 | `claude -r` |
| /resume | 在当前聊天中切换回上一段会话 | `claude -c``/resume` |
| claude commit | 协助创建 Git 提交信息并提交代码 | `claude commit` |
| /plugin | 管理插件,可安装提交与审查类扩展能力 | `/plugin` |
| /init | 用 CLAUDE.md 初始化项目说明 | `/init` |
| /clear | 清空当前会话上下文,防止信息过载 | `/clear` |
| /compact | 压缩会话历史,减少上下文 token 占用 | `/compact` |
+75 -46
View File
@@ -451,47 +451,61 @@ Claude Code 的上下文窗口是有限的(通常 200K Token)。长对话会
现在我们已经完成了用户模块,接下来做订单模块
```
### 技巧 7/commit 自动提交 —— Git 工作流自动化
### 技巧 7用 Claude Code 辅助 Git 提交
`/commit` 让 Git 提交变得 effortless。Claude 会自动查看变更,生成符合规范的提交信息
在 Claude Code 里,推荐的提交流程是:先让 Claude 帮你查看 diff、整理提交信息,再由你执行标准的 Git 命令完成提交。这样既清晰,也方便你在提交前再次确认改动内容
**使用方式:**
官方文档参考:
- [Built-in commands](https://code.claude.com/docs/en/commands)
- [Discover plugins](https://code.claude.com/docs/en/discover-plugins)
**推荐工作流:**
```bash
/commit
# 1. 查看当前改动
/diff
!git status
# 2. 让 Claude 总结变更并生成提交信息
请基于当前 git diff,按照 Conventional Commits 规范生成一个 commit message
并用中文解释为什么这样分类
# 3. 你确认后,再执行标准 Git 提交
!git add -A
!git commit -m "feat(docs): update Claude Code workflow guidance"
```
**Claude 会做什么**
**这种方式的好处**
1. **查看变更**:运行 `git diff``git status`
2. **分析变更内容**:理解修改的目的和影响
3. **生成提交信息**:按照 Conventional Commits 规范
4. **执行提交**:运行 `git commit`
1. **更贴近当前官方能力**:不依赖已经移除的内置命令
2. **更透明**:你能先检查 diff 和 commit message,再决定是否提交
3. **更通用**:换到别的 AI IDE 或纯 Git 环境时,工作流依然成立
**示例输出**
**如果你想保留"一条命令提交"的体验**
```
检测到以下变更:
- src/components/UserCard.tsx - 新增用户卡片组件
- src/types/user.ts - 添加 User 类型定义
- tests/UserCard.test.tsx - 添加单元测试
建议的提交信息:
feat(components): add UserCard component with type definitions and tests
是否执行提交?(y/n/e - 编辑信息)
```
**进阶用法:**
Claude Code 现在推荐通过插件补回这类能力。例如官方插件市场示例里的 `commit-commands` 插件,会提供 `/commit-commands:commit` 这类命令。
```bash
# 自动提交,不询问
/commit --yes
# 1. 添加示例插件市场
/plugin marketplace add anthropics/claude-code
# 生成提交信息但不执行
/commit --dry-run
# 2. 安装提交工作流插件
/plugin install commit-commands@anthropics-claude-code
# 3. 重新加载插件
/reload-plugins
# 4. 使用插件命令提交
/commit-commands:commit
```
**补充说明:**
- `/commit-commands:commit` 是插件提供的命令,不是 Claude Code 当前默认内置命令
- 如果你只是想在提交前检查改动,优先使用 `/diff`,或直接让 Claude 解读 `git diff`
- 官方也已将 `/review` 标记为 deprecated;如果你需要类似能力,建议改用插件或自然语言审查工作流
### 技巧 8Shift+Tab 自动接受 —— 提高流畅度
默认情况下,Claude 修改代码前会询问你的确认。这在学习阶段很有帮助,但熟悉后可能会觉得繁琐。`Shift+Tab` 开启自动接受模式,让工作流更流畅。
@@ -1101,8 +1115,8 @@ Slash 命令是 Claude Code 的内置功能,以 `/` 开头。它们提供标
| `/plan` | 进入规划模式 | 复杂任务前先制定计划 |
| `/clear` | 清除对话历史 | 上下文混乱时重新开始 |
| `/compact` | 压缩上下文 | 长对话后节省 Token |
| `/commit` | 创建 Git 提交 | 快速提交变更 |
| `/review` | 审查未提交的变更 | 提交前检查代码 |
| `/diff` | 打开交互式 diff 视图 | 查看当前未提交改动 |
| `/plugin` | 管理插件 | 安装提交、审查等扩展能力 |
| `/context` | 查看上下文使用 | 优化 Token 消耗 |
| `/cost` | 查看本次会话费用 | 关注使用成本 |
| `/config` | 打开配置面板 | 修改设置 |
@@ -1115,9 +1129,11 @@ Slash 命令是 Claude Code 的内置功能,以 `/` 开头。它们提供标
# 完整开发工作流
/plan # 1. 制定计划
# ... 执行开发 ...
/review # 2. 查变更
/commit # 3. 提交代码
/cost # 4. 查看成本
/diff # 2. 查变更
请基于当前 diff 生成 commit message
!git add -A # 3. 暂存改动
!git commit -m "..." # 4. 提交代码
/cost # 5. 查看成本
```
### 符号系统
@@ -1219,12 +1235,15 @@ Claude Code 深度集成了 Git,让你可以在不离开终端的情况下完
**创建提交:**
```bash
# 自动提交
/commit
# 查看变更
/diff
# 提交前审查
/review
/commit
# 让 Claude 生成提交信息
请基于当前 git diff 生成一个 Conventional Commit message
# 手动提交
!git add -A
!git commit -m "..."
```
**分支操作:**
@@ -1234,7 +1253,9 @@ Claude Code 深度集成了 Git,让你可以在不离开终端的情况下完
!git checkout -b feature/user-authentication
# 完成开发后
/commit
请根据当前改动生成提交信息
!git add -A
!git commit -m "..."
!git push -u origin feature/user-authentication
```
@@ -1250,11 +1271,13 @@ Claude Code 深度集成了 Git,让你可以在不离开终端的情况下完
# 3. 运行测试
!npm test
# 4. 查变更
/review
# 4. 查变更
/diff
# 5. 提交代码
/commit
# 5. 生成并确认提交信息
请基于当前 git diff 生成一个 Conventional Commit message
!git add -A
!git commit -m "..."
# 6. 推送到远程
!git push -u origin feature/payment-integration
@@ -1391,7 +1414,9 @@ Claude Code 深度集成了 Git,让你可以在不离开终端的情况下完
!npm test
# 5. 提交修复
/commit
请根据当前 diff 生成修复类提交信息
!git add -A
!git commit -m "fix: ..."
```
**场景 2:代码审查工作流**
@@ -1411,7 +1436,8 @@ Claude Code 深度集成了 Git,让你可以在不离开终端的情况下完
优化 UserList 组件的性能
# 5. 最终审查
/review
/diff
请审查当前改动,指出潜在风险和可改进点
```
**场景 3:新功能开发工作流**
@@ -1434,10 +1460,13 @@ Claude Code 深度集成了 Git,让你可以在不离开终端的情况下完
!npm test
# 6. 代码审查
/review
/diff
请基于当前 diff 做一次代码审查
# 7. 提交代码
/commit
请生成本次功能开发的 commit message
!git add -A
!git commit -m "feat: ..."
!git push
```