@ppdocs/mcp 3.2.18 → 3.2.20
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 +52 -39
- package/dist/storage/httpClient.d.ts +27 -0
- package/dist/storage/httpClient.js +102 -0
- package/dist/tools/analyzer.d.ts +2 -1
- package/dist/tools/analyzer.js +127 -14
- package/dist/tools/discussion.d.ts +3 -2
- package/dist/tools/discussion.js +67 -45
- package/dist/tools/docs.d.ts +2 -1
- package/dist/tools/docs.js +1 -1
- package/dist/tools/index.d.ts +3 -2
- package/dist/tools/index.js +10 -6
- package/dist/tools/meeting.d.ts +7 -0
- package/dist/tools/meeting.js +97 -0
- package/dist/tools/tasks.d.ts +2 -1
- package/dist/tools/tasks.js +2 -2
- package/package.json +1 -1
- package/templates/commands/pp/audit.md +87 -0
- package/templates/commands/pp/diagnose.md +82 -0
- package/templates/commands/pp/discuss.md +90 -0
- package/templates/commands/pp/execute.md +84 -0
- package/templates/hooks/SystemPrompt.md +16 -0
- package/dist/storage/discussion.d.ts +0 -33
- package/dist/storage/discussion.js +0 -116
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# ⚡️ "Ockham's Blade" Execution Protocol (奥卡姆之刃执行协议)
|
|
2
|
+
|
|
3
|
+
该工作流旨在执行已确认的方案。核心原则:**拒绝冗余,一行搞定,模块解耦,逻辑确权。**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
### 1.第一阶段:逻辑确权 (Knowledge Anchor) 🧠
|
|
8
|
+
🔹 **核心目标**:消除所有不确定性,确保逻辑绝对正确。
|
|
9
|
+
✏️ **动作**:
|
|
10
|
+
* 解析任务需求。
|
|
11
|
+
* 遇到模糊逻辑,立即查询**知识图谱 (Knowledge Graph)** 确认标准流程。
|
|
12
|
+
× **禁区**:
|
|
13
|
+
* 禁止基于猜测编写代码。
|
|
14
|
+
* 禁止模糊定义的变量。
|
|
15
|
+
|
|
16
|
+
### 2.第二阶段:架构定义 (Structure & Taxonomy) 🏗️
|
|
17
|
+
🔹 **核心目标**:目录清晰,分类准确,模块独立。
|
|
18
|
+
✏️ **动作**:
|
|
19
|
+
* 构建标准目录树 (Directory Tree)。
|
|
20
|
+
* 定义原子化模块 (Atomic Modules)。
|
|
21
|
+
* 确保接口通用,支持复用调用。
|
|
22
|
+
× **禁区**:
|
|
23
|
+
* 禁止模块间产生强耦合 (Zero Coupling)。
|
|
24
|
+
* 禁止混乱的文件层级。
|
|
25
|
+
|
|
26
|
+
### 3.第三阶段:极简实现 (Minimalist Coding) 🚀
|
|
27
|
+
🔹 **核心目标**:不造轮子,极致压缩代码行数。
|
|
28
|
+
✏️ **动作**:
|
|
29
|
+
* 最大化调用现有库与复用功能。
|
|
30
|
+
* 利用链式调用、推导式等语法特性。
|
|
31
|
+
× **禁区**:
|
|
32
|
+
* **能一行代码解决的问题,严格禁止使用第二行。**
|
|
33
|
+
* 禁止重复造轮子 (DRY Principle)。
|
|
34
|
+
|
|
35
|
+
### 4.第四阶段:最终交付 (Delivery) 📦
|
|
36
|
+
🔹 **核心目标**:输出可直接运行、可维护的成果。
|
|
37
|
+
✏️ **动作**:
|
|
38
|
+
* 输出标准化的文件结构。
|
|
39
|
+
* 交付模块化源码。
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### 📊 执行逻辑可视化图解 (ASCII)
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
+-----------------------+
|
|
47
|
+
| 🚀 任务启动 (Start) |
|
|
48
|
+
+-----------+-----------+
|
|
49
|
+
|
|
|
50
|
+
v
|
|
51
|
+
+-----------+-----------+
|
|
52
|
+
| 🧠 逻辑是否清晰? | <-----+
|
|
53
|
+
+-----------+-----------+ |
|
|
54
|
+
(❌ NO) | (✅ YES) |
|
|
55
|
+
| v |
|
|
56
|
+
+------+-----+ +----------------+ |
|
|
57
|
+
| 🔍 查图谱 | | 🏗️ 架构设计 | |
|
|
58
|
+
+------------+ +-------+--------+ |
|
|
59
|
+
| |
|
|
60
|
+
v |
|
|
61
|
+
+-------+--------+ |
|
|
62
|
+
| ♻️ 存在轮子? | |
|
|
63
|
+
+-------+--------+ |
|
|
64
|
+
/ \ |
|
|
65
|
+
(YES)/ \(NO)
|
|
66
|
+
v v
|
|
67
|
+
+-------+-------+ +-------+-------+
|
|
68
|
+
| ✏️ 直接调用 | | ✏️ 原子编写 |
|
|
69
|
+
+-------+-------+ +-------+-------+
|
|
70
|
+
| |
|
|
71
|
+
+----------+-----------+
|
|
72
|
+
|
|
|
73
|
+
v
|
|
74
|
+
+-------+-------+
|
|
75
|
+
| 📏 极简审查 | <-----+
|
|
76
|
+
+-------+-------+ |
|
|
77
|
+
| |
|
|
78
|
+
/-----------+----------\ |
|
|
79
|
+
/ 是否多于一行? \ |
|
|
80
|
+
v v |
|
|
81
|
+
+-------+-------+ +-------+--+----+
|
|
82
|
+
| ✅ 达标 | | × 删减 (Trim) |
|
|
83
|
+
| (Delivery) | | 压缩代码 |
|
|
84
|
+
+---------------+ +---------------+
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
你是严谨的软件架构师,围绕**用户知识图谱软件**工作,确保每个变动有据可查,每次成功沉淀为知识节点。
|
|
2
2
|
|
|
3
|
+
## 会话启动检查
|
|
4
|
+
每次会话开始时, 执行 `kg_discuss({ action: "list" })` 检查是否有涉及本项目的待回复讨论。如有, 主动提醒用户: "发现 N 条待处理讨论, 是否需要查看?"
|
|
5
|
+
|
|
3
6
|
## 核心宪法
|
|
4
7
|
| 原则 | 要求 |
|
|
5
8
|
|:---|:---|
|
|
@@ -100,3 +103,16 @@ task_create → task_add_log(progress/issue/solution/reference) → task_complet
|
|
|
100
103
|
|:---|:---|:---|:---|
|
|
101
104
|
| 复用 | 重复造轮子 | 调用utils | 无 |
|
|
102
105
|
| 结构 | 混杂views | 迁移services | 需改引用 |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 工作流速查
|
|
110
|
+
| 命令 | 用途 | 场景 |
|
|
111
|
+
|:---|:---|:---|
|
|
112
|
+
| `/pp:init` | 项目知识图谱初始化 | 新项目接入 |
|
|
113
|
+
| `/pp:sync` | 代码↔知识图谱同步 | 代码变更后 |
|
|
114
|
+
| `/pp:diagnose` | 深度问题诊断 | 排查 Bug |
|
|
115
|
+
| `/pp:execute` | 任务极简执行 | 已确认方案的编码 |
|
|
116
|
+
| `/pp:review` | 代码质量审查 | 轻量级审查 |
|
|
117
|
+
| `/pp:audit` | 多Agent严格审计 | 重要交付前 |
|
|
118
|
+
| `/pp:discuss` | 讨论响应与协作 | 跨项目协商 |
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export interface DiscussionMessage {
|
|
2
|
-
id: string;
|
|
3
|
-
sender: string;
|
|
4
|
-
content: string;
|
|
5
|
-
timestamp: string;
|
|
6
|
-
}
|
|
7
|
-
export interface DiscussionTopic {
|
|
8
|
-
id: string;
|
|
9
|
-
title: string;
|
|
10
|
-
initiator: string;
|
|
11
|
-
participants: string[];
|
|
12
|
-
summary: string;
|
|
13
|
-
status: 'active' | 'completed';
|
|
14
|
-
created_at: string;
|
|
15
|
-
updated_at: string;
|
|
16
|
-
messages: DiscussionMessage[];
|
|
17
|
-
}
|
|
18
|
-
export declare class DiscussionManager {
|
|
19
|
-
private static getFilePath;
|
|
20
|
-
private static readAll;
|
|
21
|
-
private static writeAll;
|
|
22
|
-
static listActive(): Omit<DiscussionTopic, 'messages'>[];
|
|
23
|
-
static readByIds(ids: string[]): DiscussionTopic[];
|
|
24
|
-
static create(title: string, initiator: string, participants: string[], content: string): string;
|
|
25
|
-
static reply(id: string, sender: string, content: string, newSummary?: string): boolean;
|
|
26
|
-
static getAndRemove(id: string): DiscussionTopic | null;
|
|
27
|
-
/** 按ID删除讨论(不归档,直接删除) */
|
|
28
|
-
static delete(id: string): boolean;
|
|
29
|
-
/** 清理过期讨论(默认7天不活跃) */
|
|
30
|
-
static cleanExpired(days?: number): number;
|
|
31
|
-
/** 获取活跃讨论数量 */
|
|
32
|
-
static activeCount(): number;
|
|
33
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import * as os from 'os';
|
|
4
|
-
export class DiscussionManager {
|
|
5
|
-
static getFilePath() {
|
|
6
|
-
const dir = path.join(os.homedir(), '.ppdocs');
|
|
7
|
-
if (!fs.existsSync(dir))
|
|
8
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
9
|
-
return path.join(dir, 'discussions.json');
|
|
10
|
-
}
|
|
11
|
-
static readAll() {
|
|
12
|
-
try {
|
|
13
|
-
const file = this.getFilePath();
|
|
14
|
-
if (!fs.existsSync(file))
|
|
15
|
-
return [];
|
|
16
|
-
return JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
static writeAll(data) {
|
|
23
|
-
fs.writeFileSync(this.getFilePath(), JSON.stringify(data, null, 2), 'utf-8');
|
|
24
|
-
}
|
|
25
|
-
static listActive() {
|
|
26
|
-
return this.readAll()
|
|
27
|
-
.filter(t => t.status === 'active')
|
|
28
|
-
.map(({ messages, ...rest }) => rest);
|
|
29
|
-
}
|
|
30
|
-
static readByIds(ids) {
|
|
31
|
-
return this.readAll().filter(t => ids.includes(t.id));
|
|
32
|
-
}
|
|
33
|
-
static create(title, initiator, participants, content) {
|
|
34
|
-
const id = `req_${Math.random().toString(36).substring(2, 9)}`;
|
|
35
|
-
const now = new Date().toISOString();
|
|
36
|
-
// 确保发起方始终在参与列表中
|
|
37
|
-
const allParticipants = participants.includes(initiator) ? [...participants] : [initiator, ...participants];
|
|
38
|
-
const topic = {
|
|
39
|
-
id,
|
|
40
|
-
title,
|
|
41
|
-
initiator,
|
|
42
|
-
participants: allParticipants,
|
|
43
|
-
summary: "等待各方回复中...",
|
|
44
|
-
status: 'active',
|
|
45
|
-
created_at: now,
|
|
46
|
-
updated_at: now,
|
|
47
|
-
messages: [{
|
|
48
|
-
id: `msg_${Math.random().toString(36).substring(2, 9)}`,
|
|
49
|
-
sender: initiator,
|
|
50
|
-
content,
|
|
51
|
-
timestamp: now
|
|
52
|
-
}]
|
|
53
|
-
};
|
|
54
|
-
const all = this.readAll();
|
|
55
|
-
all.push(topic);
|
|
56
|
-
this.writeAll(all);
|
|
57
|
-
return id;
|
|
58
|
-
}
|
|
59
|
-
static reply(id, sender, content, newSummary) {
|
|
60
|
-
const all = this.readAll();
|
|
61
|
-
const topic = all.find(t => t.id === id);
|
|
62
|
-
if (!topic || topic.status !== 'active')
|
|
63
|
-
return false;
|
|
64
|
-
const now = new Date().toISOString();
|
|
65
|
-
topic.messages.push({
|
|
66
|
-
id: `msg_${Math.random().toString(36).substring(2, 9)}`,
|
|
67
|
-
sender,
|
|
68
|
-
content,
|
|
69
|
-
timestamp: now
|
|
70
|
-
});
|
|
71
|
-
topic.updated_at = now;
|
|
72
|
-
if (newSummary) {
|
|
73
|
-
topic.summary = newSummary;
|
|
74
|
-
}
|
|
75
|
-
// Auto add to participants if not exists
|
|
76
|
-
if (!topic.participants.includes(sender)) {
|
|
77
|
-
topic.participants.push(sender);
|
|
78
|
-
}
|
|
79
|
-
this.writeAll(all);
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
static getAndRemove(id) {
|
|
83
|
-
const all = this.readAll();
|
|
84
|
-
const index = all.findIndex(t => t.id === id);
|
|
85
|
-
if (index === -1)
|
|
86
|
-
return null;
|
|
87
|
-
const topic = all.splice(index, 1)[0];
|
|
88
|
-
this.writeAll(all);
|
|
89
|
-
return topic;
|
|
90
|
-
}
|
|
91
|
-
/** 按ID删除讨论(不归档,直接删除) */
|
|
92
|
-
static delete(id) {
|
|
93
|
-
const all = this.readAll();
|
|
94
|
-
const index = all.findIndex(t => t.id === id);
|
|
95
|
-
if (index === -1)
|
|
96
|
-
return false;
|
|
97
|
-
all.splice(index, 1);
|
|
98
|
-
this.writeAll(all);
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
/** 清理过期讨论(默认7天不活跃) */
|
|
102
|
-
static cleanExpired(days = 7) {
|
|
103
|
-
const all = this.readAll();
|
|
104
|
-
const cutoff = Date.now() - days * 86400000;
|
|
105
|
-
const before = all.length;
|
|
106
|
-
const filtered = all.filter(t => new Date(t.updated_at).getTime() > cutoff);
|
|
107
|
-
if (filtered.length < before) {
|
|
108
|
-
this.writeAll(filtered);
|
|
109
|
-
}
|
|
110
|
-
return before - filtered.length;
|
|
111
|
-
}
|
|
112
|
-
/** 获取活跃讨论数量 */
|
|
113
|
-
static activeCount() {
|
|
114
|
-
return this.readAll().filter(t => t.status === 'active').length;
|
|
115
|
-
}
|
|
116
|
-
}
|