mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-19 01:26:29 +03:00
Re-adds the toggle in the install section that lets users download bundles with all user-invokable skills prefixed with i- (e.g. /i-audit) to avoid naming conflicts. Build now produces both unprefixed and prefixed variants for all providers and universal ZIP. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
import { readFileSync, existsSync } from "fs";
|
|
import { join, dirname } from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
const PROJECT_ROOT = join(__dirname, "../../..");
|
|
|
|
const ALLOWED_PROVIDERS = [
|
|
'cursor', 'claude-code', 'gemini', 'codex', 'agents', 'universal',
|
|
'cursor-prefixed', 'claude-code-prefixed', 'gemini-prefixed', 'codex-prefixed', 'agents-prefixed', 'universal-prefixed',
|
|
];
|
|
|
|
export default function handler(req, res) {
|
|
try {
|
|
const { provider } = req.query;
|
|
|
|
if (!provider || !ALLOWED_PROVIDERS.includes(provider)) {
|
|
return res.status(400).json({ error: "Invalid provider" });
|
|
}
|
|
|
|
const distDir = join(PROJECT_ROOT, "dist");
|
|
const zipPath = join(distDir, `${provider}.zip`);
|
|
|
|
if (!existsSync(zipPath)) {
|
|
return res.status(404).json({ error: "Bundle not found" });
|
|
}
|
|
|
|
const content = readFileSync(zipPath);
|
|
res.setHeader("Content-Type", "application/zip");
|
|
const safeProvider = provider.replace(/[^a-zA-Z0-9._-]/g, '');
|
|
res.setHeader("Content-Disposition", `attachment; filename="impeccable-style-${safeProvider}.zip"`);
|
|
res.send(content);
|
|
} catch (error) {
|
|
console.error("Error downloading bundle:", error);
|
|
res.status(500).json({ error: "Internal server error" });
|
|
}
|
|
}
|
|
|