@ppdocs/mcp 3.1.0 → 3.1.1
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/dist/cli.js +5 -4
- package/package.json +1 -1
- package/templates/hooks/hook.py +6 -1
package/dist/cli.js
CHANGED
|
@@ -274,9 +274,10 @@ function copyDirRecursive(src, dest) {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
/** 生成跨平台的 hooks 配置 (调用 python hook.py) */
|
|
277
|
-
function generateHooksConfig() {
|
|
278
|
-
//
|
|
279
|
-
const
|
|
277
|
+
function generateHooksConfig(cwd) {
|
|
278
|
+
// 使用绝对路径,避免 CWD 不一致导致找不到脚本
|
|
279
|
+
const hookPath = path.join(cwd, '.claude', 'hooks', 'hook.py').replace(/\\/g, '/');
|
|
280
|
+
const command = `python ${hookPath}`;
|
|
280
281
|
return {
|
|
281
282
|
hooks: {
|
|
282
283
|
UserPromptSubmit: [
|
|
@@ -340,7 +341,7 @@ function installClaudeTemplates(cwd) {
|
|
|
340
341
|
}
|
|
341
342
|
catch { /* ignore */ }
|
|
342
343
|
}
|
|
343
|
-
const hooksConfig = generateHooksConfig();
|
|
344
|
+
const hooksConfig = generateHooksConfig(cwd);
|
|
344
345
|
// 合并 MCP 权限到 permissions.allow
|
|
345
346
|
const existingPermissions = existingSettings.permissions || {};
|
|
346
347
|
const existingAllow = existingPermissions.allow || [];
|
package/package.json
CHANGED
package/templates/hooks/hook.py
CHANGED
|
@@ -60,9 +60,14 @@ def is_bypass(text):
|
|
|
60
60
|
# ╚══════════════════════════════════════════════════════════════╝
|
|
61
61
|
|
|
62
62
|
|
|
63
|
+
def get_project_root():
|
|
64
|
+
"""从 __file__ 反推项目根目录 (.claude/hooks/hook.py → 上两级)"""
|
|
65
|
+
return os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
66
|
+
|
|
67
|
+
|
|
63
68
|
def load_ppdocs_config():
|
|
64
69
|
"""读取 .ppdocs 配置"""
|
|
65
|
-
config_path = os.path.join(
|
|
70
|
+
config_path = os.path.join(get_project_root(), ".ppdocs")
|
|
66
71
|
if not os.path.exists(config_path):
|
|
67
72
|
return None
|
|
68
73
|
try:
|