harmonyos-skills-pack 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +40 -12
  2. package/bin/cli.js +28 -20
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # HarmonyOS Skills Pack
2
2
 
3
- Current Version: 0.1.0
3
+ [![npm version](https://img.shields.io/npm/v/harmonyos-skills-pack.svg)](https://www.npmjs.com/package/harmonyos-skills-pack)
4
+ [![GitHub release](https://img.shields.io/github/v/release/yibaiba/harmonyos-skills-pack)](https://github.com/yibaiba/harmonyos-skills-pack/releases)
5
+
6
+ Current Version: 0.1.1
4
7
 
5
8
  这是一个面向 Claude、GitHub Copilot、Codex 等 Coding Agent 的可安装 Skills 项目。
6
9
 
@@ -29,13 +32,13 @@ Current Version: 0.1.0
29
32
  - 2025 创作激励与审核避坑
30
33
  - Starter Kit 极速实现包
31
34
 
32
- 其中 starter-kit 已包含:
35
+ 其中 starter-kit 已包含 15 个模块模板:
33
36
 
34
- - 登录模块模板
35
- - 单机离线 / 免登录模块
36
- - 游客升级登录同步模块
37
- - 列表页、详情页、表单页、TabBar 模板
37
+ - 登录模块、单机离线/免登录、游客升级登录同步
38
+ - 列表页、详情页、表单页、TabBar 导航
38
39
  - 深色模式与多端适配模板
40
+ - 本地数据持久化、后台任务、通知处理
41
+ - WebSocket 实时通信、相机与媒体、支付与计费
39
42
  - Day-by-Day 执行顺序与提审前清单
40
43
 
41
44
  ### 2. universal-product-quality
@@ -67,14 +70,39 @@ Current Version: 0.1.0
67
70
 
68
71
  ## 快速开始
69
72
 
70
- ### 1. 克隆仓库
73
+ ### 方式 1:npx 一键安装(推荐)
74
+
75
+ ```bash
76
+ # 安装到当前项目(自动安装到 .claude/.github/.codex/skills)
77
+ npx harmonyos-skills-pack
78
+
79
+ # 国内用户加速
80
+ npx harmonyos-skills-pack --mirror
81
+
82
+ # 仅安装到 Claude
83
+ npx harmonyos-skills-pack --claude-only
84
+
85
+ # 仅安装到 Copilot
86
+ npx harmonyos-skills-pack --copilot-only
87
+
88
+ # 仅安装到 Codex
89
+ npx harmonyos-skills-pack --codex-only
90
+
91
+ # 强制覆盖已有文件
92
+ npx harmonyos-skills-pack --force
93
+
94
+ # 卸载
95
+ npx harmonyos-skills-pack uninstall
96
+ ```
97
+
98
+ ### 方式 2:克隆仓库 + 脚本安装
71
99
 
72
100
  ```bash
73
- git clone <your-repo-url> harmonyos-skills-pack
101
+ git clone https://github.com/yibaiba/harmonyos-skills-pack.git
74
102
  cd harmonyos-skills-pack
75
103
  ```
76
104
 
77
- ### 2. 安装到 Claude
105
+ ### 安装到 Claude
78
106
 
79
107
  ```bash
80
108
  ./scripts/install-skills.sh --claude
@@ -85,7 +113,7 @@ cd harmonyos-skills-pack
85
113
  - ~/.claude/skills/harmonyos-ark
86
114
  - ~/.claude/skills/universal-product-quality
87
115
 
88
- ### 3. 安装到 Copilot 工作区
116
+ ### 安装到 Copilot 工作区
89
117
 
90
118
  ```bash
91
119
  ./scripts/install-skills.sh --copilot-workspace /path/to/your/workspace
@@ -96,14 +124,14 @@ cd harmonyos-skills-pack
96
124
  - /path/to/your/workspace/.github/skills/harmonyos-ark
97
125
  - /path/to/your/workspace/.github/skills/universal-product-quality
98
126
 
99
- ### 4. 强制覆盖安装
127
+ ### 强制覆盖安装
100
128
 
101
129
  ```bash
102
130
  ./scripts/install-skills.sh --claude --force
103
131
  ./scripts/install-skills.sh --copilot-workspace /path/to/your/workspace --force
104
132
  ```
105
133
 
106
- ### 5. 维护者同步标准目录
134
+ ### 维护者同步标准目录
107
135
 
108
136
  ```bash
109
137
  ./scripts/sync-skills.sh
package/bin/cli.js CHANGED
@@ -23,6 +23,8 @@ const REPO = 'yibaiba/harmonyos-skills-pack';
23
23
  const BRANCH = 'main';
24
24
  const SKILLS = ['harmonyos-ark', 'universal-product-quality'];
25
25
  const ARCHIVE_URL = `https://github.com/${REPO}/archive/refs/heads/${BRANCH}.tar.gz`;
26
+ // 国内镜像(ghproxy.net 加速 GitHub 下载)
27
+ const MIRROR_URL = `https://ghproxy.net/https://github.com/${REPO}/archive/refs/heads/${BRANCH}.tar.gz`;
26
28
 
27
29
  // ── 颜色输出 ──────────────────────────────────────────
28
30
  const color = {
@@ -44,6 +46,7 @@ ${color.cyan('用法:')}
44
46
  npx harmonyos-skills-pack 安装到当前目录
45
47
  npx harmonyos-skills-pack --target . 指定目标目录
46
48
  npx harmonyos-skills-pack --force 强制覆盖已有文件
49
+ npx harmonyos-skills-pack --mirror 使用国内镜像加速下载
47
50
  npx harmonyos-skills-pack --claude-only 仅 .claude/skills
48
51
  npx harmonyos-skills-pack --copilot-only 仅 .github/skills
49
52
  npx harmonyos-skills-pack --codex-only 仅 .codex/skills
@@ -70,6 +73,7 @@ const force = args.includes('--force');
70
73
  const claudeOnly = args.includes('--claude-only');
71
74
  const copilotOnly = args.includes('--copilot-only');
72
75
  const codexOnly = args.includes('--codex-only');
76
+ const useMirror = args.includes('--mirror') || args.includes('--cn');
73
77
  const isUninstall = args.includes('uninstall');
74
78
 
75
79
  // 默认全部安装
@@ -107,22 +111,36 @@ if (isUninstall) {
107
111
  // ── 安装 ─────────────────────────────────────────────
108
112
  console.log(`
109
113
  ${color.bold('🚀 harmonyos-skills-pack')}
110
- ${color.cyan('从 GitHub 下载最新 skills...')}
114
+ ${color.cyan(useMirror ? '从国内镜像下载最新 skills...' : '从 GitHub 下载最新 skills...')}
111
115
  `);
112
116
 
113
117
  // 创建临时目录
114
118
  const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'hm-skills-'));
115
119
 
116
120
  try {
117
- // 下载并解压
118
- console.log(` 📥 下载 ${ARCHIVE_URL}`);
119
-
120
- try {
121
- execSync(`curl -sL "${ARCHIVE_URL}" | tar -xz -C "${tmpDir}"`, {
122
- stdio: ['pipe', 'pipe', 'pipe'],
123
- timeout: 60000,
124
- });
125
- } catch (e) {
121
+ // 下载并解压(镜像优先,失败自动回退 GitHub)
122
+ const urls = useMirror ? [MIRROR_URL, ARCHIVE_URL] : [ARCHIVE_URL, MIRROR_URL];
123
+
124
+ let downloaded = false;
125
+ for (let i = 0; i < urls.length; i++) {
126
+ const url = urls[i];
127
+ const label = url.includes('ghproxy') ? '国内镜像' : 'GitHub';
128
+ console.log(` 📥 ${i > 0 ? '回退到 ' : ''}下载 (${label})`);
129
+ try {
130
+ execSync(`curl -sL --connect-timeout 10 "${url}" | tar -xz -C "${tmpDir}"`, {
131
+ stdio: ['pipe', 'pipe', 'pipe'],
132
+ timeout: 60000,
133
+ });
134
+ downloaded = true;
135
+ break;
136
+ } catch (e) {
137
+ if (i < urls.length - 1) {
138
+ console.log(` ${color.yellow('⚠')} ${label} 下载失败,尝试备用源...`);
139
+ }
140
+ }
141
+ }
142
+
143
+ if (!downloaded) {
126
144
  console.error(color.red('\n❌ 下载失败。请检查网络连接。'));
127
145
  console.error(color.yellow(' 可尝试: git clone https://github.com/' + REPO + '.git'));
128
146
  process.exit(1);
@@ -167,16 +185,6 @@ try {
167
185
  }
168
186
  }
169
187
 
170
- // 复制 AGENTS.md 和 CLAUDE.md 到项目根目录(如果不存在)
171
- for (const f of ['AGENTS.md', 'CLAUDE.md']) {
172
- const src = path.join(sourceRoot, f);
173
- const dst = path.join(targetDir, f);
174
- if (fs.existsSync(src) && (!fs.existsSync(dst) || force)) {
175
- fs.copyFileSync(src, dst);
176
- console.log(` ${color.green('✓')} ${f}`);
177
- }
178
- }
179
-
180
188
  // 完成
181
189
  console.log(`
182
190
  ${color.green(color.bold(`✅ 安装完成!${installed} 个 skill 目录已就位。`))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harmonyos-skills-pack",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "一键安装鸿蒙 Ark 开发文档 + 通用产品质量 skills pack,适配 Claude/Copilot/Codex Agent",
5
5
  "keywords": [
6
6
  "harmonyos",