claude-comms 1.0.1 ā 1.0.2
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/CHANGELOG.md +53 -0
- package/README.md +64 -23
- package/bin/claude-setup.js +118 -38
- package/package.json +65 -18
- package/src/cli/index.js +30 -0
- package/src/cli/interfaces.js +386 -0
- package/src/cli/parser.js +158 -0
- package/src/cli/prompts.js +317 -0
- package/src/cli/runner.js +436 -0
- package/src/fetcher/github.js +676 -0
- package/src/index.js +221 -0
- package/src/installer/dependency-check.js +19 -0
- package/src/installer/file-writer.js +648 -0
- package/src/orchestrator/installer.js +849 -0
- package/src/orchestrator/main.js +267 -0
- package/src/orchestrator/mocks/index.js +388 -0
- package/src/utils/config.js +430 -0
- package/src/utils/constants.js +397 -0
- package/src/utils/errors.js +361 -0
- package/src/utils/index.js +46 -0
- package/src/utils/logger.js +177 -0
- package/src/utils/platform.js +362 -0
- package/src/utils/retry.js +358 -0
- package/templates/settings.local.json +1 -0
- package/.claude/hooks/comms/messages_UmaMatrix.json +0 -10
- package/.claude/hooks/comms/messages_VictorSpiral.json +0 -10
- package/.claude/hooks/comms/messages_WendyQuantum.json +0 -10
- package/.claude/hooks/comms/messages_XavierPrism.json +0 -10
- package/templates/get_unread_messages.py +0 -54
- package/templates/send_message.py +0 -75
package/src/index.js
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code Setup Installer - Main Entry Point
|
|
3
|
+
*
|
|
4
|
+
* This module provides the public API for the installation orchestrator.
|
|
5
|
+
* It integrates the new WP06 Orchestrator framework with dependency injection
|
|
6
|
+
* for team modules (WP03 GitHub Fetcher, WP04 File Writer).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const { Installer } = require('./orchestrator/installer');
|
|
10
|
+
const { createMockDependencies, createScenarioMocks } = require('./orchestrator/mocks');
|
|
11
|
+
|
|
12
|
+
// Import real implementations (will be replaced when WP03/04 are ready)
|
|
13
|
+
// const githubFetcher = require('./fetcher/github');
|
|
14
|
+
// const fileWriter = require('./installer/file-writer');
|
|
15
|
+
const logger = require('./utils/logger');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Main installation function using the new orchestrator framework
|
|
19
|
+
* @param {Object} options - Installation options
|
|
20
|
+
* @param {string} options.targetDir - Target directory for installation
|
|
21
|
+
* @param {string} options.version - Git reference (branch/tag/commit) to install
|
|
22
|
+
* @param {boolean} options.force - Force overwrite existing files
|
|
23
|
+
* @param {boolean} options.skipPythonCheck - Whether to skip Python/uv dependency check
|
|
24
|
+
* @param {boolean} options.verbose - Enable verbose logging
|
|
25
|
+
* @param {boolean} options.cache - Use local cache if available
|
|
26
|
+
* @param {boolean} options.dryRun - Dry run mode (show what would be done)
|
|
27
|
+
*/
|
|
28
|
+
async function install(options = {}) {
|
|
29
|
+
// Create dependencies - use mocks until real implementations are ready
|
|
30
|
+
const dependencies = _createDependencies(options);
|
|
31
|
+
|
|
32
|
+
// Create orchestrator with injected dependencies
|
|
33
|
+
const installer = new Installer(dependencies);
|
|
34
|
+
|
|
35
|
+
// Set up progress reporting
|
|
36
|
+
installer.on('progress', (event) => {
|
|
37
|
+
if (options.verbose) {
|
|
38
|
+
logger.info(`Progress: ${event.message} (${event.percentage}%)`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Run installation through orchestrator
|
|
43
|
+
const result = await installer.install(options);
|
|
44
|
+
|
|
45
|
+
if (result.success) {
|
|
46
|
+
logger.success('Installation completed successfully!');
|
|
47
|
+
_displaySuccessMessage(result, options);
|
|
48
|
+
} else {
|
|
49
|
+
logger.error('Installation failed');
|
|
50
|
+
_displayErrorSummary(result);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Validate installation environment without making changes
|
|
58
|
+
* @param {Object} options - Installation options
|
|
59
|
+
* @returns {Promise<ValidationResult>}
|
|
60
|
+
*/
|
|
61
|
+
async function validateEnvironment(options = {}) {
|
|
62
|
+
const dependencies = _createDependencies(options);
|
|
63
|
+
const installer = new Installer(dependencies);
|
|
64
|
+
|
|
65
|
+
return await installer.validateEnvironment(options);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Create orchestrator for advanced use cases
|
|
70
|
+
* @param {Object} dependencies - Optional dependency overrides
|
|
71
|
+
* @returns {Installer} Configured installer instance
|
|
72
|
+
*/
|
|
73
|
+
function createInstaller(dependencies = {}) {
|
|
74
|
+
const finalDependencies = {
|
|
75
|
+
..._createDependencies(),
|
|
76
|
+
...dependencies
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return new Installer(finalDependencies);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ============================================================================
|
|
83
|
+
// PRIVATE HELPER FUNCTIONS
|
|
84
|
+
// ============================================================================
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Create dependencies for the orchestrator
|
|
88
|
+
* Uses real implementations for GitHub fetcher and file writer
|
|
89
|
+
*/
|
|
90
|
+
function _createDependencies(options = {}) {
|
|
91
|
+
if (options.dryRun) {
|
|
92
|
+
return createScenarioMocks('dry_run');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Import real implementations
|
|
96
|
+
const { GitHubFetcher } = require('./fetcher/github');
|
|
97
|
+
const { FileWriter } = require('./installer/file-writer');
|
|
98
|
+
|
|
99
|
+
// Create real fetcher instance
|
|
100
|
+
const fetcher = new GitHubFetcher({
|
|
101
|
+
repository: {
|
|
102
|
+
owner: 'screwyforcepush',
|
|
103
|
+
repo: 'claude-code-subagent-bus',
|
|
104
|
+
branch: 'main',
|
|
105
|
+
paths: {
|
|
106
|
+
claudeDir: '.claude',
|
|
107
|
+
claudeMd: 'CLAUDE.md'
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
timeout: options.timeout || 10000,
|
|
111
|
+
retryCount: options.retryCount || 3,
|
|
112
|
+
userAgent: `@claude-code/setup-installer/${require('../package.json').version}`,
|
|
113
|
+
token: options.token || process.env.GITHUB_TOKEN
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// Create real file writer instance
|
|
117
|
+
const writer = new FileWriter({
|
|
118
|
+
maxRetries: options.maxRetries || 3,
|
|
119
|
+
retryDelay: options.retryDelay || 1000,
|
|
120
|
+
batchSize: options.batchSize || 50,
|
|
121
|
+
progressReporter: options.progressReporter || null
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Create mock dependencies for logger and validator (these remain mocked for now)
|
|
125
|
+
const mockDependencies = createMockDependencies({
|
|
126
|
+
logger: {
|
|
127
|
+
verbose: options.verbose,
|
|
128
|
+
prefix: '[INSTALLER]'
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
fetcher: fetcher,
|
|
134
|
+
writer: writer,
|
|
135
|
+
logger: mockDependencies.logger,
|
|
136
|
+
validator: mockDependencies.validator
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Display success message with installation summary
|
|
142
|
+
*/
|
|
143
|
+
function _displaySuccessMessage(result, options) {
|
|
144
|
+
const chalk = require('chalk');
|
|
145
|
+
|
|
146
|
+
console.log(chalk.green.bold('\nā
Installation Complete!'));
|
|
147
|
+
console.log(chalk.gray('\nClaude multi-agent orchestration setup has been installed.'));
|
|
148
|
+
|
|
149
|
+
console.log(chalk.blue('\nš Installation Summary:'));
|
|
150
|
+
console.log(chalk.gray(`⢠Files installed: ${result.filesInstalled.length}`));
|
|
151
|
+
console.log(chalk.gray(`⢠Target directory: ${options.targetDir || process.cwd()}`));
|
|
152
|
+
console.log(chalk.gray(`⢠Version: ${options.version || 'main'}`));
|
|
153
|
+
|
|
154
|
+
if (result.backups.length > 0) {
|
|
155
|
+
console.log(chalk.yellow(`⢠Backups created: ${result.backups.length}`));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
console.log(chalk.blue('\nš Next Steps:'));
|
|
159
|
+
console.log(chalk.gray('1. Review .claude/settings.local.json for configuration'));
|
|
160
|
+
console.log(chalk.gray('2. Ensure Python and uv are installed for hooks functionality'));
|
|
161
|
+
console.log(chalk.gray('3. Start the observability server (optional)'));
|
|
162
|
+
console.log(chalk.gray('4. Open your project in Claude Code'));
|
|
163
|
+
|
|
164
|
+
console.log(chalk.blue('\nš Resources:'));
|
|
165
|
+
console.log(chalk.gray('⢠Documentation: .claude/README.md'));
|
|
166
|
+
console.log(chalk.gray('⢠Troubleshooting: Check .claude/logs/ for details'));
|
|
167
|
+
console.log(chalk.gray('⢠GitHub: https://github.com/alexsavage/claude-code-hooks-multi-agent-observability'));
|
|
168
|
+
|
|
169
|
+
console.log(chalk.cyan('\nHappy coding with Claude! š¤\n'));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Display error summary for failed installations
|
|
174
|
+
*/
|
|
175
|
+
function _displayErrorSummary(result) {
|
|
176
|
+
const chalk = require('chalk');
|
|
177
|
+
|
|
178
|
+
console.log(chalk.red.bold('\nā Installation Failed!'));
|
|
179
|
+
|
|
180
|
+
if (result.errors.length > 0) {
|
|
181
|
+
console.log(chalk.red('\nErrors encountered:'));
|
|
182
|
+
result.errors.forEach((error, index) => {
|
|
183
|
+
console.log(chalk.red(`${index + 1}. ${error.message}`));
|
|
184
|
+
if (error.code) {
|
|
185
|
+
console.log(chalk.gray(` Error code: ${error.code}`));
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (result.backups.length > 0) {
|
|
191
|
+
console.log(chalk.yellow('\nBackups were created and can be restored:'));
|
|
192
|
+
result.backups.forEach(backup => {
|
|
193
|
+
console.log(chalk.yellow(`⢠${backup.originalPath} -> ${backup.backupPath}`));
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
console.log(chalk.blue('\nš§ Troubleshooting:'));
|
|
198
|
+
console.log(chalk.gray('1. Check network connectivity to GitHub'));
|
|
199
|
+
console.log(chalk.gray('2. Verify write permissions to target directory'));
|
|
200
|
+
console.log(chalk.gray('3. Ensure sufficient disk space'));
|
|
201
|
+
console.log(chalk.gray('4. Try running with --verbose flag for more details'));
|
|
202
|
+
|
|
203
|
+
console.log(chalk.gray('\nFor help, visit: https://github.com/alexsavage/claude-code-hooks-multi-agent-observability/issues'));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// ============================================================================
|
|
207
|
+
// PUBLIC API EXPORTS
|
|
208
|
+
// ============================================================================
|
|
209
|
+
|
|
210
|
+
module.exports = {
|
|
211
|
+
install,
|
|
212
|
+
validateEnvironment,
|
|
213
|
+
createInstaller,
|
|
214
|
+
|
|
215
|
+
// Re-export orchestrator classes for advanced usage
|
|
216
|
+
Installer,
|
|
217
|
+
|
|
218
|
+
// Re-export mocks for testing
|
|
219
|
+
createMockDependencies,
|
|
220
|
+
createScenarioMocks
|
|
221
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency checker for validating Python/uv installation
|
|
3
|
+
* Ensures hooks will work after installation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Placeholder implementation - will be completed in WP04
|
|
7
|
+
async function validatePythonEnvironment() {
|
|
8
|
+
// TODO: Check for Python 3.8+ installation
|
|
9
|
+
// TODO: Check for uv package manager
|
|
10
|
+
// TODO: Validate hook dependencies
|
|
11
|
+
|
|
12
|
+
// For now, just log that validation would occur
|
|
13
|
+
console.log('Python/uv validation would occur here (WP04)');
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
validatePythonEnvironment
|
|
19
|
+
};
|