#!/usr/bin/env node
import { copyFile, mkdir, readdir } from "fs/promises";
import { join, dirname } from "path";
import { fileURLToPath } from "url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const commandsSource = join(__dirname, "..", ".claude", "commands");
const targetDir = process.argv[2] || process.cwd();
const commandsTarget = join(targetDir, ".claude", "commands");
async function install() {
console.log("Installing DevOps Helper slash commands...\n");
try {
// Create target directory
await mkdir(commandsTarget, { recursive: true });
// Copy command files
const files = await readdir(commandsSource);
for (const file of files) {
if (file.endsWith(".md")) {
await copyFile(join(commandsSource, file), join(commandsTarget, file));
console.log(` Installed: /project ${file.replace(".md", "")}`);
}
}
console.log(`\nCommands installed to: ${commandsTarget}`);
console.log("\nAvailable commands:");
console.log(" /onboard-dev - Full developer environment check");
console.log(" /docker-setup - Create Dockerfile for project");
console.log(" /github-pr - Create a pull request");
console.log(" /ghcr-push - Push image to GitHub Container Registry");
console.log(" /github-actions - Create CI/CD workflow");
console.log(" /github-secrets - Manage GitHub Actions secrets");
console.log(" /sonarcloud - Set up SonarCloud code analysis");
console.log(" /azure-deploy - Deploy containers to Azure");
console.log(" /git-help - Contextual git assistance");
} catch (error) {
console.error("Error installing commands:", error.message);
process.exit(1);
}
}
install();