stigmergy 1.1.6 → 1.2.6

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.
Files changed (118) hide show
  1. package/LICENSE +18 -18
  2. package/README.md +28 -223
  3. package/STIGMERGY.md +61 -61
  4. package/docs/PROJECT_CONSTITUTION.md +433 -433
  5. package/docs/PROJECT_STRUCTURE_CURRENT.md +80 -80
  6. package/examples/calculator-example.js +72 -72
  7. package/examples/cline_usage_examples.md +364 -364
  8. package/examples/encryption-example.js +67 -67
  9. package/examples/json-parser-example.js +120 -120
  10. package/examples/json-validation-example.js +64 -64
  11. package/examples/rest-client-example.js +52 -52
  12. package/examples/rest_client_example.js +54 -54
  13. package/package.json +15 -7
  14. package/scripts/build.js +74 -74
  15. package/scripts/post-deployment-config.js +296 -296
  16. package/scripts/preinstall-check.js +173 -111
  17. package/scripts/publish.js +58 -268
  18. package/scripts/run-layered-tests.js +247 -0
  19. package/scripts/safe-install.js +139 -139
  20. package/scripts/simple-publish.js +57 -59
  21. package/src/adapters/claude/install_claude_integration.js +292 -0
  22. package/src/adapters/codebuddy/install_codebuddy_integration.js +349 -0
  23. package/src/adapters/codex/install_codex_integration.js +395 -0
  24. package/src/adapters/copilot/install_copilot_integration.js +716 -0
  25. package/src/adapters/gemini/install_gemini_integration.js +304 -0
  26. package/src/adapters/iflow/install_iflow_integration.js +304 -0
  27. package/src/adapters/qoder/install_qoder_integration.js +1090 -0
  28. package/src/adapters/qwen/install_qwen_integration.js +285 -0
  29. package/src/auth.js +173 -173
  30. package/src/auth_command.js +208 -208
  31. package/src/calculator.js +313 -313
  32. package/src/cli/router.js +792 -67
  33. package/src/core/cache_cleaner.js +767 -0
  34. package/src/core/cli_help_analyzer.js +680 -674
  35. package/src/core/cli_parameter_handler.js +132 -127
  36. package/src/core/cli_tools.js +89 -89
  37. package/src/core/coordination/index.js +16 -16
  38. package/src/core/coordination/nodejs/AdapterManager.js +102 -89
  39. package/src/core/coordination/nodejs/CLCommunication.js +132 -124
  40. package/src/core/coordination/nodejs/CLIIntegrationManager.js +272 -236
  41. package/src/core/coordination/nodejs/HealthChecker.js +76 -77
  42. package/src/core/coordination/nodejs/HookDeploymentManager.js +263 -190
  43. package/src/core/coordination/nodejs/StatisticsCollector.js +71 -71
  44. package/src/core/coordination/nodejs/index.js +90 -72
  45. package/src/core/coordination/nodejs/utils/Logger.js +29 -29
  46. package/src/core/enhanced_installer.js +479 -0
  47. package/src/core/enhanced_uninstaller.js +638 -0
  48. package/src/core/error_handler.js +406 -406
  49. package/src/core/installer.js +816 -294
  50. package/src/core/memory_manager.js +83 -83
  51. package/src/core/rest_client.js +160 -160
  52. package/src/core/smart_router.js +249 -146
  53. package/src/core/upgrade_manager.js +420 -0
  54. package/src/data_encryption.js +143 -143
  55. package/src/data_structures.js +440 -440
  56. package/src/deploy.js +55 -55
  57. package/src/index.js +30 -30
  58. package/src/test/cli-availability-checker.js +194 -0
  59. package/src/test/test-environment.js +289 -0
  60. package/src/utils/helpers.js +35 -35
  61. package/src/utils.js +921 -915
  62. package/src/weatherProcessor.js +228 -228
  63. package/test/calculator.test.js +0 -215
  64. package/test/collision-test.js +0 -26
  65. package/test/comprehensive-execution-test.js +0 -428
  66. package/test/conflict-prevention-test.js +0 -95
  67. package/test/cross-cli-detection-test.js +0 -33
  68. package/test/csv-processing-test.js +0 -36
  69. package/test/deploy-hooks-test.js +0 -250
  70. package/test/e2e/claude-cli-test.js +0 -128
  71. package/test/e2e/collaboration-test.js +0 -75
  72. package/test/e2e/comprehensive-test.js +0 -431
  73. package/test/e2e/error-handling-test.js +0 -90
  74. package/test/e2e/individual-tool-test.js +0 -143
  75. package/test/e2e/other-cli-test.js +0 -130
  76. package/test/e2e/qoder-cli-test.js +0 -128
  77. package/test/e2e/run-e2e-tests.js +0 -73
  78. package/test/e2e/test-data.js +0 -88
  79. package/test/e2e/test-utils.js +0 -222
  80. package/test/encryption-simple-test.js +0 -110
  81. package/test/encryption.test.js +0 -129
  82. package/test/enhanced-main-alignment.test.js +0 -298
  83. package/test/error-handling-test.js +0 -341
  84. package/test/fibonacci.test.js +0 -178
  85. package/test/final-deploy-test.js +0 -221
  86. package/test/final-install-test.js +0 -226
  87. package/test/hash-table-demo.js +0 -33
  88. package/test/hash-table-test.js +0 -26
  89. package/test/hash_table_test.js +0 -114
  90. package/test/hook-system-integration-test.js +0 -307
  91. package/test/iflow-integration-test.js +0 -292
  92. package/test/improved-install-test.js +0 -362
  93. package/test/install-command-test.js +0 -370
  94. package/test/json-parser-test.js +0 -161
  95. package/test/json-validation-test.js +0 -164
  96. package/test/natural-language-skills-test.js +0 -320
  97. package/test/nl-integration-test.js +0 -179
  98. package/test/parameter-parsing-test.js +0 -143
  99. package/test/plugin-deployment-test.js +0 -316
  100. package/test/postinstall-test.js +0 -269
  101. package/test/python-plugins-test.js +0 -259
  102. package/test/real-test.js +0 -435
  103. package/test/remaining-adapters-test.js +0 -256
  104. package/test/rest-client-test.js +0 -56
  105. package/test/rest_client.test.js +0 -85
  106. package/test/simple-iflow-hook-test.js +0 -137
  107. package/test/system-compatibility-test.js +0 -467
  108. package/test/tdd-deploy-fix-test.js +0 -324
  109. package/test/tdd-fixes-test.js +0 -211
  110. package/test/third-party-skills-test.js +0 -321
  111. package/test/tool-selection-integration-test.js +0 -158
  112. package/test/unit/calculator-full.test.js +0 -191
  113. package/test/unit/calculator-simple.test.js +0 -96
  114. package/test/unit/calculator.test.js +0 -97
  115. package/test/unit/cli-scanner.test.js +0 -291
  116. package/test/unit/cli_parameter_handler.test.js +0 -116
  117. package/test/unit/cross-cli-executor.test.js +0 -399
  118. package/test/weather-processor.test.js +0 -104
@@ -1,111 +1,173 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Stigmergy Pre-installation Safety Check
5
- * This script prevents installation conflicts by checking for potential issues
6
- */
7
-
8
- const fs = require('fs');
9
- const path = require('path');
10
- const { spawnSync } = require('child_process');
11
-
12
- console.log('[PRE-INSTALL] Running safety checks...');
13
-
14
- // Check 1: Verify no conflicting "node" package is already installed
15
- function checkConflictingNodePackage() {
16
- console.log('[CHECK] Looking for conflicting node packages...');
17
-
18
- try {
19
- const result = spawnSync('npm', ['list', '-g', 'node'], {
20
- encoding: 'utf8',
21
- timeout: 5000
22
- });
23
-
24
- if (result.stdout && result.stdout.includes('node@')) {
25
- console.error('[ERROR] Conflicting "node" package detected!');
26
- console.error('[ERROR] This will interfere with CLI tools. Please run:');
27
- console.error('[ERROR] npm uninstall -g node');
28
- console.error('[ERROR] Then try installing stigmergy again.');
29
- process.exit(1);
30
- }
31
- } catch (error) {
32
- // If npm command fails, continue anyway
33
- console.log('[INFO] Could not verify node package status, continuing...');
34
- }
35
-
36
- console.log('[OK] No conflicting node package found.');
37
- }
38
-
39
- // Check 2: Verify system Node.js installation
40
- function checkSystemNode() {
41
- console.log('[CHECK] Verifying system Node.js installation...');
42
-
43
- const nodeVersion = process.version;
44
- const majorVersion = parseInt(nodeVersion.match(/^v(\d+)/)[1]);
45
-
46
- if (majorVersion < 16) {
47
- console.error('[ERROR] Node.js version 16 or higher is required.');
48
- console.error(`[ERROR] Current version: ${nodeVersion}`);
49
- process.exit(1);
50
- }
51
-
52
- console.log(`[OK] Node.js ${nodeVersion} detected.`);
53
- }
54
-
55
- // Check 3: Verify npm installation
56
- function checkNpm() {
57
- console.log('[CHECK] Verifying npm installation...');
58
-
59
- // On Windows, npm might not be directly executable
60
- if (process.platform === 'win32') {
61
- console.log('[INFO] Skipping npm verification on Windows (may not be directly executable)');
62
- return;
63
- }
64
-
65
- try {
66
- const result = spawnSync('npm', ['--version'], {
67
- encoding: 'utf8',
68
- timeout: 5000
69
- });
70
-
71
- if (result.status !== 0) {
72
- console.error('[ERROR] npm is not properly installed or accessible.');
73
- process.exit(1);
74
- }
75
-
76
- console.log(`[OK] npm ${result.stdout.trim()} detected.`);
77
- } catch (error) {
78
- console.error('[ERROR] Failed to verify npm installation.');
79
- process.exit(1);
80
- }
81
- }
82
-
83
- // Check 4: Check for existing stigmergy installation conflicts
84
- function checkExistingInstallation() {
85
- console.log('[CHECK] Looking for existing Stigmergy installations...');
86
-
87
- const npmBinDir = path.join(process.env.APPDATA || process.env.HOME, 'npm');
88
- const stigmergyBin = path.join(npmBinDir, 'stigmergy');
89
-
90
- if (fs.existsSync(stigmergyBin)) {
91
- console.log('[WARNING] Existing Stigmergy installation detected.');
92
- console.log('[WARNING] This may cause conflicts. Consider uninstalling first:');
93
- console.log('[WARNING] npm uninstall -g stigmergy');
94
- }
95
-
96
- console.log('[OK] No conflicting Stigmergy installation found.');
97
- }
98
-
99
- // Run all checks
100
- try {
101
- checkSystemNode();
102
- checkNpm();
103
- checkConflictingNodePackage();
104
- checkExistingInstallation();
105
-
106
- console.log('[SUCCESS] All safety checks passed. Proceeding with installation.');
107
- process.exit(0);
108
- } catch (error) {
109
- console.error('[FATAL] Safety check failed:', error.message);
110
- process.exit(1);
111
- }
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Enhanced Stigmergy Pre-installation Check
5
+ * This script prevents installation conflicts and cleans historical caches
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const { spawnSync } = require('child_process');
11
+
12
+ console.log('[PRE-INSTALL] Running enhanced installation preparation...');
13
+
14
+ // Check 1: Verify no conflicting "node" package is already installed
15
+ function checkConflictingNodePackage() {
16
+ console.log('[CHECK] Looking for conflicting node packages...');
17
+
18
+ try {
19
+ const result = spawnSync('npm', ['list', '-g', 'node'], {
20
+ encoding: 'utf8',
21
+ timeout: 5000
22
+ });
23
+
24
+ if (result.stdout && result.stdout.includes('node@')) {
25
+ console.error('[ERROR] Conflicting "node" package detected!');
26
+ console.error('[ERROR] This will interfere with CLI tools. Please run:');
27
+ console.error('[ERROR] npm uninstall -g node');
28
+ console.error('[ERROR] Then try installing stigmergy again.');
29
+ process.exit(1);
30
+ }
31
+ } catch (error) {
32
+ // If npm command fails, continue anyway
33
+ console.log('[INFO] Could not verify node package status, continuing...');
34
+ }
35
+
36
+ console.log('[OK] No conflicting node package found.');
37
+ }
38
+
39
+ // Check 2: Verify system Node.js installation
40
+ function checkSystemNode() {
41
+ console.log('[CHECK] Verifying system Node.js installation...');
42
+
43
+ const nodeVersion = process.version;
44
+ const majorVersion = parseInt(nodeVersion.match(/^v(\d+)/)[1]);
45
+
46
+ if (majorVersion < 16) {
47
+ console.error('[ERROR] Node.js version 16 or higher is required.');
48
+ console.error(`[ERROR] Current version: ${nodeVersion}`);
49
+ process.exit(1);
50
+ }
51
+
52
+ console.log(`[OK] Node.js ${nodeVersion} detected.`);
53
+ }
54
+
55
+ // Check 3: Verify npm installation
56
+ function checkNpm() {
57
+ console.log('[CHECK] Verifying npm installation...');
58
+
59
+ // On Windows, npm might not be directly executable
60
+ if (process.platform === 'win32') {
61
+ console.log('[INFO] Skipping npm verification on Windows (may not be directly executable)');
62
+ return;
63
+ }
64
+
65
+ try {
66
+ const result = spawnSync('npm', ['--version'], {
67
+ encoding: 'utf8',
68
+ timeout: 5000
69
+ });
70
+
71
+ if (result.status !== 0) {
72
+ console.error('[ERROR] npm is not properly installed or accessible.');
73
+ process.exit(1);
74
+ }
75
+
76
+ console.log(`[OK] npm ${result.stdout.trim()} detected.`);
77
+ } catch (error) {
78
+ console.error('[ERROR] Failed to verify npm installation.');
79
+ process.exit(1);
80
+ }
81
+ }
82
+
83
+ // Check 4: Check for existing stigmergy installation conflicts
84
+ function checkExistingInstallation() {
85
+ console.log('[CHECK] Looking for existing Stigmergy installations...');
86
+
87
+ const npmBinDir = path.join(process.env.APPDATA || process.env.HOME, 'npm');
88
+ const stigmergyBin = path.join(npmBinDir, 'stigmergy');
89
+
90
+ if (fs.existsSync(stigmergyBin)) {
91
+ console.log('[WARNING] Existing Stigmergy installation detected.');
92
+ console.log('[WARNING] This may cause conflicts. Consider uninstalling first:');
93
+ console.log('[WARNING] npm uninstall -g stigmergy');
94
+ }
95
+
96
+ console.log('[OK] No conflicting Stigmergy installation found.');
97
+ }
98
+
99
+ // Check 5: Clean historical caches (NEW FUNCTION)
100
+ function cleanHistoricalCaches() {
101
+ console.log('[CLEAN] Cleaning historical caches to prevent conflicts...');
102
+
103
+ try {
104
+ // Import and use our enhanced cache cleaner
105
+ const CacheCleaner = require('../src/core/cache_cleaner');
106
+ const cleaner = new CacheCleaner({
107
+ dryRun: false,
108
+ force: true,
109
+ verbose: false,
110
+ preserveRecent: 60 * 60 * 1000 // Preserve files from last hour
111
+ });
112
+
113
+ // Clean only safe items before installation
114
+ cleaner.cleanAllCaches({
115
+ cleanStigmergy: false, // Don't clean main config during install
116
+ cleanNPX: true, // Clean NPX cache (safe)
117
+ cleanNPM: false, // Don't clean NPM cache during install
118
+ cleanCLI: false, // Don't clean CLI configs during install
119
+ cleanTemp: true // Clean temporary files (safe)
120
+ }).then(results => {
121
+ if (results.filesRemoved > 0) {
122
+ console.log(`[CLEAN] Removed ${results.filesRemoved} cache files`);
123
+ console.log(`[CLEAN] Freed ${formatBytes(results.bytesFreed)} space`);
124
+ } else {
125
+ console.log('[CLEAN] No cache files needed cleaning');
126
+ }
127
+ }).catch(error => {
128
+ console.log(`[WARN] Cache cleaning failed: ${error.message}`);
129
+ console.log('[INFO] Continuing with installation...');
130
+ });
131
+
132
+ } catch (error) {
133
+ console.log(`[WARN] Could not initialize cache cleaner: ${error.message}`);
134
+ console.log('[INFO] Continuing with installation...');
135
+ }
136
+ }
137
+
138
+ // Helper function to format bytes
139
+ function formatBytes(bytes) {
140
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
141
+ if (bytes === 0) return '0 Bytes';
142
+ const i = Math.floor(Math.log(bytes) / Math.log(1024));
143
+ return Math.round(bytes / Math.pow(1024, i) * 100) / 100 + ' ' + sizes[i];
144
+ }
145
+
146
+ // Run all checks and preparation
147
+ async function runInstallationPreparation() {
148
+ try {
149
+ // System requirements first
150
+ checkSystemNode();
151
+ checkNpm();
152
+ checkConflictingNodePackage();
153
+ checkExistingInstallation();
154
+
155
+ // Clean caches (async, but don't wait for completion to avoid blocking npm install)
156
+ cleanHistoricalCaches();
157
+
158
+ console.log('[SUCCESS] Enhanced installation preparation completed.');
159
+ console.log('[INFO] Proceeding with package installation...');
160
+
161
+ // Give cache cleaning a moment to start
162
+ setTimeout(() => {
163
+ process.exit(0);
164
+ }, 1000);
165
+
166
+ } catch (error) {
167
+ console.error('[FATAL] Installation preparation failed:', error.message);
168
+ process.exit(1);
169
+ }
170
+ }
171
+
172
+ // Run the enhanced preparation
173
+ runInstallationPreparation();
@@ -1,268 +1,58 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Stigmergy CLI 发布脚本
5
- * 自动化发布流程到npm
6
- */
7
-
8
- import { execSync } from 'child_process';
9
- import { readFile, writeFile } from 'fs/promises';
10
- import { join } from 'path';
11
- import { fileURLToPath } from 'url';
12
-
13
- const __filename = fileURLToPath(import.meta.url);
14
- const __dirname = join(__filename, '..');
15
-
16
- class NPMPublisher {
17
- constructor() {
18
- this.rootDir = __dirname;
19
- this.packagePath = join(this.rootDir, 'package.json');
20
- }
21
-
22
- log(message, type = 'info') {
23
- const timestamp = new Date().toISOString();
24
- const prefix = {
25
- 'info': '📦 ',
26
- 'success': '✅ ',
27
- 'error': '❌ ',
28
- 'warning': '⚠️ '
29
- }[type] || '📦 ';
30
-
31
- console.log(`${timestamp} ${prefix}${message}`);
32
- }
33
-
34
- async readPackage() {
35
- try {
36
- const content = await readFile(this.packagePath, 'utf8');
37
- return JSON.parse(content);
38
- } catch (error) {
39
- this.log(`读取package.json失败: ${error.message}`, 'error');
40
- throw error;
41
- }
42
- }
43
-
44
- async checkRequirements() {
45
- this.log('检查发布要求...', 'info');
46
-
47
- const pkg = await this.readPackage();
48
-
49
- // 检查必要字段
50
- const required = ['name', 'version', 'description', 'main', 'bin', 'repository'];
51
- for (const field of required) {
52
- if (!pkg[field]) {
53
- throw new Error(`缺少必要字段: ${field}`);
54
- }
55
- }
56
-
57
- // 检查版本格式
58
- if (!/^\d+\.\d+\.\d+$/.test(pkg.version)) {
59
- throw new Error(`版本格式不正确: ${pkg.version}`);
60
- }
61
-
62
- // 检查仓库URL
63
- if (!pkg.repository?.url) {
64
- throw new Error('缺少repository.url');
65
- }
66
-
67
- this.log('所有检查通过', 'success');
68
- }
69
-
70
- async buildProject() {
71
- this.log('构建项目...', 'info');
72
-
73
- try {
74
- // 清理之前的构建
75
- execSync('rm -rf dist', { cwd: this.rootDir });
76
-
77
- // 创建dist目录
78
- execSync('mkdir -p dist', { cwd: this.rootDir });
79
-
80
- // 复制必要文件
81
- const filesToCopy = [
82
- 'src/index.js',
83
- 'src/adapters/',
84
- 'src/templates/',
85
- 'package.json',
86
- 'README.md',
87
- 'LICENSE'
88
- ];
89
-
90
- for (const file of filesToCopy) {
91
- if (file.endsWith('/')) {
92
- execSync(`cp -r ${file} dist/`, { cwd: this.rootDir });
93
- } else {
94
- execSync(`cp ${file} dist/`, { cwd: this.rootDir });
95
- }
96
- }
97
-
98
- // 复制bin文件
99
- execSync('mkdir -p dist/bin', { cwd: this.rootDir });
100
- execSync('cp bin/* dist/bin/', { cwd: this.rootDir });
101
-
102
- // 生成package.json用于发布
103
- const publishPackage = await this.readPackage();
104
- const publishConfig = {
105
- ...publishPackage,
106
- files: [
107
- 'src/index.js',
108
- 'src/adapters/**',
109
- 'src/templates/**',
110
- 'bin/**',
111
- 'README.md',
112
- 'LICENSE'
113
- ],
114
- main: 'src/index.js',
115
- bin: {
116
- 'stigmergy-cli': 'src/index.js'
117
- }
118
- };
119
-
120
- await writeFile(
121
- join(this.rootDir, 'dist/package.json'),
122
- JSON.stringify(publishConfig, null, 2),
123
- 'utf8'
124
- );
125
-
126
- this.log('构建完成', 'success');
127
- } catch (error) {
128
- this.log(`构建失败: ${error.message}`, 'error');
129
- throw error;
130
- }
131
- }
132
-
133
- async runTests() {
134
- this.log('运行测试...', 'info');
135
-
136
- try {
137
- execSync('npm test', { cwd: this.rootDir, stdio: 'inherit' });
138
- this.log('测试通过', 'success');
139
- } catch (error) {
140
- this.log(`测试失败: ${error.message}`, 'error');
141
- throw error;
142
- }
143
- }
144
-
145
- async publishToNPM(dryRun = false) {
146
- this.log('准备发布到npm...', 'info');
147
-
148
- try {
149
- // 检查是否已登录npm
150
- try {
151
- execSync('npm whoami', { stdio: 'pipe' });
152
- this.log('npm登录状态: 已登录', 'success');
153
- } catch {
154
- this.log('请先登录npm: npm login', 'warning');
155
- throw new Error('需要先登录npm');
156
- }
157
-
158
- // 检查包名是否可用
159
- const pkg = await this.readPackage();
160
- try {
161
- execSync(`npm view ${pkg.name}`, { stdio: 'pipe' });
162
- this.log(`包名 ${pkg.name} 已存在,将覆盖发布`, 'warning');
163
- } catch {
164
- this.log(`包名 ${pkg.name} 可用`, 'success');
165
- }
166
-
167
- // 发布命令
168
- const publishCmd = dryRun ? 'npm publish --dry-run' : 'npm publish --access public';
169
-
170
- if (dryRun) {
171
- this.log('模拟发布中...', 'info');
172
- execSync(publishCmd, { cwd: join(this.rootDir, 'dist'), stdio: 'inherit' });
173
- this.log('模拟发布完成', 'success');
174
- } else {
175
- this.log('发布到npm...', 'info');
176
- execSync(publishCmd, { cwd: join(this.rootDir, 'dist'), stdio: 'inherit' });
177
- this.log('发布成功!', 'success');
178
- }
179
-
180
- } catch (error) {
181
- this.log(`发布失败: ${error.message}`, 'error');
182
- throw error;
183
- }
184
- }
185
-
186
- async versionUpdate(type = 'patch') {
187
- this.log(`更新版本 (${type})...`, 'info');
188
-
189
- try {
190
- execSync(`npm version ${type}`, { cwd: this.rootDir, stdio: 'inherit' });
191
- this.log('版本更新完成', 'success');
192
- } catch (error) {
193
- this.log(`版本更新失败: ${error.message}`, 'error');
194
- throw error;
195
- }
196
- }
197
-
198
- async showHelp() {
199
- console.log(`
200
- 🚀 Stigmergy CLI 发布工具
201
-
202
- 用法: node scripts/publish.js [选项]
203
-
204
- 选项:
205
- --dry-run 模拟发布,不实际上传到npm
206
- --patch 更新补丁版本 (默认)
207
- --minor 更新次版本
208
- --major 更新主版本
209
- --help, -h 显示帮助信息
210
-
211
- 示例:
212
- node scripts/publish.js # 发布到npm
213
- node scripts/publish.js --dry-run # 模拟发布
214
- node scripts/publish.js --minor # 更新次版本并发布
215
- node scripts/publish.js --help # 显示帮助
216
-
217
- 工作流程:
218
- 1. 检查发布要求
219
- 2. 运行测试
220
- 3. 构建项目
221
- 4. 更新版本 (可选)
222
- 5. 发布到npm
223
- `);
224
- }
225
- }
226
-
227
- async function main() {
228
- const publisher = new NPMPublisher();
229
- const args = process.argv.slice(2);
230
-
231
- // 显示帮助
232
- if (args.includes('--help') || args.includes('-h')) {
233
- publisher.showHelp();
234
- return;
235
- }
236
-
237
- try {
238
- // 检查发布要求
239
- await publisher.checkRequirements();
240
-
241
- // 运行测试
242
- await publisher.runTests();
243
-
244
- // 构建项目
245
- await publisher.buildProject();
246
-
247
- // 处理版本更新
248
- let versionType = 'patch';
249
- if (args.includes('--minor')) versionType = 'minor';
250
- if (args.includes('--major')) versionType = 'major';
251
-
252
- if (versionType !== 'patch') {
253
- await publisher.versionUpdate(versionType);
254
- }
255
-
256
- // 发布到npm
257
- const dryRun = args.includes('--dry-run');
258
- await publisher.publishToNPM(dryRun);
259
-
260
- } catch (error) {
261
- console.error('发布失败:', error.message);
262
- process.exit(1);
263
- }
264
- }
265
-
266
- if (import.meta.url === `file://${process.argv[1]}`) {
267
- main();
268
- }
1
+ #!/bin/bash
2
+ # Release script for Stigmergy CLI v1.2.1
3
+
4
+ echo "=========================================="
5
+ echo "Stigmergy CLI v1.2.1 Release Preparation"
6
+ echo "=========================================="
7
+
8
+ echo ""
9
+ echo "Changes in v1.2.1:"
10
+ echo "- Added 'call' command implementation to modular architecture"
11
+ echo "- Moved old main.js and main_english.js implementations to archive directory"
12
+ echo "- Fixed missing call command functionality in new system"
13
+ echo "- Updated version from 1.2.0 to 1.2.1"
14
+ echo ""
15
+
16
+ # Verify package
17
+ echo "Verifying package..."
18
+ npm pack
19
+ echo "Package stigmergy-1.2.1.tgz created successfully"
20
+
21
+ # Show important files for verification
22
+ echo ""
23
+ echo "Important files to verify before publishing:"
24
+ echo "- package.json: version updated to 1.2.1"
25
+ echo "- CHANGELOG.md: updated with v1.2.1 changes"
26
+ echo "- src/cli/router.js: contains call command implementation"
27
+ echo "- archive/main.js.backup: old implementation preserved"
28
+
29
+ # Instructions for publishing
30
+ echo ""
31
+ echo "=========================================="
32
+ echo "Publishing Instructions (for maintainers):"
33
+ echo "=========================================="
34
+ echo ""
35
+ echo "Before publishing, ensure you have:"
36
+ echo "1. npm login credentials"
37
+ echo "2. Two-factor authentication set up (if required)"
38
+ echo "3. Permissions to publish to 'stigmergy' package"
39
+ echo ""
40
+ echo "To publish the package, run:"
41
+ echo " npm publish"
42
+ echo ""
43
+ echo "To publish a specific tag (e.g., beta):"
44
+ echo " npm publish --tag beta"
45
+ echo ""
46
+ echo "After publishing, verify the release:"
47
+ echo " npm view stigmergy@1.2.1"
48
+ echo ""
49
+ echo "=========================================="
50
+ echo "Git Tagging Commands:"
51
+ echo "=========================================="
52
+ echo "After successful npm publish, tag the release:"
53
+ echo " git add ."
54
+ echo " git commit -m \"Release v1.2.1 - Add call command to modular architecture\""
55
+ echo " git tag -a v1.2.1 -m \"Release v1.2.1\""
56
+ echo " git push origin main"
57
+ echo " git push origin v1.2.1"
58
+ echo "=========================================="