mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-20 02:15:12 +00:00
- Add multi-select dropdown component for all filter fields - Implement light/dark theme toggle with system preference detection - Add client-side ZIP download for skills using JSZip - Include file lists in skills metadata for download feature - Add title tooltips to multi-select options for long values - Update all pages with consistent theme toggle in header
368 lines
15 KiB
HTML
368 lines
15 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Skills - Awesome GitHub Copilot</title>
|
|
<meta name="description" content="Self-contained agent skills with instructions and bundled resources">
|
|
<link rel="stylesheet" href="../css/styles.css">
|
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
|
<script src="../js/theme.js"></script>
|
|
</head>
|
|
<body>
|
|
<header class="site-header">
|
|
<div class="container">
|
|
<div class="header-content">
|
|
<a href="../index.html" class="logo">
|
|
<span class="logo-icon">🤖</span>
|
|
<span class="logo-text">Awesome Copilot</span>
|
|
</a>
|
|
<nav class="main-nav">
|
|
<a href="agents.html">Agents</a>
|
|
<a href="prompts.html">Prompts</a>
|
|
<a href="instructions.html">Instructions</a>
|
|
<a href="skills.html" class="active">Skills</a>
|
|
<a href="collections.html">Collections</a>
|
|
<a href="tools.html">Tools</a>
|
|
<a href="samples.html">Samples</a>
|
|
</nav>
|
|
<div class="header-actions">
|
|
<button id="theme-toggle" class="theme-toggle" title="Toggle theme">
|
|
<svg class="icon-sun" viewBox="0 0 16 16" fill="currentColor">
|
|
<path d="M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0V.75A.75.75 0 0 1 8 0zm0 13a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0v-1.5A.75.75 0 0 1 8 13zM2.343 2.343a.75.75 0 0 1 1.061 0l1.06 1.061a.75.75 0 0 1-1.06 1.06l-1.06-1.06a.75.75 0 0 1 0-1.06zm9.193 9.193a.75.75 0 0 1 1.06 0l1.061 1.06a.75.75 0 0 1-1.06 1.061l-1.061-1.06a.75.75 0 0 1 0-1.061zM0 8a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 0 1.5H.75A.75.75 0 0 1 0 8zm13 0a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 0 1.5h-1.5A.75.75 0 0 1 13 8zM2.343 13.657a.75.75 0 0 1 0-1.061l1.06-1.06a.75.75 0 0 1 1.061 1.06l-1.06 1.06a.75.75 0 0 1-1.061 0zm9.193-9.193a.75.75 0 0 1 0-1.06l1.061-1.061a.75.75 0 0 1 1.06 1.06l-1.06 1.061a.75.75 0 0 1-1.061 0z"/>
|
|
</svg>
|
|
<svg class="icon-moon" viewBox="0 0 16 16" fill="currentColor">
|
|
<path d="M9.598 1.591a.75.75 0 0 1 .785-.175 7 7 0 1 1-8.967 8.967.75.75 0 0 1 .961-.96 5.5 5.5 0 0 0 7.046-7.046.75.75 0 0 1 .175-.786zm1.616 1.945a7 7 0 0 1-7.678 7.678 5.5 5.5 0 1 0 7.678-7.678z"/>
|
|
</svg>
|
|
</button>
|
|
<a href="https://github.com/github/awesome-copilot" class="github-link" target="_blank" rel="noopener">
|
|
<svg viewBox="0 0 16 16" width="24" height="24" fill="currentColor">
|
|
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path>
|
|
</svg>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main>
|
|
<div class="page-header">
|
|
<div class="container">
|
|
<h1>⚡ Agent Skills</h1>
|
|
<p>Self-contained folders with instructions and bundled resources for specialized AI capabilities</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="page-content">
|
|
<div class="container">
|
|
<div class="search-bar">
|
|
<input type="text" id="search-input" placeholder="Search skills..." autocomplete="off">
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="filters-bar" id="filters-bar">
|
|
<div class="filter-group">
|
|
<label>Category:</label>
|
|
<div id="filter-category" class="multi-select-container"></div>
|
|
</div>
|
|
<div class="filter-group">
|
|
<label class="checkbox-label">
|
|
<input type="checkbox" id="filter-has-assets">
|
|
Has Bundled Assets
|
|
</label>
|
|
</div>
|
|
<button id="clear-filters" class="btn btn-secondary btn-small">Clear Filters</button>
|
|
</div>
|
|
|
|
<div class="results-count" id="results-count"></div>
|
|
<div class="resource-list" id="resource-list">
|
|
<div class="loading">Loading skills...</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<footer class="site-footer">
|
|
<div class="container">
|
|
<p>
|
|
<a href="https://github.com/github/awesome-copilot" target="_blank" rel="noopener">GitHub</a> ·
|
|
<a href="https://github.com/github/awesome-copilot/blob/main/CONTRIBUTING.md" target="_blank" rel="noopener">Contribute</a> ·
|
|
<a href="https://github.com/github/awesome-copilot/blob/main/LICENSE" target="_blank" rel="noopener">MIT License</a>
|
|
</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- File Viewer Modal -->
|
|
<div id="file-modal" class="modal hidden">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h3 id="modal-title">File</h3>
|
|
<div class="modal-actions">
|
|
<button id="copy-btn" class="btn btn-secondary" title="Copy to clipboard">
|
|
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor">
|
|
<path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path>
|
|
<path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path>
|
|
</svg>
|
|
Copy
|
|
</button>
|
|
<a id="install-vscode-btn" href="#" class="btn btn-primary" style="display:none" title="Install to VS Code">
|
|
Install
|
|
</a>
|
|
<a id="github-btn" href="#" class="btn btn-secondary" target="_blank" title="View on GitHub">
|
|
GitHub
|
|
</a>
|
|
<button id="close-modal" class="btn btn-icon" title="Close">
|
|
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor">
|
|
<path d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"></path>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="modal-body">
|
|
<pre id="modal-content"><code></code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="../js/utils.js"></script>
|
|
<script src="../js/search.js"></script>
|
|
<script src="../js/multi-select.js"></script>
|
|
<script src="../js/jszip.min.js"></script>
|
|
<script src="../js/app.js"></script>
|
|
<script>
|
|
const resourceType = 'skill';
|
|
const dataFile = 'skills.json';
|
|
let allItems = [];
|
|
let filters = { categories: [], hasAssets: [] };
|
|
let search = new FuzzySearch();
|
|
let categorySelect;
|
|
|
|
// Current filter state
|
|
let currentFilters = {
|
|
categories: [],
|
|
hasAssets: false,
|
|
};
|
|
|
|
async function initPage() {
|
|
const list = document.getElementById('resource-list');
|
|
const countEl = document.getElementById('results-count');
|
|
const searchInput = document.getElementById('search-input');
|
|
const hasAssetsCheckbox = document.getElementById('filter-has-assets');
|
|
const clearFiltersBtn = document.getElementById('clear-filters');
|
|
|
|
const data = await fetchData(dataFile);
|
|
if (!data || !data.items) {
|
|
list.innerHTML = '<div class="empty-state"><h3>Failed to load data</h3></div>';
|
|
return;
|
|
}
|
|
|
|
allItems = data.items;
|
|
filters = data.filters;
|
|
search.setItems(allItems);
|
|
|
|
// Initialize multi-select filter
|
|
categorySelect = new MultiSelect('#filter-category', {
|
|
placeholder: 'All Categories',
|
|
onChange: (selected) => {
|
|
currentFilters.categories = selected;
|
|
applyFiltersAndRender();
|
|
}
|
|
});
|
|
categorySelect.setItems(filters.categories);
|
|
|
|
// Render all items
|
|
applyFiltersAndRender();
|
|
|
|
// Setup search
|
|
searchInput.addEventListener('input', debounce(() => applyFiltersAndRender(), 200));
|
|
|
|
hasAssetsCheckbox.addEventListener('change', () => {
|
|
currentFilters.hasAssets = hasAssetsCheckbox.checked;
|
|
applyFiltersAndRender();
|
|
});
|
|
|
|
clearFiltersBtn.addEventListener('click', () => {
|
|
currentFilters = { categories: [], hasAssets: false };
|
|
categorySelect.clearSelection();
|
|
hasAssetsCheckbox.checked = false;
|
|
searchInput.value = '';
|
|
applyFiltersAndRender();
|
|
});
|
|
|
|
setupModal();
|
|
}
|
|
|
|
function applyFiltersAndRender() {
|
|
const searchInput = document.getElementById('search-input');
|
|
const countEl = document.getElementById('results-count');
|
|
const query = searchInput.value;
|
|
|
|
// Start with all items or search results
|
|
let results = query ? search.search(query) : [...allItems];
|
|
|
|
// Apply category filter (OR logic)
|
|
if (currentFilters.categories.length > 0) {
|
|
results = results.filter(item => currentFilters.categories.includes(item.category));
|
|
}
|
|
|
|
// Apply has assets filter
|
|
if (currentFilters.hasAssets) {
|
|
results = results.filter(item => item.hasAssets);
|
|
}
|
|
|
|
renderItems(results, query);
|
|
|
|
// Update count with filter info
|
|
const activeFilters = [];
|
|
if (currentFilters.categories.length > 0) activeFilters.push(`${currentFilters.categories.length} categor${currentFilters.categories.length > 1 ? 'ies' : 'y'}`);
|
|
if (currentFilters.hasAssets) activeFilters.push('has assets');
|
|
|
|
let countText = `${results.length} of ${allItems.length} skills`;
|
|
if (activeFilters.length > 0) {
|
|
countText += ` (filtered by ${activeFilters.join(', ')})`;
|
|
}
|
|
countEl.textContent = countText;
|
|
}
|
|
|
|
function renderItems(items, query = '') {
|
|
const list = document.getElementById('resource-list');
|
|
|
|
if (items.length === 0) {
|
|
list.innerHTML = `
|
|
<div class="empty-state">
|
|
<h3>No skills found</h3>
|
|
<p>Try a different search term or adjust filters</p>
|
|
</div>
|
|
`;
|
|
return;
|
|
}
|
|
|
|
list.innerHTML = items.map(item => `
|
|
<div class="resource-item" onclick="openFileModal('${item.skillFile}', '${resourceType}')">
|
|
<div class="resource-info">
|
|
<div class="resource-title">${query ? search.highlight(item.title, query) : escapeHtml(item.title)}</div>
|
|
<div class="resource-description">${escapeHtml(item.description || 'No description')}</div>
|
|
<div class="resource-meta">
|
|
<span class="resource-tag tag-category">${escapeHtml(item.category)}</span>
|
|
${item.hasAssets ? `<span class="resource-tag tag-assets">${item.assetCount} asset${item.assetCount === 1 ? '' : 's'}</span>` : ''}
|
|
<span class="resource-tag">${item.files.length} file${item.files.length === 1 ? '' : 's'}</span>
|
|
</div>
|
|
</div>
|
|
<div class="resource-actions">
|
|
<button class="btn btn-primary" onclick="event.stopPropagation(); downloadSkill('${item.id}')" title="Download as ZIP">
|
|
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor">
|
|
<path d="M2.75 14A1.75 1.75 0 0 1 1 12.25v-2.5a.75.75 0 0 1 1.5 0v2.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25v-2.5a.75.75 0 0 1 1.5 0v2.5A1.75 1.75 0 0 1 13.25 14Z"/>
|
|
<path d="M7.25 7.689V2a.75.75 0 0 1 1.5 0v5.689l1.97-1.969a.749.749 0 1 1 1.06 1.06l-3.25 3.25a.749.749 0 0 1-1.06 0L4.22 6.78a.749.749 0 1 1 1.06-1.06l1.97 1.969Z"/>
|
|
</svg>
|
|
Download
|
|
</button>
|
|
<a href="${getGitHubUrl(item.path)}" class="btn btn-secondary" target="_blank" onclick="event.stopPropagation()">
|
|
View Folder
|
|
</a>
|
|
</div>
|
|
</div>
|
|
`).join('');
|
|
}
|
|
|
|
// Download skill as ZIP file
|
|
async function downloadSkill(skillId) {
|
|
const skill = allItems.find(item => item.id === skillId);
|
|
if (!skill || !skill.files || skill.files.length === 0) {
|
|
alert('No files found for this skill');
|
|
return;
|
|
}
|
|
|
|
// Show loading state
|
|
const btn = event.target.closest('button');
|
|
const originalContent = btn.innerHTML;
|
|
btn.disabled = true;
|
|
btn.innerHTML = `
|
|
<svg class="spinner" viewBox="0 0 16 16" width="16" height="16" fill="currentColor">
|
|
<path d="M8 0a8 8 0 1 0 8 8h-1.5A6.5 6.5 0 1 1 8 1.5V0z"/>
|
|
</svg>
|
|
Preparing...
|
|
`;
|
|
|
|
try {
|
|
const zip = new JSZip();
|
|
const folder = zip.folder(skill.id);
|
|
|
|
// Fetch all files in parallel
|
|
const fetchPromises = skill.files.map(async (file) => {
|
|
const url = getRawGitHubUrl(file.path);
|
|
try {
|
|
const response = await fetch(url);
|
|
if (!response.ok) {
|
|
console.warn(`Failed to fetch ${file.path}: ${response.status}`);
|
|
return null;
|
|
}
|
|
const content = await response.text();
|
|
return { name: file.name, content };
|
|
} catch (err) {
|
|
console.warn(`Error fetching ${file.path}:`, err);
|
|
return null;
|
|
}
|
|
});
|
|
|
|
const results = await Promise.all(fetchPromises);
|
|
|
|
// Add successfully fetched files to zip
|
|
let addedFiles = 0;
|
|
for (const result of results) {
|
|
if (result) {
|
|
folder.file(result.name, result.content);
|
|
addedFiles++;
|
|
}
|
|
}
|
|
|
|
if (addedFiles === 0) {
|
|
throw new Error('Failed to fetch any files');
|
|
}
|
|
|
|
// Generate and download zip
|
|
const blob = await zip.generateAsync({ type: 'blob' });
|
|
const downloadUrl = URL.createObjectURL(blob);
|
|
|
|
const link = document.createElement('a');
|
|
link.href = downloadUrl;
|
|
link.download = `${skill.id}.zip`;
|
|
document.body.appendChild(link);
|
|
link.click();
|
|
document.body.removeChild(link);
|
|
|
|
URL.revokeObjectURL(downloadUrl);
|
|
|
|
// Show success
|
|
btn.innerHTML = `
|
|
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor">
|
|
<path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.75.75 0 0 1 1.06-1.06L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0z"/>
|
|
</svg>
|
|
Downloaded!
|
|
`;
|
|
|
|
setTimeout(() => {
|
|
btn.disabled = false;
|
|
btn.innerHTML = originalContent;
|
|
}, 2000);
|
|
|
|
} catch (err) {
|
|
console.error('Download failed:', err);
|
|
btn.innerHTML = `
|
|
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor">
|
|
<path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 0 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 0 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06z"/>
|
|
</svg>
|
|
Failed
|
|
`;
|
|
|
|
setTimeout(() => {
|
|
btn.disabled = false;
|
|
btn.innerHTML = originalContent;
|
|
}, 2000);
|
|
}
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', initPage);
|
|
</script>
|
|
</body>
|
|
</html>
|