From 437c41ec51a020a0dc67aaa844162a317782efae Mon Sep 17 00:00:00 2001 From: Lexical Bits Date: Sun, 13 Jul 2025 16:26:37 -0400 Subject: [PATCH] Use the project name in the export filename --- src/exporter.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/exporter.js b/src/exporter.js index c1e03bf..6c6e22b 100644 --- a/src/exporter.js +++ b/src/exporter.js @@ -76,12 +76,32 @@ const ArtifactExporter = { return finalMap; }, + toSnakeCase(str) { + return str + .replace(/([a-z])([A-Z])/g, '$1_$2') // camelCase to snake_case + .replace(/[\s\-\.]+/g, '_') // spaces, hyphens, dots to underscores + .replace(/[^\w]/g, '') // remove non-word characters + .toLowerCase() // convert to lowercase + .replace(/^_+|_+$/g, '') // trim leading/trailing underscores + .replace(/_+/g, '_'); // collapse multiple underscores + }, + generateZipFilename() { const now = new Date(); const timestamp = now.getFullYear() + '-' + String(now.getMonth() + 1).padStart(2, '0') + '-' + - String(now.getDate()).padStart(2, '0'); - return `${timestamp}_claude-artifacts.zip`; + String(now.getDate()).padStart(2, '0') + '_' + + String(now.getHours()).padStart(2, '0') + '-' + + String(now.getMinutes()).padStart(2, '0') + '-' + + String(now.getSeconds()).padStart(2, '0'); + + // Get project name and convert to snake_case + const rawProjectName = ProjectMeta.getProjectName(); + const projectName = (rawProjectName && rawProjectName.trim()) + ? this.toSnakeCase(rawProjectName.trim()) + : 'claude_artifacts'; + + return `${timestamp}_${projectName}.zip`; }, addFilesToZip(zip, finalMap) {