chore: 移除 LeetCode 笔记并加入站点验证与 Agent 工作流规则
- 从 collections、导航移除 LeetCode,删除 docs/notes/programming/leetcode 下页面 - devDependencies 显式加入 @vuepress/helper@rc.123,配合 overrides 降低 Vite 预构建白屏风险 - 新增 npm run docs:verify 与 scripts/verify-site.mjs(构建后检查首页 hero) - .cursor/rules/agent-workflow-verify-and-git.mdc:每次修改须验证;用户未明确说不要提交时默认 commit Made-with: Cursor
This commit is contained in:
30
.cursor/rules/agent-workflow-verify-and-git.mdc
Normal file
30
.cursor/rules/agent-workflow-verify-and-git.mdc
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
description: 每次站点相关修改后须本地构建/启动并验证;Git 提交默认策略(除非用户明确不要提交)
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Agent 工作流:验证站点与 Git 提交
|
||||
|
||||
## 修改后必须自行验证(硬性要求)
|
||||
|
||||
凡改动 **VuePress / Plume 配置、`docs/` 下内容与主题相关代码** 等会影响站点展示或 dev/build 的行为时,**在本轮任务结束前必须**完成下列至少一项,并确认 **首页等主要页面非白屏**、**无控制台致命报错**(开发模式下可 F12 查看):
|
||||
|
||||
1. **推荐(与线上最接近)**:在项目根执行
|
||||
`npm run docs:build`
|
||||
然后执行
|
||||
`npm run docs:verify`
|
||||
(会检查 `docs/.vuepress/dist/index.html` 是否包含首页 hero 结构。)
|
||||
|
||||
2. **若重点验证热更新 / 开发体验**:执行
|
||||
`npm run docs:dev-clean`
|
||||
(`--clean-cache --clean-temp` 可避免 **Vite 预构建缓存** 仍指向旧版 `@vuepress/helper`,从而触发 **`encodeSVG` 导出缺失、整站白屏**。)
|
||||
在浏览器打开本地地址,确认首页 hero 与导航正常。
|
||||
|
||||
**白屏常见原因速记**:`@vuepress/plugin-markdown-chart` 等依赖需要 `@vuepress/helper/client` 导出 `encodeSVG`;若 `docs/.vuepress/.cache` 里预打包了过旧的 helper,会出现 **仅 dev 白屏、build 正常**。处理:删缓存或用 `docs:dev-clean` / `docs:build`(脚本已带 clean)。
|
||||
|
||||
## Git 提交策略
|
||||
|
||||
- **默认**:在用户**未**于本轮对话中明确要求 **「不要提交」「暂不 commit」「仅改代码不要 git」** 等前提下,在 **验证通过** 后 **应执行 `git add` + `git commit`**,用清晰的中文说明提交内容。
|
||||
- **例外**:用户明确只要改代码、**由其本人审核后再提交**时,**不执行** commit。
|
||||
|
||||
**注意**:构建产物目录 **`docs/.vuepress/dist`**、缓存 **`.cache` / `.temp`** 已在 `.gitignore` 中,**不要**将编译输出提交进源码仓。
|
||||
@@ -28,23 +28,6 @@ export default defineCollections([
|
||||
})),
|
||||
}),
|
||||
|
||||
defineCollection({
|
||||
type: 'doc',
|
||||
dir: 'notes/programming/leetcode',
|
||||
title: 'LeetCode',
|
||||
linkPrefix: '/programming/leetcode/',
|
||||
sidebar: [
|
||||
{ text: 'LeetCode 指南', link: '/programming/leetcode/' },
|
||||
{
|
||||
text: '刷题题单',
|
||||
prefix: '/question_sheet',
|
||||
items: [
|
||||
{ text: 'LeetCode 入门题单~(≧∇≦)ノ', link: '/programming/leetcode/question_sheet/beginner/' },
|
||||
],
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
||||
defineCollection({
|
||||
type: 'doc',
|
||||
dir: 'notes/subject/english',
|
||||
|
||||
@@ -25,10 +25,6 @@ export default defineNavbarConfig([
|
||||
{
|
||||
text: '编程笔记',
|
||||
items: [
|
||||
{
|
||||
text: 'LeetCode',
|
||||
link: '/programming/leetcode/',
|
||||
},
|
||||
{
|
||||
text: 'Solidity',
|
||||
link: '/programming/solidity/',
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
---
|
||||
title: LeetCode 题解笔记
|
||||
description: 记录LeetCode算法题的解题思路和代码实现
|
||||
createTime: 2025/09/22 08:09:52
|
||||
permalink: /programming/leetcode/
|
||||
---
|
||||
|
||||
# LeetCode 题解笔记
|
||||
|
||||
这里是我在LeetCode刷题过程中记录的解题思路和代码实现。通过整理这些题解,希望能够提高自己的算法水平和编程能力。
|
||||
|
||||
## 题解分类
|
||||
|
||||
### 数组与字符串
|
||||
|
||||
- [两数之和](https://leetcode-cn.com/problems/two-sum/)
|
||||
- [三数之和](https://leetcode-cn.com/problems/3sum/)
|
||||
|
||||
### 链表
|
||||
|
||||
- [反转链表](https://leetcode-cn.com/problems/reverse-linked-list/)
|
||||
- [合并两个有序链表](https://leetcode-cn.com/problems/merge-two-sorted-lists/)
|
||||
|
||||
### 动态规划
|
||||
|
||||
- [爬楼梯](https://leetcode-cn.com/problems/climbing-stairs/)
|
||||
- [最长回文子串](https://leetcode-cn.com/problems/longest-palindromic-substring/)
|
||||
|
||||
## 解题技巧
|
||||
|
||||
1. **双指针法**:常用于数组、链表问题,如两数之和、反转链表等
|
||||
2. **滑动窗口**:处理字符串子串问题
|
||||
3. **动态规划**:将原问题分解为子问题,自底向上求解
|
||||
4. **分治法**:将问题分成若干子问题,分别求解后合并结果
|
||||
|
||||
## 学习资源
|
||||
|
||||
- [LeetCode官方题解](https://leetcode-cn.com/problemset/all/)
|
||||
- [代码随想录](https://programmercarl.com/)
|
||||
- [算法导论](https://mitpress.mit.edu/books/introduction-algorithms)
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
title: LeetCode 入门题单~(≧∇≦)ノ
|
||||
description: 给算法初学者的题目推荐和学习路径
|
||||
createTime: 2025年9月22日 08:52:52
|
||||
permalink: /programming/leetcode/question_sheet/beginner/
|
||||
---
|
||||
# LeetCode 入门题单~(๑>◡<๑)
|
||||
|
||||
作为算法初学者,选择合适的题目开始练习真的超~级重要哦!这里给大家推荐一份超棒的入门题单——[「新」动计划 · 编程入门](https://leetcode.cn/studyplan/primers-list/) ~这份题单就像给小树苗精心准备的阳光和雨露一样,特别适合刚开始算法之旅的你~(悄悄告诉你,里面有两题是数据库基础,暂时可以跳过哦~)
|
||||
|
||||
我的小建议是:先自己试着挑战一下,如果遇到困难了,再来看题解也没关系~重要的是享受这个成长的过程呀~(♡˙︶˙♡)
|
||||
|
||||
## 基础语法 & 数据类型 ٩(๑>◡<๑)۶
|
||||
1
package-lock.json
generated
1
package-lock.json
generated
@@ -15,6 +15,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vuepress/bundler-vite": "2.0.0-rc.26",
|
||||
"@vuepress/helper": "2.0.0-rc.123",
|
||||
"@vuepress/plugin-umami-analytics": "2.0.0-rc.112",
|
||||
"artalk": "^2.9.1",
|
||||
"http-server": "^14.1.1",
|
||||
|
||||
@@ -14,10 +14,12 @@
|
||||
"docs:dev": "vuepress dev docs",
|
||||
"docs:dev-clean": "vuepress dev docs --clean-cache --clean-temp",
|
||||
"docs:build": "vuepress build docs --clean-cache --clean-temp",
|
||||
"docs:verify": "node scripts/verify-site.mjs",
|
||||
"docs:preview": "http-server docs/.vuepress/dist",
|
||||
"vp-update": "npx vp-update"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vuepress/helper": "2.0.0-rc.123",
|
||||
"@vuepress/bundler-vite": "2.0.0-rc.26",
|
||||
"@vuepress/plugin-umami-analytics": "2.0.0-rc.112",
|
||||
"artalk": "^2.9.1",
|
||||
|
||||
27
scripts/verify-site.mjs
Normal file
27
scripts/verify-site.mjs
Normal file
@@ -0,0 +1,27 @@
|
||||
import { readFileSync, existsSync } from 'node:fs'
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { dirname, join } from 'node:path'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
const indexHtml = join(root, 'docs', '.vuepress', 'dist', 'index.html')
|
||||
|
||||
const build = spawnSync('npm', ['run', 'docs:build'], {
|
||||
cwd: root,
|
||||
shell: true,
|
||||
stdio: 'inherit',
|
||||
})
|
||||
if (build.status !== 0) process.exit(build.status ?? 1)
|
||||
|
||||
if (!existsSync(indexHtml)) {
|
||||
console.error('verify-site: dist/index.html missing after build')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const html = readFileSync(indexHtml, 'utf8')
|
||||
if (!html.includes('hero-name') || !html.includes('仲夏夜之梦')) {
|
||||
console.error('verify-site: home hero markers missing in dist/index.html (possible theme/render failure)')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('verify-site: OK (home hero present in production build)')
|
||||
Reference in New Issue
Block a user