ccsetup 1.1.1 → 1.2.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.
Files changed (88) hide show
  1. package/README.md +96 -363
  2. package/bin/create-project.js +1616 -60
  3. package/bin/lib/claudeInterface.js +209 -0
  4. package/bin/lib/contextGenerator.js +287 -0
  5. package/bin/lib/scanner/index.js +28 -0
  6. package/bin/scan.js +367 -0
  7. package/lib/aiAgentSelector.js +155 -0
  8. package/lib/aiMergeHelper.js +112 -0
  9. package/lib/contextGenerator.js +574 -0
  10. package/lib/contextMerger.js +812 -0
  11. package/lib/progressReporter.js +88 -0
  12. package/lib/scanConfig.js +200 -0
  13. package/lib/scanner/fileAnalyzer.js +605 -0
  14. package/lib/scanner/index.js +164 -0
  15. package/lib/scanner/patterns.js +277 -0
  16. package/lib/scanner/projectDetector.js +147 -0
  17. package/lib/templates/README.md +176 -0
  18. package/lib/templates/catalog.js +230 -0
  19. package/lib/templates/filter.js +257 -0
  20. package/lib/templates/index.js +45 -0
  21. package/lib/templates/metadata/agents.json +413 -0
  22. package/lib/templates/metadata-extractor.js +329 -0
  23. package/lib/templates/search.js +356 -0
  24. package/package.json +11 -4
  25. package/template/{agents → .claude/agents}/checker.md +29 -0
  26. package/template/.claude/settings.json +15 -0
  27. package/template/.claude/skills/prd/SKILL.md +343 -0
  28. package/template/.claude/skills/ralph/SKILL.md +339 -0
  29. package/template/CLAUDE.md +39 -21
  30. package/template/CONTRIBUTING.md +37 -0
  31. package/template/agents/README.md +15 -171
  32. package/template/docs/ROADMAP.md +0 -36
  33. package/template/docs/agent-orchestration.md +24 -141
  34. package/template/hooks/workflow-selector/index.js +398 -0
  35. package/template/scripts/ralph/CLAUDE.md +174 -0
  36. package/template/scripts/ralph/ralph.sh +127 -0
  37. package/template/tickets/ticket-list.md +17 -68
  38. package/template/agents/ai-engineer.md +0 -31
  39. package/template/agents/api-documenter.md +0 -31
  40. package/template/agents/architect-review.md +0 -42
  41. package/template/agents/backend-architect.md +0 -29
  42. package/template/agents/business-analyst.md +0 -34
  43. package/template/agents/c-pro.md +0 -34
  44. package/template/agents/cloud-architect.md +0 -31
  45. package/template/agents/code-reviewer.md +0 -28
  46. package/template/agents/content-marketer.md +0 -34
  47. package/template/agents/context-manager.md +0 -63
  48. package/template/agents/cpp-pro.md +0 -37
  49. package/template/agents/customer-support.md +0 -34
  50. package/template/agents/data-engineer.md +0 -31
  51. package/template/agents/data-scientist.md +0 -28
  52. package/template/agents/database-admin.md +0 -31
  53. package/template/agents/database-optimizer.md +0 -31
  54. package/template/agents/debugger.md +0 -29
  55. package/template/agents/deployment-engineer.md +0 -31
  56. package/template/agents/devops-troubleshooter.md +0 -31
  57. package/template/agents/dx-optimizer.md +0 -62
  58. package/template/agents/error-detective.md +0 -31
  59. package/template/agents/frontend-developer.md +0 -30
  60. package/template/agents/golang-pro.md +0 -31
  61. package/template/agents/graphql-architect.md +0 -31
  62. package/template/agents/incident-responder.md +0 -73
  63. package/template/agents/javascript-pro.md +0 -34
  64. package/template/agents/legacy-modernizer.md +0 -31
  65. package/template/agents/ml-engineer.md +0 -31
  66. package/template/agents/mlops-engineer.md +0 -56
  67. package/template/agents/mobile-developer.md +0 -31
  68. package/template/agents/network-engineer.md +0 -31
  69. package/template/agents/payment-integration.md +0 -31
  70. package/template/agents/performance-engineer.md +0 -31
  71. package/template/agents/prompt-engineer.md +0 -58
  72. package/template/agents/python-pro.md +0 -31
  73. package/template/agents/quant-analyst.md +0 -31
  74. package/template/agents/risk-manager.md +0 -40
  75. package/template/agents/rust-pro.md +0 -34
  76. package/template/agents/sales-automator.md +0 -34
  77. package/template/agents/search-specialist.md +0 -58
  78. package/template/agents/security-auditor.md +0 -31
  79. package/template/agents/sql-pro.md +0 -34
  80. package/template/agents/terraform-specialist.md +0 -34
  81. package/template/agents/test-automator.md +0 -31
  82. /package/template/{agents → .claude/agents}/backend.md +0 -0
  83. /package/template/{agents → .claude/agents}/blockchain.md +0 -0
  84. /package/template/{agents → .claude/agents}/coder.md +0 -0
  85. /package/template/{agents → .claude/agents}/frontend.md +0 -0
  86. /package/template/{agents → .claude/agents}/planner.md +0 -0
  87. /package/template/{agents → .claude/agents}/researcher.md +0 -0
  88. /package/template/{agents → .claude/agents}/shadcn.md +0 -0
@@ -0,0 +1,209 @@
1
+ const { exec } = require('child_process');
2
+ const { promisify } = require('util');
3
+ const execAsync = promisify(exec);
4
+
5
+ class ClaudeInterface {
6
+ constructor(projectPath) {
7
+ this.projectPath = projectPath;
8
+ }
9
+
10
+ /**
11
+ * Check if Claude Code CLI is available
12
+ */
13
+ async isAvailable() {
14
+ try {
15
+ await execAsync('claude --version');
16
+ return true;
17
+ } catch (error) {
18
+ return false;
19
+ }
20
+ }
21
+
22
+ /**
23
+ * Scan repository using Claude Code CLI
24
+ */
25
+ async scanRepository() {
26
+ const isAvailable = await this.isAvailable();
27
+ if (!isAvailable) {
28
+ throw new Error('Claude Code CLI is not available. Please install it first: npm install -g @anthropic-ai/claude-code');
29
+ }
30
+
31
+ console.log('🤖 Using Claude Code to analyze your repository...');
32
+
33
+ try {
34
+ // Use Claude Code to analyze the repository
35
+ const projectInfo = await this.analyzeProject();
36
+ const dependencies = await this.analyzeDependencies();
37
+ const structure = await this.analyzeStructure();
38
+ const commands = await this.analyzeCommands();
39
+ const patterns = await this.analyzePatterns();
40
+
41
+ return {
42
+ projectType: projectInfo.language || 'Unknown',
43
+ frameworks: projectInfo.frameworks || [],
44
+ purpose: projectInfo.description || '',
45
+ structure: structure.directories || [],
46
+ dependencies: dependencies,
47
+ commands: commands.scripts || [],
48
+ patterns: patterns,
49
+ scanDate: new Date().toISOString(),
50
+ scanMethod: 'claude-code'
51
+ };
52
+ } catch (error) {
53
+ throw new Error(`Claude Code analysis failed: ${error.message}`);
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Analyze project type and frameworks
59
+ */
60
+ async analyzeProject() {
61
+ const prompt = `Analyze this project and tell me:
62
+ 1. The main programming language
63
+ 2. Key frameworks being used
64
+ 3. A one-sentence description of what this project does
65
+
66
+ Respond in this exact JSON format:
67
+ {
68
+ "language": "the main language",
69
+ "frameworks": ["framework1", "framework2"],
70
+ "description": "one sentence description"
71
+ }`;
72
+
73
+ const result = await this.executeCommand(prompt);
74
+ return this.parseJsonResponse(result);
75
+ }
76
+
77
+ /**
78
+ * Analyze project dependencies
79
+ */
80
+ async analyzeDependencies() {
81
+ const prompt = `List the key dependencies in this project. Look at package.json, requirements.txt, go.mod, etc.
82
+
83
+ Respond in this exact JSON format:
84
+ {
85
+ "runtime": ["dep1", "dep2"],
86
+ "dev": ["devDep1", "devDep2"]
87
+ }`;
88
+
89
+ const result = await this.executeCommand(prompt);
90
+ const parsed = this.parseJsonResponse(result);
91
+ return {
92
+ runtime: parsed.runtime || [],
93
+ dev: parsed.dev || []
94
+ };
95
+ }
96
+
97
+ /**
98
+ * Analyze project structure
99
+ */
100
+ async analyzeStructure() {
101
+ const prompt = `List the most important directories in this project and their purpose.
102
+
103
+ Respond in this exact JSON format:
104
+ {
105
+ "directories": [
106
+ {"path": "/src", "purpose": "source code"},
107
+ {"path": "/tests", "purpose": "test files"}
108
+ ]
109
+ }`;
110
+
111
+ const result = await this.executeCommand(prompt);
112
+ return this.parseJsonResponse(result);
113
+ }
114
+
115
+ /**
116
+ * Analyze available commands
117
+ */
118
+ async analyzeCommands() {
119
+ const prompt = `List all available commands from package.json scripts, Makefile, or other sources.
120
+
121
+ Respond in this exact JSON format:
122
+ {
123
+ "scripts": [
124
+ {"command": "npm run dev", "description": "start development server"},
125
+ {"command": "npm test", "description": "run tests"}
126
+ ]
127
+ }`;
128
+
129
+ const result = await this.executeCommand(prompt);
130
+ return this.parseJsonResponse(result);
131
+ }
132
+
133
+ /**
134
+ * Analyze patterns and tools
135
+ */
136
+ async analyzePatterns() {
137
+ const prompt = `Identify architectural patterns, testing tools, and deployment methods used.
138
+
139
+ Respond in this exact JSON format:
140
+ {
141
+ "architecture": ["MVC", "REST API"],
142
+ "testing": ["Jest", "unit tests"],
143
+ "deployment": ["Docker", "CI/CD"]
144
+ }`;
145
+
146
+ const result = await this.executeCommand(prompt);
147
+ return this.parseJsonResponse(result);
148
+ }
149
+
150
+ /**
151
+ * Execute Claude Code command
152
+ */
153
+ async executeCommand(prompt) {
154
+ // Create a temporary file to store the prompt to avoid shell escaping issues
155
+ const fs = require('fs');
156
+ const path = require('path');
157
+ const os = require('os');
158
+
159
+ const tmpFile = path.join(os.tmpdir(), `claude-prompt-${Date.now()}.txt`);
160
+ fs.writeFileSync(tmpFile, prompt);
161
+
162
+ try {
163
+ const command = `cat "${tmpFile}" | claude --print`;
164
+
165
+ const { stdout, stderr } = await execAsync(command, {
166
+ cwd: this.projectPath,
167
+ maxBuffer: 1024 * 1024 * 10, // 10MB buffer
168
+ timeout: 60000 // 60 second timeout
169
+ });
170
+
171
+ // Clean up temp file
172
+ fs.unlinkSync(tmpFile);
173
+
174
+ if (stderr && !stderr.includes('Warning')) {
175
+ throw new Error(`Claude Code error: ${stderr}`);
176
+ }
177
+
178
+ return stdout;
179
+ } catch (error) {
180
+ // Clean up temp file on error
181
+ if (fs.existsSync(tmpFile)) {
182
+ fs.unlinkSync(tmpFile);
183
+ }
184
+ throw error;
185
+ }
186
+ }
187
+
188
+ /**
189
+ * Parse JSON from Claude's response
190
+ */
191
+ parseJsonResponse(response) {
192
+ try {
193
+ // Try to extract JSON from the response
194
+ const jsonMatch = response.match(/\{[\s\S]*\}/);
195
+ if (jsonMatch) {
196
+ return JSON.parse(jsonMatch[0]);
197
+ }
198
+
199
+ // If no JSON found, return empty object
200
+ console.warn('Could not parse JSON from Claude response');
201
+ return {};
202
+ } catch (error) {
203
+ console.warn('JSON parsing failed:', error.message);
204
+ return {};
205
+ }
206
+ }
207
+ }
208
+
209
+ module.exports = ClaudeInterface;
@@ -0,0 +1,287 @@
1
+ class ContextGenerator {
2
+ constructor(scanResults) {
3
+ this.scanResults = scanResults;
4
+ }
5
+
6
+ generate() {
7
+ return {
8
+ overview: this.generateOverview(),
9
+ techStack: this.generateTechStack(),
10
+ commands: this.generateCommands(),
11
+ structure: this.generateStructure(),
12
+ patterns: this.generatePatterns(),
13
+ context: this.generateImportantContext()
14
+ };
15
+ }
16
+
17
+ generateOverview() {
18
+ const { projectType, purpose, frameworks } = this.scanResults;
19
+
20
+ if (purpose) {
21
+ return purpose;
22
+ }
23
+
24
+ let overview = `This is a ${projectType || 'Unknown'} project`;
25
+
26
+ if (frameworks && frameworks.length > 0) {
27
+ overview += ` using ${frameworks.join(', ')}`;
28
+ }
29
+
30
+ overview += '.';
31
+
32
+ return overview;
33
+ }
34
+
35
+ generateTechStack() {
36
+ const techStack = {
37
+ languages: [],
38
+ frameworks: [],
39
+ databases: [],
40
+ devTools: [],
41
+ testing: [],
42
+ deployment: []
43
+ };
44
+
45
+ // All results now come from Claude Code
46
+ if (this.scanResults.projectType) {
47
+ techStack.languages.push(this.scanResults.projectType);
48
+ }
49
+
50
+ if (this.scanResults.frameworks && Array.isArray(this.scanResults.frameworks)) {
51
+ techStack.frameworks.push(...this.scanResults.frameworks);
52
+ }
53
+
54
+ if (this.scanResults.dependencies) {
55
+ if (this.scanResults.dependencies.runtime) {
56
+ const dbPackages = ['mysql', 'postgresql', 'mongodb', 'redis', 'sqlite'];
57
+
58
+ for (const dep of this.scanResults.dependencies.runtime) {
59
+ if (dbPackages.some(db => dep.toLowerCase().includes(db))) {
60
+ techStack.databases.push(dep);
61
+ }
62
+ }
63
+ }
64
+
65
+ if (this.scanResults.dependencies.dev) {
66
+ const devToolPackages = ['eslint', 'prettier', 'webpack', 'rollup', 'vite'];
67
+
68
+ for (const dep of this.scanResults.dependencies.dev) {
69
+ if (devToolPackages.some(tool => dep.toLowerCase().includes(tool))) {
70
+ techStack.devTools.push(dep);
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+ if (this.scanResults.patterns) {
77
+ if (this.scanResults.patterns.testing) {
78
+ techStack.testing.push(...this.scanResults.patterns.testing);
79
+ }
80
+
81
+ if (this.scanResults.patterns.deployment) {
82
+ techStack.deployment.push(...this.scanResults.patterns.deployment);
83
+ }
84
+ }
85
+
86
+ techStack.languages = [...new Set(techStack.languages)];
87
+ techStack.frameworks = [...new Set(techStack.frameworks)];
88
+ techStack.databases = [...new Set(techStack.databases)];
89
+ techStack.devTools = [...new Set(techStack.devTools)];
90
+ techStack.testing = [...new Set(techStack.testing)];
91
+ techStack.deployment = [...new Set(techStack.deployment)];
92
+
93
+ return techStack;
94
+ }
95
+
96
+ generateCommands() {
97
+ const commands = {};
98
+
99
+ // All results now come from Claude Code
100
+ if (this.scanResults.commands && Array.isArray(this.scanResults.commands)) {
101
+ commands.available = this.scanResults.commands.map(cmd => ({
102
+ name: cmd.command,
103
+ description: cmd.description,
104
+ command: cmd.command
105
+ }));
106
+ }
107
+
108
+ return commands;
109
+ }
110
+
111
+ generateStructure() {
112
+ const structure = {
113
+ overview: '',
114
+ keyDirectories: []
115
+ };
116
+
117
+ if (this.scanResults.structure && Array.isArray(this.scanResults.structure)) {
118
+ structure.keyDirectories = this.scanResults.structure.map(dir => ({
119
+ name: dir.path,
120
+ purpose: dir.purpose
121
+ }));
122
+
123
+ if (structure.keyDirectories.length > 0) {
124
+ structure.overview = `Project organized into ${structure.keyDirectories.length} key directories`;
125
+ }
126
+ }
127
+
128
+ return structure;
129
+ }
130
+
131
+ generatePatterns() {
132
+ const patterns = {
133
+ architecture: [],
134
+ testing: [],
135
+ deployment: []
136
+ };
137
+
138
+ if (this.scanResults.patterns) {
139
+ if (this.scanResults.patterns.architecture) {
140
+ patterns.architecture = this.scanResults.patterns.architecture.map(name => ({
141
+ name,
142
+ description: `${name} pattern detected`
143
+ }));
144
+ }
145
+
146
+ if (this.scanResults.patterns.testing) {
147
+ patterns.testing = this.scanResults.patterns.testing.map(name => ({
148
+ name,
149
+ description: `${name} testing framework`
150
+ }));
151
+ }
152
+
153
+ if (this.scanResults.patterns.deployment) {
154
+ patterns.deployment = this.scanResults.patterns.deployment.map(name => ({
155
+ name,
156
+ description: `${name} deployment method`
157
+ }));
158
+ }
159
+ }
160
+
161
+ return patterns;
162
+ }
163
+
164
+ generateImportantContext() {
165
+ const context = [];
166
+
167
+ if (this.scanResults.frameworks && this.scanResults.frameworks.length > 0) {
168
+ context.push(`Primary frameworks: ${this.scanResults.frameworks.join(', ')}`);
169
+ }
170
+
171
+ if (this.scanResults.patterns && this.scanResults.patterns.architecture && this.scanResults.patterns.architecture.length > 0) {
172
+ context.push(`Architecture: ${this.scanResults.patterns.architecture.join(', ')}`);
173
+ }
174
+
175
+ const hasDatabases = this.scanResults.dependencies &&
176
+ this.scanResults.dependencies.runtime &&
177
+ this.scanResults.dependencies.runtime.some(dep =>
178
+ ['mysql', 'postgresql', 'mongodb', 'redis', 'sqlite'].some(db =>
179
+ dep.toLowerCase().includes(db)
180
+ )
181
+ );
182
+
183
+ if (hasDatabases) {
184
+ context.push('Uses database connectivity');
185
+ }
186
+
187
+ if (this.scanResults.patterns && this.scanResults.patterns.deployment && this.scanResults.patterns.deployment.includes('Docker')) {
188
+ context.push('Containerized with Docker');
189
+ }
190
+
191
+ return context;
192
+ }
193
+
194
+ formatForClaude() {
195
+ const generated = this.generate();
196
+ const sections = [];
197
+
198
+ sections.push('\n## Additional Notes\n');
199
+
200
+ if (generated.overview) {
201
+ sections.push('### Project Overview');
202
+ sections.push(generated.overview);
203
+ sections.push('');
204
+ }
205
+
206
+ const techStack = generated.techStack;
207
+ if (Object.values(techStack).some(arr => arr.length > 0)) {
208
+ sections.push('### Tech Stack');
209
+
210
+ if (techStack.languages.length > 0) {
211
+ sections.push(`- **Languages**: ${techStack.languages.join(', ')}`);
212
+ }
213
+ if (techStack.frameworks.length > 0) {
214
+ sections.push(`- **Frameworks**: ${techStack.frameworks.join(', ')}`);
215
+ }
216
+ if (techStack.databases.length > 0) {
217
+ sections.push(`- **Databases**: ${techStack.databases.join(', ')}`);
218
+ }
219
+ if (techStack.devTools.length > 0 && techStack.devTools.length <= 8) {
220
+ sections.push(`- **Dev Tools**: ${techStack.devTools.join(', ')}`);
221
+ }
222
+ if (techStack.testing.length > 0) {
223
+ sections.push(`- **Testing**: ${techStack.testing.join(', ')}`);
224
+ }
225
+ if (techStack.deployment.length > 0) {
226
+ sections.push(`- **Deployment**: ${techStack.deployment.join(', ')}`);
227
+ }
228
+ sections.push('');
229
+ }
230
+
231
+ const commands = generated.commands;
232
+ if (commands.available && commands.available.length > 0) {
233
+ sections.push('### Key Commands');
234
+
235
+ for (const cmd of commands.available.slice(0, 10)) {
236
+ sections.push(`- \`${cmd.command}\` - ${cmd.description}`);
237
+ }
238
+
239
+ sections.push('');
240
+ }
241
+
242
+ const structure = generated.structure;
243
+ if (structure.keyDirectories.length > 0) {
244
+ sections.push('### Project Structure');
245
+
246
+ for (const dir of structure.keyDirectories.slice(0, 8)) {
247
+ sections.push(`- \`${dir.name}\` - ${dir.purpose}`);
248
+ }
249
+ sections.push('');
250
+ }
251
+
252
+ const patterns = generated.patterns;
253
+ const allPatterns = [
254
+ ...patterns.architecture,
255
+ ...patterns.testing,
256
+ ...patterns.deployment
257
+ ];
258
+
259
+ if (allPatterns.length > 0) {
260
+ sections.push('### Architecture & Patterns');
261
+ for (const pattern of allPatterns.slice(0, 8)) {
262
+ sections.push(`- **${pattern.name}**: ${pattern.description}`);
263
+ }
264
+ sections.push('');
265
+ }
266
+
267
+ if (generated.context.length > 0) {
268
+ sections.push('### Important Context');
269
+ for (const item of generated.context) {
270
+ sections.push(`- ${item}`);
271
+ }
272
+ sections.push('');
273
+ }
274
+
275
+ const scanInfo = this.scanResults;
276
+ if (scanInfo.scanDate) {
277
+ sections.push('### Scan Information');
278
+ sections.push(`- Analyzed using Claude Code AI`);
279
+ sections.push(`- Last scanned: ${new Date(scanInfo.scanDate).toLocaleString()}`);
280
+ sections.push('');
281
+ }
282
+
283
+ return sections.join('\n');
284
+ }
285
+ }
286
+
287
+ module.exports = ContextGenerator;
@@ -0,0 +1,28 @@
1
+ const ClaudeInterface = require('../claudeInterface');
2
+
3
+ class RepositoryScanner {
4
+ constructor(projectPath, options = {}) {
5
+ this.projectPath = projectPath;
6
+ this.options = options;
7
+ this.claudeInterface = new ClaudeInterface(this.projectPath);
8
+ }
9
+
10
+ /**
11
+ * Scan repository using ONLY Claude Code CLI
12
+ */
13
+ async scan() {
14
+ // Check if Claude Code is available
15
+ const isAvailable = await this.claudeInterface.isAvailable();
16
+
17
+ if (!isAvailable) {
18
+ throw new Error('Claude Code CLI is required but not found. Please install it first: npm install -g @anthropic-ai/claude-code');
19
+ }
20
+
21
+ console.log('✓ Claude Code detected, starting AI-powered analysis...');
22
+
23
+ // Use Claude Code to scan the repository
24
+ return await this.claudeInterface.scanRepository();
25
+ }
26
+ }
27
+
28
+ module.exports = RepositoryScanner;