Skip to content

Commit ef81503

Browse files
committed
✨ Integrate Kiro deployment into main service
1 parent d65098b commit ef81503

File tree

5 files changed

+1134
-12
lines changed

5 files changed

+1134
-12
lines changed

.kiro/specs/kiro-deploy-support/tasks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ This document outlines the implementation plan for adding Kiro IDE deployment su
111111
- _Requirements: 7.1, 7.2, 17.3_
112112
- _Estimated: 2 days_
113113

114-
- [ ] 4.1 Integrate Kiro deployment into main deployment service
114+
- [x] 4.1 Integrate Kiro deployment into main deployment service
115115
- Add `deployToKiro()` method to existing `DeploymentService`
116116
- Implement Kiro deployment orchestration using existing infrastructure
117117
- Integrate with existing backup, security, and performance monitoring services
@@ -121,7 +121,7 @@ This document outlines the implementation plan for adding Kiro IDE deployment su
121121
- _Requirements: 2.1, 6.1, 6.2, 13.1, 13.2_
122122
- _Estimated: 2 days_
123123

124-
- [ ] 4.2 Implement Kiro installation detection and compatibility
124+
- [x] 4.2 Implement Kiro installation detection and compatibility
125125
- Create `src/modules/deploy/services/kiro-installation-detector.service.ts`
126126
- Implement Kiro installation detection and version checking
127127
- Add existing configuration analysis and compatibility validation

src/modules/deploy/deploy.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ErrorRecoveryService } from './services/error-recovery.service';
1212
import { ImportService } from './services/import.service';
1313
import { KiroComponentHandlerService } from './services/kiro-component-handler.service';
1414
import { KiroConflictResolverService } from './services/kiro-conflict-resolver.service';
15+
import { KiroInstallationDetectorService } from './services/kiro-installation-detector.service';
1516
import { KiroTransformerService } from './services/kiro-transformer.service';
1617
import { KiroValidatorService } from './services/kiro-validator.service';
1718
import { LargeFileStreamerService } from './services/large-file-streamer.service';
@@ -38,6 +39,7 @@ import { PerformanceOptimizer } from './utils/performance-optimizer.utility';
3839
ImportService,
3940
KiroComponentHandlerService,
4041
KiroConflictResolverService,
42+
KiroInstallationDetectorService,
4143
KiroTransformerService,
4244
KiroValidatorService,
4345
LargeFileStreamerService,

src/modules/deploy/services/deployment.service.ts

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { BackupService } from './backup.service';
1616
import { DiffService } from './diff.service';
1717
import { ErrorRecoveryService } from './error-recovery.service';
1818
import { KiroComponentHandlerService } from './kiro-component-handler.service';
19+
import { KiroInstallationDetectorService } from './kiro-installation-detector.service';
1920
import { KiroTransformerService } from './kiro-transformer.service';
2021
import { LargeFileStreamerService } from './large-file-streamer.service';
2122
import { PerformanceMonitorService } from './performance-monitor.service';
@@ -34,6 +35,7 @@ export class DeploymentService {
3435
private readonly largeFileStreamer: LargeFileStreamerService,
3536
private readonly kiroTransformer: KiroTransformerService,
3637
private readonly kiroComponentHandler: KiroComponentHandlerService,
38+
private readonly kiroInstallationDetector: KiroInstallationDetectorService,
3739
) {}
3840

3941
async deployToClaudeCode(
@@ -309,7 +311,67 @@ export class DeploymentService {
309311
};
310312

311313
try {
312-
// Step 1: Validate configuration for Kiro platform
314+
// Step 1: Check Kiro installation and compatibility
315+
this.performanceMonitor.recordMemoryUsage(deploymentId, 'installation-check-start');
316+
317+
const installationInfo = await this.kiroInstallationDetector.detectKiroInstallation();
318+
319+
if (!installationInfo.isInstalled) {
320+
result.errors.push({
321+
message: 'Kiro IDE is not installed or not found in expected locations',
322+
code: 'KIRO_NOT_INSTALLED',
323+
severity: 'CRITICAL',
324+
});
325+
this.performanceMonitor.endDeploymentTiming(deploymentId);
326+
result.metadata!.performanceReport = 'Kiro deployment failed - installation not found';
327+
return result;
328+
}
329+
330+
// Add installation info to warnings for user visibility
331+
result.warnings.push({
332+
message: `Kiro IDE detected: v${installationInfo.version || 'unknown'} at ${installationInfo.installationPath}`,
333+
code: 'KIRO_INSTALLATION_DETECTED',
334+
});
335+
336+
// Check compatibility
337+
if (!installationInfo.isCompatible) {
338+
const compatibilityResult = await this.kiroInstallationDetector.checkCompatibility(installationInfo.version);
339+
340+
// Add compatibility issues as warnings or errors based on severity
341+
for (const issue of compatibilityResult.issues) {
342+
if (issue.severity === 'critical') {
343+
result.errors.push({
344+
message: `Compatibility issue: ${issue.message}`,
345+
code: 'KIRO_COMPATIBILITY_ERROR',
346+
severity: 'HIGH',
347+
});
348+
} else {
349+
result.warnings.push({
350+
message: `Compatibility warning: ${issue.message}`,
351+
code: 'KIRO_COMPATIBILITY_WARNING',
352+
});
353+
}
354+
}
355+
356+
// Stop deployment if critical compatibility issues exist
357+
if (compatibilityResult.issues.some(issue => issue.severity === 'critical')) {
358+
this.performanceMonitor.endDeploymentTiming(deploymentId);
359+
result.metadata!.performanceReport = 'Kiro deployment failed - compatibility issues';
360+
return result;
361+
}
362+
363+
// Add recommendations
364+
for (const recommendation of compatibilityResult.recommendations) {
365+
result.warnings.push({
366+
message: `Recommendation: ${recommendation}`,
367+
code: 'KIRO_RECOMMENDATION',
368+
});
369+
}
370+
}
371+
372+
this.performanceMonitor.recordMemoryUsage(deploymentId, 'installation-check-end');
373+
374+
// Step 2: Validate configuration for Kiro platform
313375
this.performanceMonitor.recordMemoryUsage(deploymentId, 'validation-start');
314376
const validationResult = await this.validatorService.validateForPlatform(
315377
context,
@@ -337,15 +399,15 @@ export class DeploymentService {
337399
}));
338400
}
339401

340-
// Step 2: Return early for validation-only mode
402+
// Step 3: Return early for validation-only mode
341403
if (options.validateOnly) {
342404
result.success = true;
343405
result.metadata!.performanceReport = 'Kiro validation completed successfully';
344406
this.performanceMonitor.endDeploymentTiming(deploymentId);
345407
return result;
346408
}
347409

348-
// Step 3: Security scan for Kiro components
410+
// Step 4: Security scan for Kiro components
349411
this.performanceMonitor.recordMemoryUsage(deploymentId, 'security-start');
350412

351413
// Transform TaptikContext to Kiro formats for security scanning
@@ -407,7 +469,7 @@ export class DeploymentService {
407469
});
408470
}
409471

410-
// Step 4: Validate transformation results
472+
// Step 5: Validate transformation results
411473
const validation = this.kiroTransformer.validateTransformation(
412474
globalSettings,
413475
projectTransformation.settings
@@ -433,12 +495,12 @@ export class DeploymentService {
433495
})));
434496
}
435497

436-
// Step 5: Create deployment context
498+
// Step 6: Create deployment context
437499
const homeDirectory = os.homedir();
438500
const projectDirectory = process.cwd();
439501
const deploymentContext = this.kiroTransformer.createDeploymentContext(homeDirectory, projectDirectory);
440502

441-
// Step 6: Apply deployment options filtering
503+
// Step 7: Apply deployment options filtering
442504
let componentsToProcess = ['settings', 'steering', 'specs', 'hooks', 'agents', 'templates'];
443505
if (options.components && options.components.length > 0) {
444506
componentsToProcess = options.components.filter(c => componentsToProcess.includes(c));
@@ -447,7 +509,7 @@ export class DeploymentService {
447509
componentsToProcess = componentsToProcess.filter(c => !options.skipComponents!.includes(c as ComponentType));
448510
}
449511

450-
// Step 7: Prepare deployment result with transformation data
512+
// Step 8: Prepare deployment result with transformation data
451513
result.success = true;
452514
result.deployedComponents = componentsToProcess;
453515
result.summary.filesDeployed = componentsToProcess.length; // Will be updated when actual file writing is implemented
@@ -485,7 +547,7 @@ export class DeploymentService {
485547
code: 'KIRO_TRANSFORMATION_INFO'
486548
});
487549

488-
// Step 7: Handle backup strategy
550+
// Step 9: Handle backup strategy
489551
if (options.conflictStrategy === 'backup') {
490552
try {
491553
const backupPath = await this.createKiroBackup();
@@ -503,7 +565,7 @@ export class DeploymentService {
503565
}
504566
}
505567

506-
// Step 8: Return early for dry-run mode
568+
// Step 10: Return early for dry-run mode
507569
if (options.dryRun) {
508570
result.success = true;
509571
result.warnings.push({
@@ -515,7 +577,7 @@ export class DeploymentService {
515577
return result;
516578
}
517579

518-
// Step 9: Deploy components using component handler
580+
// Step 11: Deploy components using component handler
519581
const kiroOptions = {
520582
platform: 'kiro-ide' as const,
521583
conflictStrategy: options.conflictStrategy,

0 commit comments

Comments
 (0)