prd-workflow-cli 1.1.25 → 1.1.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prd-workflow-cli",
3
- "version": "1.1.25",
3
+ "version": "1.1.26",
4
4
  "description": "产品需求管理规范 CLI 工具 - 基于 A→R→B→C 流程,集成 PM 确认机制和对话归档的需求管理命令行工具",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -113,13 +113,26 @@ function getAllFiles(dirPath, basePath = dirPath) {
113
113
  function main() {
114
114
  try {
115
115
  // 获取 npm 包的路径(当前脚本所在目录的上级)
116
+ // 脚本路径: node_modules/prd-workflow-cli/scripts/postinstall.js
117
+ // __dirname = node_modules/prd-workflow-cli/scripts
118
+ // packagePath = node_modules/prd-workflow-cli
116
119
  const packagePath = path.join(__dirname, '..');
117
120
 
118
- // 尝试找到项目根目录
119
- // 通常 node_modules 在项目根目录下,所以向上查找
120
- const nodeModulesPath = path.dirname(path.dirname(packagePath));
121
+ // 项目根目录的推断:
122
+ // packagePath = /project/node_modules/prd-workflow-cli
123
+ // node_modules = /project/node_modules
124
+ // projectRoot = /project
125
+ const nodeModulesPath = path.dirname(packagePath);
121
126
  const potentialProjectRoot = path.dirname(nodeModulesPath);
122
127
 
128
+ // 调试信息(仅在非静默模式下显示)
129
+ if (!SILENT && process.env.PRD_DEBUG === 'true') {
130
+ console.log('DEBUG: __dirname =', __dirname);
131
+ console.log('DEBUG: packagePath =', packagePath);
132
+ console.log('DEBUG: nodeModulesPath =', nodeModulesPath);
133
+ console.log('DEBUG: potentialProjectRoot =', potentialProjectRoot);
134
+ }
135
+
123
136
  // 检查是否是 PRD 项目
124
137
  const projectRoot = findProjectRoot(potentialProjectRoot);
125
138