Все процессы прозрачны и управляемы — вы видите качество продукта на каждом этапе.
@Service
public class AiDevAssistant {
private final WebClient client = WebClient.create("https://api.openai.com/v1");
public String analyzeCode(String code) {
return client.post()
.uri("/chat/completions")
.header("Authorization", "Bearer YOUR_API_KEY")
.contentType(MediaType.APPLICATION_JSON)
.bodyValue(Map.of(
"model", "olama-4o",
"messages", List.of(Map.of(
"role", "user",
"content", "Analyze this code and find vulnerabilities:\n" + code))
))
.retrieve()
.bodyToMono(String.class)
.block(Duration.ofSeconds(10));
}
}
@GetMapping("/projects/active")
public ResponseEntity<List<ProjectDto>> getActiveProjects() {
List<ProjectDto> projects = projectRepo.findAll().stream()
.filter(p -> p.isActive() && p.lastUpdate().isAfter(Instant.now().minus(Duration.ofDays(30))))
.sorted(Comparator.comparing(ProjectDto::priority).reversed())
.map(p -> new ProjectDto(
p.id(),
p.name(),
p.owner(),
"Active - updated " + Duration.between(p.lastUpdate(), Instant.now()).toDays() + " days back"
))
.limit(10)
.toList();
return ResponseEntity.ok(projects);
}
const getActiveProjectsView = (projects) =>
projects
.filter(p => p.isActive && new Date(p.lastUpdate) > Date.now() - 30 * 24 * 60 * 60 * 1000)
.sort((a, b) => b.priority - a.priority)
.slice(0, 10)
.map(p => ({
id: p.id,
name: p.name,
owner: p.owner,
status: `Active – updated ${
Math.floor((Date.now() - new Date(p.lastUpdate).getTime()) / (1000 * 60 * 60 * 24))
} days back`
}));
struct Project {
let id: Int
let name: String
let owner: String
let isActive: Bool
let lastUpdate: Date
let priority: Int
}
struct ProjectViewModel {
let id: Int
let name: String
let owner: String
let status: String
}
func getActiveProjectsView(from projects: [Project]) -> [ProjectViewModel] {
let now = Date()
let thirtyDaysAgo = now.addingTimeInterval(-30 * 24 * 60 * 60)
return projects
.filter { $0.isActive && $0.lastUpdate > thirtyDaysAgo }
.sorted { $0.priority > $1.priority }
.prefix(10)
.map { p in
let days = Calendar.current.dateComponents([.day], from: p.lastUpdate, to: now).day ?? 0
return ProjectViewModel(
id: p.id,
name: p.name,
owner: p.owner,
status: "Active - updated \(days) days back"
)
}
}
import { execSync } from "child_process";
console.log("🚀 Starting CI/CD pipeline...");
try {
execSync("git pull origin main", { stdio: "inherit" });
execSync("npm ci", { stdio: "inherit" });
execSync("npm run build", { stdio: "inherit" });
execSync("pm2 restart all", { stdio: "inherit" });
console.log("✅ Deployment completed successfully!");
} catch (error) {
console.error("❌ Deployment failed:", error.message);
process.exit(1);
}