@bangdao-ai/acw-tools 1.1.20 → 1.1.22

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.
@@ -236,8 +236,73 @@ if (!fs.existsSync(CHAT_GRAB_MARKDOWN_DIR)) {
236
236
 
237
237
  const __filename = fileURLToPath(import.meta.url);
238
238
  const __dirname = dirname(__filename);
239
- const packageJson = JSON.parse(readPackageJson(path.join(__dirname, 'package.json'), 'utf8'));
240
- const CURRENT_MCP_VERSION = packageJson.version;
239
+
240
+ // 读取 package.json(现在 package.json 和 index.js 在同一目录)
241
+ function findPackageJson() {
242
+ // package.json 现在和 index.js 在同一目录
243
+ const packagePath = path.join(__dirname, 'package.json');
244
+
245
+ logger.debug('开始查找 package.json', {
246
+ __dirname,
247
+ __filename,
248
+ packagePath
249
+ });
250
+
251
+ try {
252
+ if (fs.existsSync(packagePath)) {
253
+ logger.info('找到 package.json', { path: packagePath });
254
+ const content = readPackageJson(packagePath, 'utf8');
255
+ const parsed = JSON.parse(content);
256
+
257
+ // 验证是否是我们要找的包
258
+ if (parsed.name === '@bangdao-ai/acw-tools' || parsed.name === 'acw-tools') {
259
+ logger.debug('成功解析 package.json', {
260
+ path: packagePath,
261
+ version: parsed.version,
262
+ name: parsed.name
263
+ });
264
+ return parsed;
265
+ } else {
266
+ logger.warn('找到 package.json 但不是目标包', {
267
+ path: packagePath,
268
+ name: parsed.name
269
+ });
270
+ }
271
+ } else {
272
+ logger.error('package.json 不存在', { path: packagePath });
273
+ }
274
+ } catch (error) {
275
+ logger.error('读取 package.json 失败', {
276
+ path: packagePath,
277
+ error: error.message
278
+ });
279
+ }
280
+
281
+ return null;
282
+ }
283
+
284
+ // 尝试获取 package.json,如果失败则使用默认版本
285
+ let packageJson = null;
286
+ let CURRENT_MCP_VERSION = '1.0.0'; // 默认版本
287
+
288
+ try {
289
+ packageJson = findPackageJson();
290
+ if (packageJson && packageJson.version) {
291
+ CURRENT_MCP_VERSION = packageJson.version;
292
+ logger.info('MCP 版本已设置', { version: CURRENT_MCP_VERSION });
293
+ } else {
294
+ logger.warn('无法获取 package.json 版本,使用默认版本', {
295
+ defaultVersion: CURRENT_MCP_VERSION
296
+ });
297
+ }
298
+ } catch (error) {
299
+ logger.error('读取 package.json 时发生异常', {
300
+ error: error.message,
301
+ stack: error.stack,
302
+ defaultVersion: CURRENT_MCP_VERSION
303
+ });
304
+ // 使用默认版本继续运行
305
+ }
241
306
 
242
307
  /**
243
308
  * 检查MCP版本并在版本升级时重置state.json
package/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ACW工具集",
3
3
  "description": "ACW平台工具集:智能下载规则到项目、初始化Common Admin模板项目",
4
- "version": "1.1.20",
4
+ "version": "1.1.22",
5
5
  "author": "邦道科技 - 产品技术中心",
6
6
  "homepage": "https://www.npmjs.com/package/@bangdao-ai/acw-tools",
7
7
  "repository": "https://www.npmjs.com/package/@bangdao-ai/acw-tools?activeTab=readme",
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@bangdao-ai/acw-tools",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "type": "module",
5
5
  "description": "MCP (Model Context Protocol) tools for ACW - download rules and initialize Common Admin projects",
6
- "main": "src/index.js",
6
+ "main": "index.js",
7
7
  "bin": {
8
- "acw-tools": "src/index.js"
8
+ "acw-tools": "index.js"
9
9
  },
10
10
  "scripts": {
11
- "start:stdio": "node src/index.js"
11
+ "start:stdio": "node index.js"
12
12
  },
13
13
  "keywords": [
14
14
  "mcp",
@@ -46,7 +46,8 @@
46
46
  "zod": "^3.25.76"
47
47
  },
48
48
  "files": [
49
- "src/",
49
+ "index.js",
50
+ "cursorConversationParser.js",
50
51
  "manifest.json",
51
52
  "README.md",
52
53
  "LICENSE"