stigmergy 1.3.18-beta.0 → 1.3.20-beta.0

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stigmergy",
3
- "version": "1.3.18-beta.0",
3
+ "version": "1.3.20-beta.0",
4
4
  "description": "Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -6,6 +6,7 @@
6
6
  const StigmergyInstaller = require('../../core/installer');
7
7
  const chalk = require('chalk');
8
8
  const { ensureSkillsCache } = require('../utils/skills_cache');
9
+ const { handleDeployCommand } = require('./project');
9
10
 
10
11
  /**
11
12
  * Handle install command
@@ -30,8 +31,21 @@ async function handleInstallCommand(options = {}) {
30
31
  // Scan for available and missing tools
31
32
  const { missing: missingTools, available: availableTools } = await installer.scanCLI();
32
33
 
33
- if (Object.keys(missingTools).length === 0) {
34
- console.log(chalk.green('✅ All AI CLI tools are already installed!'));
34
+ // Filter to only install tools with autoInstall: true, unless --all is specified
35
+ let toolsToInstall;
36
+ if (options.all) {
37
+ console.log(chalk.blue('[AUTO-INSTALL] Installing ALL CLI tools (--all mode)'));
38
+ toolsToInstall = Object.entries(missingTools);
39
+ } else {
40
+ console.log(chalk.blue('[AUTO-INSTALL] Installing only auto-install tools'));
41
+ toolsToInstall = Object.entries(missingTools)
42
+ .filter(([toolName]) => installer.router.tools[toolName]?.autoInstall === true);
43
+ }
44
+
45
+ const filteredMissingTools = Object.fromEntries(toolsToInstall);
46
+
47
+ if (Object.keys(filteredMissingTools).length === 0) {
48
+ console.log(chalk.green('✅ All CLI tools are already installed!'));
35
49
  return {
36
50
  success: true,
37
51
  installed: [],
@@ -40,13 +54,31 @@ async function handleInstallCommand(options = {}) {
40
54
  }
41
55
 
42
56
  // Install all missing tools in auto mode
43
- const selectedTools = Object.keys(missingTools);
57
+ const selectedTools = Object.keys(filteredMissingTools);
44
58
  console.log(chalk.blue(`[AUTO-INSTALL] Installing ${selectedTools.length} tools: ${selectedTools.join(', ')}`));
45
59
 
46
- const installResult = await installer.installTools(selectedTools, missingTools);
60
+ const installResult = await installer.installTools(selectedTools, filteredMissingTools);
47
61
 
48
62
  if (installResult.success) {
49
63
  console.log(chalk.green('✅ Auto-install completed successfully!'));
64
+
65
+ // 如果是 --all 模式,自动部署所有工具
66
+ if (options.all) {
67
+ console.log(chalk.blue('\n🚀 Deploying hooks for all installed tools...'));
68
+ try {
69
+ const deployResult = await handleDeployCommand({
70
+ verbose: options.verbose || process.env.DEBUG === 'true',
71
+ force: options.force || false,
72
+ all: true
73
+ });
74
+ if (deployResult.success) {
75
+ console.log(chalk.green('✅ Hooks deployed successfully!'));
76
+ }
77
+ } catch (deployError) {
78
+ console.log(chalk.yellow(`⚠️ Hook deployment warning: ${deployError.message}`));
79
+ }
80
+ }
81
+
50
82
  return {
51
83
  success: true,
52
84
  installed: installResult.installed || [],
@@ -68,8 +100,13 @@ async function handleInstallCommand(options = {}) {
68
100
  // Interactive install mode
69
101
  const { missing: missingTools, available: availableTools } = await installer.scanCLI();
70
102
 
71
- if (Object.keys(missingTools).length === 0) {
72
- console.log(chalk.green('✅ All AI CLI tools are already installed!'));
103
+ // Filter to only show tools with autoInstall: true
104
+ const toolsToInstall = Object.entries(missingTools)
105
+ .filter(([toolName]) => installer.router.tools[toolName]?.autoInstall === true);
106
+ const filteredMissingTools = Object.fromEntries(toolsToInstall);
107
+
108
+ if (Object.keys(filteredMissingTools).length === 0) {
109
+ console.log(chalk.green('✅ All auto-install CLI tools are already installed!'));
73
110
 
74
111
  if (Object.keys(availableTools).length > 0) {
75
112
  console.log(chalk.cyan('\n📦 Available tools:'));
@@ -85,14 +122,14 @@ async function handleInstallCommand(options = {}) {
85
122
  };
86
123
  }
87
124
 
88
- console.log(chalk.yellow(`\n⚠️ Found ${Object.keys(missingTools).length} missing tools:`));
89
- Object.entries(missingTools).forEach(([toolName, toolInfo]) => {
125
+ console.log(chalk.yellow(`\n⚠️ Found ${Object.keys(filteredMissingTools).length} missing tools:`));
126
+ Object.entries(filteredMissingTools).forEach(([toolName, toolInfo]) => {
90
127
  console.log(` - ${toolInfo.name}: ${toolInfo.install}`);
91
128
  });
92
129
 
93
130
  // For now, install all missing tools
94
- const selectedTools = Object.keys(missingTools);
95
- const installResult = await installer.installTools(selectedTools, missingTools);
131
+ const selectedTools = Object.keys(filteredMissingTools);
132
+ const installResult = await installer.installTools(selectedTools, filteredMissingTools);
96
133
 
97
134
  if (installResult.success) {
98
135
  console.log(chalk.green('✅ Installation completed successfully!'));
@@ -104,18 +104,30 @@ async function handleDeployCommand(options = {}) {
104
104
  const installer = new StigmergyInstaller({ verbose: options.verbose });
105
105
  const { available: deployedTools } = await installer.scanCLI();
106
106
 
107
- if (Object.keys(deployedTools).length === 0) {
107
+ // 如果 options.all true,部署所有工具;否则只部署 autoInstall: true 的工具
108
+ let filteredDeployedTools;
109
+ if (options.all) {
110
+ console.log(chalk.blue('[INFO] Deploying hooks for ALL available tools (--all mode)'));
111
+ filteredDeployedTools = deployedTools;
112
+ } else {
113
+ console.log(chalk.blue('[INFO] Deploying hooks for auto-install tools only'));
114
+ const toolsToDeploy = Object.entries(deployedTools)
115
+ .filter(([toolName]) => installer.router.tools[toolName]?.autoInstall === true);
116
+ filteredDeployedTools = Object.fromEntries(toolsToDeploy);
117
+ }
118
+
119
+ if (Object.keys(filteredDeployedTools).length === 0) {
108
120
  console.log(chalk.yellow('[INFO] No CLI tools found for deployment'));
109
121
  console.log(chalk.blue('💡 Run: stigmergy install to install CLI tools first'));
110
122
  return { success: true, deployed: 0 };
111
123
  }
112
124
 
113
- console.log(chalk.blue(`[INFO] Deploying hooks for ${Object.keys(deployedTools).length} tools...`));
125
+ console.log(chalk.blue(`[INFO] Deploying hooks for ${Object.keys(filteredDeployedTools).length} tools...`));
114
126
 
115
- await installer.deployHooks(deployedTools);
127
+ await installer.deployHooks(filteredDeployedTools);
116
128
 
117
129
  console.log(chalk.green('\n✅ Hook deployment completed successfully!'));
118
- return { success: true, deployed: Object.keys(deployedTools).length };
130
+ return { success: true, deployed: Object.keys(filteredDeployedTools).length };
119
131
 
120
132
  } catch (error) {
121
133
  console.error(chalk.red('[ERROR] Deployment failed:'), error.message);
@@ -123,11 +123,18 @@ async function main() {
123
123
  program
124
124
  .command('install')
125
125
  .alias('inst')
126
+ .alias('a')
126
127
  .description('Install CLI tools')
127
128
  .option('-c, --cli <cli>', 'Install specific CLI tool')
128
129
  .option('-v, --verbose', 'Verbose output')
129
130
  .option('-f, --force', 'Force installation')
131
+ .option('--all', 'Install all CLI tools (ignore autoInstall filter)')
130
132
  .action(async (options) => {
133
+ // 检测是否通过 'a' 别名调用,自动设置 --all 选项
134
+ const commandName = process.argv[2];
135
+ if (commandName === 'a') {
136
+ options.all = true;
137
+ }
131
138
  await handleInstallCommand(options);
132
139
  });
133
140
 
@@ -12,6 +12,7 @@ const CLI_TOOLS = {
12
12
  install: 'npm install -g @anthropic-ai/claude-code',
13
13
  hooksDir: path.join(os.homedir(), '.claude', 'hooks'),
14
14
  config: path.join(os.homedir(), '.claude', 'config.json'),
15
+ autoInstall: false, // 默认不安装
15
16
  },
16
17
  gemini: {
17
18
  name: 'Gemini CLI',
@@ -19,6 +20,7 @@ const CLI_TOOLS = {
19
20
  install: 'npm install -g @google/gemini-cli',
20
21
  hooksDir: path.join(os.homedir(), '.gemini', 'extensions'),
21
22
  config: path.join(os.homedir(), '.gemini', 'config.json'),
23
+ autoInstall: false, // 默认不安装
22
24
  },
23
25
  qwen: {
24
26
  name: 'Qwen CLI',
@@ -26,6 +28,7 @@ const CLI_TOOLS = {
26
28
  install: 'npm install -g @qwen-code/qwen-code',
27
29
  hooksDir: path.join(os.homedir(), '.qwen', 'hooks'),
28
30
  config: path.join(os.homedir(), '.qwen', 'config.json'),
31
+ autoInstall: true, // 默认安装
29
32
  },
30
33
  iflow: {
31
34
  name: 'iFlow CLI',
@@ -33,6 +36,7 @@ const CLI_TOOLS = {
33
36
  install: 'npm install -g @iflow-ai/iflow-cli',
34
37
  hooksDir: path.join(os.homedir(), '.iflow', 'hooks'),
35
38
  config: path.join(os.homedir(), '.iflow', 'config.json'),
39
+ autoInstall: true, // 默认安装
36
40
  },
37
41
  qodercli: {
38
42
  name: 'Qoder CLI',
@@ -40,6 +44,7 @@ const CLI_TOOLS = {
40
44
  install: 'npm install -g @qoder-ai/qodercli',
41
45
  hooksDir: path.join(os.homedir(), '.qoder', 'hooks'),
42
46
  config: path.join(os.homedir(), '.qoder', 'config.json'),
47
+ autoInstall: true, // 默认安装
43
48
  },
44
49
  codebuddy: {
45
50
  name: 'CodeBuddy CLI',
@@ -47,6 +52,7 @@ const CLI_TOOLS = {
47
52
  install: 'npm install -g @tencent-ai/codebuddy-code',
48
53
  hooksDir: path.join(os.homedir(), '.codebuddy', 'hooks'),
49
54
  config: path.join(os.homedir(), '.codebuddy', 'config.json'),
55
+ autoInstall: true, // 默认安装
50
56
  },
51
57
  copilot: {
52
58
  name: 'GitHub Copilot CLI',
@@ -54,6 +60,7 @@ const CLI_TOOLS = {
54
60
  install: 'npm install -g @github/copilot',
55
61
  hooksDir: path.join(os.homedir(), '.copilot', 'mcp'),
56
62
  config: path.join(os.homedir(), '.copilot', 'config.json'),
63
+ autoInstall: false, // 默认不安装
57
64
  },
58
65
  codex: {
59
66
  name: 'OpenAI Codex CLI',
@@ -61,6 +68,7 @@ const CLI_TOOLS = {
61
68
  install: 'npm install -g @openai/codex',
62
69
  hooksDir: path.join(os.homedir(), '.config', 'codex', 'slash_commands'),
63
70
  config: path.join(os.homedir(), '.codex', 'config.json'),
71
+ autoInstall: false, // 默认不安装
64
72
  },
65
73
  kode: {
66
74
  name: 'Kode CLI',
@@ -68,6 +76,7 @@ const CLI_TOOLS = {
68
76
  install: 'npm install -g @shareai-lab/kode',
69
77
  hooksDir: path.join(os.homedir(), '.kode', 'agents'),
70
78
  config: path.join(os.homedir(), '.kode', 'config.json'),
79
+ autoInstall: false, // 默认不安装
71
80
  },
72
81
  resumesession: {
73
82
  name: 'ResumeSession CLI',
@@ -75,6 +84,7 @@ const CLI_TOOLS = {
75
84
  install: 'npm install -g @stigmergy/resume',
76
85
  hooksDir: path.join(os.homedir(), '.resumesession', 'hooks'),
77
86
  config: path.join(os.homedir(), '.resumesession', 'config.json'),
87
+ autoInstall: false, // 内部功能,不单独安装
78
88
  },
79
89
  opencode: {
80
90
  name: 'OpenCode AI CLI',
@@ -82,6 +92,7 @@ const CLI_TOOLS = {
82
92
  install: 'npm install -g opencode-ai',
83
93
  hooksDir: path.join(os.homedir(), '.opencode', 'hooks'),
84
94
  config: path.join(os.homedir(), '.opencode', 'config.json'),
95
+ autoInstall: false, // 默认不安装
85
96
  },
86
97
  'oh-my-opencode': {
87
98
  name: 'Oh-My-OpenCode Plugin Manager',
@@ -91,6 +102,7 @@ const CLI_TOOLS = {
91
102
  config: path.join(os.homedir(), '.opencode', 'config.json'),
92
103
  skipVersionCheck: true, // Version check may not work properly for bunx packages
93
104
  requiresBun: true, // Requires bun runtime
105
+ autoInstall: false, // 默认不安装
94
106
  },
95
107
  };
96
108