create-claude-cabinet 0.29.3 → 0.29.5
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.
package/lib/site-audit-setup.js
CHANGED
|
@@ -44,8 +44,12 @@ function setupSiteAuditRuntime(opts = {}) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if (fs.existsSync(tarballPath) && fs.statSync(tarballPath).size > 1024) {
|
|
47
|
-
|
|
47
|
+
// Tarball exists — ensure it's extracted and installed (may have been
|
|
48
|
+
// packed but not installed on a prior run)
|
|
49
|
+
extractAndInstall(path.join(SITE_AUDIT_BASE, version), tarballPath, results);
|
|
50
|
+
updateCurrentBinSymlink(SITE_AUDIT_BASE, version);
|
|
48
51
|
writeVersionPointer(versionPointer, version);
|
|
52
|
+
results.push(`@claude-cabinet/site-audit@${version} already installed (${tarballPath})`);
|
|
49
53
|
return { installPath: installDir, version, status: 'skipped', results };
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -70,12 +74,46 @@ function setupSiteAuditRuntime(opts = {}) {
|
|
|
70
74
|
throw new Error(`site-audit-setup: tarball not found after npm pack: ${tarballPath}`);
|
|
71
75
|
}
|
|
72
76
|
|
|
77
|
+
// Extract and install so the runtime is runnable (not just a tarball)
|
|
78
|
+
extractAndInstall(path.join(SITE_AUDIT_BASE, version), tarballPath, results);
|
|
79
|
+
|
|
73
80
|
writeVersionPointer(versionPointer, version);
|
|
81
|
+
updateCurrentBinSymlink(SITE_AUDIT_BASE, version);
|
|
74
82
|
results.push(`Installed @claude-cabinet/site-audit@${version}`);
|
|
75
83
|
results.push(` ${tarballPath}`);
|
|
76
84
|
return { installPath: installDir, version, status: 'installed', results };
|
|
77
85
|
}
|
|
78
86
|
|
|
87
|
+
function extractAndInstall(versionDir, tarballPath, results) {
|
|
88
|
+
const pkgDir = path.join(versionDir, 'package');
|
|
89
|
+
if (fs.existsSync(path.join(pkgDir, 'node_modules'))) return;
|
|
90
|
+
|
|
91
|
+
execSync(`tar xf "${tarballPath}" -C "${versionDir}"`, { encoding: 'utf8' });
|
|
92
|
+
execSync('npm install --omit=dev --ignore-scripts --silent', { cwd: pkgDir, encoding: 'utf8' });
|
|
93
|
+
|
|
94
|
+
const binDir = path.join(versionDir, 'bin');
|
|
95
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
96
|
+
const binSrc = path.join(pkgDir, 'bin', 'cc-site-audit');
|
|
97
|
+
const binDst = path.join(binDir, 'cc-site-audit');
|
|
98
|
+
if (fs.existsSync(binSrc)) {
|
|
99
|
+
try { fs.unlinkSync(binDst); } catch { /* may not exist */ }
|
|
100
|
+
fs.symlinkSync(binSrc, binDst);
|
|
101
|
+
fs.chmodSync(binSrc, 0o755);
|
|
102
|
+
}
|
|
103
|
+
results.push(` Extracted and installed to ${pkgDir}`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function updateCurrentBinSymlink(baseDir, version) {
|
|
107
|
+
const currentDir = path.join(baseDir, 'current');
|
|
108
|
+
fs.mkdirSync(currentDir, { recursive: true });
|
|
109
|
+
const binLink = path.join(currentDir, 'bin');
|
|
110
|
+
const targetBin = path.join(baseDir, version, 'bin');
|
|
111
|
+
try { fs.unlinkSync(binLink); } catch { /* may not exist */ }
|
|
112
|
+
if (fs.existsSync(targetBin)) {
|
|
113
|
+
fs.symlinkSync(targetBin, binLink);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
79
117
|
function writeVersionPointer(pointerPath, version) {
|
|
80
118
|
fs.mkdirSync(path.dirname(pointerPath), { recursive: true });
|
|
81
119
|
fs.writeFileSync(pointerPath, version + '\n', 'utf8');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-cabinet/site-audit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Comprehensive deployed-site quality audit engine for Claude Cabinet. Runs checks across performance, accessibility, security, SEO, content, DNS, and privacy against a deployed URL; single-site and comparison modes; standalone HTML report.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -85,7 +85,7 @@ export function validateOptions(opts) {
|
|
|
85
85
|
function writeReport(html, report, outDir, suffix = '') {
|
|
86
86
|
const dir = outDir || 'reports';
|
|
87
87
|
mkdirSync(dir, { recursive: true });
|
|
88
|
-
const host = sanitizeHostname(report.url);
|
|
88
|
+
const host = sanitizeHostname(report.url || report.urlA || 'unknown');
|
|
89
89
|
const ts = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
90
90
|
let base = `site-audit-${host}-${ts}${suffix ? '-' + suffix : ''}`;
|
|
91
91
|
let path = join(dir, `${base}.html`);
|