stigmergy 1.3.19-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.19-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,14 +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
- // Filter to only install tools with autoInstall: true
34
- const toolsToInstall = Object.entries(missingTools)
35
- .filter(([toolName]) => installer.router.tools[toolName]?.autoInstall === true);
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
+ }
36
44
 
37
45
  const filteredMissingTools = Object.fromEntries(toolsToInstall);
38
46
 
39
47
  if (Object.keys(filteredMissingTools).length === 0) {
40
- console.log(chalk.green('✅ All auto-install CLI tools are already installed!'));
48
+ console.log(chalk.green('✅ All CLI tools are already installed!'));
41
49
  return {
42
50
  success: true,
43
51
  installed: [],
@@ -53,6 +61,24 @@ async function handleInstallCommand(options = {}) {
53
61
 
54
62
  if (installResult.success) {
55
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
+
56
82
  return {
57
83
  success: true,
58
84
  installed: installResult.installed || [],
@@ -104,13 +104,20 @@ async function handleDeployCommand(options = {}) {
104
104
  const installer = new StigmergyInstaller({ verbose: options.verbose });
105
105
  const { available: deployedTools } = await installer.scanCLI();
106
106
 
107
- // Filter to only deploy tools with autoInstall: true
108
- const toolsToDeploy = Object.entries(deployedTools)
109
- .filter(([toolName]) => installer.router.tools[toolName]?.autoInstall === true);
110
- const filteredDeployedTools = Object.fromEntries(toolsToDeploy);
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
+ }
111
118
 
112
119
  if (Object.keys(filteredDeployedTools).length === 0) {
113
- console.log(chalk.yellow('[INFO] No auto-install CLI tools found for deployment'));
120
+ console.log(chalk.yellow('[INFO] No CLI tools found for deployment'));
114
121
  console.log(chalk.blue('💡 Run: stigmergy install to install CLI tools first'));
115
122
  return { success: true, deployed: 0 };
116
123
  }
@@ -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