diff --git a/docs/fumadocs/package.json b/docs/fumadocs/package.json index ab44fbbb..496497c6 100644 --- a/docs/fumadocs/package.json +++ b/docs/fumadocs/package.json @@ -21,7 +21,8 @@ "next-themes": "^0.4.6", "react": "^19.2.3", "react-dom": "^19.2.3", - "tailwind-merge": "^3.4.0" + "tailwind-merge": "^3.4.0", + "turndown": "^7.2.2" }, "devDependencies": { "@tailwindcss/postcss": "^4.1.18", @@ -29,6 +30,7 @@ "@types/node": "^24.10.2", "@types/react": "^19.2.7", "@types/react-dom": "^19.2.3", + "@types/turndown": "^5.0.6", "postcss": "^8.5.6", "tailwindcss": "^4.1.18", "typescript": "^5.9.3" diff --git a/docs/fumadocs/src/app/api/save-skill/route.ts b/docs/fumadocs/src/app/api/save-skill/route.ts new file mode 100644 index 00000000..34ea66f2 --- /dev/null +++ b/docs/fumadocs/src/app/api/save-skill/route.ts @@ -0,0 +1,291 @@ +import { NextRequest, NextResponse } from 'next/server'; +import TurndownService from 'turndown'; + +const rateLimitMap = new Map(); +const RATE_LIMIT_WINDOW_MS = 60 * 1000; +const RATE_LIMIT_MAX_REQUESTS = 10; + +function checkRateLimit(key: string): { allowed: boolean; remaining: number } { + const now = Date.now(); + const entry = rateLimitMap.get(key); + + if (!entry || now > entry.resetTime) { + rateLimitMap.set(key, { count: 1, resetTime: now + RATE_LIMIT_WINDOW_MS }); + return { allowed: true, remaining: RATE_LIMIT_MAX_REQUESTS - 1 }; + } + + if (entry.count >= RATE_LIMIT_MAX_REQUESTS) { + return { allowed: false, remaining: 0 }; + } + + entry.count++; + return { allowed: true, remaining: RATE_LIMIT_MAX_REQUESTS - entry.count }; +} + +const BLOCKED_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]', '::1', '0.0.0.0']); + +function isAllowedUrl(url: string): boolean { + try { + const parsed = new URL(url); + if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return false; + + const hostname = parsed.hostname.toLowerCase(); + const bare = hostname.replace(/^\[|\]$/g, ''); + + if (BLOCKED_HOSTS.has(hostname) || BLOCKED_HOSTS.has(bare)) return false; + if (bare.startsWith('::ffff:')) return isAllowedUrl(`http://${bare.slice(7)}`); + if (/^127\./.test(bare) || /^0\./.test(bare)) return false; + if (bare.startsWith('10.') || bare.startsWith('192.168.')) return false; + if (/^172\.(1[6-9]|2\d|3[01])\./.test(bare)) return false; + if (bare.startsWith('169.254.')) return false; + if (bare.startsWith('fe80:') || bare.startsWith('fc00:') || bare.startsWith('fd')) return false; + if (/^(22[4-9]|23\d|24\d|25[0-5])\./.test(bare)) return false; + if (/^ff[0-9a-f]{2}:/.test(bare)) return false; + return true; + } catch { + return false; + } +} + +const GITHUB_URL_PATTERN = /^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/blob\/([^/]+)\/(.+)$/; +const GITHUB_RAW_PATTERN = /^https?:\/\/raw\.githubusercontent\.com\//; +const FETCH_TIMEOUT = 30_000; + +const TECH_KEYWORDS = new Set([ + 'react', 'vue', 'angular', 'svelte', 'nextjs', 'nuxt', 'remix', + 'typescript', 'javascript', 'python', 'rust', 'go', 'java', 'ruby', + 'node', 'deno', 'bun', 'docker', 'kubernetes', 'terraform', + 'aws', 'gcp', 'azure', 'vercel', 'netlify', 'cloudflare', + 'graphql', 'rest', 'grpc', 'websocket', 'redis', 'postgres', + 'mongodb', 'sqlite', 'mysql', 'prisma', 'drizzle', + 'tailwind', 'css', 'html', 'sass', 'webpack', 'vite', 'esbuild', + 'git', 'ci', 'cd', 'testing', 'security', 'authentication', + 'api', 'cli', 'sdk', 'mcp', 'llm', 'ai', 'ml', 'openai', 'anthropic', +]); + +const TAG_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/; + +const turndown = new TurndownService({ headingStyle: 'atx', codeBlockStyle: 'fenced' }); + +interface ExtractedContent { + title: string; + content: string; + sourceUrl: string; + contentType: string; + language?: string; +} + +async function extractFromUrl(url: string): Promise { + if (GITHUB_URL_PATTERN.test(url) || GITHUB_RAW_PATTERN.test(url)) { + return fetchGitHubContent(url); + } + + const MAX_BODY_SIZE = 5 * 1024 * 1024; + const response = await fetch(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT) }); + if (!response.ok) { + throw new Error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`); + } + + const contentLength = Number(response.headers.get('content-length') || '0'); + if (contentLength > MAX_BODY_SIZE) { + throw new Error('Response too large'); + } + + const contentType = response.headers.get('content-type') ?? ''; + const body = await response.text(); + if (body.length > MAX_BODY_SIZE) { + throw new Error('Response too large'); + } + + if (contentType.includes('text/html')) { + const titleMatch = body.match(/]*>([^<]+)<\/title>/i); + const title = titleMatch?.[1]?.trim() ?? new URL(url).hostname; + const bodyMatch = body.match(/]*>([\s\S]*)<\/body>/i); + const content = turndown.turndown(bodyMatch?.[1] ?? body); + return { title, content, sourceUrl: url, contentType: 'webpage' }; + } + + const title = new URL(url).pathname.split('/').pop() ?? 'Untitled'; + return { title, content: body, sourceUrl: url, contentType: 'text' }; +} + +const LANG_MAP: Record = { + '.ts': 'typescript', '.tsx': 'typescript', '.js': 'javascript', '.jsx': 'javascript', + '.py': 'python', '.rb': 'ruby', '.go': 'go', '.rs': 'rust', '.java': 'java', + '.kt': 'kotlin', '.swift': 'swift', '.sh': 'shell', '.yml': 'yaml', '.yaml': 'yaml', + '.json': 'json', '.md': 'markdown', '.html': 'html', '.css': 'css', '.sql': 'sql', +}; + +async function fetchGitHubContent(url: string): Promise { + let rawUrl = url; + const match = url.match(GITHUB_URL_PATTERN); + if (match) { + const [, owner, repo, branch, path] = match; + rawUrl = `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${path}`; + } + + const MAX_BODY_SIZE = 5 * 1024 * 1024; + const response = await fetch(rawUrl, { signal: AbortSignal.timeout(FETCH_TIMEOUT) }); + if (!response.ok) { + throw new Error(`Failed to fetch GitHub content: ${response.status} ${response.statusText}`); + } + + const contentLength = Number(response.headers.get('content-length') || '0'); + if (contentLength > MAX_BODY_SIZE) { + throw new Error('Response too large'); + } + + const body = await response.text(); + if (body.length > MAX_BODY_SIZE) { + throw new Error('Response too large'); + } + const filename = rawUrl.split('/').pop() ?? 'file'; + const ext = filename.includes('.') ? '.' + filename.split('.').pop()!.toLowerCase() : ''; + const language = LANG_MAP[ext]; + const isCode = language !== undefined && language !== 'markdown'; + const content = isCode ? `\`\`\`${language}\n${body}\n\`\`\`` : body; + + return { title: filename, content, sourceUrl: url, contentType: 'github', language }; +} + +function addTag(counts: Map, tag: string, weight: number): void { + if (TAG_PATTERN.test(tag)) { + counts.set(tag, (counts.get(tag) ?? 0) + weight); + } +} + +function detectTags(extracted: ExtractedContent): string[] { + const counts = new Map(); + + try { + const segments = new URL(extracted.sourceUrl).pathname + .split('/').filter(Boolean) + .map((s) => s.toLowerCase().replace(/[^a-z0-9-]/g, '')); + for (const seg of segments) { + if (seg.length >= 2 && seg.length <= 30) { + addTag(counts, seg, 2); + } + } + } catch { /* skip */ } + + const headingRe = /^#{1,2}\s+(.+)$/gm; + let m: RegExpExecArray | null; + while ((m = headingRe.exec(extracted.content)) !== null) { + for (const word of m[1].toLowerCase().split(/\s+/)) { + const cleaned = word.replace(/[^a-z0-9-]/g, ''); + if (cleaned.length >= 2) { + addTag(counts, cleaned, 2); + } + } + } + + const codeBlockRe = /^```(\w+)/gm; + while ((m = codeBlockRe.exec(extracted.content)) !== null) { + const lang = m[1].toLowerCase(); + if (lang.length >= 2) { + addTag(counts, lang, 3); + } + } + + const lower = extracted.content.toLowerCase(); + for (const keyword of TECH_KEYWORDS) { + if (new RegExp(`\\b${keyword}\\b`, 'i').test(lower)) { + addTag(counts, keyword, 1); + } + } + + if (extracted.language) { + addTag(counts, extracted.language.toLowerCase(), 3); + } + + return Array.from(counts.entries()) + .sort((a, b) => b[1] - a[1]) + .slice(0, 10) + .map(([tag]) => tag); +} + +function slugify(input: string): string { + const slug = input + .toLowerCase() + .replace(/[^a-z0-9]+/g, '-') + .replace(/^-+|-+$/g, '') + .replace(/-{2,}/g, '-'); + return slug.slice(0, 64).replace(/-+$/, '') || 'untitled-skill'; +} + +function yamlEscape(value: string): string { + const singleLine = value.replace(/\r?\n/g, ' ').trim(); + if (/[:#{}[\],&*?|>!%@`]/.test(singleLine) || singleLine.startsWith("'") || singleLine.startsWith('"')) { + return `"${singleLine.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`; + } + return singleLine; +} + +export async function POST(request: NextRequest) { + const ip = request.headers.get('x-forwarded-for')?.split(',')[0]?.trim() ?? 'unknown'; + const { allowed, remaining } = checkRateLimit(ip); + + if (!allowed) { + return NextResponse.json( + { error: 'Too many requests. Try again in a minute.' }, + { status: 429, headers: { 'X-RateLimit-Remaining': '0', 'Retry-After': '60' } }, + ); + } + + let body: { url?: string; name?: string }; + try { + body = await request.json(); + } catch { + return NextResponse.json({ error: 'Invalid JSON body' }, { status: 400 }); + } + + const { url, name } = body; + if (!url || typeof url !== 'string') { + return NextResponse.json({ error: 'Missing required field: url' }, { status: 400 }); + } + + if (name !== undefined && typeof name !== 'string') { + return NextResponse.json({ error: 'Field "name" must be a string' }, { status: 400 }); + } + + if (!isAllowedUrl(url)) { + return NextResponse.json({ error: 'URL not allowed' }, { status: 403 }); + } + + try { + const extracted = await extractFromUrl(url); + const tags = detectTags(extracted); + + const skillName = slugify(name || extracted.title || 'untitled'); + const description = extracted.content + .split('\n') + .find((l) => l.trim().length > 0) + ?.replace(/^#+\s*/, '') + .trim() + .slice(0, 200) || 'Saved skill'; + const savedAt = new Date().toISOString(); + + const yamlTags = tags.length > 0 + ? `tags:\n${tags.map((t) => ` - ${t}`).join('\n')}\n` + : ''; + + const skillMd = + `---\n` + + `name: ${skillName}\n` + + `description: ${yamlEscape(description)}\n` + + yamlTags + + `metadata:\n` + + ` source: ${yamlEscape(url)}\n` + + ` savedAt: ${savedAt}\n` + + `---\n\n` + + extracted.content + '\n'; + + return NextResponse.json( + { name: skillName, skillMd, tags, description }, + { headers: { 'X-RateLimit-Remaining': String(remaining) } }, + ); + } catch (err) { + const message = err instanceof Error ? err.message : 'Failed to extract content'; + return NextResponse.json({ error: message }, { status: 502 }); + } +} diff --git a/docs/skillkit/public/privacy.html b/docs/skillkit/public/privacy.html index 691993db..32910360 100644 --- a/docs/skillkit/public/privacy.html +++ b/docs/skillkit/public/privacy.html @@ -24,21 +24,30 @@
← Back to SkillKit

Privacy Policy

-

Last updated: February 10, 2026

+

Last updated: February 14, 2026

Overview

SkillKit ("we", "our", "us") is an open-source CLI tool and Chrome extension for managing AI agent skills. We are committed to protecting your privacy. This policy explains what data we collect (or don't) across all SkillKit products.

Chrome Extension — "SkillKit - Save as Skill"

-

The Chrome extension operates entirely within your browser. It does not collect, transmit, or store any personal data externally.

+

The Chrome extension helps you save webpages as AI agent skill files.

    -
  • No data collection: We do not collect browsing history, page content, personal information, or any other user data.
  • -
  • No external requests: The extension makes zero network requests. All processing (HTML to markdown conversion, SKILL.md generation) happens locally in your browser.
  • +
  • What data is sent: When you click "Save as Skill", the extension sends the URL of the current page to our server at agenstskills.com/api/save-skill. This is required to fetch and convert the webpage content into a skill file.
  • +
  • What data is NOT sent: We do not send page content, browsing history, personal information, cookies, authentication tokens, or any data beyond the single URL you choose to save.
  • +
  • No data stored on server: The URL is processed in real time to extract content, generate tags, and build the skill file. No URLs, page content, or user data are stored, logged, or retained on the server after the response is returned.
  • +
  • Selection saves are local: When you save selected text via the right-click menu, the skill file is built entirely in the browser with no network requests.
  • No analytics or tracking: We do not use any analytics, telemetry, or tracking services.
  • -
  • Local storage only: The Chrome storage API is used solely to store user preferences (e.g., default settings) on your device. This data never leaves your browser.
  • +
  • No user accounts: No login, API key, or account is required.
  • Downloads: Generated skill files are saved to your local filesystem via the Chrome Downloads API. No files are uploaded anywhere.
+

Permissions Used

+
    +
  • activeTab: Read the URL and title of the tab you are viewing when you click the extension. Only accessed when you actively use the extension.
  • +
  • contextMenus: Add "Save page as Skill" and "Save selection as Skill" to the right-click menu.
  • +
  • downloads: Save the generated SKILL.md file to your Downloads folder.
  • +
+

CLI Tool

The SkillKit CLI runs entirely on your local machine. It does not phone home, collect telemetry, or transmit any data to external servers unless you explicitly use network features (e.g., skillkit install fetches public GitHub repositories).

@@ -49,10 +58,10 @@

The SkillKit website (agenstskills.com) is a static site hosted on Vercel. We do not use cookies, analytics trackers, or collect personal information. Vercel may collect standard web server logs (IP address, user agent) as described in their privacy policy.

Third-Party Services

-

SkillKit does not integrate with any third-party data processors, advertising networks, or analytics services.

+

The Chrome extension communicates with agenstskills.com (our own server, hosted on Vercel) to process webpage URLs. No third-party data processors, advertising networks, or analytics services are used.

Data Retention

-

We do not retain any user data because we do not collect any user data.

+

We do not retain any user data. URLs sent to the API are processed in memory and discarded immediately after the response.

Changes to This Policy

We may update this privacy policy from time to time. Changes will be posted on this page with an updated revision date.

diff --git a/packages/extension/package.json b/packages/extension/package.json index 6eaa653a..05b6ab43 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -9,12 +9,9 @@ "dev": "tsup --watch", "typecheck": "tsc --noEmit" }, - "dependencies": { - "turndown": "^7.2.2" - }, + "dependencies": {}, "devDependencies": { "@types/chrome": "^0.0.280", - "@types/turndown": "^5.0.6", "tsup": "^8.3.5", "typescript": "^5.7.2" } diff --git a/packages/extension/src/background.ts b/packages/extension/src/background.ts index d577caab..e7405c3e 100644 --- a/packages/extension/src/background.ts +++ b/packages/extension/src/background.ts @@ -1,13 +1,6 @@ import type { SaveResponse, ErrorResponse, ExtensionMessage } from './types'; -const TECH_KEYWORDS = new Set([ - 'react', 'vue', 'angular', 'svelte', 'next', 'nuxt', 'node', 'deno', 'bun', - 'typescript', 'javascript', 'python', 'rust', 'go', 'java', 'kotlin', 'swift', - 'docker', 'kubernetes', 'aws', 'gcp', 'azure', 'terraform', 'ansible', - 'graphql', 'rest', 'api', 'sql', 'nosql', 'redis', 'postgres', 'mongodb', - 'testing', 'ci', 'cd', 'git', 'webpack', 'vite', 'tailwind', 'css', - 'ai', 'ml', 'llm', 'mcp', 'agent', 'prompt', 'rag', 'embedding', -]); +const API_URL = 'https://agenstskills.com/api/save-skill'; chrome.runtime.onInstalled.addListener(() => { chrome.contextMenus.create({ @@ -28,83 +21,107 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => { try { if (info.menuItemId === 'save-page') { - const pageInfo = await chrome.tabs.sendMessage(tab.id, { type: 'GET_PAGE_INFO' }); - if (pageInfo?.type === 'PAGE_INFO') { - const { url, title, markdown } = pageInfo.payload; - const result = generateAndDownload({ url, title, content: markdown }); - notifyTab(tab.id, result); + const url = tab.url ?? ''; + if (!url || url.startsWith('chrome://') || url.startsWith('about:')) { + notifyTab(tab.id, { error: 'Cannot save skills from this page' }); + return; } + const result = await callSaveApi(url); + if (!('error' in result)) { + downloadSkill(result.name, result.skillMd); + } + notifyTab(tab.id, result); } if (info.menuItemId === 'save-selection' && info.selectionText) { const url = tab.url ?? ''; - const result = generateAndDownload({ url, title: '', content: info.selectionText }); + const result = buildSelectionSkill(info.selectionText, url); + downloadSkill(result.name, result.skillMd); notifyTab(tab.id, result); } } catch { - notifyTab(tab.id, { error: 'Failed to extract page content' }); + notifyTab(tab.id, { error: 'Failed to save skill' }); } }); chrome.runtime.onMessage.addListener( (message: ExtensionMessage, _sender, sendResponse) => { if (message.type === 'SAVE_PAGE') { - const { url, title, markdown, name } = message.payload; - sendResponse(generateAndDownload({ url, title, content: markdown, name })); - } else if (message.type === 'SAVE_SELECTION') { - const { text, url, name } = message.payload; - sendResponse(generateAndDownload({ url, title: '', content: text, name })); + const { url, name } = message.payload; + callSaveApi(url, name).then((result) => { + if (!('error' in result)) { + downloadSkill(result.name, result.skillMd); + } + sendResponse(result); + }).catch(() => { + sendResponse({ error: 'Failed to save skill' }); + }); + return true; } + + if (message.type === 'SAVE_SELECTION') { + const { text, url, name } = message.payload; + const result = buildSelectionSkill(text, url, name); + downloadSkill(result.name, result.skillMd); + sendResponse(result); + } + return false; }, ); -interface GenerateInput { - url: string; - title: string; - content: string; - name?: string; +async function callSaveApi(url: string, name?: string): Promise { + const response = await fetch(API_URL, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ url, name }), + }); + + let data: Record; + try { + data = await response.json(); + } catch { + return { error: `Server error: ${response.status}` }; + } + if (!response.ok) { + return { error: (data.error as string) ?? `Server error: ${response.status}` }; + } + return { + name: data.name as string, + filename: `${data.name}/SKILL.md`, + skillMd: data.skillMd as string, + tags: (data.tags as string[]) ?? [], + }; } -function generateAndDownload(input: GenerateInput): SaveResponse | ErrorResponse { - try { - const name = slugify(input.name || input.title || titleFromUrl(input.url)); - const tags = detectTags(input.url, input.content); - const description = makeDescription(input.content); - const savedAt = new Date().toISOString(); +function buildSelectionSkill(text: string, url: string, name?: string): SaveResponse { + const skillName = slugify(name || 'selection'); + const savedAt = new Date().toISOString(); - const yamlTags = tags.length > 0 - ? `tags:\n${tags.map((t) => ` - ${t}`).join('\n')}\n` - : ''; + const skillMd = + `---\n` + + `name: ${skillName}\n` + + `description: Selected text saved as skill\n` + + `metadata:\n` + + (url ? ` source: ${yamlEscape(url)}\n` : '') + + ` savedAt: ${savedAt}\n` + + `---\n\n` + + text + '\n'; - const skillMd = - `---\n` + - `name: ${name}\n` + - `description: ${yamlEscape(description)}\n` + - yamlTags + - `metadata:\n` + - (input.url ? ` source: ${input.url}\n` : '') + - ` savedAt: ${savedAt}\n` + - `---\n\n` + - input.content + '\n'; + return { + name: skillName, + filename: `${skillName}/SKILL.md`, + skillMd, + tags: [], + }; +} - const filename = `${name}/SKILL.md`; - - const blob = new Blob([skillMd], { type: 'text/markdown' }); - const blobUrl = URL.createObjectURL(blob); - - chrome.downloads.download({ - url: blobUrl, - filename: `skillkit-skills/${filename}`, - saveAs: false, - }, () => { - URL.revokeObjectURL(blobUrl); - }); - - return { name, filename, skillMd, tags }; - } catch (err) { - return { error: err instanceof Error ? err.message : 'Generation failed' }; +function yamlEscape(value: string): string { + const singleLine = value.replace(/\r?\n/g, ' ').trim(); + if (/[:#{}[\],&*?|>!%@`]/.test(singleLine) || singleLine.startsWith("'") || singleLine.startsWith('"')) { + return `"${singleLine.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`; } + return singleLine; } function slugify(input: string): string { @@ -116,39 +133,16 @@ function slugify(input: string): string { return slug.slice(0, 64).replace(/-+$/, '') || 'untitled-skill'; } -function titleFromUrl(url: string): string { - try { - const pathname = new URL(url).pathname; - const last = pathname.split('/').filter(Boolean).pop(); - return last ?? 'untitled'; - } catch { - return 'untitled'; - } -} - -function makeDescription(content: string): string { - const firstLine = content.split('\n').find((l) => l.trim().length > 0) ?? ''; - const cleaned = firstLine.replace(/^#+\s*/, '').trim(); - if (cleaned.length > 200) return cleaned.slice(0, 197) + '...'; - return cleaned || 'Saved skill'; -} - -function yamlEscape(value: string): string { - const singleLine = value.replace(/\r?\n/g, ' ').trim(); - if (/[:#{}[\],&*?|>!%@`]/.test(singleLine) || singleLine.startsWith("'") || singleLine.startsWith('"')) { - return `"${singleLine.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`; - } - return singleLine; -} - -function detectTags(url: string, content: string): string[] { - const text = `${url} ${content}`.toLowerCase(); - const found: string[] = []; - for (const kw of TECH_KEYWORDS) { - if (text.includes(kw)) found.push(kw); - if (found.length >= 10) break; - } - return found; +function downloadSkill(name: string, skillMd: string): void { + const blob = new Blob([skillMd], { type: 'text/markdown' }); + const blobUrl = URL.createObjectURL(blob); + chrome.downloads.download({ + url: blobUrl, + filename: `skillkit-skills/${name}/SKILL.md`, + saveAs: false, + }, () => { + URL.revokeObjectURL(blobUrl); + }); } function notifyTab(tabId: number, result: SaveResponse | ErrorResponse): void { diff --git a/packages/extension/src/content.ts b/packages/extension/src/content.ts deleted file mode 100644 index 1d352696..00000000 --- a/packages/extension/src/content.ts +++ /dev/null @@ -1,38 +0,0 @@ -import TurndownService from 'turndown'; -import type { ExtensionMessage, PageContent } from './types'; - -const turndown = new TurndownService({ - headingStyle: 'atx', - codeBlockStyle: 'fenced', -}); - -turndown.remove(['script', 'style', 'nav', 'footer', 'iframe', 'noscript']); - -function extractPageContent(): PageContent { - const selection = window.getSelection()?.toString() ?? ''; - const description = - document.querySelector('meta[name="description"]')?.getAttribute('content') ?? ''; - - const article = document.querySelector('article, main, [role="main"]'); - const source = article ?? document.body; - const markdown = turndown.turndown(source.innerHTML); - - return { - url: window.location.href, - title: document.title || description || window.location.hostname, - markdown, - selection, - description, - }; -} - -chrome.runtime.onMessage.addListener( - (message: ExtensionMessage, _sender, sendResponse) => { - if (message.type === 'GET_PAGE_INFO') { - const content = extractPageContent(); - const response: ExtensionMessage = { type: 'PAGE_INFO', payload: content }; - sendResponse(response); - } - return false; - }, -); diff --git a/packages/extension/src/manifest.json b/packages/extension/src/manifest.json index bc4cc905..5b04f4b9 100644 --- a/packages/extension/src/manifest.json +++ b/packages/extension/src/manifest.json @@ -1,9 +1,9 @@ { "manifest_version": 3, "name": "SkillKit - Save as Skill", - "version": "1.17.0", + "version": "1.18.0", "description": "Save any webpage as an AI agent skill — instantly available across 44 agents", - "permissions": ["contextMenus", "activeTab", "storage", "downloads"], + "permissions": ["contextMenus", "activeTab", "downloads"], "background": { "service_worker": "background.global.js" }, @@ -15,12 +15,6 @@ "128": "icons/icon128.png" } }, - "content_scripts": [ - { - "matches": [""], - "js": ["content.global.js"] - } - ], "icons": { "16": "icons/icon16.png", "48": "icons/icon48.png", diff --git a/packages/extension/src/popup.html b/packages/extension/src/popup.html index 27ec8c47..7ee9448c 100644 --- a/packages/extension/src/popup.html +++ b/packages/extension/src/popup.html @@ -32,7 +32,6 @@
-