stigmergy 1.0.65 → 1.0.66
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
|
@@ -198,14 +198,9 @@ class VerifiedCrossCLISystem:
|
|
|
198
198
|
)
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
#
|
|
202
|
-
self.
|
|
203
|
-
self.
|
|
204
|
-
self.context_dir = self.memory_dir / 'context_files'
|
|
205
|
-
self.context_dir.mkdir(exist_ok=True)
|
|
206
|
-
|
|
207
|
-
self.call_history_file = self.memory_dir / 'verified_call_history.json'
|
|
208
|
-
self.context_cache_file = self.memory_dir / 'context_cache.json'
|
|
201
|
+
# 初始化文件操作工具
|
|
202
|
+
self.file_writer = SafeFileWriter()
|
|
203
|
+
self.file_reader = SafeFileReader()
|
|
209
204
|
|
|
210
205
|
def check_cli_availability(self, cli_name: str) -> Dict[str, Any]:
|
|
211
206
|
"""检查CLI可用性 - 基于真实规范"""
|
package/src/postinstall.js
CHANGED
|
@@ -276,6 +276,39 @@ async function copyPluginExtensions(availableCLIs) {
|
|
|
276
276
|
console.log('✅ 插件扩展复制完成');
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
// 生成全局配置文件
|
|
280
|
+
async function generateGlobalConfig(availableCLIs) {
|
|
281
|
+
console.log('\n📝 生成全局配置文件...');
|
|
282
|
+
|
|
283
|
+
const globalConfigDir = join(homedir(), '.stigmergy-cli');
|
|
284
|
+
const globalConfigPath = join(globalConfigDir, 'global-config.json');
|
|
285
|
+
|
|
286
|
+
const timestamp = new Date().toISOString();
|
|
287
|
+
const config = {
|
|
288
|
+
version: '1.0.0',
|
|
289
|
+
generatedAt: timestamp,
|
|
290
|
+
platform: process.platform,
|
|
291
|
+
nodeVersion: process.version,
|
|
292
|
+
availableTools: availableCLIs.filter(cli => cli.available).map(cli => ({
|
|
293
|
+
name: cli.name,
|
|
294
|
+
displayName: cli.displayName,
|
|
295
|
+
path: cli.path.replace(/\r$/, ''), // 清理路径中的回车符
|
|
296
|
+
description: cli.description,
|
|
297
|
+
required: cli.required
|
|
298
|
+
})),
|
|
299
|
+
scanResults: availableCLIs
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
try {
|
|
303
|
+
await fs.writeFile(globalConfigPath, JSON.stringify(config, null, 2), 'utf8');
|
|
304
|
+
console.log(`✅ 全局配置文件已生成: ${globalConfigPath}`);
|
|
305
|
+
return true;
|
|
306
|
+
} catch (error) {
|
|
307
|
+
console.log(`⚠️ 无法生成全局配置文件: ${error.message}`);
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
279
312
|
// 生成全局记忆配置MD文件
|
|
280
313
|
async function generateGlobalMemoryConfigMD(availableCLIs) {
|
|
281
314
|
console.log('\n📝 生成全局记忆配置MD文件...');
|
|
@@ -356,12 +389,18 @@ async function main() {
|
|
|
356
389
|
// 5. 复制各个CLI工具所必须的插件扩展到各个CLI安装的路径中
|
|
357
390
|
await copyPluginExtensions(updatedAvailableCLIs);
|
|
358
391
|
|
|
359
|
-
// 6.
|
|
360
|
-
await
|
|
392
|
+
// 6. 生成全局配置文件和全局记忆配置MD文件
|
|
393
|
+
const configGenerated = await generateGlobalConfig(updatedAvailableCLIs);
|
|
394
|
+
if (configGenerated) {
|
|
395
|
+
await generateGlobalMemoryConfigMD(updatedAvailableCLIs);
|
|
396
|
+
}
|
|
361
397
|
} else {
|
|
362
398
|
// 如果没有安装新工具,直接处理已有的工具
|
|
363
|
-
await
|
|
364
|
-
|
|
399
|
+
const configGenerated = await generateGlobalConfig(availableCLIs);
|
|
400
|
+
if (configGenerated) {
|
|
401
|
+
await copyPluginExtensions(availableCLIs);
|
|
402
|
+
await generateGlobalMemoryConfigMD(availableCLIs);
|
|
403
|
+
}
|
|
365
404
|
}
|
|
366
405
|
|
|
367
406
|
console.log('\n🎉 Stigmergy CLI 安装后设置完成!');
|