Skip to content

Commit 69960f0

Browse files
authored
Merge pull request #8 from Arylo/feat/cloud-storage
feat(cloud-storage): add Cloudflare Worker-based cloud storage app
2 parents 0dd6b70 + e0b9b7d commit 69960f0

277 files changed

Lines changed: 35119 additions & 5603 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/skills/commit/SKILL.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ user-invocable: true
2121
4. 检查当前 staged 变更。
2222
5. 如果没有 staged 变更,先将当前工作区改动加入暂存区。
2323
6. 如果 staged 或当前工作区改动中包含 `package.json` 或 `package-lock.json`,需要检查变更内容:
24-
- 如果 `package-lock.json` 有修改 **或者** `package.json` 的 `dependencies` 或 `devDependencies` 部分有修改,必须先执行 `/linux-native-binding-repair`,确认不存在 Linux native binding、optionalDependencies 或 lockfile 跨平台漂移问题。
25-
- 如果只有 `package.json` 的其他部分(如 scripts、workspaces 等)修改,且 `package-lock.json` 没有修改,则不需要执行 `/linux-native-binding-repair`。
24+
- 如果 `package-lock.json` 有修改 **或者** `package.json` 的 `dependencies` 或 `devDependencies` 部分有修改,必须先执行 `/install-native-binding`。
25+
- 如果只有 `package.json` 的其他部分(如 scripts、workspaces 等)修改,且 `package-lock.json` 没有修改,则不需要执行 `/install-native-binding`。
2626
7. 基于暂存区差异生成 commit message,格式必须是 `<type>(<scope>): <subject>`。
27+
- 如果 staged 文件数量 **> 8**,在 subject 行之后追加 commit message body,列出各核心改动摘要(每行一条,格式 `- <summary>`)。
2728
8. 如果用户传入参数,将其作为 subject,仍需自动补全 type 和 scope。
2829
9. 执行 git 提交。
2930
10. 返回以下结果:
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
name: install-native-binding
3+
description: '安装 npm 依赖并确保 Linux native binding 正确生成。在非 Linux 系统上通过 docker/podman 以 linux/amd64 容器执行安装,保证 lockfile 中包含跨平台 native binding。Use when installing dependencies, fixing missing native bindings, or syncing package-lock.json for Linux environments.'
4+
user-invocable: true
5+
---
6+
7+
# Install Native Binding Skill
8+
9+
## 适用场景
10+
11+
- 安装/更新 npm 依赖后需要确保 Linux native binding 正确写入 lockfile
12+
- 在 macOS / Windows 开发机上需要为 Linux 生产环境生成正确的 lockfile
13+
- CI 报告缺少 native binding 或 optionalDependencies 平台条目
14+
15+
## 执行步骤
16+
17+
### 1. 检测当前操作系统
18+
19+
运行 `uname -s` 获取系统类型。
20+
21+
- 若输出为 `Linux`,进入**步骤 2(Linux 路径)**。
22+
- 否则(macOS、Windows 等),进入**步骤 3(非 Linux 路径)**。
23+
24+
### 2. Linux 路径
25+
26+
直接在当前环境运行:
27+
28+
```bash
29+
npm i --include-workspace-root --workspaces
30+
```
31+
32+
完成后跳至**步骤 5**。
33+
34+
### 3. 非 Linux 路径 —— 检测容器运行时
35+
36+
依次检查以下命令是否可用:
37+
38+
```bash
39+
command -v docker
40+
command -v podman
41+
```
42+
43+
- 若两者均不可用,**停止执行**,告知用户需要安装 Docker 或 Podman 后重试。
44+
- 优先使用 `docker`;若 `docker` 不可用则使用 `podman`(以下统称 `<runtime>`)。
45+
46+
### 4. 非 Linux 路径 —— 读取 Node 版本并在容器中安装
47+
48+
#### 4a. 读取 Node 版本
49+
50+
读取仓库根目录的 `.nvmrc` 文件,获取版本号(去掉前缀 `v`),作为镜像 tag。
51+
52+
例如 `.nvmrc` 内容为 `v24.12.0`,则镜像为 `node:24.12.0`。
53+
54+
#### 4b. 在容器中执行安装
55+
56+
```bash
57+
<runtime> run --rm --platform linux/amd64 \
58+
-v "$PWD":/src \
59+
--tmpfs /src/node_modules:exec \
60+
node:<version> \
61+
bash -lc 'cd /src && npm i --include-workspace-root --workspaces'
62+
```
63+
64+
- 挂载当前工作目录为 `/src`(读写,不加 `:ro`),使安装结果(`node_modules`、`package-lock.json`)直接写回宿主机。
65+
- `--tmpfs /src/node_modules:exec` 将容器内的根 `node_modules` 挂载为内存文件系统,避免宿主机的 `node_modules` 被覆盖,同时加速安装;`:exec` 允许 postinstall 脚本执行二进制文件(Docker tmpfs 默认带 `noexec`)。
66+
- `--platform linux/amd64` 确保 native binding 以 Linux x64 平台编译/下载。
67+
68+
## 约束
69+
70+
- 容器挂载目录为当前工作区根目录(即含 `package.json` 和 `package-lock.json` 的目录)
71+
- 不要在容器内部 `cp` 文件;直接挂载读写以避免权限问题
72+
- Node 镜像版本必须严格来自 `.nvmrc`,不得硬编码或猜测

‎.claude/skills/linux-native-binding-repair/SKILL.md‎

Lines changed: 0 additions & 86 deletions
This file was deleted.

‎.github/workflows/caddyfile_sdk.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
cache-dependency-path: package-lock.json
3131

3232
- name: Install dependencies
33-
run: npm ci -ws --include-workspace-root
33+
run: npm ci --workspaces --include-workspace-root
3434

3535
- name: Lint
3636
run: npm run lint
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Cloud Storage
2+
3+
on:
4+
push:
5+
paths:
6+
- apps/cf-worker/cloud-storage/**
7+
- package.json
8+
- package-lock.json
9+
- tsconfig.json
10+
- turbo.json
11+
pull_request:
12+
paths:
13+
- apps/cf-worker/cloud-storage/**
14+
- package.json
15+
- package-lock.json
16+
- tsconfig.json
17+
- turbo.json
18+
19+
jobs:
20+
cloud-storage:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 24.12.0
29+
cache: npm
30+
cache-dependency-path: package-lock.json
31+
32+
- name: Install dependencies
33+
run: npm ci --workspaces --include-workspace-root
34+
35+
- name: Lint
36+
run: npm run lint
37+
env:
38+
TURBO_FILTER: ./apps/cf-worker/cloud-storage
39+
40+
- name: Test
41+
run: npm run test
42+
env:
43+
TURBO_FILTER: ./apps/cf-worker/cloud-storage
44+
45+
- name: Build
46+
run: npm run build --ignore-scripts
47+
env:
48+
TURBO_FILTER: ./apps/cf-worker/cloud-storage

‎.vscode/mcp.json‎

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
{
2-
"servers": {
3-
"git": {
4-
"command": "bash",
5-
"args": [
6-
"-c",
7-
"(nvm -h || source $HOME/.nvm/nvm.sh) && (nvm use 20 || nvm install 20) && nvm exec 20 npx -y @cyanheads/git-mcp-server"
8-
]
9-
}
10-
}
2+
"servers": {
3+
"git": {
4+
"command": "npx",
5+
"args": [
6+
"-y",
7+
"@cyanheads/git-mcp-server"
8+
]
9+
},
10+
"chrome-devtools": {
11+
"command": "npx",
12+
"args": [
13+
"-y",
14+
"chrome-devtools-mcp"
15+
]
16+
},
17+
"shadcn": {
18+
"command": "npx",
19+
"args": [
20+
"shadcn@latest",
21+
"mcp"
22+
]
23+
}
24+
}
1125
}

‎.vscode/settings.json‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{
22
"cSpell.words": [
3-
"arylo"
3+
"arylo",
4+
"qinglong",
5+
"syncpack"
46
],
57
"files.associations": {
68
"wrangler.json": "jsonc"
7-
}
9+
},
10+
"chat.tools.terminal.autoApprove": {
11+
"command": true
12+
}
813
}

‎CLAUDE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
## Claude Skills
44

55
- `/commit`:根据当前改动生成并执行规范化 Git 提交
6-
- `/linux-native-binding-repair`:排查并修复 Linux 环境下缺失的 native binding、optionalDependencies 和 package-lock 跨平台漂移问题
6+
- `/install-native-binding`:安装 npm 依赖并确保 Linux native binding 正确生成(非 Linux 系统自动通过 docker/podman 容器执行)
77

88
以上能力已迁移到 `.claude/skills/`,按 Claude skill 方式维护与发现。

‎apps/caddyfile-sdk/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
"devDependencies": {
4747
"concurrently": "^8.2.2",
4848
"oxfmt": "^0.35.0",
49-
"oxlint": "^1.24.0",
50-
"rimraf": "^6.0.1",
49+
"oxlint": "^1.58.0",
50+
"rimraf": "^6.1.3",
5151
"typescript": "~5.9.3",
52-
"vitest": "^4.1.0"
52+
"vitest": "^4.1.4"
5353
}
5454
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"singleQuote": true,
3+
"semi": false,
4+
"sortImports": {
5+
"newlinesBetween": false
6+
},
7+
"ignorePatterns": ["*.md", "dist/**", ".wrangler/**", "src/react-app/Components/**"]
8+
}

0 commit comments

Comments
 (0)