prd-workflow-cli 1.1.30 → 1.1.31
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.
- package/README.md +35 -18
- package/bin/prd-cli.js +24 -5
- package/commands/init.js +11 -0
- package/package.json +2 -2
- package/scripts/postinstall.js +29 -1
package/README.md
CHANGED
|
@@ -55,45 +55,62 @@ C3(版本冻结)
|
|
|
55
55
|
|
|
56
56
|
## 🚀 安装
|
|
57
57
|
|
|
58
|
-
### 方式1
|
|
58
|
+
### 方式1:一键初始化(推荐)✨
|
|
59
|
+
|
|
60
|
+
只需一个命令,**自动完成初始化并配置 AI 规则文件**:
|
|
59
61
|
|
|
60
62
|
```bash
|
|
61
|
-
#
|
|
62
|
-
|
|
63
|
+
# 1. 创建并进入项目目录
|
|
64
|
+
mkdir 我的项目 && cd 我的项目
|
|
63
65
|
|
|
64
|
-
#
|
|
65
|
-
|
|
66
|
+
# 2. 一键初始化(自动配置一切!)
|
|
67
|
+
npx prd-workflow-cli
|
|
66
68
|
```
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
git clone https://github.com/houtonghoutong/PRD-CLI.git
|
|
73
|
-
cd PRD-CLI/prd-cli
|
|
70
|
+
就这样!运行后你会看到:
|
|
71
|
+
- ✅ `.agent/workflows/` - PRD 工作流指引
|
|
72
|
+
- ✅ `.cursorrules` - Cursor AI 规则
|
|
73
|
+
- ✅ `.antigravity/` - Antigravity AI 规则
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
> 💡 **现在你的 AI 助手已经知道如何协助你完成 PRD 流程了!**
|
|
76
|
+
> 例如:直接告诉 AI "我要创建一个新项目的需求文档"
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
npm link
|
|
80
|
-
```
|
|
78
|
+
### 方式2:全局安装
|
|
81
79
|
|
|
82
|
-
|
|
80
|
+
如果你经常使用,可以全局安装:
|
|
83
81
|
|
|
84
82
|
```bash
|
|
85
|
-
# 稍后可用
|
|
86
83
|
npm install -g prd-workflow-cli
|
|
84
|
+
|
|
85
|
+
# 然后使用
|
|
86
|
+
prd init 我的项目
|
|
87
|
+
cd 我的项目
|
|
88
|
+
npm install # 重要!这一步会安装 AI 规则文件
|
|
87
89
|
```
|
|
88
90
|
|
|
91
|
+
### 方式3:从源码安装
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git clone https://github.com/houtonghoutong/PRD-CLI.git
|
|
95
|
+
cd PRD-CLI/prd-cli
|
|
96
|
+
npm install
|
|
97
|
+
npm link
|
|
98
|
+
```
|
|
89
99
|
|
|
90
100
|
## 📝 快速开始
|
|
91
101
|
|
|
92
102
|
### 1. 初始化项目
|
|
93
103
|
|
|
94
104
|
```bash
|
|
105
|
+
# 使用 npx(推荐)
|
|
106
|
+
npx prd-workflow-cli init my-product
|
|
107
|
+
cd my-product
|
|
108
|
+
npm install
|
|
109
|
+
|
|
110
|
+
# 或者全局安装后使用
|
|
95
111
|
prd init my-product
|
|
96
112
|
cd my-product
|
|
113
|
+
npm install
|
|
97
114
|
```
|
|
98
115
|
|
|
99
116
|
这将创建标准的目录结构:
|
package/bin/prd-cli.js
CHANGED
|
@@ -126,9 +126,28 @@ program.on('--help', () => {
|
|
|
126
126
|
console.log('');
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
// 智能处理:无参数时自动初始化
|
|
130
|
+
if (process.argv.length === 2) {
|
|
131
|
+
const fs = require('fs');
|
|
132
|
+
const path = require('path');
|
|
133
|
+
const configPath = path.join(process.cwd(), '.prd-config.json');
|
|
134
|
+
|
|
135
|
+
if (!fs.existsSync(configPath)) {
|
|
136
|
+
// 不是 PRD 项目,自动初始化
|
|
137
|
+
console.log(chalk.blue('📦 检测到当前目录尚未初始化 PRD 项目'));
|
|
138
|
+
console.log(chalk.blue('🚀 正在自动初始化...'));
|
|
139
|
+
console.log('');
|
|
140
|
+
require('../commands/init')('.').then(() => {
|
|
141
|
+
process.exit(0);
|
|
142
|
+
}).catch((err) => {
|
|
143
|
+
console.error(chalk.red('初始化失败:'), err.message);
|
|
144
|
+
process.exit(1);
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
// 已经是 PRD 项目,显示帮助
|
|
148
|
+
program.parse(process.argv);
|
|
149
|
+
program.outputHelp();
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
program.parse(process.argv);
|
|
134
153
|
}
|
package/commands/init.js
CHANGED
|
@@ -346,6 +346,17 @@ prd plan freeze
|
|
|
346
346
|
|
|
347
347
|
console.log(chalk.green('✓ 项目创建成功!'));
|
|
348
348
|
console.log('');
|
|
349
|
+
|
|
350
|
+
// 显示 AI 集成信息
|
|
351
|
+
console.log(chalk.bold('🤖 AI 集成已配置:'));
|
|
352
|
+
console.log(chalk.gray(' ✓ .agent/workflows/ - PRD 工作流指引(包含所有阶段的详细步骤)'));
|
|
353
|
+
console.log(chalk.gray(' ✓ .cursorrules - Cursor AI 规则'));
|
|
354
|
+
console.log(chalk.gray(' ✓ .antigravity/ - Antigravity AI 规则'));
|
|
355
|
+
console.log('');
|
|
356
|
+
console.log(chalk.yellow(' 💡 现在你可以直接与 AI 助手对话,AI 已经知道如何协助你完成 PRD 流程!'));
|
|
357
|
+
console.log(chalk.gray(' 例如:告诉 AI "我要创建一个新项目的需求文档"'));
|
|
358
|
+
console.log('');
|
|
359
|
+
|
|
349
360
|
console.log(chalk.bold('📋 下一步操作(请按顺序执行):'));
|
|
350
361
|
console.log('');
|
|
351
362
|
if (!isCurrentDir) {
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -117,7 +117,35 @@ function main() {
|
|
|
117
117
|
|
|
118
118
|
// 检查是否是全局安装
|
|
119
119
|
if (isGlobalInstall(packagePath)) {
|
|
120
|
-
debug('
|
|
120
|
+
debug('检测到全局安装,显示使用说明');
|
|
121
|
+
|
|
122
|
+
// 全局安装时输出使用说明
|
|
123
|
+
console.log('');
|
|
124
|
+
console.log('╔════════════════════════════════════════════════════════════════╗');
|
|
125
|
+
console.log('║ 🎉 prd-workflow-cli 安装成功! ║');
|
|
126
|
+
console.log('╠════════════════════════════════════════════════════════════════╣');
|
|
127
|
+
console.log('║ ║');
|
|
128
|
+
console.log('║ 📋 快速开始: ║');
|
|
129
|
+
console.log('║ ║');
|
|
130
|
+
console.log('║ 1. 创建新项目: ║');
|
|
131
|
+
console.log('║ prd init 我的项目 ║');
|
|
132
|
+
console.log('║ cd 我的项目 ║');
|
|
133
|
+
console.log('║ ║');
|
|
134
|
+
console.log('║ 2. 或在现有目录初始化: ║');
|
|
135
|
+
console.log('║ cd 现有目录 ║');
|
|
136
|
+
console.log('║ prd init . ║');
|
|
137
|
+
console.log('║ ║');
|
|
138
|
+
console.log('║ 📖 查看帮助: prd --help ║');
|
|
139
|
+
console.log('║ ║');
|
|
140
|
+
console.log('║ 🤖 AI 集成说明: ║');
|
|
141
|
+
console.log('║ 初始化后会自动创建 AI 规则文件: ║');
|
|
142
|
+
console.log('║ - .agent/workflows/ PRD 工作流指引 ║');
|
|
143
|
+
console.log('║ - .cursorrules Cursor AI 规则 ║');
|
|
144
|
+
console.log('║ - .antigravity/ Antigravity AI 规则 ║');
|
|
145
|
+
console.log('║ ║');
|
|
146
|
+
console.log('╚════════════════════════════════════════════════════════════════╝');
|
|
147
|
+
console.log('');
|
|
148
|
+
|
|
121
149
|
return;
|
|
122
150
|
}
|
|
123
151
|
|