@paulduvall/claude-dev-toolkit 0.0.1-alpha.2 → 0.0.1-alpha.21

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 (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -37
  3. package/bin/claude-commands +307 -65
  4. package/commands/active/xarchitecture.md +393 -0
  5. package/commands/active/xconfig.md +127 -0
  6. package/commands/active/xcontinue.md +92 -0
  7. package/commands/active/xdebug.md +130 -0
  8. package/commands/active/xdocs.md +178 -0
  9. package/commands/active/xexplore.md +94 -0
  10. package/commands/active/xgit.md +149 -0
  11. package/commands/active/xpipeline.md +152 -0
  12. package/commands/active/xquality.md +96 -0
  13. package/commands/active/xrefactor.md +198 -0
  14. package/commands/active/xrelease.md +142 -0
  15. package/commands/active/xsecurity.md +92 -0
  16. package/commands/active/xspec.md +174 -0
  17. package/commands/active/xtdd.md +151 -0
  18. package/commands/active/xtest.md +89 -0
  19. package/commands/active/xverify.md +80 -0
  20. package/commands/experiments/xact.md +742 -0
  21. package/commands/experiments/xanalytics.md +113 -0
  22. package/commands/experiments/xanalyze.md +70 -0
  23. package/commands/experiments/xapi.md +161 -0
  24. package/commands/experiments/xatomic.md +112 -0
  25. package/commands/experiments/xaws.md +85 -0
  26. package/commands/experiments/xcicd.md +337 -0
  27. package/commands/experiments/xcommit.md +122 -0
  28. package/commands/experiments/xcompliance.md +182 -0
  29. package/commands/experiments/xconstraints.md +89 -0
  30. package/commands/experiments/xcoverage.md +90 -0
  31. package/commands/experiments/xdb.md +102 -0
  32. package/commands/experiments/xdesign.md +121 -0
  33. package/commands/experiments/xdevcontainer.md +238 -0
  34. package/commands/experiments/xevaluate.md +111 -0
  35. package/commands/experiments/xfootnote.md +12 -0
  36. package/commands/experiments/xgenerate.md +117 -0
  37. package/commands/experiments/xgovernance.md +149 -0
  38. package/commands/experiments/xgreen.md +66 -0
  39. package/commands/experiments/xiac.md +118 -0
  40. package/commands/experiments/xincident.md +137 -0
  41. package/commands/experiments/xinfra.md +115 -0
  42. package/commands/experiments/xknowledge.md +115 -0
  43. package/commands/experiments/xmaturity.md +120 -0
  44. package/commands/experiments/xmetrics.md +118 -0
  45. package/commands/experiments/xmonitoring.md +128 -0
  46. package/commands/experiments/xnew.md +903 -0
  47. package/commands/experiments/xobservable.md +114 -0
  48. package/commands/experiments/xoidc.md +165 -0
  49. package/commands/experiments/xoptimize.md +115 -0
  50. package/commands/experiments/xperformance.md +112 -0
  51. package/commands/experiments/xplanning.md +131 -0
  52. package/commands/experiments/xpolicy.md +115 -0
  53. package/commands/experiments/xproduct.md +98 -0
  54. package/commands/experiments/xreadiness.md +75 -0
  55. package/commands/experiments/xred.md +55 -0
  56. package/commands/experiments/xrisk.md +128 -0
  57. package/commands/experiments/xrules.md +124 -0
  58. package/commands/experiments/xsandbox.md +120 -0
  59. package/commands/experiments/xscan.md +102 -0
  60. package/commands/experiments/xsetup.md +123 -0
  61. package/commands/experiments/xtemplate.md +116 -0
  62. package/commands/experiments/xtrace.md +212 -0
  63. package/commands/experiments/xux.md +171 -0
  64. package/commands/experiments/xvalidate.md +104 -0
  65. package/commands/experiments/xworkflow.md +113 -0
  66. package/hooks/.smellrc.example.json +19 -0
  67. package/hooks/README.md +263 -0
  68. package/hooks/check-commit-signing.py +127 -0
  69. package/hooks/check-complexity.py +38 -0
  70. package/hooks/check-security.py +37 -0
  71. package/hooks/claude-wrapper.sh +29 -0
  72. package/hooks/config.py +110 -0
  73. package/hooks/file-logger.sh +100 -0
  74. package/hooks/lib/argument-parser.sh +427 -0
  75. package/hooks/lib/config-constants.sh +230 -0
  76. package/hooks/lib/context-manager.sh +560 -0
  77. package/hooks/lib/error-handler.sh +423 -0
  78. package/hooks/lib/execution-engine.sh +444 -0
  79. package/hooks/lib/execution-results.sh +113 -0
  80. package/hooks/lib/execution-simulation.sh +114 -0
  81. package/hooks/lib/field-validators.sh +104 -0
  82. package/hooks/lib/file-utils.sh +398 -0
  83. package/hooks/lib/subagent-discovery.sh +468 -0
  84. package/hooks/lib/subagent-validator.sh +407 -0
  85. package/hooks/lib/validation-reporter.sh +134 -0
  86. package/hooks/on-error-debug.sh +226 -0
  87. package/hooks/pre-commit-quality.sh +204 -0
  88. package/hooks/pre-commit-test-runner.sh +132 -0
  89. package/hooks/pre-write-security.sh +115 -0
  90. package/hooks/prevent-credential-exposure.sh +279 -0
  91. package/hooks/security_bandit.py +177 -0
  92. package/hooks/security_checks.py +97 -0
  93. package/hooks/security_secrets.py +81 -0
  94. package/hooks/security_trojan.py +61 -0
  95. package/hooks/settings.example.json +52 -0
  96. package/hooks/smell_checks.py +238 -0
  97. package/hooks/smell_javascript.py +231 -0
  98. package/hooks/smell_python.py +110 -0
  99. package/hooks/smell_ruff.py +70 -0
  100. package/hooks/smell_types.py +72 -0
  101. package/hooks/subagent-trigger-simple.sh +202 -0
  102. package/hooks/subagent-trigger.sh +253 -0
  103. package/hooks/suppression.py +82 -0
  104. package/hooks/tab-color.sh +70 -0
  105. package/hooks/verify-before-edit.sh +135 -0
  106. package/lib/backup-restore-command.js +140 -0
  107. package/lib/base/base-command.js +252 -0
  108. package/lib/base/command-result.js +184 -0
  109. package/lib/config/constants.js +255 -0
  110. package/lib/config.js +48 -6
  111. package/lib/configure-command.js +428 -0
  112. package/lib/dependency-validator.js +64 -5
  113. package/lib/hook-installer-core.js +2 -2
  114. package/lib/installation-instruction-generator.js +213 -495
  115. package/lib/installer.js +134 -56
  116. package/lib/oidc-command.js +740 -0
  117. package/lib/services/backup-list-service.js +226 -0
  118. package/lib/services/backup-service.js +230 -0
  119. package/lib/services/command-installer-service.js +217 -0
  120. package/lib/services/logger-service.js +201 -0
  121. package/lib/services/package-manager-service.js +319 -0
  122. package/lib/services/platform-instruction-service.js +294 -0
  123. package/lib/services/recovery-instruction-service.js +348 -0
  124. package/lib/services/restore-service.js +221 -0
  125. package/lib/setup-command.js +359 -0
  126. package/lib/setup-wizard.js +155 -262
  127. package/lib/uninstall-command.js +100 -0
  128. package/lib/utils/claude-path-config.js +184 -0
  129. package/lib/utils/file-system-utils.js +152 -0
  130. package/lib/utils.js +8 -4
  131. package/lib/verify-command.js +430 -0
  132. package/package.json +7 -3
  133. package/scripts/postinstall.js +172 -157
  134. package/subagents/debug-specialist.md +7 -0
  135. package/templates/README.md +115 -0
  136. package/templates/basic-settings.json +30 -0
  137. package/templates/comprehensive-settings.json +57 -0
  138. package/templates/global-claude.md +344 -0
  139. package/templates/hybrid-hook-config.yaml +132 -0
  140. package/templates/security-focused-settings.json +62 -0
  141. package/templates/subagent-hooks.yaml +188 -0
  142. package/lib/package-manager-service.js +0 -270
  143. package/subagents/debug-context.md +0 -197
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
+ };