feat: Implement Skills Manager View and Notifier Module

- Added `skills-manager.js` for managing Claude Code skills with functionalities for loading, displaying, and editing skills.
- Introduced a Notifier module in `notifier.ts` for CLI to server communication, enabling notifications for UI updates on data changes.
- Created comprehensive documentation for the Chain Search implementation, including usage examples and performance tips.
- Developed a test suite for the Chain Search engine, covering basic search, quick search, symbol search, and files-only search functionalities.
This commit is contained in:
catlog22
2025-12-14 11:12:48 +08:00
parent 08dc0a0348
commit ac43cf85ec
26 changed files with 3827 additions and 2005 deletions

View File

@@ -115,6 +115,7 @@
border-bottom: 1px solid hsl(var(--border));
background: hsl(var(--muted) / 0.3);
gap: 1rem;
flex-wrap: nowrap;
}
.prompt-timeline-header h3 {
@@ -125,6 +126,7 @@
font-weight: 600;
margin: 0;
flex-shrink: 0;
white-space: nowrap;
}
.prompt-timeline-filters {
@@ -133,12 +135,16 @@
gap: 0.5rem;
flex: 1;
justify-content: flex-end;
flex-wrap: nowrap;
min-width: 0;
}
.prompt-search-wrapper {
position: relative;
display: flex;
align-items: center;
flex: 1;
min-width: 150px;
min-width: 120px;
max-width: 280px;
}
@@ -149,6 +155,7 @@
transform: translateY(-50%);
color: hsl(var(--muted-foreground));
pointer-events: none;
z-index: 1;
}
.prompt-search-input {
@@ -225,28 +232,102 @@
.prompt-session-items {
display: flex;
flex-direction: column;
gap: 0.5rem;
gap: 0;
position: relative;
padding-left: 2rem;
}
/* Prompt Items */
/* Timeline axis - subtle vertical line */
.prompt-session-items::before {
content: '';
position: absolute;
left: 0.4375rem;
top: 0;
bottom: 0;
width: 2px;
background: hsl(var(--border));
}
/* Prompt Items - Card style matching memory timeline */
.prompt-item {
display: flex;
gap: 0.75rem;
padding: 0.875rem;
background: hsl(var(--card));
margin-bottom: 0.625rem;
background: hsl(var(--background));
border: 1px solid hsl(var(--border));
border-radius: 0.5rem;
cursor: pointer;
transition: all 0.2s;
transition: all 0.15s ease;
position: relative;
}
/* Timeline dot - clean circle */
.prompt-item::before {
content: '';
position: absolute;
left: -2rem;
top: 1rem;
width: 12px;
height: 12px;
background: hsl(var(--background));
border: 2px solid hsl(var(--muted-foreground) / 0.4);
border-radius: 50%;
transform: translateX(50%);
z-index: 1;
transition: all 0.2s ease;
}
/* Timeline connector line to card */
.prompt-item::after {
content: '';
position: absolute;
left: -1.25rem;
top: 1.25rem;
width: 1rem;
height: 2px;
background: hsl(var(--border));
}
.prompt-item:last-child {
margin-bottom: 0;
}
.prompt-item:hover {
border-color: hsl(var(--primary) / 0.3);
box-shadow: 0 2px 8px hsl(var(--primary) / 0.1);
background: hsl(var(--hover));
}
.prompt-item:hover::before {
border-color: hsl(var(--primary));
background: hsl(var(--primary) / 0.1);
}
.prompt-item:hover::after {
background: hsl(var(--primary) / 0.3);
}
.prompt-item-expanded {
max-height: none;
background: hsl(var(--muted) / 0.3);
border-color: hsl(var(--primary) / 0.5);
}
.prompt-item-expanded::before {
background: hsl(var(--primary));
border-color: hsl(var(--primary));
}
.prompt-item-expanded::after {
background: hsl(var(--primary) / 0.5);
}
/* Inner content layout */
.prompt-item-inner {
flex: 1;
min-width: 0;
}
.prompt-item-header {
display: flex;
align-items: center;
@@ -665,3 +746,322 @@
color: hsl(var(--muted-foreground));
font-size: 0.875rem;
}
/* ========== Insights History Cards ========== */
.insights-history-container {
padding: 0.75rem;
max-height: calc(100vh - 300px);
overflow-y: auto;
}
.insights-history-cards {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.insight-history-card {
padding: 0.875rem;
background: hsl(var(--card));
border: 1px solid hsl(var(--border));
border-left-width: 3px;
border-radius: 0.5rem;
cursor: pointer;
transition: all 0.2s ease;
}
.insight-history-card:hover {
background: hsl(var(--muted) / 0.5);
transform: translateY(-1px);
box-shadow: 0 2px 8px hsl(var(--foreground) / 0.08);
}
.insight-history-card.high {
border-left-color: hsl(0, 84%, 60%);
}
.insight-history-card.medium {
border-left-color: hsl(48, 96%, 53%);
}
.insight-history-card.low {
border-left-color: hsl(142, 71%, 45%);
}
.insight-card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 0.625rem;
}
.insight-card-tool {
display: flex;
align-items: center;
gap: 0.375rem;
font-size: 0.75rem;
font-weight: 500;
color: hsl(var(--foreground));
}
.insight-card-tool i {
color: hsl(var(--primary));
}
.insight-card-time {
font-size: 0.6875rem;
color: hsl(var(--muted-foreground));
}
.insight-card-stats {
display: flex;
gap: 1rem;
margin-bottom: 0.625rem;
}
.insight-stat {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.125rem;
}
.insight-stat-value {
font-size: 1rem;
font-weight: 600;
color: hsl(var(--foreground));
}
.insight-stat-label {
font-size: 0.625rem;
color: hsl(var(--muted-foreground));
text-transform: uppercase;
letter-spacing: 0.025em;
}
.insight-card-preview {
margin-top: 0.5rem;
}
.pattern-preview {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem;
border-radius: 0.375rem;
font-size: 0.75rem;
overflow: hidden;
}
.pattern-preview.high {
background: hsl(0, 84%, 95%);
}
.pattern-preview.medium {
background: hsl(48, 96%, 95%);
}
.pattern-preview.low {
background: hsl(142, 71%, 95%);
}
.pattern-preview .pattern-type {
font-weight: 600;
text-transform: capitalize;
white-space: nowrap;
}
.pattern-preview .pattern-desc {
color: hsl(var(--muted-foreground));
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Insight Detail Panel */
.insight-detail-panel {
position: fixed;
top: 0;
right: 0;
width: 400px;
max-width: 90vw;
height: 100vh;
background: hsl(var(--card));
border-left: 1px solid hsl(var(--border));
box-shadow: -4px 0 16px hsl(var(--foreground) / 0.1);
z-index: 1000;
overflow-y: auto;
animation: slideInRight 0.2s ease;
}
@keyframes slideInRight {
from {
transform: translateX(100%);
}
to {
transform: translateX(0);
}
}
.insight-detail {
padding: 1.25rem;
}
.insight-detail-header {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 1rem;
border-bottom: 1px solid hsl(var(--border));
margin-bottom: 1rem;
}
.insight-detail-header h4 {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1rem;
font-weight: 600;
margin: 0;
}
.insight-detail-meta {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
margin-bottom: 1.25rem;
font-size: 0.75rem;
color: hsl(var(--muted-foreground));
}
.insight-detail-meta span {
display: flex;
align-items: center;
gap: 0.25rem;
}
.insight-patterns,
.insight-suggestions {
margin-bottom: 1.25rem;
}
.insight-patterns h5,
.insight-suggestions h5 {
display: flex;
align-items: center;
gap: 0.375rem;
font-size: 0.8125rem;
font-weight: 600;
margin: 0 0 0.75rem 0;
}
.patterns-list,
.suggestions-list {
display: flex;
flex-direction: column;
gap: 0.625rem;
}
.pattern-item {
padding: 0.75rem;
background: hsl(var(--background));
border: 1px solid hsl(var(--border));
border-left-width: 3px;
border-radius: 0.5rem;
}
.pattern-item.high {
border-left-color: hsl(0, 84%, 60%);
}
.pattern-item.medium {
border-left-color: hsl(48, 96%, 53%);
}
.pattern-item.low {
border-left-color: hsl(142, 71%, 45%);
}
.pattern-item .pattern-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.5rem;
}
.pattern-type-badge {
padding: 0.125rem 0.5rem;
background: hsl(var(--muted));
border-radius: 0.25rem;
font-size: 0.6875rem;
font-weight: 600;
text-transform: uppercase;
}
.pattern-severity {
font-size: 0.6875rem;
color: hsl(var(--muted-foreground));
text-transform: capitalize;
}
.pattern-occurrences {
margin-left: auto;
font-size: 0.75rem;
font-weight: 600;
color: hsl(var(--muted-foreground));
}
.pattern-item .pattern-description {
font-size: 0.8125rem;
line-height: 1.5;
margin-bottom: 0.5rem;
}
.pattern-item .pattern-suggestion {
display: flex;
align-items: start;
gap: 0.375rem;
padding: 0.5rem;
background: hsl(var(--muted) / 0.5);
border-radius: 0.375rem;
font-size: 0.75rem;
color: hsl(var(--muted-foreground));
}
.suggestion-item {
padding: 0.75rem;
background: hsl(var(--background));
border: 1px solid hsl(var(--border));
border-radius: 0.5rem;
}
.suggestion-item .suggestion-title {
font-size: 0.8125rem;
font-weight: 600;
margin-bottom: 0.375rem;
}
.suggestion-item .suggestion-description {
font-size: 0.75rem;
color: hsl(var(--muted-foreground));
line-height: 1.5;
margin-bottom: 0.5rem;
}
.suggestion-item .suggestion-example {
padding: 0.5rem;
background: hsl(var(--muted) / 0.5);
border-radius: 0.375rem;
}
.suggestion-item .suggestion-example code {
font-size: 0.75rem;
font-family: monospace;
color: hsl(var(--foreground));
}
.insight-detail-actions {
margin-top: 1.5rem;
padding-top: 1rem;
border-top: 1px solid hsl(var(--border));
}

View File

@@ -0,0 +1,216 @@
/* ==========================================
SKILLS & RULES MANAGER STYLES
========================================== */
/* Skills Manager */
.skills-manager {
width: 100%;
}
.skills-manager.loading {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 300px;
color: hsl(var(--muted-foreground));
}
.skills-section {
margin-bottom: 2rem;
width: 100%;
}
.skills-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 1rem;
width: 100%;
}
.skill-card {
position: relative;
transition: all 0.2s ease;
}
.skill-card:hover {
border-color: hsl(var(--primary));
transform: translateY(-2px);
}
.skills-empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 160px;
}
/* Skill Detail Panel */
.skill-detail-panel {
animation: slideIn 0.2s ease-out;
}
.skill-detail-overlay {
animation: fadeIn 0.15s ease-out;
}
/* Rules Manager */
.rules-manager {
width: 100%;
}
.rules-manager.loading {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 300px;
color: hsl(var(--muted-foreground));
}
.rules-section {
margin-bottom: 2rem;
width: 100%;
}
.rules-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 1rem;
width: 100%;
}
.rule-card {
position: relative;
transition: all 0.2s ease;
}
.rule-card:hover {
border-color: hsl(var(--success));
transform: translateY(-2px);
}
.rules-empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 160px;
}
/* Rule Detail Panel */
.rule-detail-panel {
animation: slideIn 0.2s ease-out;
}
.rule-detail-overlay {
animation: fadeIn 0.15s ease-out;
}
/* Shared Animations */
@keyframes slideIn {
from {
opacity: 0;
transform: translateX(100%);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
/* Line clamp utility for card descriptions */
.line-clamp-2 {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.skills-grid,
.rules-grid {
grid-template-columns: 1fr;
}
.skill-detail-panel,
.rule-detail-panel {
width: 100%;
max-width: 100%;
}
}
/* Badge styles for skills and rules */
.skill-card .badge,
.rule-card .badge {
font-size: 0.75rem;
font-weight: 500;
}
/* Code preview in rule cards */
.rule-card pre {
font-family: var(--font-mono);
font-size: 0.75rem;
line-height: 1.4;
}
/* Create modal styles (shared) */
.skill-modal,
.rule-modal {
animation: fadeIn 0.15s ease-out;
}
.skill-modal-backdrop,
.rule-modal-backdrop {
animation: fadeIn 0.15s ease-out;
}
.skill-modal-content,
.rule-modal-content {
animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.skill-modal.hidden,
.rule-modal.hidden {
display: none;
}
/* Form group styles */
.skill-modal .form-group label,
.rule-modal .form-group label {
display: block;
margin-bottom: 0.25rem;
}
.skill-modal input,
.skill-modal textarea,
.rule-modal input,
.rule-modal textarea {
transition: border-color 0.15s, box-shadow 0.15s;
}
.skill-modal input:focus,
.skill-modal textarea:focus,
.rule-modal input:focus,
.rule-modal textarea:focus {
border-color: hsl(var(--primary));
box-shadow: 0 0 0 2px hsl(var(--primary) / 0.2);
}