Remove requirement for chats to be in a project

This commit is contained in:
2025-07-17 11:52:30 -04:00
parent 12e0f709bc
commit e68bfc1d12
3 changed files with 11 additions and 20 deletions

View File

@ -1,17 +1,8 @@
async function main() {
console.log('Running artifact collector');
const currentUrl = window.location.href;
const isProjectPage = currentUrl.includes('/project/');
const isChatPage = currentUrl.includes('/chat/');
if (!isProjectPage && !isChatPage) {
console.log('Not on a project or chat page, exiting');
return;
}
if (!ProjectMeta.isInProject()) {
console.log('Not in a project context, exiting');
if (!ProjectMeta.isScrapable()) {
console.log('Not in a scrapable context, exiting');
return;
}

View File

@ -13,10 +13,10 @@ const ProjectMeta = {
// Fallback: try to get from H1 (project pages)
const projectH1 = document.querySelector('h1.font-ui-serif');
if (projectH1) {
return projectH1.textContent.trim() || null;
return projectH1.textContent.trim() || 'Claude Project';
}
return null;
return 'Claude Project';
},
getChatName() {
@ -28,8 +28,8 @@ const ProjectMeta = {
return chatNameDiv.textContent.trim() || null;
},
isProjectChat() {
return Boolean(this.getProjectName()) && Boolean(this.getChatName());
isChat() {
return Boolean(this.getChatName());
},
isProjectPage() {
@ -40,8 +40,8 @@ const ProjectMeta = {
return Boolean(this.getProjectName()) && hasProjectKnowledge;
},
isInProject() {
return this.isProjectChat() || this.isProjectPage();
isScrapable() {
return this.isChat() || this.isProjectPage();
}
};

View File

@ -350,14 +350,14 @@ const ProjectArtifactScraper = {
const ArtifactScraper = {
async collectArtifacts() {
if (ProjectMeta.isProjectChat()) {
console.log('Detected project chat - using ChatArtifactScraper');
if (ProjectMeta.isChat()) {
console.log('Detected chat - using ChatArtifactScraper');
return await ChatArtifactScraper.collectArtifacts();
} else if (ProjectMeta.isProjectPage()) {
console.log('Detected project page - using ProjectArtifactScraper');
return await ProjectArtifactScraper.collectArtifacts();
} else {
throw new Error('Unknown page type - not a project chat or project page');
throw new Error('Unknown page type - not a chat or project page');
}
}