@ppdocs/mcp 2.6.0 → 2.6.2
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 +13 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -94,6 +94,14 @@ function initProject(opts) {
|
|
|
94
94
|
user: opts.user,
|
|
95
95
|
};
|
|
96
96
|
const ppdocsPath = path.join(cwd, '.ppdocs');
|
|
97
|
+
// 检查是否存在同名目录,如果是则删除
|
|
98
|
+
if (fs.existsSync(ppdocsPath)) {
|
|
99
|
+
const stat = fs.statSync(ppdocsPath);
|
|
100
|
+
if (stat.isDirectory()) {
|
|
101
|
+
fs.rmSync(ppdocsPath, { recursive: true });
|
|
102
|
+
console.log(`⚠️ Removed existing .ppdocs directory`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
97
105
|
fs.writeFileSync(ppdocsPath, JSON.stringify(ppdocsConfig, null, 2));
|
|
98
106
|
console.log(`✅ Created ${ppdocsPath}`);
|
|
99
107
|
// Install workflow templates
|
|
@@ -134,7 +142,7 @@ function autoRegisterMcp(apiUrl, user) {
|
|
|
134
142
|
if (commandExists('claude')) {
|
|
135
143
|
detected.push('Claude');
|
|
136
144
|
try {
|
|
137
|
-
const cmd = `claude mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp`;
|
|
145
|
+
const cmd = `claude mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp@latest`;
|
|
138
146
|
console.log(`✅ Detected Claude CLI, registering MCP...`);
|
|
139
147
|
execSync(cmd, { stdio: 'inherit' });
|
|
140
148
|
}
|
|
@@ -146,7 +154,7 @@ function autoRegisterMcp(apiUrl, user) {
|
|
|
146
154
|
if (commandExists('codex')) {
|
|
147
155
|
detected.push('Codex');
|
|
148
156
|
try {
|
|
149
|
-
const cmd = `codex mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp`;
|
|
157
|
+
const cmd = `codex mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp@latest`;
|
|
150
158
|
console.log(`✅ Detected Codex CLI, registering MCP...`);
|
|
151
159
|
execSync(cmd, { stdio: 'inherit' });
|
|
152
160
|
}
|
|
@@ -158,7 +166,7 @@ function autoRegisterMcp(apiUrl, user) {
|
|
|
158
166
|
if (commandExists('gemini')) {
|
|
159
167
|
detected.push('Gemini');
|
|
160
168
|
try {
|
|
161
|
-
const cmd = `gemini mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp`;
|
|
169
|
+
const cmd = `gemini mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp@latest`;
|
|
162
170
|
console.log(`✅ Detected Gemini CLI, registering MCP...`);
|
|
163
171
|
execSync(cmd, { stdio: 'inherit' });
|
|
164
172
|
}
|
|
@@ -188,8 +196,8 @@ function createMcpJson(cwd) {
|
|
|
188
196
|
// Windows 需要 cmd /c 包装才能执行 npx
|
|
189
197
|
const isWindows = process.platform === 'win32';
|
|
190
198
|
const ppdocsServer = isWindows
|
|
191
|
-
? { command: 'cmd', args: ['/c', 'npx', '@ppdocs/mcp'] }
|
|
192
|
-
: { command: 'npx', args: ['@ppdocs/mcp'] };
|
|
199
|
+
? { command: 'cmd', args: ['/c', 'npx', '@ppdocs/mcp@latest'] }
|
|
200
|
+
: { command: 'npx', args: ['@ppdocs/mcp@latest'] };
|
|
193
201
|
mcpConfig.mcpServers = {
|
|
194
202
|
...(mcpConfig.mcpServers || {}),
|
|
195
203
|
ppdocs: ppdocsServer,
|