rovis-learn-ai-flow-cli 1.0.0

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 (2) hide show
  1. package/index.js +46 -0
  2. package/package.json +16 -0
package/index.js ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+
3
+ // 引入 Node 原生文件模块(无需安装)
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ // ======================================
8
+ // 🔥 配置:你要安装到的目标目录(可自定义)
9
+ // 最终路径:用户项目/.claude/my-ai-flow/
10
+ // ======================================
11
+ const TARGET_FOLDER = '.claude/my-ai-flow';
12
+ // 你的工具源文件目录
13
+ const SOURCE_TEMPLATE = path.join(__dirname, 'template');
14
+
15
+ // 获取用户当前运行命令的项目根目录
16
+ const userProjectRoot = process.cwd();
17
+ const targetPath = path.join(userProjectRoot, TARGET_FOLDER);
18
+
19
+ // 复制文件夹函数
20
+ function copySync(source, target) {
21
+ if (!fs.existsSync(target)) {
22
+ fs.mkdirSync(target, { recursive: true });
23
+ }
24
+
25
+ const files = fs.readdirSync(source);
26
+ files.forEach(file => {
27
+ const sourcePath = path.join(source, file);
28
+ const targetPath = path.join(target, file);
29
+ if (fs.statSync(sourcePath).isDirectory()) {
30
+ copySync(sourcePath, targetPath);
31
+ } else {
32
+ fs.copyFileSync(sourcePath, targetPath);
33
+ }
34
+ });
35
+ }
36
+
37
+ // 执行复制
38
+ try {
39
+ console.log('🔧 正在安装 AI 工作流...');
40
+ copySync(SOURCE_TEMPLATE, targetPath);
41
+ console.log('✅ 安装成功!');
42
+ console.log(`📂 文件已安装到:${TARGET_FOLDER}`);
43
+ console.log('🚀 现在 Claude Code 会自动识别你的工作流!');
44
+ } catch (err) {
45
+ console.error('❌ 安装失败:', err);
46
+ }
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "rovis-learn-ai-flow-cli",
3
+ "version": "1.0.0",
4
+ "description": "如何构建自己的仓库工作流",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "learn-ai-flow-cli": "index.js"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "keywords": [],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "type": "commonjs"
16
+ }