@paulduvall/claude-dev-toolkit 0.0.1-alpha.1 → 0.0.1-alpha.11

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 (141) hide show
  1. package/README.md +74 -23
  2. package/bin/claude-commands +263 -64
  3. package/commands/active/xarchitecture.md +393 -0
  4. package/commands/active/xconfig.md +127 -0
  5. package/commands/active/xdebug.md +130 -0
  6. package/commands/active/xdocs.md +178 -0
  7. package/commands/active/xgit.md +149 -0
  8. package/commands/active/xpipeline.md +152 -0
  9. package/commands/active/xquality.md +96 -0
  10. package/commands/active/xrefactor.md +198 -0
  11. package/commands/active/xrelease.md +142 -0
  12. package/commands/active/xsecurity.md +92 -0
  13. package/commands/active/xspec.md +174 -0
  14. package/commands/active/xtdd.md +151 -0
  15. package/commands/active/xtest.md +89 -0
  16. package/commands/experiments/xact.md +742 -0
  17. package/commands/experiments/xanalytics.md +113 -0
  18. package/commands/experiments/xanalyze.md +70 -0
  19. package/commands/experiments/xapi.md +161 -0
  20. package/commands/experiments/xatomic.md +112 -0
  21. package/commands/experiments/xaws.md +85 -0
  22. package/commands/experiments/xcicd.md +337 -0
  23. package/commands/experiments/xcommit.md +122 -0
  24. package/commands/experiments/xcompliance.md +182 -0
  25. package/commands/experiments/xconstraints.md +89 -0
  26. package/commands/experiments/xcoverage.md +90 -0
  27. package/commands/experiments/xdb.md +102 -0
  28. package/commands/experiments/xdesign.md +121 -0
  29. package/commands/experiments/xevaluate.md +111 -0
  30. package/commands/experiments/xfootnote.md +12 -0
  31. package/commands/experiments/xgenerate.md +117 -0
  32. package/commands/experiments/xgovernance.md +149 -0
  33. package/commands/experiments/xgreen.md +66 -0
  34. package/commands/experiments/xiac.md +118 -0
  35. package/commands/experiments/xincident.md +137 -0
  36. package/commands/experiments/xinfra.md +115 -0
  37. package/commands/experiments/xknowledge.md +115 -0
  38. package/commands/experiments/xmaturity.md +120 -0
  39. package/commands/experiments/xmetrics.md +118 -0
  40. package/commands/experiments/xmonitoring.md +128 -0
  41. package/commands/experiments/xnew.md +898 -0
  42. package/commands/experiments/xobservable.md +114 -0
  43. package/commands/experiments/xoidc.md +165 -0
  44. package/commands/experiments/xoptimize.md +115 -0
  45. package/commands/experiments/xperformance.md +112 -0
  46. package/commands/experiments/xplanning.md +131 -0
  47. package/commands/experiments/xpolicy.md +115 -0
  48. package/commands/experiments/xproduct.md +98 -0
  49. package/commands/experiments/xreadiness.md +75 -0
  50. package/commands/experiments/xred.md +55 -0
  51. package/commands/experiments/xrisk.md +128 -0
  52. package/commands/experiments/xrules.md +124 -0
  53. package/commands/experiments/xsandbox.md +120 -0
  54. package/commands/experiments/xscan.md +102 -0
  55. package/commands/experiments/xsetup.md +123 -0
  56. package/commands/experiments/xtemplate.md +116 -0
  57. package/commands/experiments/xtrace.md +212 -0
  58. package/commands/experiments/xux.md +171 -0
  59. package/commands/experiments/xvalidate.md +104 -0
  60. package/commands/experiments/xworkflow.md +113 -0
  61. package/hooks/README.md +231 -0
  62. package/hooks/file-logger.sh +98 -0
  63. package/hooks/lib/argument-parser.sh +422 -0
  64. package/hooks/lib/config-constants.sh +230 -0
  65. package/hooks/lib/context-manager.sh +549 -0
  66. package/hooks/lib/error-handler.sh +412 -0
  67. package/hooks/lib/execution-engine.sh +627 -0
  68. package/hooks/lib/file-utils.sh +375 -0
  69. package/hooks/lib/subagent-discovery.sh +465 -0
  70. package/hooks/lib/subagent-validator.sh +597 -0
  71. package/hooks/on-error-debug.sh +221 -0
  72. package/hooks/pre-commit-quality.sh +204 -0
  73. package/hooks/pre-write-security.sh +107 -0
  74. package/hooks/prevent-credential-exposure.sh +265 -0
  75. package/hooks/subagent-trigger-simple.sh +193 -0
  76. package/hooks/subagent-trigger.sh +253 -0
  77. package/lib/backup-restore-command.js +140 -0
  78. package/lib/base/base-command.js +252 -0
  79. package/lib/base/command-result.js +184 -0
  80. package/lib/config/constants.js +255 -0
  81. package/lib/config.js +228 -3
  82. package/lib/configure-command.js +428 -0
  83. package/lib/dependency-validator.js +64 -5
  84. package/lib/hook-installer-core.js +2 -2
  85. package/lib/installation-instruction-generator-backup.js +579 -0
  86. package/lib/installation-instruction-generator.js +213 -495
  87. package/lib/installer.js +134 -56
  88. package/lib/oidc-command.js +363 -0
  89. package/lib/result.js +138 -0
  90. package/lib/services/backup-list-service.js +226 -0
  91. package/lib/services/backup-service.js +230 -0
  92. package/lib/services/command-installer-service.js +217 -0
  93. package/lib/services/logger-service.js +201 -0
  94. package/lib/services/package-manager-service.js +319 -0
  95. package/lib/services/platform-instruction-service.js +294 -0
  96. package/lib/services/recovery-instruction-service.js +348 -0
  97. package/lib/services/restore-service.js +221 -0
  98. package/lib/setup-command.js +309 -0
  99. package/lib/subagent-formatter.js +278 -0
  100. package/lib/subagents-core.js +237 -0
  101. package/lib/subagents.js +508 -0
  102. package/lib/types.d.ts +183 -0
  103. package/lib/utils/claude-path-config.js +184 -0
  104. package/lib/utils/file-system-utils.js +152 -0
  105. package/lib/utils.js +8 -4
  106. package/lib/verify-command.js +430 -0
  107. package/package.json +17 -4
  108. package/scripts/postinstall.js +28 -10
  109. package/subagents/api-guardian.md +29 -0
  110. package/subagents/audit-trail-verifier.md +24 -0
  111. package/subagents/change-scoper.md +23 -0
  112. package/subagents/ci-pipeline-curator.md +24 -0
  113. package/subagents/code-review-assistant.md +258 -0
  114. package/subagents/continuous-release-orchestrator.md +29 -0
  115. package/subagents/contract-tester.md +24 -0
  116. package/subagents/data-steward.md +29 -0
  117. package/subagents/debug-context.md +197 -0
  118. package/subagents/debug-specialist.md +138 -0
  119. package/subagents/dependency-steward.md +24 -0
  120. package/subagents/deployment-strategist.md +29 -0
  121. package/subagents/documentation-curator.md +29 -0
  122. package/subagents/environment-guardian.md +29 -0
  123. package/subagents/license-compliance-guardian.md +29 -0
  124. package/subagents/observability-engineer.md +25 -0
  125. package/subagents/performance-guardian.md +29 -0
  126. package/subagents/product-owner-proxy.md +28 -0
  127. package/subagents/requirements-reviewer.md +26 -0
  128. package/subagents/rollback-first-responder.md +24 -0
  129. package/subagents/sbom-provenance.md +25 -0
  130. package/subagents/security-auditor.md +29 -0
  131. package/subagents/style-enforcer.md +23 -0
  132. package/subagents/test-writer.md +24 -0
  133. package/subagents/trunk-guardian.md +29 -0
  134. package/subagents/workflow-coordinator.md +26 -0
  135. package/templates/README.md +100 -0
  136. package/templates/basic-settings.json +30 -0
  137. package/templates/comprehensive-settings.json +206 -0
  138. package/templates/hybrid-hook-config.yaml +133 -0
  139. package/templates/security-focused-settings.json +62 -0
  140. package/templates/subagent-hooks.yaml +188 -0
  141. package/tsconfig.json +37 -0
package/lib/installer.js CHANGED
@@ -1,68 +1,146 @@
1
- // Installation logic for Claude Dev Toolkit
2
- const fs = require('fs');
3
- const path = require('path');
4
- const os = require('os');
5
- const { ensureDirectory } = require('./utils');
1
+ // Enhanced Installation logic for Claude Dev Toolkit - Refactored
2
+ const BaseCommand = require('./base/base-command');
3
+ const CommandInstallerService = require('./services/command-installer-service');
4
+ const BackupService = require('./services/backup-service');
5
+ const FileSystemUtils = require('./utils/file-system-utils');
6
6
 
7
- module.exports = {
8
- install: async (options = {}) => {
9
- const claudeDir = path.join(os.homedir(), '.claude', 'commands');
10
- const packageDir = path.join(__dirname, '..');
11
-
12
- console.log('šŸš€ Installing Claude Custom Commands...\n');
13
-
14
- // Ensure directories exist
15
- ensureDirectory(claudeDir);
16
- ensureDirectory(path.join(claudeDir, 'active'));
17
- ensureDirectory(path.join(claudeDir, 'experimental'));
18
-
19
- let installedCount = 0;
7
+ class CommandInstaller extends BaseCommand {
8
+ constructor(config = null) {
9
+ super(config);
10
+ this.installerService = new CommandInstallerService(this.config);
11
+ this.backupService = new BackupService(this.config);
12
+ }
13
+
14
+ /**
15
+ * Main install method with enhanced options
16
+ */
17
+ async install(options = {}) {
18
+ this.logger.step('Installing Claude Custom Commands', { options });
20
19
 
21
- // Install active commands
22
- if (options.active || options.all || (!options.active && !options.experimental)) {
23
- const activeSource = path.join(packageDir, 'commands', 'active');
24
- const activeTarget = path.join(claudeDir, 'active');
20
+ const startTime = Date.now();
21
+
22
+ try {
23
+ // Handle dry-run mode
24
+ if (options['dry-run'] || options.dryRun) {
25
+ return await this.dryRun(options);
26
+ }
27
+
28
+ // Validate installation requirements
29
+ const validation = this.installerService.validateInstallation();
30
+ if (!validation.valid) {
31
+ throw new Error(`Installation validation failed: ${validation.issues.join(', ')}`);
32
+ }
33
+
34
+ // Create backup if requested
35
+ if (options.backup) {
36
+ this.logger.step('Creating backup before installation');
37
+ const backupResult = await this.backupService.create(`pre-install-${Date.now()}`);
38
+ this.logger.success(`Backup created: ${backupResult.name}`);
39
+ }
40
+
41
+ // Install commands using service
42
+ const result = await this.installerService.install(options);
43
+
44
+ // Report results
45
+ const duration = ((Date.now() - startTime) / 1000).toFixed(2);
25
46
 
26
- if (fs.existsSync(activeSource)) {
27
- const activeFiles = fs.readdirSync(activeSource).filter(f => f.endsWith('.md'));
28
- activeFiles.forEach(file => {
29
- fs.copyFileSync(
30
- path.join(activeSource, file),
31
- path.join(activeTarget, file)
32
- );
33
- });
34
- installedCount += activeFiles.length;
35
- console.log(`āœ… Installed ${activeFiles.length} active commands`);
47
+ const installContext = {
48
+ activeCommands: result.results.active,
49
+ experimentalCommands: result.results.experimental,
50
+ skippedCommands: result.skippedCount,
51
+ totalInstalled: result.installedCount,
52
+ duration: parseFloat(duration)
53
+ };
54
+
55
+ if (result.results.active > 0) {
56
+ this.logger.success(`Installed ${result.results.active} active commands`);
36
57
  }
37
- }
38
-
39
- // Install experimental commands
40
- if (options.experimental || options.all) {
41
- const expSource = path.join(packageDir, 'commands', 'experiments');
42
- const expTarget = path.join(claudeDir, 'experiments');
58
+ if (result.results.experimental > 0) {
59
+ this.logger.success(`Installed ${result.results.experimental} experimental commands`);
60
+ }
61
+ if (result.skippedCount > 0) {
62
+ this.logger.warn(`Skipped ${result.skippedCount} commands due to errors`);
63
+ }
64
+
65
+ this.logger.complete(`Installation complete! ${result.installedCount} commands installed`, installContext);
43
66
 
44
- if (fs.existsSync(expSource)) {
45
- const expFiles = fs.readdirSync(expSource).filter(f => f.endsWith('.md'));
46
- expFiles.forEach(file => {
47
- fs.copyFileSync(
48
- path.join(expSource, file),
49
- path.join(expTarget, file)
50
- );
67
+ // Performance check
68
+ if (parseFloat(duration) > 30) {
69
+ this.logger.warn('Installation took longer than expected (>30s)', {
70
+ actualDuration: duration,
71
+ expectedMaxDuration: 30
51
72
  });
52
- installedCount += expFiles.length;
53
- console.log(`āœ… Installed ${expFiles.length} experimental commands`);
54
73
  }
74
+
75
+ this.logger.info('Next steps:', {
76
+ nextSteps: [
77
+ 'Verify: claude-commands verify',
78
+ 'List: claude-commands list',
79
+ 'Use in Claude Code: /xhelp'
80
+ ]
81
+ });
82
+
83
+ return {
84
+ success: true,
85
+ installedPath: this.config.commandsDir,
86
+ commandsInstalled: result.installedCount,
87
+ skipped: result.skippedCount,
88
+ duration: duration,
89
+ backupPath: options.backup ? this.config.backupsDir : null
90
+ };
91
+
92
+ } catch (error) {
93
+ return this.handleError(error, options);
55
94
  }
95
+ }
96
+
97
+ /**
98
+ * Dry run mode - show what would be installed
99
+ */
100
+ async dryRun(options) {
101
+ this.logger.info('DRY RUN MODE - No changes will be made', { options });
102
+
103
+ const preview = this.installerService.getDryRunPreview(options);
56
104
 
57
- console.log(`\nšŸŽ‰ Installation complete! ${installedCount} commands installed.`);
58
- console.log('\nNext steps:');
59
- console.log('• Try: claude-commands list');
60
- console.log('• Use commands in Claude Code: /xhelp');
105
+ this.logger.info('Would install the following commands:', {
106
+ destination: preview.destination,
107
+ totalCommands: preview.total
108
+ });
109
+
110
+ if (preview.byType.active.length > 0) {
111
+ this.logger.info(`Active Commands (${preview.byType.active.length}):`, {
112
+ activeCommands: preview.byType.active.map(cmd => cmd.file)
113
+ });
114
+ }
115
+
116
+ if (preview.byType.experimental.length > 0) {
117
+ this.logger.info(`Experimental Commands (${preview.byType.experimental.length}):`, {
118
+ experimentalCommands: preview.byType.experimental.map(cmd => cmd.file)
119
+ });
120
+ }
121
+
122
+ if (options.backup) {
123
+ this.logger.info('Would create backup before installation');
124
+ }
125
+
126
+ this.logger.success(`Total commands to install: ${preview.total}`, {
127
+ summary: preview.byType,
128
+ dryRun: true
129
+ });
61
130
 
62
- return {
63
- success: true,
64
- installedPath: claudeDir,
65
- commandsInstalled: installedCount
131
+ return {
132
+ success: true,
133
+ dryRun: true,
134
+ wouldInstall: preview.total,
135
+ details: preview.byType
66
136
  };
67
137
  }
68
- };
138
+ }
139
+
140
+ // Export as function for backward compatibility
141
+ module.exports = {
142
+ install: async (options = {}) => {
143
+ const installer = new CommandInstaller();
144
+ return installer.install(options);
145
+ }
146
+ };
@@ -0,0 +1,363 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * OIDC Command Implementation
5
+ * Provides GitHub Actions OIDC configuration with AWS through the toolkit's CLI framework
6
+ */
7
+
8
+ const BaseCommand = require('./base/base-command');
9
+ const DependencyValidator = require('./dependency-validator');
10
+ const ErrorHandlerUtils = require('./error-handler-utils');
11
+
12
+ class OidcCommand extends BaseCommand {
13
+ constructor() {
14
+ super();
15
+ this.dependencyValidator = new DependencyValidator();
16
+ this.errorHandlerUtils = new ErrorHandlerUtils();
17
+ }
18
+
19
+ /**
20
+ * Get required tools for OIDC functionality
21
+ */
22
+ getRequiredTools() {
23
+ return [
24
+ {
25
+ name: 'aws',
26
+ description: 'AWS CLI for AWS operations',
27
+ required: true
28
+ },
29
+ {
30
+ name: 'git',
31
+ description: 'Git for repository operations',
32
+ required: true
33
+ },
34
+ {
35
+ name: 'gh',
36
+ description: 'GitHub CLI for GitHub operations',
37
+ required: true
38
+ }
39
+ ];
40
+ }
41
+
42
+ /**
43
+ * Validate required dependencies
44
+ */
45
+ async validateDependencies(options = {}) {
46
+ const requiredTools = this.getRequiredTools();
47
+ const result = this.dependencyValidator.checkDependencies(requiredTools);
48
+
49
+ return result;
50
+ }
51
+
52
+ /**
53
+ * Handle dependency errors with enhanced error information
54
+ */
55
+ handleDependencyError(error, context = {}) {
56
+ const enhancedError = this.errorHandlerUtils.createEnhancedError(error, {
57
+ operation: 'dependency validation',
58
+ component: 'OIDC command',
59
+ ...context
60
+ });
61
+
62
+ // Generate specific recovery suggestions for OIDC dependencies
63
+ const oidcSuggestions = this.generateOIDCRecoverySuggestions(context.missingTools || []);
64
+ const suggestions = this.errorHandlerUtils.generateRecoverySuggestions(enhancedError);
65
+
66
+ return {
67
+ ...enhancedError,
68
+ suggestions: [...oidcSuggestions, ...Array.from(suggestions || [])],
69
+ message: this.enhanceErrorMessage(enhancedError.message, context.missingTools || [])
70
+ };
71
+ }
72
+
73
+ /**
74
+ * Generate OIDC-specific recovery suggestions
75
+ */
76
+ generateOIDCRecoverySuggestions(missingTools) {
77
+ const suggestions = [
78
+ "šŸ“‹ OIDC Setup requires these prerequisites:",
79
+ " Run 'claude-commands oidc --help' for complete setup guide",
80
+ ""
81
+ ];
82
+
83
+ missingTools.forEach(tool => {
84
+ switch (tool.name) {
85
+ case 'aws':
86
+ suggestions.push(
87
+ "šŸ”§ Install AWS CLI:",
88
+ " • macOS: brew install awscli",
89
+ " • Linux: curl 'https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip' -o 'awscliv2.zip' && unzip awscliv2.zip && sudo ./aws/install",
90
+ " • Windows: Download from https://aws.amazon.com/cli/",
91
+ " • Configure: aws configure (requires Access Key ID and Secret)",
92
+ ""
93
+ );
94
+ break;
95
+ case 'gh':
96
+ suggestions.push(
97
+ "šŸ”§ Install GitHub CLI:",
98
+ " • macOS: brew install gh",
99
+ " • Linux: curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg",
100
+ " • Windows: Download from https://github.com/cli/cli/releases",
101
+ " • Authenticate: gh auth login",
102
+ ""
103
+ );
104
+ break;
105
+ case 'git':
106
+ suggestions.push(
107
+ "šŸ”§ Install Git:",
108
+ " • macOS: brew install git (or use Xcode Command Line Tools)",
109
+ " • Linux: sudo apt-get install git (Ubuntu/Debian) or sudo yum install git (RHEL/CentOS)",
110
+ " • Windows: Download from https://git-scm.com/download/win",
111
+ " • Ensure your repository has a GitHub remote origin",
112
+ ""
113
+ );
114
+ break;
115
+ }
116
+ });
117
+
118
+ suggestions.push(
119
+ "āœ… After installation, verify with:",
120
+ " • aws --version && aws sts get-caller-identity",
121
+ " • gh --version && gh auth status",
122
+ " • git --version && git remote -v",
123
+ "",
124
+ "šŸ“– For detailed setup instructions:",
125
+ " claude-commands oidc --help"
126
+ );
127
+
128
+ return suggestions;
129
+ }
130
+
131
+ /**
132
+ * Enhance error message with context
133
+ */
134
+ enhanceErrorMessage(originalMessage, missingTools) {
135
+ if (missingTools.length === 0) return originalMessage;
136
+
137
+ const toolNames = missingTools.map(t => t.name).join(', ');
138
+ return `${originalMessage}
139
+
140
+ šŸŽÆ OIDC Setup Prerequisites Missing
141
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
142
+ Missing tools: ${toolNames}
143
+
144
+ The OIDC command requires AWS CLI, GitHub CLI, and Git to be installed and configured.
145
+ These tools enable secure authentication between GitHub Actions and AWS.
146
+
147
+ Run 'claude-commands oidc --help' for complete setup requirements.`;
148
+ }
149
+
150
+ /**
151
+ * Create context-aware error with operation details
152
+ */
153
+ createContextAwareError(error, context = {}) {
154
+ return this.errorHandlerUtils.createEnhancedError(error, context);
155
+ }
156
+
157
+ /**
158
+ * Process command arguments with defaults and validation
159
+ */
160
+ processArguments(options = {}) {
161
+ const processed = {
162
+ // Default values for common options
163
+ region: options.region || 'us-east-1',
164
+ dryRun: options.dryRun || false,
165
+ verbose: options.verbose || false,
166
+ help: options.help || false,
167
+
168
+ // OIDC-specific options with defaults
169
+ repositoryPath: options.repositoryPath || process.cwd(),
170
+ roleName: options.roleName || 'GitHubActionsRole',
171
+
172
+ // Copy other options as-is
173
+ ...options
174
+ };
175
+
176
+ // Special handling for help option
177
+ if (processed.help) {
178
+ processed.shouldShowHelp = true;
179
+ }
180
+
181
+ return processed;
182
+ }
183
+
184
+ /**
185
+ * Validate argument constraints and requirements
186
+ */
187
+ validateArguments(options = {}) {
188
+ const errors = [];
189
+ const result = {
190
+ valid: true,
191
+ errors,
192
+ warnings: []
193
+ };
194
+
195
+ // Validate region format
196
+ if (options.region && !/^[a-z0-9-]+$/.test(options.region)) {
197
+ errors.push('Region must contain only lowercase letters, numbers, and hyphens');
198
+ }
199
+
200
+ // Validate repository path if provided
201
+ if (options.repositoryPath && typeof options.repositoryPath !== 'string') {
202
+ errors.push('Repository path must be a string');
203
+ }
204
+
205
+
206
+ // Update validation status
207
+ result.valid = errors.length === 0;
208
+
209
+ return result;
210
+ }
211
+
212
+ /**
213
+ * Pre-execution validation
214
+ */
215
+ async preValidate(options = {}) {
216
+ try {
217
+ // Process and validate arguments first
218
+ const processedOptions = this.processArguments(options);
219
+ const argumentValidation = this.validateArguments(processedOptions);
220
+
221
+ if (!argumentValidation.valid) {
222
+ const error = new Error(`Invalid arguments: ${argumentValidation.errors.join(', ')}`);
223
+ error.code = 'VALIDATION_ERROR';
224
+
225
+ const enhancedError = this.createContextAwareError(error, {
226
+ operation: 'OIDC argument validation',
227
+ component: 'argument processor',
228
+ validationErrors: argumentValidation.errors
229
+ });
230
+
231
+ return {
232
+ success: false,
233
+ error: enhancedError.message,
234
+ enhancedError,
235
+ argumentValidation
236
+ };
237
+ }
238
+
239
+ this.showProgress('Validating dependencies...', processedOptions);
240
+
241
+ // Validate required tools are available
242
+ const dependencyResult = await this.validateDependencies(processedOptions);
243
+
244
+ if (!dependencyResult.valid) {
245
+ const missingTools = dependencyResult.missing.map(tool => tool.name).join(', ');
246
+
247
+ // Create enhanced error with context and recovery suggestions
248
+ const error = new Error(`Missing required tools: ${missingTools}`);
249
+ error.code = 'NOT_FOUND';
250
+
251
+ const enhancedError = this.handleDependencyError(error, {
252
+ operation: 'OIDC pre-validation',
253
+ component: 'dependency check',
254
+ missingTools: dependencyResult.missing
255
+ });
256
+
257
+ return {
258
+ success: false,
259
+ error: enhancedError.message,
260
+ enhancedError,
261
+ dependencyResult
262
+ };
263
+ }
264
+
265
+ this.showProgress('Dependencies validated successfully', processedOptions);
266
+ return {
267
+ success: true,
268
+ processedOptions,
269
+ argumentValidation,
270
+ dependencyResult
271
+ };
272
+
273
+ } catch (error) {
274
+ // Handle unexpected validation errors
275
+ const enhancedError = this.createContextAwareError(error, {
276
+ operation: 'OIDC pre-validation',
277
+ component: 'validation system'
278
+ });
279
+
280
+ return {
281
+ success: false,
282
+ error: enhancedError.message,
283
+ enhancedError
284
+ };
285
+ }
286
+ }
287
+
288
+ /**
289
+ * Main command execution logic
290
+ */
291
+ async run(options = {}) {
292
+ const { dryRun = false } = options;
293
+
294
+ if (dryRun) {
295
+ this.showDryRun(options);
296
+ return {
297
+ message: 'āœ… Dry run completed successfully',
298
+ dryRun: true
299
+ };
300
+ }
301
+
302
+ // Show progress to user
303
+ this.showProgress('šŸš€ Initializing OIDC command...', options);
304
+
305
+ // For now, this is a minimal implementation placeholder
306
+ console.log('šŸ“‹ OIDC Setup Status: Command structure implemented');
307
+ console.log('āš ļø Full OIDC implementation is in development');
308
+ console.log('šŸ’” Use --dry-run to preview planned functionality');
309
+
310
+ return {
311
+ message: 'āœ… OIDC command executed successfully (minimal implementation)'
312
+ };
313
+ }
314
+
315
+ /**
316
+ * Show dry run preview
317
+ */
318
+ showDryRun(options) {
319
+ console.log('šŸ” Dry Run - Preview of OIDC configuration actions:\n');
320
+ console.log('šŸ“‹ OIDC Setup:');
321
+ console.log(' • Detect GitHub repository context');
322
+ console.log(' • Validate AWS credentials and permissions');
323
+ console.log(' • Create AWS OIDC Identity Provider for GitHub');
324
+ console.log(' • Create IAM role with trust policy for GitHub Actions');
325
+ console.log(' • Set up GitHub repository variables (AWS_DEPLOYMENT_ROLE, AWS_REGION)');
326
+ console.log('\nšŸ’” This was a dry run - no changes were made');
327
+ console.log(' Run without --dry-run to execute OIDC setup');
328
+
329
+ return { dryRun: true, message: 'Dry run completed' };
330
+ }
331
+
332
+ /**
333
+ * Get help text for OIDC command
334
+ */
335
+ getHelpText() {
336
+ return `
337
+ Configure GitHub Actions OIDC integration with AWS.
338
+
339
+ This command creates AWS OIDC identity provider, IAM role with trust policy,
340
+ and configures GitHub repository variables for secure passwordless authentication.
341
+
342
+ Usage:
343
+ claude-commands oidc [options]
344
+
345
+ Options:
346
+ --region <region> AWS region (default: us-east-1)
347
+ --role-name <name> IAM role name (default: GitHubActionsRole)
348
+ --repository-path <path> Repository path (default: current directory)
349
+ --dry-run Preview actions without making changes
350
+ --verbose Show detailed output
351
+ --help Show this help message
352
+
353
+ Examples:
354
+ claude-commands oidc --help
355
+ claude-commands oidc --dry-run
356
+ claude-commands oidc --region us-west-2 --role-name MyGitHubRole
357
+
358
+ This command creates direct IAM resources without CloudFormation.
359
+ `.trim();
360
+ }
361
+ }
362
+
363
+ module.exports = OidcCommand;