mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-19 02:13:58 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b5d4b6881 | ||
|
|
cbd9fcd679 | ||
|
|
f9e31fedc8 | ||
|
|
12ed10d170 | ||
|
|
eebaa710f7 | ||
|
|
eae5accf36 | ||
|
|
e41b0cd8a3 | ||
|
|
21df323134 | ||
|
|
363d28e266 | ||
|
|
a229c384b0 | ||
|
|
3e9a3cd84c |
@@ -7,6 +7,60 @@ on:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
# Verify all packages have consistent versions
|
||||
version-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Check version consistency
|
||||
run: |
|
||||
echo "Checking version consistency across all packages..."
|
||||
|
||||
# Get the main version from apps/skillkit
|
||||
MAIN_VERSION=$(node -p "require('./apps/skillkit/package.json').version")
|
||||
echo "Main version: $MAIN_VERSION"
|
||||
|
||||
# List of all packages to check
|
||||
PACKAGES=(
|
||||
"package.json"
|
||||
"apps/skillkit/package.json"
|
||||
"packages/cli/package.json"
|
||||
"packages/core/package.json"
|
||||
"packages/tui/package.json"
|
||||
"packages/agents/package.json"
|
||||
"packages/memory/package.json"
|
||||
"packages/mesh/package.json"
|
||||
"packages/messaging/package.json"
|
||||
"packages/mcp-memory/package.json"
|
||||
"packages/resources/package.json"
|
||||
"docs/skillkit/package.json"
|
||||
"docs/fumadocs/package.json"
|
||||
)
|
||||
|
||||
FAILED=0
|
||||
for pkg in "${PACKAGES[@]}"; do
|
||||
if [ -f "$pkg" ]; then
|
||||
PKG_VERSION=$(node -p "require('./$pkg').version")
|
||||
if [ "$PKG_VERSION" != "$MAIN_VERSION" ]; then
|
||||
echo "❌ Version mismatch: $pkg has $PKG_VERSION (expected $MAIN_VERSION)"
|
||||
FAILED=1
|
||||
else
|
||||
echo "✓ $pkg: $PKG_VERSION"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $FAILED -eq 1 ]; then
|
||||
echo ""
|
||||
echo "Version mismatch detected!"
|
||||
echo "Run: ./scripts/bump-version.sh $MAIN_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "All packages have consistent version: $MAIN_VERSION"
|
||||
|
||||
# Unit tests run on all Node versions
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -78,12 +132,14 @@ jobs:
|
||||
# Final status check for branch protection
|
||||
ci-success:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test, e2e]
|
||||
needs: [version-check, test, e2e]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Check all jobs passed
|
||||
run: |
|
||||
if [[ "${{ needs.test.result }}" != "success" ]] || [[ "${{ needs.e2e.result }}" != "success" ]]; then
|
||||
if [[ "${{ needs.version-check.result }}" != "success" ]] || \
|
||||
[[ "${{ needs.test.result }}" != "success" ]] || \
|
||||
[[ "${{ needs.e2e.result }}" != "success" ]]; then
|
||||
echo "One or more jobs failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -16,6 +16,19 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Verify tag matches package version
|
||||
run: |
|
||||
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
|
||||
PKG_VERSION=$(node -p "require('./apps/skillkit/package.json').version")
|
||||
echo "Tag version: $TAG_VERSION"
|
||||
echo "Package version: $PKG_VERSION"
|
||||
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
|
||||
echo "❌ Tag version ($TAG_VERSION) doesn't match package version ($PKG_VERSION)"
|
||||
echo "Please update package versions before creating the release tag."
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Version check passed"
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# Versioning
|
||||
|
||||
SkillKit uses **synchronized versioning** - all packages share the same version number.
|
||||
|
||||
## Package List
|
||||
|
||||
All these packages are kept in sync:
|
||||
|
||||
| Package | Location |
|
||||
|---------|----------|
|
||||
| `skillkit` | `apps/skillkit/` |
|
||||
| `@skillkit/cli` | `packages/cli/` |
|
||||
| `@skillkit/core` | `packages/core/` |
|
||||
| `@skillkit/tui` | `packages/tui/` |
|
||||
| `@skillkit/agents` | `packages/agents/` |
|
||||
| `@skillkit/memory` | `packages/memory/` |
|
||||
| `@skillkit/mesh` | `packages/mesh/` |
|
||||
| `@skillkit/messaging` | `packages/messaging/` |
|
||||
| `@skillkit/mcp-memory` | `packages/mcp-memory/` |
|
||||
| `@skillkit/resources` | `packages/resources/` |
|
||||
| `skillkit-docs` | `docs/fumadocs/` |
|
||||
| Website | `docs/skillkit/` |
|
||||
|
||||
## How to Release
|
||||
|
||||
### 1. Bump Version
|
||||
|
||||
Use the version bump script:
|
||||
|
||||
```bash
|
||||
./scripts/bump-version.sh 1.8.1
|
||||
```
|
||||
|
||||
This updates all package.json files to the same version.
|
||||
|
||||
### 2. Commit Changes
|
||||
|
||||
```bash
|
||||
git add -A
|
||||
git commit -m "chore: bump version to 1.8.1"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
### 3. Create Release
|
||||
|
||||
```bash
|
||||
gh release create v1.8.1 --generate-notes
|
||||
```
|
||||
|
||||
Or with custom notes:
|
||||
|
||||
```bash
|
||||
gh release create v1.8.1 --title "v1.8.1 - Bug fixes" --notes "Release notes here"
|
||||
```
|
||||
|
||||
### 4. Automated Publishing
|
||||
|
||||
When you push a tag starting with `v`, the CI automatically:
|
||||
|
||||
1. Verifies tag matches package versions
|
||||
2. Runs tests
|
||||
3. Publishes to npm
|
||||
4. Publishes to GitHub Packages
|
||||
5. Creates GitHub Release
|
||||
|
||||
## CI Checks
|
||||
|
||||
The CI validates version consistency on every PR:
|
||||
|
||||
- **version-check** job compares all package versions
|
||||
- Fails if any package has a different version
|
||||
- Run `./scripts/bump-version.sh <version>` to fix mismatches
|
||||
|
||||
## Semantic Versioning
|
||||
|
||||
We follow [semver](https://semver.org/):
|
||||
|
||||
- **MAJOR** (x.0.0): Breaking changes
|
||||
- **MINOR** (0.x.0): New features, backward compatible
|
||||
- **PATCH** (0.0.x): Bug fixes, backward compatible
|
||||
|
||||
## Quick Commands
|
||||
|
||||
```bash
|
||||
# Check current versions
|
||||
grep -r '"version"' apps/skillkit/package.json
|
||||
|
||||
# Bump all packages
|
||||
./scripts/bump-version.sh 1.8.1
|
||||
|
||||
# Create release
|
||||
gh release create v1.8.1 --generate-notes
|
||||
```
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "skillkit",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "Supercharge AI coding agents with portable skills. Install, translate, and share skills across Claude Code, Cursor, Codex, Copilot & 13 more",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -87,6 +87,151 @@ import { RecommendationEngine, analyzeProject } from '@skillkit/core/recommend'
|
||||
const engine = new RecommendationEngine()
|
||||
const profile = await analyzeProject('./my-project')
|
||||
const recommendations = engine.recommend(profile)
|
||||
|
||||
// Recommendations with scores and reasons
|
||||
recommendations.forEach(rec => {
|
||||
console.log(`${rec.score}% - ${rec.skill.name}`)
|
||||
console.log(`Reasons: ${rec.reasons.join(', ')}`)
|
||||
})
|
||||
```
|
||||
|
||||
## Primer (Auto-Generate Instructions)
|
||||
|
||||
```typescript
|
||||
import { promises as fs } from 'node:fs'
|
||||
import { analyzeProject, generateInstructions } from '@skillkit/core'
|
||||
|
||||
// Analyze project
|
||||
const analysis = await analyzeProject('./my-project')
|
||||
console.log(analysis.techStack)
|
||||
// { framework: 'Next.js', language: 'TypeScript', styling: 'Tailwind' }
|
||||
|
||||
// Generate instructions for specific agents
|
||||
const instructions = await generateInstructions(analysis, {
|
||||
agents: ['claude', 'cursor', 'windsurf'],
|
||||
includeExamples: true,
|
||||
tone: 'detailed',
|
||||
})
|
||||
|
||||
// Write to files
|
||||
for (const [agent, content] of Object.entries(instructions)) {
|
||||
await fs.writeFile(`.${agent}/instructions.md`, content)
|
||||
}
|
||||
```
|
||||
|
||||
## Mesh Network
|
||||
|
||||
```typescript
|
||||
import { MeshHost, PeerIdentity } from '@skillkit/mesh'
|
||||
|
||||
// Generate identity
|
||||
const identity = await PeerIdentity.generate()
|
||||
|
||||
// Create mesh host
|
||||
const host = new MeshHost({
|
||||
hostId: 'my-workstation',
|
||||
identity,
|
||||
security: { mode: 'secure' },
|
||||
})
|
||||
|
||||
await host.start()
|
||||
|
||||
// Send message to peer
|
||||
await host.send('peer-fingerprint', {
|
||||
type: 'skill-sync',
|
||||
payload: { skills: ['react-patterns'] },
|
||||
})
|
||||
|
||||
// Listen for messages
|
||||
host.on('message', (msg) => {
|
||||
console.log('Received:', msg.type, 'from', msg.from)
|
||||
})
|
||||
```
|
||||
|
||||
## Inter-Agent Messaging
|
||||
|
||||
```typescript
|
||||
import { MessagingClient } from '@skillkit/messaging'
|
||||
|
||||
// Create messaging client (host is a MeshHost instance from the example above)
|
||||
const messaging = new MessagingClient({
|
||||
meshHost: host, // See MeshHost setup in "Mesh Network" section above
|
||||
storagePath: '~/.skillkit/messages',
|
||||
})
|
||||
|
||||
await messaging.init()
|
||||
|
||||
// Send a message
|
||||
await messaging.send({
|
||||
to: 'claude@laptop',
|
||||
subject: 'Code review completed',
|
||||
body: 'I reviewed the auth module...',
|
||||
priority: 'normal',
|
||||
})
|
||||
|
||||
// Listen for new messages
|
||||
messaging.on('message', (msg) => {
|
||||
console.log('New message from:', msg.from)
|
||||
console.log('Subject:', msg.subject)
|
||||
})
|
||||
|
||||
// Get inbox
|
||||
const inbox = await messaging.getInbox({ unread: true })
|
||||
```
|
||||
|
||||
## Workflow Orchestration
|
||||
|
||||
```typescript
|
||||
import { WorkflowEngine, WorkflowStep } from '@skillkit/core'
|
||||
|
||||
// Define workflow
|
||||
const workflow = {
|
||||
name: 'feature-development',
|
||||
steps: [
|
||||
{ skill: 'tdd-workflow', action: 'write-tests' },
|
||||
{ skill: 'code-implementation', action: 'implement' },
|
||||
{ skill: 'code-review', action: 'review' },
|
||||
{ skill: 'documentation', action: 'update-docs' },
|
||||
],
|
||||
}
|
||||
|
||||
// Execute workflow
|
||||
const engine = new WorkflowEngine()
|
||||
const result = await engine.run(workflow)
|
||||
|
||||
console.log('Workflow completed:', result.status)
|
||||
console.log('Steps executed:', result.steps.length)
|
||||
```
|
||||
|
||||
## Skill Testing
|
||||
|
||||
```typescript
|
||||
import { SkillTestRunner, SkillTest } from '@skillkit/core'
|
||||
|
||||
// Define test
|
||||
const test: SkillTest = {
|
||||
name: 'pdf-processing',
|
||||
setup: async () => {
|
||||
// Setup test environment
|
||||
},
|
||||
assertions: [
|
||||
{
|
||||
type: 'file_exists',
|
||||
path: './output.pdf',
|
||||
},
|
||||
{
|
||||
type: 'content_includes',
|
||||
text: 'Expected content',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
// Run test
|
||||
const runner = new SkillTestRunner()
|
||||
const result = await runner.run(test)
|
||||
|
||||
console.log('Test passed:', result.passed)
|
||||
console.log('Assertions:', result.assertions)
|
||||
```
|
||||
|
||||
## Types
|
||||
@@ -99,6 +244,15 @@ interface Skill {
|
||||
content: string
|
||||
metadata: SkillMetadata
|
||||
enabled: boolean
|
||||
agent: string
|
||||
}
|
||||
|
||||
interface SkillMetadata {
|
||||
version?: string
|
||||
author?: string
|
||||
tags?: string[]
|
||||
dependencies?: string[]
|
||||
quality?: QualityScore
|
||||
}
|
||||
|
||||
interface QualityScore {
|
||||
@@ -114,4 +268,155 @@ interface Recommendation {
|
||||
score: number
|
||||
reasons: string[]
|
||||
}
|
||||
|
||||
interface ProjectAnalysis {
|
||||
techStack: {
|
||||
framework?: string
|
||||
language: string
|
||||
styling?: string
|
||||
testing?: string
|
||||
packageManager: string
|
||||
}
|
||||
patterns: {
|
||||
architecture: string
|
||||
codeStyle: Record<string, any>
|
||||
directory: string
|
||||
}
|
||||
dependencies: Record<string, string>
|
||||
}
|
||||
|
||||
interface MeshMessage {
|
||||
from: string
|
||||
to: string
|
||||
type: string
|
||||
payload: any
|
||||
timestamp: number
|
||||
signature?: string
|
||||
}
|
||||
|
||||
interface WorkflowResult {
|
||||
status: 'success' | 'failure'
|
||||
steps: WorkflowStepResult[]
|
||||
duration: number
|
||||
}
|
||||
```
|
||||
|
||||
## Package Exports
|
||||
|
||||
### @skillkit/core
|
||||
|
||||
```typescript
|
||||
export {
|
||||
// Discovery
|
||||
findAllSkills,
|
||||
findSkill,
|
||||
|
||||
// Quality
|
||||
evaluateSkillContent,
|
||||
getQualityGrade,
|
||||
|
||||
// Translation
|
||||
translateSkill,
|
||||
|
||||
// Memory
|
||||
MemoryCompressor,
|
||||
LearningStore,
|
||||
|
||||
// Recommendations
|
||||
RecommendationEngine,
|
||||
analyzeProject,
|
||||
|
||||
// Primer
|
||||
generateInstructions,
|
||||
|
||||
// Workflows
|
||||
WorkflowEngine,
|
||||
|
||||
// Testing
|
||||
SkillTestRunner,
|
||||
}
|
||||
```
|
||||
|
||||
### @skillkit/mesh
|
||||
|
||||
```typescript
|
||||
export {
|
||||
MeshHost,
|
||||
PeerIdentity,
|
||||
PeerRegistry,
|
||||
SecureTransport,
|
||||
}
|
||||
```
|
||||
|
||||
### @skillkit/messaging
|
||||
|
||||
```typescript
|
||||
export {
|
||||
MessagingClient,
|
||||
MessageBuilder,
|
||||
MessageRouter,
|
||||
}
|
||||
```
|
||||
|
||||
### @skillkit/memory
|
||||
|
||||
```typescript
|
||||
export {
|
||||
MemoryStore,
|
||||
TierManager,
|
||||
EmbeddingEncoder,
|
||||
}
|
||||
```
|
||||
|
||||
## Full Example: Custom Build Pipeline
|
||||
|
||||
```typescript
|
||||
import { promises as fs } from 'node:fs'
|
||||
import {
|
||||
analyzeProject,
|
||||
generateInstructions,
|
||||
RecommendationEngine,
|
||||
translateSkill,
|
||||
} from '@skillkit/core'
|
||||
|
||||
async function setupProject() {
|
||||
// 1. Analyze project
|
||||
const analysis = await analyzeProject('./my-project')
|
||||
|
||||
// 2. Generate base instructions
|
||||
const instructions = await generateInstructions(analysis, {
|
||||
agents: ['claude', 'cursor', 'windsurf'],
|
||||
})
|
||||
|
||||
// 3. Get recommendations
|
||||
const engine = new RecommendationEngine()
|
||||
const recommendations = engine.recommend(analysis)
|
||||
|
||||
// 4. Install top recommendations
|
||||
const topSkills = recommendations.slice(0, 5)
|
||||
for (const rec of topSkills) {
|
||||
console.log(`Installing ${rec.skill.name} (${rec.score}% match)`)
|
||||
}
|
||||
|
||||
// 5. Translate skills to all agents
|
||||
for (const agent of ['claude', 'cursor', 'windsurf']) {
|
||||
const translated = await translateSkill(
|
||||
topSkills[0].skill.content,
|
||||
agent
|
||||
)
|
||||
await fs.writeFile(`.${agent}/skills/${translated.filename}`, translated.content)
|
||||
}
|
||||
|
||||
console.log('✅ Project setup complete!')
|
||||
}
|
||||
|
||||
setupProject()
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Commands Reference](/docs/commands) - CLI commands
|
||||
- [Memory System](/docs/memory) - Persistent learning
|
||||
- [Mesh Network](/docs/mesh) - Multi-machine setup
|
||||
- [Workflows](/docs/workflows) - Automation
|
||||
- [Testing](/docs/testing) - Skill validation
|
||||
|
||||
@@ -86,19 +86,132 @@ skillkit settings --set autoSync=true
|
||||
skillkit settings --get agent
|
||||
```
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
### Memory System
|
||||
|
||||
```yaml
|
||||
# skillkit.yaml
|
||||
memory:
|
||||
enabled: true
|
||||
tier: personal # personal, project, global
|
||||
compression:
|
||||
minObservations: 10 # Compress after N observations
|
||||
autoExport: true # Auto-export as skills
|
||||
storage:
|
||||
backend: cozodb # cozodb, sqlite, memory
|
||||
path: ~/.skillkit/memory
|
||||
```
|
||||
|
||||
### Mesh Network
|
||||
|
||||
```yaml
|
||||
# skillkit.yaml
|
||||
mesh:
|
||||
enabled: true
|
||||
hostId: my-workstation
|
||||
discovery:
|
||||
method: local # local, tailscale, manual
|
||||
port: 9876
|
||||
security:
|
||||
mode: secure # development, signed, secure, strict
|
||||
keyPath: ~/.skillkit/mesh/keys
|
||||
peers:
|
||||
- id: laptop-dev
|
||||
address: 192.168.1.100
|
||||
trusted: true
|
||||
```
|
||||
|
||||
### Messaging
|
||||
|
||||
```yaml
|
||||
# skillkit.yaml
|
||||
messaging:
|
||||
enabled: true
|
||||
storagePath: ~/.skillkit/messages
|
||||
notifications: true
|
||||
autoArchive:
|
||||
enabled: true
|
||||
afterDays: 30
|
||||
```
|
||||
|
||||
### Primer
|
||||
|
||||
```yaml
|
||||
# skillkit.yaml
|
||||
primer:
|
||||
autoGenerate: true # Generate on changes
|
||||
agents:
|
||||
priority: [claude, cursor, windsurf]
|
||||
customize:
|
||||
tone: detailed # concise, detailed, technical
|
||||
includeExamples: true
|
||||
exclude:
|
||||
- node_modules
|
||||
- dist
|
||||
- .next
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
~/.skillkit/
|
||||
├── preferences.json # User preferences
|
||||
├── cache/ # Marketplace cache
|
||||
└── memory/ # Learning storage
|
||||
├── observations/
|
||||
├── learnings/
|
||||
└── index.json
|
||||
├── memory/ # Learning storage
|
||||
│ ├── observations/
|
||||
│ ├── learnings/
|
||||
│ └── index.json
|
||||
├── mesh/ # Mesh network
|
||||
│ ├── keys/ # Encryption keys
|
||||
│ ├── peers.json # Known peers
|
||||
│ └── config.json
|
||||
└── messages/ # Inter-agent messages
|
||||
├── inbox/
|
||||
├── sent/
|
||||
└── archived/
|
||||
|
||||
./project/
|
||||
├── skillkit.yaml # Project config
|
||||
├── .skills # Team manifest
|
||||
└── skills/ # Local skills
|
||||
├── skills/ # Local skills
|
||||
└── .skillkit/ # Project-specific
|
||||
├── cache/
|
||||
├── primer-config.json
|
||||
└── memory/
|
||||
```
|
||||
|
||||
## Configuration Profiles
|
||||
|
||||
Create different profiles for different environments:
|
||||
|
||||
```yaml
|
||||
# skillkit.yaml
|
||||
profiles:
|
||||
development:
|
||||
agent: claude
|
||||
autoSync: true
|
||||
mesh:
|
||||
security:
|
||||
mode: development
|
||||
|
||||
production:
|
||||
agent: universal
|
||||
autoSync: false
|
||||
mesh:
|
||||
security:
|
||||
mode: strict
|
||||
```
|
||||
|
||||
Use profiles:
|
||||
|
||||
```bash
|
||||
skillkit --profile production sync
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Primer](/docs/primer) - Auto-generate instructions
|
||||
- [Memory System](/docs/memory) - Persistent learning
|
||||
- [Mesh Network](/docs/mesh) - Multi-machine setup
|
||||
- [Team Collaboration](/docs/teams) - Team configuration
|
||||
|
||||
@@ -7,7 +7,7 @@ description: Universal CLI for managing AI agent skills across 32 coding platfor
|
||||
|
||||
SkillKit is a universal command-line interface (CLI) and programmatic toolkit for managing AI agent skills across **32 AI coding platforms**.
|
||||
|
||||
**Current Version:** v1.7.5
|
||||
**Current Version:** v1.8.0
|
||||
|
||||
## The Problem
|
||||
|
||||
@@ -25,22 +25,80 @@ SkillKit provides a **"write once, deploy everywhere"** platform. Maintain a sin
|
||||
## Quick Install
|
||||
|
||||
```bash
|
||||
# Run instantly with npx (no install required)
|
||||
npx skillkit@latest
|
||||
|
||||
# Or install globally for frequent use
|
||||
npm install -g skillkit
|
||||
skillkit init
|
||||
skillkit install anthropics/skills
|
||||
skillkit sync
|
||||
```
|
||||
|
||||
## Key Features
|
||||
## Core Features
|
||||
|
||||
| Feature | Description |
|
||||
|---------|-------------|
|
||||
| **Cross-Platform Translation** | Automatic conversion between 32 agent formats |
|
||||
| **Skill Discovery** | 15,000+ marketplace skills with AI recommendations |
|
||||
| **Smart Recommendations** | AI-powered skill suggestions based on your tech stack |
|
||||
| **Session Memory** | Persistent learning that survives across sessions |
|
||||
| **Primer** | Auto-generate agent instructions from your codebase |
|
||||
| **Mesh Network** | Multi-machine agent distribution with encrypted P2P |
|
||||
| **Inter-Agent Messaging** | Send messages between AI agents across your network |
|
||||
| **Team Collaboration** | Git-based `.skills` manifest for sharing |
|
||||
| **Quality Evaluation** | 0-100 scoring with A-F grades |
|
||||
| **Interactive TUI** | Beautiful terminal interface |
|
||||
| **Memory System** | Persistent learning across sessions |
|
||||
| **Workflow Orchestration** | Compose skills into multi-step automated workflows |
|
||||
| **Skill Testing** | Built-in test framework with assertions |
|
||||
| **CI/CD Integration** | GitHub Actions, GitLab CI, and pre-commit hooks |
|
||||
| **TypeScript API** | Full programmatic access to all features |
|
||||
| **Interactive TUI** | Beautiful terminal interface with real-time updates |
|
||||
|
||||
## Advanced Capabilities
|
||||
|
||||
### Session Memory System
|
||||
|
||||
Your AI agents learn patterns during sessions—then forget everything. SkillKit captures these learnings and makes them permanent.
|
||||
|
||||
```bash
|
||||
skillkit memory compress # Compress learnings
|
||||
skillkit memory search auth # Search knowledge
|
||||
skillkit memory export auth-patterns # Export as skill
|
||||
```
|
||||
|
||||
[Learn more →](/docs/memory)
|
||||
|
||||
### Primer - Auto-Generate Instructions
|
||||
|
||||
Automatically generate CLAUDE.md, .cursorrules, and agent instructions by analyzing your codebase.
|
||||
|
||||
```bash
|
||||
skillkit primer # Analyze project
|
||||
skillkit primer --all-agents # Generate for all 32 agents
|
||||
```
|
||||
|
||||
[Learn more →](/docs/primer)
|
||||
|
||||
### Mesh Network
|
||||
|
||||
Run agents across multiple machines with encrypted P2P communication.
|
||||
|
||||
```bash
|
||||
skillkit mesh init # Initialize mesh node
|
||||
skillkit mesh discover # Find peers on LAN
|
||||
skillkit mesh security init # Setup Ed25519 encryption
|
||||
```
|
||||
|
||||
[Learn more →](/docs/mesh)
|
||||
|
||||
### Inter-Agent Messaging
|
||||
|
||||
Send messages between AI agents across your mesh network.
|
||||
|
||||
```bash
|
||||
skillkit message send # Send to another agent
|
||||
skillkit message inbox # Check your inbox
|
||||
```
|
||||
|
||||
[Learn more →](/docs/messaging)
|
||||
|
||||
## Architecture
|
||||
|
||||
@@ -48,18 +106,23 @@ skillkit sync
|
||||
|------|------------|
|
||||
| **User Interfaces** | CLI (Clipanion v4), TUI (OpenTUI/React), Documentation |
|
||||
| **Business Logic** | @skillkit/core, @skillkit/agents (32 adapters) |
|
||||
| **Data Layer** | @skillkit/memory (CozoDB), @skillkit/mesh (WebSocket/UDP) |
|
||||
| **External Systems** | GitHub/GitLab, Marketplace (15,000+ skills) |
|
||||
|
||||
## Supported Agents
|
||||
## Supported Agents (32)
|
||||
|
||||
Claude Code, Cursor, Codex, Gemini CLI, OpenCode, GitHub Copilot, Windsurf, Antigravity, Amp, Clawdbot, Droid, Goose, Kilo Code, Kiro CLI, Roo Code, Trae, Cline, CodeBuddy, Continue, Crush, Factory, MCPJam, Mux, Neovate, OpenHands, Pi, Qoder, Qwen, Vercel, Zencoder, CommandCode, Universal
|
||||
|
||||
## Popular Sources
|
||||
[Full agent details →](/docs/agents)
|
||||
|
||||
## Popular Skill Sources
|
||||
|
||||
| Repository | Skills |
|
||||
|------------|--------|
|
||||
| anthropics/skills | PDF, XLSX, DOCX processing |
|
||||
| vercel-labs/agent-skills | React/Next.js best practices |
|
||||
| nextlevelbuilder/ui-ux-pro-max-skill | UI/UX design patterns |
|
||||
| superdesigndev/superdesign-skill | Modern design systems |
|
||||
|
||||
## Get Started
|
||||
|
||||
@@ -67,3 +130,19 @@ Claude Code, Cursor, Codex, Gemini CLI, OpenCode, GitHub Copilot, Windsurf, Anti
|
||||
2. [Quick Start](/docs/quickstart) - 5-minute guide
|
||||
3. [Commands](/docs/commands) - Full CLI reference
|
||||
4. [Skills](/docs/skills) - Skill format and lifecycle
|
||||
5. [API Reference](/docs/api-reference) - Programmatic access
|
||||
|
||||
## Use Cases
|
||||
|
||||
- **Multi-Agent Developer** - Write skills once, use across Claude, Cursor, Windsurf, and more
|
||||
- **Team Lead** - Share skills via Git-based manifest, ensure team alignment
|
||||
- **New Project Starter** - Auto-generate agent instructions with Primer
|
||||
- **Enterprise Architect** - Distribute agents across multiple machines with Mesh Network
|
||||
|
||||
## Enterprise Features
|
||||
|
||||
- **Private Registries** - Host internal skills in private repos
|
||||
- **Git-Based Sync** - Skills live in your repo, push to share
|
||||
- **CI/CD Integration** - Auto-validate and deploy skills on every commit
|
||||
- **TypeScript API** - Full programmatic access for custom workflows
|
||||
- **Security** - Ed25519 encryption, XChaCha20-Poly1305, TLS 1.3
|
||||
|
||||
@@ -10,13 +10,17 @@
|
||||
"translation",
|
||||
"marketplace",
|
||||
"recommendations",
|
||||
"primer",
|
||||
"memory",
|
||||
"mesh",
|
||||
"messaging",
|
||||
"workflows",
|
||||
"testing",
|
||||
"commands",
|
||||
"configuration",
|
||||
"api-reference",
|
||||
"cicd",
|
||||
"teams",
|
||||
"custom-agents",
|
||||
"contributing"
|
||||
]
|
||||
|
||||
@@ -0,0 +1,303 @@
|
||||
---
|
||||
title: Primer
|
||||
description: Auto-generate AI agent instructions from your codebase
|
||||
---
|
||||
|
||||
# Primer
|
||||
|
||||
Primer analyzes your codebase and automatically generates optimized instructions for all 32 AI agents. No more manual configuration—let SkillKit detect your tech stack, coding patterns, and project structure.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Analyze current project
|
||||
skillkit primer
|
||||
|
||||
# Generate for specific agents
|
||||
skillkit primer --agent claude,cursor,windsurf
|
||||
|
||||
# Generate for all 32 agents
|
||||
skillkit primer --all-agents
|
||||
|
||||
# Preview without writing files
|
||||
skillkit primer --dry-run
|
||||
```
|
||||
|
||||
## What Primer Detects
|
||||
|
||||
### Tech Stack
|
||||
- **Frameworks**: React, Next.js, Vue, Angular, Svelte, etc.
|
||||
- **Languages**: TypeScript, JavaScript, Python, Go, Rust, etc.
|
||||
- **Build Tools**: Vite, Webpack, Turbopack, esbuild
|
||||
- **Package Managers**: npm, pnpm, yarn, bun
|
||||
|
||||
### Project Patterns
|
||||
- **Architecture**: Monorepo, microservices, serverless
|
||||
- **Code Style**: Formatting rules, naming conventions
|
||||
- **Directory Structure**: Feature-based, layer-based, domain-driven
|
||||
- **Dependencies**: Key libraries and their versions
|
||||
|
||||
### Best Practices
|
||||
- **Testing Setup**: Jest, Vitest, Playwright, Cypress
|
||||
- **Linting**: ESLint, Prettier, TypeScript strict mode
|
||||
- **Documentation**: JSDoc, TSDoc, README patterns
|
||||
- **Git Workflow**: Branch strategy, commit conventions
|
||||
|
||||
## Generated Instructions
|
||||
|
||||
Primer creates agent-specific instructions for:
|
||||
|
||||
### Claude Code
|
||||
```
|
||||
.claude/
|
||||
└── CLAUDE.md # Full project context
|
||||
```
|
||||
|
||||
### Cursor
|
||||
```
|
||||
.cursor/
|
||||
└── .cursorrules # IDE-specific rules
|
||||
```
|
||||
|
||||
### GitHub Copilot
|
||||
```
|
||||
.github/
|
||||
└── copilot-instructions.md
|
||||
```
|
||||
|
||||
### All 32 Agents
|
||||
Each agent gets optimized instructions in their native format.
|
||||
|
||||
## Example Output
|
||||
|
||||
```bash
|
||||
$ skillkit primer
|
||||
|
||||
🔍 Analyzing project...
|
||||
|
||||
Detected:
|
||||
Framework: Next.js 14 (App Router)
|
||||
Language: TypeScript (strict mode)
|
||||
Styling: Tailwind CSS v3
|
||||
Testing: Vitest + Playwright
|
||||
Package Manager: pnpm
|
||||
|
||||
✅ Generated instructions for:
|
||||
- Claude Code (.claude/CLAUDE.md)
|
||||
- Cursor (.cursor/.cursorrules)
|
||||
- Codex (.codex/instructions.md)
|
||||
+ 29 more agents
|
||||
|
||||
💡 Tip: Run `skillkit sync` to apply changes
|
||||
```
|
||||
|
||||
## Customization
|
||||
|
||||
### Configuration File
|
||||
|
||||
Create `.skillkit/primer-config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"include": {
|
||||
"techStack": true,
|
||||
"codeStyle": true,
|
||||
"testingPatterns": true,
|
||||
"customRules": [
|
||||
"Always use async/await over promises",
|
||||
"Prefer functional components in React",
|
||||
"Use Zod for runtime validation"
|
||||
]
|
||||
},
|
||||
"exclude": {
|
||||
"directories": ["node_modules", "dist", ".next"],
|
||||
"patterns": ["*.test.ts", "*.spec.ts"]
|
||||
},
|
||||
"agents": {
|
||||
"priority": ["claude", "cursor", "windsurf"],
|
||||
"customize": {
|
||||
"claude": {
|
||||
"tone": "detailed",
|
||||
"examples": true
|
||||
},
|
||||
"cursor": {
|
||||
"tone": "concise",
|
||||
"shortcuts": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Template Overrides
|
||||
|
||||
Override default templates in `.skillkit/primer-templates/`:
|
||||
|
||||
```
|
||||
.skillkit/primer-templates/
|
||||
├── claude.template.md
|
||||
├── cursor.template.md
|
||||
└── shared/
|
||||
├── header.md
|
||||
└── footer.md
|
||||
```
|
||||
|
||||
## Update Strategies
|
||||
|
||||
### Incremental Updates
|
||||
|
||||
```bash
|
||||
# Update only when changes detected
|
||||
skillkit primer --incremental
|
||||
|
||||
# Force regeneration
|
||||
skillkit primer --force
|
||||
```
|
||||
|
||||
### Git Integration
|
||||
|
||||
```bash
|
||||
# Auto-generate on git hooks
|
||||
cat > .git/hooks/post-checkout << 'EOF'
|
||||
#!/usr/bin/env bash
|
||||
skillkit primer --incremental
|
||||
EOF
|
||||
chmod +x .git/hooks/post-checkout
|
||||
```
|
||||
|
||||
### CI/CD Pipeline
|
||||
|
||||
```yaml
|
||||
# .github/workflows/primer.yml
|
||||
name: Update Agent Instructions
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'package.json'
|
||||
- 'tsconfig.json'
|
||||
- 'src/**'
|
||||
|
||||
jobs:
|
||||
primer:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: npx skillkit primer --all-agents
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "chore: update agent instructions"
|
||||
```
|
||||
|
||||
## Programmatic API
|
||||
|
||||
```typescript
|
||||
import { analyzeProject, generateInstructions } from '@skillkit/core';
|
||||
|
||||
// Analyze project
|
||||
const analysis = await analyzeProject('./my-project');
|
||||
console.log(analysis.techStack);
|
||||
// { framework: 'Next.js', language: 'TypeScript', ... }
|
||||
|
||||
// Generate instructions
|
||||
const instructions = await generateInstructions(analysis, {
|
||||
agents: ['claude', 'cursor'],
|
||||
includeExamples: true,
|
||||
tone: 'detailed',
|
||||
});
|
||||
|
||||
// Write to files
|
||||
for (const [agent, content] of Object.entries(instructions)) {
|
||||
await writeAgentFile(agent, content);
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### When to Run Primer
|
||||
|
||||
- **Initial Setup** - First time configuring agents
|
||||
- **Major Changes** - New frameworks or architecture changes
|
||||
- **Team Onboarding** - New developers joining the project
|
||||
- **Agent Migration** - Switching to new AI coding tools
|
||||
|
||||
### What to Commit
|
||||
|
||||
```text
|
||||
# Commit generated instructions
|
||||
.claude/
|
||||
.cursor/
|
||||
.github/copilot-instructions.md
|
||||
|
||||
# Don't commit
|
||||
.skillkit/cache/
|
||||
.skillkit/primer-temp/
|
||||
```
|
||||
|
||||
### Combining with Skills
|
||||
|
||||
Primer generates base instructions. Layer on specific skills:
|
||||
|
||||
```bash
|
||||
# 1. Generate base instructions
|
||||
skillkit primer --all-agents
|
||||
|
||||
# 2. Install domain-specific skills
|
||||
skillkit install anthropics/skills --skill pdf,xlsx
|
||||
|
||||
# 3. Sync everything
|
||||
skillkit sync
|
||||
```
|
||||
|
||||
## Comparison
|
||||
|
||||
| Method | Setup Time | Accuracy | Maintenance |
|
||||
|--------|-----------|----------|-------------|
|
||||
| **Manual Writing** | Hours | Variable | Manual updates |
|
||||
| **AI Generation** | Minutes | High | Auto-detect changes |
|
||||
| **Copy/Paste** | Minutes | Low | Stale quickly |
|
||||
| **Primer** | Seconds | Very High | Auto-incremental |
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Primer Not Detecting Framework
|
||||
|
||||
```bash
|
||||
# Specify manually
|
||||
skillkit primer --framework nextjs --language typescript
|
||||
|
||||
# Check detection logs
|
||||
skillkit primer --verbose
|
||||
```
|
||||
|
||||
### Generated Instructions Too Generic
|
||||
|
||||
Customize with `primer-config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"tone": "detailed",
|
||||
"includeExamples": true,
|
||||
"customRules": [
|
||||
"Your specific coding guidelines..."
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Instructions Out of Sync
|
||||
|
||||
```bash
|
||||
# Force regeneration
|
||||
skillkit primer --force
|
||||
|
||||
# Clean cache
|
||||
rm -rf .skillkit/cache/primer
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Memory System](/docs/memory) - Capture learnings from sessions
|
||||
- [Skills](/docs/skills) - Install domain-specific skills
|
||||
- [Translation](/docs/translation) - Convert between agent formats
|
||||
- [Team Collaboration](/docs/teams) - Share instructions with your team
|
||||
@@ -136,6 +136,55 @@ skillkit install vercel-labs/agent-skills --agent claude,cursor,windsurf
|
||||
skillkit sync
|
||||
```
|
||||
|
||||
## 7. Advanced Features
|
||||
|
||||
### Auto-Generate Instructions (Primer)
|
||||
|
||||
Let SkillKit analyze your codebase and generate optimized instructions:
|
||||
|
||||
```bash
|
||||
skillkit primer # Analyze and generate
|
||||
skillkit primer --all-agents # Generate for all 32 agents
|
||||
```
|
||||
|
||||
[Learn more about Primer →](/docs/primer)
|
||||
|
||||
### Session Memory
|
||||
|
||||
Capture learnings from your AI sessions:
|
||||
|
||||
```bash
|
||||
skillkit memory compress # Compress learnings
|
||||
skillkit memory search auth # Search knowledge
|
||||
skillkit memory export auth-skill # Export as skill
|
||||
```
|
||||
|
||||
[Learn more about Memory →](/docs/memory)
|
||||
|
||||
### Mesh Network (Multi-Machine)
|
||||
|
||||
Distribute agents across multiple machines:
|
||||
|
||||
```bash
|
||||
skillkit mesh init # Initialize mesh node
|
||||
skillkit mesh discover # Find peers on LAN
|
||||
skillkit mesh security init # Setup encryption
|
||||
```
|
||||
|
||||
[Learn more about Mesh →](/docs/mesh)
|
||||
|
||||
### Inter-Agent Messaging
|
||||
|
||||
Send messages between AI agents:
|
||||
|
||||
```bash
|
||||
skillkit message send # Send to another agent
|
||||
skillkit message inbox # Check your inbox
|
||||
skillkit message reply <id> # Reply to message
|
||||
```
|
||||
|
||||
[Learn more about Messaging →](/docs/messaging)
|
||||
|
||||
## Team Collaboration
|
||||
|
||||
Share skills with your team using manifest files:
|
||||
@@ -154,6 +203,41 @@ skillkit manifest install
|
||||
|
||||
The `.skills` file can be committed to Git for team-wide consistency.
|
||||
|
||||
## Workflows & Automation
|
||||
|
||||
### Workflow Orchestration
|
||||
|
||||
Compose skills into multi-step workflows:
|
||||
|
||||
```bash
|
||||
skillkit workflow create feature-development
|
||||
skillkit workflow run feature-development
|
||||
```
|
||||
|
||||
[Learn more about Workflows →](/docs/workflows)
|
||||
|
||||
### Skill Testing
|
||||
|
||||
Test skills before deployment:
|
||||
|
||||
```bash
|
||||
skillkit test # Run all tests
|
||||
skillkit test --tags unit # Run specific tests
|
||||
```
|
||||
|
||||
[Learn more about Testing →](/docs/testing)
|
||||
|
||||
### CI/CD Integration
|
||||
|
||||
Generate GitHub Actions, GitLab CI configs:
|
||||
|
||||
```bash
|
||||
skillkit cicd init --provider github
|
||||
skillkit cicd init --provider gitlab
|
||||
```
|
||||
|
||||
[Learn more about CI/CD →](/docs/cicd)
|
||||
|
||||
## User Preferences
|
||||
|
||||
Your choices are saved to `~/.skillkit/preferences.json`:
|
||||
@@ -168,9 +252,44 @@ Your choices are saved to `~/.skillkit/preferences.json`:
|
||||
}
|
||||
```
|
||||
|
||||
## Complete Workflow Example
|
||||
|
||||
```bash
|
||||
# 1. Install SkillKit
|
||||
npm install -g skillkit
|
||||
|
||||
# 2. Initialize in your project
|
||||
cd my-project
|
||||
skillkit init
|
||||
|
||||
# 3. Auto-generate base instructions
|
||||
skillkit primer --all-agents
|
||||
|
||||
# 4. Get smart recommendations
|
||||
skillkit recommend
|
||||
|
||||
# 5. Install recommended skills
|
||||
skillkit install anthropics/skills
|
||||
|
||||
# 6. Setup mesh network (optional)
|
||||
skillkit mesh init
|
||||
|
||||
# 7. Setup session memory (optional)
|
||||
skillkit memory compress
|
||||
|
||||
# 8. Sync everything to agents
|
||||
skillkit sync
|
||||
|
||||
# 9. Launch TUI for visual management
|
||||
skillkit
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
- **Browse Marketplace** - `skillkit marketplace`
|
||||
- **Create Custom Skills** - `skillkit create my-skill`
|
||||
- **Translate Between Agents** - `skillkit translate skill --to cursor`
|
||||
- **Auto-Generate Instructions** - `skillkit primer`
|
||||
- **Setup Memory System** - `skillkit memory compress`
|
||||
- **View All Commands** - `skillkit --help`
|
||||
- **API Reference** - [Programmatic Access →](/docs/api-reference)
|
||||
@@ -0,0 +1,455 @@
|
||||
---
|
||||
title: Team Collaboration
|
||||
description: Share skills and maintain consistency across your development team
|
||||
---
|
||||
|
||||
# Team Collaboration
|
||||
|
||||
SkillKit provides powerful team collaboration features to ensure every developer has the same AI agent capabilities, follows the same patterns, and stays in sync.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Initialize team manifest
|
||||
skillkit team init
|
||||
|
||||
# Add skills to team manifest
|
||||
skillkit team add anthropics/skills
|
||||
skillkit team add ./local-skills
|
||||
|
||||
# Share with team (commit to Git)
|
||||
git add .skills
|
||||
git commit -m "Add team skills manifest"
|
||||
git push
|
||||
|
||||
# Team members install
|
||||
git pull
|
||||
skillkit team install
|
||||
```
|
||||
|
||||
## Team Manifest (.skills)
|
||||
|
||||
The `.skills` file is a Git-committable manifest that defines your team's skill stack.
|
||||
|
||||
### Example Manifest
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "1.0",
|
||||
"name": "my-team",
|
||||
"skills": [
|
||||
{
|
||||
"source": "anthropics/skills",
|
||||
"skills": ["pdf", "xlsx", "docx"],
|
||||
"version": "1.2.0"
|
||||
},
|
||||
{
|
||||
"source": "vercel-labs/agent-skills",
|
||||
"skills": ["react-best-practices", "nextjs-patterns"],
|
||||
"version": "latest"
|
||||
},
|
||||
{
|
||||
"source": "./local-skills",
|
||||
"skills": ["company-coding-standards", "api-guidelines"],
|
||||
"type": "local"
|
||||
}
|
||||
],
|
||||
"agents": ["claude", "cursor", "windsurf"],
|
||||
"config": {
|
||||
"autoSync": true,
|
||||
"syncOnPull": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
### Initialize Team
|
||||
|
||||
```bash
|
||||
# Create .skills manifest
|
||||
skillkit team init
|
||||
|
||||
# Specify team name
|
||||
skillkit team init --name engineering-team
|
||||
|
||||
# Add initial skills
|
||||
skillkit team init --skills anthropics/skills,vercel-labs/agent-skills
|
||||
```
|
||||
|
||||
### Manage Skills
|
||||
|
||||
```bash
|
||||
# Add skill source
|
||||
skillkit team add anthropics/skills
|
||||
|
||||
# Add specific skills
|
||||
skillkit team add anthropics/skills --skills pdf,xlsx
|
||||
|
||||
# Remove skill
|
||||
skillkit team remove anthropics/skills
|
||||
|
||||
# List team skills
|
||||
skillkit team list
|
||||
```
|
||||
|
||||
### Install & Sync
|
||||
|
||||
```bash
|
||||
# Install all team skills
|
||||
skillkit team install
|
||||
|
||||
# Install and sync
|
||||
skillkit team install --sync
|
||||
|
||||
# Force reinstall
|
||||
skillkit team install --force
|
||||
```
|
||||
|
||||
### Share & Update
|
||||
|
||||
```bash
|
||||
# Share current skills as team manifest
|
||||
skillkit team share
|
||||
|
||||
# Update team manifest from installed skills
|
||||
skillkit team update
|
||||
|
||||
# Sync team manifest with Git remote
|
||||
skillkit team sync
|
||||
```
|
||||
|
||||
## Git Integration
|
||||
|
||||
### Auto-Install on Pull
|
||||
|
||||
Add to `.git/hooks/post-merge`:
|
||||
|
||||
```bash
|
||||
#!/bin/sh
|
||||
if [ -f .skills ]; then
|
||||
echo "📦 Installing team skills..."
|
||||
skillkit team install --yes
|
||||
fi
|
||||
```
|
||||
|
||||
Make it executable:
|
||||
|
||||
```bash
|
||||
chmod +x .git/hooks/post-merge
|
||||
```
|
||||
|
||||
### Pre-Commit Validation
|
||||
|
||||
Ensure skills are valid before committing:
|
||||
|
||||
```bash
|
||||
# .git/hooks/pre-commit
|
||||
#!/bin/sh
|
||||
if [ -f .skills ]; then
|
||||
echo "🔍 Validating team skills..."
|
||||
skillkit team validate
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Team skills validation failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
```
|
||||
|
||||
## CI/CD Integration
|
||||
|
||||
### GitHub Actions
|
||||
|
||||
```yaml
|
||||
# .github/workflows/skills.yml
|
||||
name: Team Skills
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.skills'
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Install SkillKit
|
||||
run: npm install -g skillkit
|
||||
|
||||
- name: Validate Team Manifest
|
||||
run: skillkit team validate
|
||||
|
||||
- name: Install Skills
|
||||
run: skillkit team install --yes
|
||||
|
||||
- name: Run Skill Tests
|
||||
run: skillkit test
|
||||
```
|
||||
|
||||
### GitLab CI
|
||||
|
||||
```yaml
|
||||
# .gitlab-ci.yml
|
||||
skills:validate:
|
||||
stage: test
|
||||
script:
|
||||
- npm install -g skillkit
|
||||
- skillkit team validate
|
||||
- skillkit team install --yes
|
||||
- skillkit test
|
||||
only:
|
||||
changes:
|
||||
- .skills
|
||||
```
|
||||
|
||||
## Private Registries
|
||||
|
||||
Host proprietary skills in private repositories.
|
||||
|
||||
### Setup Private Registry
|
||||
|
||||
```bash
|
||||
# Add private registry
|
||||
skillkit registry add company-skills \
|
||||
--url https://github.com/mycompany/skills \
|
||||
--token $GITHUB_TOKEN
|
||||
|
||||
# Install from private registry
|
||||
skillkit install company-skills/auth-patterns
|
||||
```
|
||||
|
||||
### Team Manifest with Private Skills
|
||||
|
||||
```json
|
||||
{
|
||||
"skills": [
|
||||
{
|
||||
"source": "company-skills/proprietary-skills",
|
||||
"registry": "company-skills",
|
||||
"skills": ["auth-patterns", "payment-processing"],
|
||||
"private": true
|
||||
}
|
||||
],
|
||||
"registries": [
|
||||
{
|
||||
"name": "company-skills",
|
||||
"url": "https://github.com/mycompany/skills",
|
||||
"auth": "env:GITHUB_TOKEN"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Team Workflows
|
||||
|
||||
### Onboarding New Developers
|
||||
|
||||
```bash
|
||||
# 1. Clone repository
|
||||
git clone https://github.com/company/project
|
||||
cd project
|
||||
|
||||
# 2. Install team skills
|
||||
skillkit team install
|
||||
|
||||
# 3. Generate project instructions
|
||||
skillkit primer --all-agents
|
||||
|
||||
# 4. Sync to agents
|
||||
skillkit sync
|
||||
|
||||
# ✅ Developer is ready!
|
||||
```
|
||||
|
||||
### Creating Team-Wide Skills
|
||||
|
||||
```bash
|
||||
# 1. Create new skill
|
||||
skillkit create company-coding-standards
|
||||
|
||||
# 2. Add to local skills
|
||||
mv company-coding-standards ./local-skills/
|
||||
|
||||
# 3. Add to team manifest
|
||||
skillkit team add ./local-skills
|
||||
|
||||
# 4. Commit and push
|
||||
git add .skills local-skills/
|
||||
git commit -m "Add company coding standards"
|
||||
git push
|
||||
```
|
||||
|
||||
### Updating Team Skills
|
||||
|
||||
```bash
|
||||
# 1. Update skill version
|
||||
skillkit team update anthropics/skills --version 1.3.0
|
||||
|
||||
# 2. Test locally
|
||||
skillkit team install
|
||||
skillkit test
|
||||
|
||||
# 3. Commit if tests pass
|
||||
git add .skills
|
||||
git commit -m "Update anthropics/skills to v1.3.0"
|
||||
git push
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Version Pinning
|
||||
|
||||
Pin critical skills to specific versions:
|
||||
|
||||
```json
|
||||
{
|
||||
"skills": [
|
||||
{
|
||||
"source": "anthropics/skills",
|
||||
"version": "1.2.0",
|
||||
"pinned": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Skill Categories
|
||||
|
||||
Organize by category:
|
||||
|
||||
```json
|
||||
{
|
||||
"skills": [
|
||||
{
|
||||
"category": "core",
|
||||
"source": "anthropics/skills",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"category": "optional",
|
||||
"source": "vercel-labs/agent-skills",
|
||||
"required": false
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Environment-Specific Skills
|
||||
|
||||
```json
|
||||
{
|
||||
"environments": {
|
||||
"development": {
|
||||
"skills": ["debug-tools", "dev-server-patterns"]
|
||||
},
|
||||
"production": {
|
||||
"skills": ["performance-monitoring", "error-tracking"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Conflict Resolution
|
||||
|
||||
### Skill Name Conflicts
|
||||
|
||||
When multiple sources provide the same skill name:
|
||||
|
||||
```bash
|
||||
# List conflicts
|
||||
skillkit team conflicts
|
||||
|
||||
# Resolve by priority
|
||||
skillkit team resolve --priority "local,anthropics,vercel"
|
||||
```
|
||||
|
||||
### Version Conflicts
|
||||
|
||||
```bash
|
||||
# Show version mismatches
|
||||
skillkit team check-versions
|
||||
|
||||
# Align to latest
|
||||
skillkit team align --strategy latest
|
||||
|
||||
# Align to pinned
|
||||
skillkit team align --strategy pinned
|
||||
```
|
||||
|
||||
## Programmatic API
|
||||
|
||||
```typescript
|
||||
import { TeamManifest, TeamSync } from '@skillkit/core'
|
||||
|
||||
// Load team manifest
|
||||
const manifest = await TeamManifest.load('./.skills')
|
||||
|
||||
// Install team skills
|
||||
const sync = new TeamSync(manifest)
|
||||
await sync.install({
|
||||
agents: ['claude', 'cursor'],
|
||||
force: false,
|
||||
})
|
||||
|
||||
// Update manifest
|
||||
manifest.addSkill({
|
||||
source: 'anthropics/skills',
|
||||
skills: ['pdf'],
|
||||
version: '1.2.0',
|
||||
})
|
||||
|
||||
await manifest.save()
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Skills Not Syncing
|
||||
|
||||
```bash
|
||||
# Force reinstall
|
||||
skillkit team install --force
|
||||
|
||||
# Clear cache
|
||||
skillkit team clean
|
||||
|
||||
# Reinstall
|
||||
skillkit team install
|
||||
```
|
||||
|
||||
### Manifest Validation Errors
|
||||
|
||||
```bash
|
||||
# Validate manifest
|
||||
skillkit team validate --verbose
|
||||
|
||||
# Fix common issues
|
||||
skillkit team validate --fix
|
||||
```
|
||||
|
||||
### Merge Conflicts in .skills
|
||||
|
||||
```bash
|
||||
# Accept theirs
|
||||
git checkout --theirs .skills
|
||||
skillkit team install
|
||||
|
||||
# Accept ours
|
||||
git checkout --ours .skills
|
||||
skillkit team install
|
||||
|
||||
# Merge manually
|
||||
skillkit team merge-conflicts
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [CI/CD Integration](/docs/cicd) - Automate skill deployment
|
||||
- [Workflows](/docs/workflows) - Team-wide automation
|
||||
- [Testing](/docs/testing) - Validate skills before deployment
|
||||
@@ -18,10 +18,12 @@ skillkit
|
||||
## Framework
|
||||
|
||||
Built on modern technologies:
|
||||
- **@opentui/react** - Terminal rendering
|
||||
- **React 19.0.0** - Component architecture
|
||||
- **@opentui/solid** - Terminal rendering with Solid.js
|
||||
- **Solid.js 1.9.0** - Reactive component architecture
|
||||
- **Bun 1.2.0+** - Runtime requirement
|
||||
|
||||
The TUI was migrated from React to Solid.js in v1.8.0 for improved performance and smaller bundle size.
|
||||
|
||||
## Screens
|
||||
|
||||
| Screen | Key | Purpose |
|
||||
@@ -159,8 +161,10 @@ loadSkills()
|
||||
|
||||
### Performance Optimizations
|
||||
|
||||
- `useMemo` for filtered lists
|
||||
- `useCallback` for event handlers
|
||||
- `createMemo` for filtered lists and computed values
|
||||
- `createSignal` for reactive state management
|
||||
- `createEffect` for side effects and subscriptions
|
||||
- Windowed list rendering for large datasets
|
||||
- Pagination limits rendered items
|
||||
- Progressive animation with phases
|
||||
|
||||
@@ -174,18 +178,32 @@ loadSkills()
|
||||
|
||||
## Integration
|
||||
|
||||
The TUI integrates with @skillkit/core:
|
||||
The TUI integrates with @skillkit/core using Solid.js reactive patterns:
|
||||
|
||||
```typescript
|
||||
findAllSkills(searchDirs) // Returns skill metadata
|
||||
evaluateSkillDirectory(path) // Quality metrics
|
||||
getQualityGrade(score) // 0-100 to A-F
|
||||
import { createSignal, createMemo, createEffect } from 'solid-js';
|
||||
|
||||
const [skills, setSkills] = createSignal([]);
|
||||
|
||||
createEffect(async () => {
|
||||
const result = await findAllSkills(searchDirs);
|
||||
setSkills(result);
|
||||
});
|
||||
|
||||
const filteredSkills = createMemo(() =>
|
||||
skills().filter(s => s.name.includes(searchTerm()))
|
||||
);
|
||||
```
|
||||
|
||||
Core functions:
|
||||
- `findAllSkills(searchDirs)` - Returns skill metadata
|
||||
- `evaluateSkillDirectory(path)` - Quality metrics
|
||||
- `getQualityGrade(score)` - 0-100 to A-F
|
||||
|
||||
## Graceful Exit
|
||||
|
||||
The TUI handles shutdown gracefully:
|
||||
1. Unmounts React components
|
||||
1. Runs Solid.js cleanup functions (`onCleanup`)
|
||||
2. Restores terminal state
|
||||
3. Cleans up signal handlers
|
||||
4. Exits process cleanly
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "skillkit-docs",
|
||||
"version": "1.0.0",
|
||||
"version": "1.8.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "next build",
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
import Link from 'next/link'
|
||||
|
||||
const GITHUB_ICON = (
|
||||
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path fillRule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clipRule="evenodd" />
|
||||
</svg>
|
||||
)
|
||||
|
||||
const NPM_ICON = (
|
||||
<svg className="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M0 7.334v8h6.666v1.332H12v-1.332h12v-8H0zm6.666 6.664H5.334v-4H3.999v4H1.335V8.667h5.331v5.331zm4 0v1.336H8.001V8.667h5.334v5.332h-2.669v-.001zm12.001 0h-1.33v-4h-1.336v4h-1.335v-4h-1.33v4h-2.671V8.667h8.002v5.331zM10.665 10H12v2.667h-1.335V10z" />
|
||||
</svg>
|
||||
)
|
||||
|
||||
export default function HomeLayout({
|
||||
children,
|
||||
}: {
|
||||
@@ -22,34 +10,24 @@ export default function HomeLayout({
|
||||
<nav className="fixed top-0 left-0 right-0 z-50 border-b border-zinc-800 bg-black/90 backdrop-blur-md">
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="flex h-14 items-center justify-between">
|
||||
<Link href="/" className="flex items-center gap-2 cursor-pointer">
|
||||
<Link href="/" className="flex items-center gap-2">
|
||||
<div className="w-4 h-4 bg-white"></div>
|
||||
<span className="text-base font-bold tracking-tight text-white font-mono">SKILLKIT</span>
|
||||
</Link>
|
||||
<div className="flex items-center gap-2 sm:gap-4">
|
||||
<div className="flex items-center gap-4">
|
||||
<Link
|
||||
href="/docs"
|
||||
className="text-zinc-400 hover:text-white transition-colors text-sm font-mono"
|
||||
>
|
||||
Docs
|
||||
</Link>
|
||||
<a
|
||||
href="https://www.npmjs.com/package/skillkit"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
className="text-zinc-400 hover:text-red-500 transition-colors p-2"
|
||||
aria-label="npm"
|
||||
>
|
||||
{NPM_ICON}
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/rohitg00/skillkit"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
className="text-zinc-400 hover:text-white transition-colors p-2"
|
||||
aria-label="GitHub"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-400 hover:text-white transition-colors text-sm font-mono"
|
||||
>
|
||||
{GITHUB_ICON}
|
||||
GitHub
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,40 +1,96 @@
|
||||
'use client'
|
||||
|
||||
import { Hero } from '@/components/Hero'
|
||||
import { Agents } from '@/components/Agents'
|
||||
import { Features } from '@/components/Features'
|
||||
import { Commands } from '@/components/Commands'
|
||||
import { SkillGenerator } from '@/components/SkillGenerator'
|
||||
import { SkillSubmitForm } from '@/components/SkillSubmitForm'
|
||||
import { Footer } from '@/components/Footer'
|
||||
import Link from 'next/link'
|
||||
|
||||
export default function HomePage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-black text-zinc-100 font-sans selection:bg-white selection:text-black">
|
||||
<main>
|
||||
<Hero />
|
||||
<Agents />
|
||||
<Features />
|
||||
<Commands />
|
||||
|
||||
<section id="skills" className="py-12 border-b border-zinc-800">
|
||||
<SkillGenerator />
|
||||
</section>
|
||||
|
||||
<section id="submit" className="py-12 border-b border-zinc-800 bg-zinc-900/50">
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="text-center mb-8">
|
||||
<h2 className="text-2xl font-bold text-white mb-2 font-mono">Submit Your Skill</h2>
|
||||
<p className="text-zinc-400 font-mono text-sm">
|
||||
Share your AI agent skills with the community.
|
||||
</p>
|
||||
</div>
|
||||
<SkillSubmitForm />
|
||||
<div className="min-h-screen bg-black text-zinc-100">
|
||||
<main className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8 py-20">
|
||||
{/* Hero */}
|
||||
<div className="text-center mb-16">
|
||||
<div className="inline-flex items-center space-x-2 border border-zinc-800 bg-zinc-900/50 px-3 py-1 mb-6">
|
||||
<span className="flex h-2 w-2 bg-white rounded-full"></span>
|
||||
<span className="text-sm font-mono text-zinc-400">v1.8.0</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<h1 className="text-4xl sm:text-5xl lg:text-6xl font-bold tracking-tight text-white mb-6 font-mono">
|
||||
Universal Skills for<br />
|
||||
<span className="text-zinc-500">AI Coding Agents</span>
|
||||
</h1>
|
||||
|
||||
<p className="text-lg text-zinc-400 mb-8 max-w-2xl mx-auto font-mono">
|
||||
One CLI to install, sync, and manage skills across Claude Code, Cursor,
|
||||
Windsurf, Copilot, and 28 more agents. 15,000+ skills ready to use.
|
||||
</p>
|
||||
|
||||
<div className="flex flex-wrap justify-center gap-4 mb-12">
|
||||
<code className="inline-flex items-center bg-zinc-900 border border-zinc-700 px-4 py-3 text-sm font-mono">
|
||||
<span className="text-zinc-500 mr-2">$</span>
|
||||
<span className="text-white">npx skillkit@latest</span>
|
||||
</code>
|
||||
|
||||
<Link
|
||||
href="/docs"
|
||||
className="inline-flex items-center bg-white text-black px-6 py-3 font-mono text-sm hover:bg-zinc-200 transition-colors"
|
||||
>
|
||||
Read the Docs →
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Features Grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-16">
|
||||
<div className="border border-zinc-800 bg-zinc-900/30 p-6">
|
||||
<h3 className="text-lg font-bold text-white mb-2 font-mono">32 Agents</h3>
|
||||
<p className="text-zinc-500 text-sm">Claude, Cursor, Codex, Windsurf, Copilot, and 27 more supported out of the box.</p>
|
||||
</div>
|
||||
<div className="border border-zinc-800 bg-zinc-900/30 p-6">
|
||||
<h3 className="text-lg font-bold text-white mb-2 font-mono">15,000+ Skills</h3>
|
||||
<p className="text-zinc-500 text-sm">Browse the marketplace or create your own. Install with a single command.</p>
|
||||
</div>
|
||||
<div className="border border-zinc-800 bg-zinc-900/30 p-6">
|
||||
<h3 className="text-lg font-bold text-white mb-2 font-mono">Auto Translation</h3>
|
||||
<p className="text-zinc-500 text-sm">Write once, deploy everywhere. Automatic format conversion between all agents.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Quick Links */}
|
||||
<div className="text-center">
|
||||
<h2 className="text-2xl font-bold text-white mb-6 font-mono">Get Started</h2>
|
||||
<div className="flex flex-wrap justify-center gap-4">
|
||||
<Link href="/docs/quickstart" className="text-zinc-400 hover:text-white font-mono text-sm border border-zinc-800 px-4 py-2 hover:border-zinc-600 transition-colors">
|
||||
Quick Start
|
||||
</Link>
|
||||
<Link href="/docs/primer" className="text-zinc-400 hover:text-white font-mono text-sm border border-zinc-800 px-4 py-2 hover:border-zinc-600 transition-colors">
|
||||
Primer
|
||||
</Link>
|
||||
<Link href="/docs/memory" className="text-zinc-400 hover:text-white font-mono text-sm border border-zinc-800 px-4 py-2 hover:border-zinc-600 transition-colors">
|
||||
Memory System
|
||||
</Link>
|
||||
<Link href="/docs/mesh" className="text-zinc-400 hover:text-white font-mono text-sm border border-zinc-800 px-4 py-2 hover:border-zinc-600 transition-colors">
|
||||
Mesh Network
|
||||
</Link>
|
||||
<Link href="/docs/api-reference" className="text-zinc-400 hover:text-white font-mono text-sm border border-zinc-800 px-4 py-2 hover:border-zinc-600 transition-colors">
|
||||
API Reference
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<Footer />
|
||||
|
||||
{/* Footer */}
|
||||
<footer className="border-t border-zinc-800 py-8">
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="flex flex-col sm:flex-row items-center justify-between gap-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-4 h-4 bg-white"></div>
|
||||
<span className="font-mono font-bold text-white">SKILLKIT</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-6 text-sm font-mono text-zinc-500">
|
||||
<a href="https://github.com/rohitg00/skillkit" target="_blank" rel="noopener noreferrer" className="hover:text-white transition-colors">GitHub</a>
|
||||
<a href="https://www.npmjs.com/package/skillkit" target="_blank" rel="noopener noreferrer" className="hover:text-white transition-colors">npm</a>
|
||||
<Link href="/docs" className="hover:text-white transition-colors">Docs</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
+78
-76
@@ -9,6 +9,9 @@ import { Commands } from './components/Commands';
|
||||
import { StackBuilder } from './components/StackBuilder';
|
||||
import { TrendingSkills } from './components/TrendingSkills';
|
||||
import { Attribution } from './components/Attribution';
|
||||
import { AdvancedFeatures } from './components/AdvancedFeatures';
|
||||
import { UseCases } from './components/UseCases';
|
||||
import { TeamEnterprise } from './components/TeamEnterprise';
|
||||
|
||||
const GITHUB_ICON = (
|
||||
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
|
||||
@@ -16,12 +19,6 @@ const GITHUB_ICON = (
|
||||
</svg>
|
||||
);
|
||||
|
||||
const NPM_ICON = (
|
||||
<svg className="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M0 7.334v8h6.666v1.332H12v-1.332h12v-8H0zm6.666 6.664H5.334v-4H3.999v4H1.335V8.667h5.331v5.331zm4 0v1.336H8.001V8.667h5.334v5.332h-2.669v-.001zm12.001 0h-1.33v-4h-1.336v4h-1.335v-4h-1.33v4h-2.671V8.667h8.002v5.331zM10.665 10H12v2.667h-1.335V10z" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
function scrollToTop(e: React.MouseEvent): void {
|
||||
e.preventDefault();
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
@@ -47,13 +44,6 @@ export default function App(): React.ReactElement {
|
||||
<span className="text-base font-bold tracking-tight text-white font-mono">SKILLKIT</span>
|
||||
</a>
|
||||
<div className="hidden sm:flex items-center gap-4 text-xs font-mono">
|
||||
<a
|
||||
href="#stack"
|
||||
onClick={(e) => scrollToSection(e, 'stack')}
|
||||
className="text-zinc-500 hover:text-white transition-colors"
|
||||
>
|
||||
Stack
|
||||
</a>
|
||||
<a
|
||||
href="#trending"
|
||||
onClick={(e) => scrollToSection(e, 'trending')}
|
||||
@@ -61,42 +51,47 @@ export default function App(): React.ReactElement {
|
||||
>
|
||||
Trending
|
||||
</a>
|
||||
<a
|
||||
href="#stack"
|
||||
onClick={(e) => scrollToSection(e, 'stack')}
|
||||
className="text-zinc-500 hover:text-white transition-colors"
|
||||
>
|
||||
Stack
|
||||
</a>
|
||||
<a
|
||||
href="#advanced"
|
||||
onClick={(e) => scrollToSection(e, 'advanced')}
|
||||
className="text-zinc-500 hover:text-white transition-colors"
|
||||
>
|
||||
Features
|
||||
</a>
|
||||
<a
|
||||
href="#use-cases"
|
||||
onClick={(e) => scrollToSection(e, 'use-cases')}
|
||||
className="text-zinc-500 hover:text-white transition-colors"
|
||||
>
|
||||
Use Cases
|
||||
</a>
|
||||
<a
|
||||
href="#skills"
|
||||
onClick={(e) => scrollToSection(e, 'skills')}
|
||||
className="text-zinc-500 hover:text-white transition-colors"
|
||||
>
|
||||
Find Skills
|
||||
</a>
|
||||
<a
|
||||
href="#sources"
|
||||
onClick={(e) => scrollToSection(e, 'sources')}
|
||||
className="text-zinc-500 hover:text-white transition-colors"
|
||||
>
|
||||
Sources
|
||||
Generator
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 sm:gap-4">
|
||||
<div className="flex items-center gap-3 sm:gap-4">
|
||||
<a
|
||||
href="https://agenstskills.com/docs"
|
||||
className="text-zinc-400 hover:text-white transition-colors text-sm font-mono hidden sm:block"
|
||||
className="text-zinc-400 hover:text-white transition-colors text-xs sm:text-sm font-mono"
|
||||
>
|
||||
Docs
|
||||
</a>
|
||||
<a
|
||||
href="https://www.npmjs.com/package/skillkit"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-400 hover:text-red-500 transition-colors p-2"
|
||||
aria-label="npm"
|
||||
>
|
||||
{NPM_ICON}
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/rohitg00/skillkit"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-400 hover:text-white transition-colors p-2"
|
||||
className="text-zinc-400 hover:text-white transition-colors p-1"
|
||||
aria-label="GitHub"
|
||||
>
|
||||
{GITHUB_ICON}
|
||||
@@ -109,89 +104,95 @@ export default function App(): React.ReactElement {
|
||||
<main className="pt-14">
|
||||
<Hero />
|
||||
|
||||
<div className="border-b border-zinc-800 py-4 bg-zinc-950">
|
||||
<div className="border-b border-zinc-800/50 py-2.5" style={{ background: 'linear-gradient(to bottom, rgba(9,9,11,0.95), rgba(0,0,0,1))' }}>
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="flex flex-wrap items-center justify-center gap-3 sm:gap-4">
|
||||
<div className="flex items-center justify-center gap-4 sm:gap-6 text-xs font-mono">
|
||||
<a
|
||||
href="https://www.npmjs.com/package/skillkit"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center"
|
||||
className="flex items-center gap-1.5 text-zinc-500 hover:text-white transition-colors group"
|
||||
>
|
||||
<img
|
||||
src="https://img.shields.io/npm/v/skillkit.svg?style=flat&color=white&labelColor=000000"
|
||||
alt="npm version"
|
||||
className="h-5"
|
||||
/>
|
||||
<span className="text-zinc-600 group-hover:text-zinc-400">v</span>
|
||||
<span className="text-white font-medium">1.8.0</span>
|
||||
</a>
|
||||
<span className="text-zinc-800">·</span>
|
||||
<a
|
||||
href="https://www.npmjs.com/package/skillkit"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center"
|
||||
className="flex items-center gap-1.5 text-zinc-500 hover:text-white transition-colors group"
|
||||
>
|
||||
<img
|
||||
src="https://img.shields.io/npm/dt/skillkit.svg?style=flat&color=white&labelColor=000000"
|
||||
alt="npm downloads"
|
||||
className="h-5"
|
||||
/>
|
||||
<svg className="w-3 h-3 text-zinc-600 group-hover:text-zinc-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" />
|
||||
</svg>
|
||||
<span className="text-white font-medium">2.4k</span>
|
||||
</a>
|
||||
<span className="text-zinc-800">·</span>
|
||||
<a
|
||||
href="https://github.com/rohitg00/skillkit"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center"
|
||||
className="flex items-center gap-1.5 text-zinc-500 hover:text-white transition-colors group"
|
||||
>
|
||||
<img
|
||||
src="https://img.shields.io/github/stars/rohitg00/skillkit?style=flat&color=white&labelColor=000000"
|
||||
alt="GitHub stars"
|
||||
className="h-5"
|
||||
/>
|
||||
<svg className="w-3 h-3 text-zinc-600 group-hover:text-yellow-500" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
|
||||
</svg>
|
||||
<span className="text-white font-medium">66</span>
|
||||
</a>
|
||||
<span className="text-zinc-800 hidden sm:inline">·</span>
|
||||
<a
|
||||
href="https://github.com/rohitg00/skillkit/blob/main/LICENSE"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center"
|
||||
className="text-zinc-500 hover:text-white transition-colors hidden sm:inline"
|
||||
>
|
||||
<img
|
||||
src="https://img.shields.io/badge/License-Apache%202.0-white?style=flat&labelColor=000000"
|
||||
alt="License"
|
||||
className="h-5"
|
||||
/>
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/rohitg00/skillkit"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center"
|
||||
>
|
||||
<img
|
||||
src="https://img.shields.io/badge/PRs-welcome-white?style=flat&labelColor=000000"
|
||||
alt="PRs Welcome"
|
||||
className="h-5"
|
||||
/>
|
||||
Apache 2.0
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Agent Support - Quick visual proof */}
|
||||
<Agents />
|
||||
|
||||
{/* Core Features & Comparison - Value prop at a glance */}
|
||||
<Features />
|
||||
<Commands />
|
||||
|
||||
<section id="stack" style={{ scrollMarginTop: '4rem' }}>
|
||||
<StackBuilder />
|
||||
</section>
|
||||
|
||||
{/* Trending Skills - Social proof, what's popular */}
|
||||
<section id="trending" style={{ scrollMarginTop: '4rem' }}>
|
||||
<TrendingSkills />
|
||||
</section>
|
||||
|
||||
{/* Stack Builder - Interactive, engaging */}
|
||||
<section id="stack" style={{ scrollMarginTop: '4rem' }}>
|
||||
<StackBuilder />
|
||||
</section>
|
||||
|
||||
{/* Advanced Capabilities: Memory, Primer, Mesh, Messaging */}
|
||||
<section id="advanced" style={{ scrollMarginTop: '4rem' }}>
|
||||
<AdvancedFeatures />
|
||||
</section>
|
||||
|
||||
{/* Commands Reference */}
|
||||
<Commands />
|
||||
|
||||
{/* Real-World Use Cases */}
|
||||
<section id="use-cases" style={{ scrollMarginTop: '4rem' }}>
|
||||
<UseCases />
|
||||
</section>
|
||||
|
||||
{/* Team & Enterprise */}
|
||||
<section id="team" style={{ scrollMarginTop: '4rem' }}>
|
||||
<TeamEnterprise />
|
||||
</section>
|
||||
|
||||
{/* Skill Generator */}
|
||||
<section id="skills" className="py-12 border-b border-zinc-800" style={{ scrollMarginTop: '4rem' }}>
|
||||
<SkillGenerator />
|
||||
</section>
|
||||
|
||||
{/* Submit Skill */}
|
||||
<section id="submit" className="py-12 border-b border-zinc-800" style={{ backgroundColor: '#09090b', scrollMarginTop: '4rem' }}>
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="text-center mb-8">
|
||||
@@ -204,6 +205,7 @@ export default function App(): React.ReactElement {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Attribution & Sources */}
|
||||
<section id="sources" style={{ scrollMarginTop: '4rem' }}>
|
||||
<Attribution />
|
||||
</section>
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
interface AdvancedFeature {
|
||||
id: string;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
description: string;
|
||||
icon: React.ReactNode;
|
||||
commands: Array<{ cmd: string; desc: string }>;
|
||||
highlight: string;
|
||||
}
|
||||
|
||||
const ADVANCED_FEATURES: AdvancedFeature[] = [
|
||||
{
|
||||
id: 'memory',
|
||||
title: 'Session Memory',
|
||||
subtitle: 'AI That Actually Learns',
|
||||
description: 'Your AI agents learn patterns during sessions—then forget everything. SkillKit captures these learnings and makes them permanent. Knowledge persists across sessions, projects, and even different agents.',
|
||||
highlight: 'Persistent learning across all agents',
|
||||
icon: (
|
||||
<svg className="w-8 h-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" />
|
||||
</svg>
|
||||
),
|
||||
commands: [
|
||||
{ cmd: 'memory compress', desc: 'Turn observations into learnings' },
|
||||
{ cmd: 'memory search "auth"', desc: 'Find past patterns' },
|
||||
{ cmd: 'memory export', desc: 'Convert to shareable skill' },
|
||||
{ cmd: 'memory --global', desc: 'Share across all projects' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'primer',
|
||||
title: 'Primer',
|
||||
subtitle: 'Zero-Config AI Instructions',
|
||||
description: 'Automatically generate CLAUDE.md, .cursorrules, and agent instructions by analyzing your codebase. Detects your tech stack, coding patterns, and project structure—then creates optimized instructions for all 32 agents.',
|
||||
highlight: 'Auto-generates instructions for 32 agents',
|
||||
icon: (
|
||||
<svg className="w-8 h-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" />
|
||||
</svg>
|
||||
),
|
||||
commands: [
|
||||
{ cmd: 'primer', desc: 'Analyze & generate for detected agents' },
|
||||
{ cmd: 'primer --all-agents', desc: 'Generate for all 32 agents' },
|
||||
{ cmd: 'primer --analyze-only', desc: 'Preview codebase analysis' },
|
||||
{ cmd: 'primer --json', desc: 'Machine-readable output' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'mesh',
|
||||
title: 'Mesh Network',
|
||||
subtitle: 'Multi-Machine Agent Distribution',
|
||||
description: 'Run agents across multiple machines with encrypted P2P communication. Discover peers on your LAN, establish trust with Ed25519 keys, and distribute skills across your entire infrastructure.',
|
||||
highlight: 'Encrypted P2P agent network',
|
||||
icon: (
|
||||
<svg className="w-8 h-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" />
|
||||
</svg>
|
||||
),
|
||||
commands: [
|
||||
{ cmd: 'mesh init', desc: 'Initialize your mesh node' },
|
||||
{ cmd: 'mesh discover', desc: 'Find peers on LAN' },
|
||||
{ cmd: 'mesh security init', desc: 'Setup Ed25519 encryption' },
|
||||
{ cmd: 'mesh peer trust <id>', desc: 'Establish peer trust' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'messaging',
|
||||
title: 'Inter-Agent Messaging',
|
||||
subtitle: 'Agents That Communicate',
|
||||
description: 'Send messages between AI agents across your mesh network. Coordinate complex tasks, share context, and build multi-agent workflows where agents collaborate to solve problems.',
|
||||
highlight: 'Agents collaborate across machines',
|
||||
icon: (
|
||||
<svg className="w-8 h-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" />
|
||||
</svg>
|
||||
),
|
||||
commands: [
|
||||
{ cmd: 'message send', desc: 'Send to another agent' },
|
||||
{ cmd: 'message inbox', desc: 'Check your inbox' },
|
||||
{ cmd: 'message reply <id>', desc: 'Reply to messages' },
|
||||
{ cmd: 'message archive', desc: 'Archive old messages' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export function AdvancedFeatures(): React.ReactElement {
|
||||
const [activeFeature, setActiveFeature] = useState<string>('memory');
|
||||
const feature = ADVANCED_FEATURES.find(f => f.id === activeFeature) || ADVANCED_FEATURES[0];
|
||||
|
||||
return (
|
||||
<section className="py-12 sm:py-16 border-b border-zinc-800 relative overflow-hidden">
|
||||
{/* Gradient background */}
|
||||
<div className="absolute inset-0 bg-gradient-to-b from-zinc-950 via-zinc-900/50 to-zinc-950"></div>
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(255,255,255,0.03),transparent_50%)]"></div>
|
||||
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8 relative">
|
||||
{/* Section Header */}
|
||||
<div className="text-center mb-8 sm:mb-12">
|
||||
<div className="inline-flex items-center gap-2 border border-zinc-700 bg-zinc-900/80 px-2 sm:px-3 py-1 mb-4 backdrop-blur-sm">
|
||||
<span className="w-1.5 h-1.5 bg-emerald-400 rounded-full animate-pulse"></span>
|
||||
<span className="text-[10px] sm:text-xs font-mono text-zinc-300 uppercase tracking-wider">Beyond Installation</span>
|
||||
</div>
|
||||
<h2 className="text-2xl sm:text-3xl lg:text-4xl font-bold text-white mb-3 font-mono tracking-tight">
|
||||
Advanced Capabilities
|
||||
</h2>
|
||||
<p className="text-zinc-400 font-mono text-xs sm:text-sm max-w-2xl mx-auto px-4">
|
||||
SkillKit isn't just a package manager. It's a complete infrastructure for
|
||||
intelligent, distributed AI agent orchestration.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Feature Tabs */}
|
||||
<div className="flex justify-center gap-1 sm:gap-2 mb-8 flex-wrap" role="tablist" aria-label="Advanced features">
|
||||
{ADVANCED_FEATURES.map((f) => {
|
||||
const isActive = f.id === activeFeature;
|
||||
return (
|
||||
<button
|
||||
key={f.id}
|
||||
role="tab"
|
||||
aria-selected={isActive}
|
||||
aria-controls="advanced-features-panel"
|
||||
id={`tab-${f.id}`}
|
||||
onClick={() => setActiveFeature(f.id)}
|
||||
className={`group relative px-2 sm:px-4 py-1.5 sm:py-2 font-mono text-xs sm:text-sm transition-all duration-300 ${
|
||||
isActive
|
||||
? 'text-white'
|
||||
: 'text-zinc-500 hover:text-zinc-300'
|
||||
}`}
|
||||
>
|
||||
<span className="relative z-10">{f.title}</span>
|
||||
{isActive && (
|
||||
<div className="absolute inset-0 bg-gradient-to-r from-zinc-800 to-zinc-700 border border-zinc-600"></div>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Feature Content */}
|
||||
<div
|
||||
className="grid grid-cols-1 lg:grid-cols-2 gap-6 sm:gap-8 items-start"
|
||||
role="tabpanel"
|
||||
id="advanced-features-panel"
|
||||
aria-labelledby={`tab-${activeFeature}`}
|
||||
>
|
||||
{/* Left: Description */}
|
||||
<div className="space-y-4 sm:space-y-6">
|
||||
<div className="flex items-start gap-3 sm:gap-4">
|
||||
<div className="p-2 sm:p-3 bg-zinc-800/50 border border-zinc-700 text-white flex-shrink-0">
|
||||
{feature.icon}
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-xl sm:text-2xl font-bold text-white font-mono mb-1">
|
||||
{feature.title}
|
||||
</h3>
|
||||
<p className="text-zinc-500 font-mono text-xs sm:text-sm">
|
||||
{feature.subtitle}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p className="text-zinc-300 leading-relaxed text-sm sm:text-base">
|
||||
{feature.description}
|
||||
</p>
|
||||
|
||||
<div className="inline-flex items-center gap-2 bg-emerald-950/30 border border-emerald-800/50 px-2 sm:px-3 py-1.5 sm:py-2">
|
||||
<svg className="w-3 h-3 sm:w-4 sm:h-4 text-emerald-400 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
|
||||
</svg>
|
||||
<span className="text-emerald-300 text-xs sm:text-sm font-mono">{feature.highlight}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right: Commands */}
|
||||
<div className="bg-black/60 border border-zinc-800 backdrop-blur-sm">
|
||||
<div className="flex items-center gap-1.5 px-4 py-3 border-b border-zinc-800 bg-zinc-900/50">
|
||||
<div className="w-3 h-3 rounded-full bg-zinc-700"></div>
|
||||
<div className="w-3 h-3 rounded-full bg-zinc-700"></div>
|
||||
<div className="w-3 h-3 rounded-full bg-zinc-700"></div>
|
||||
<span className="ml-2 text-zinc-500 text-xs font-mono">Terminal</span>
|
||||
</div>
|
||||
<div className="p-3 sm:p-4 space-y-3">
|
||||
{feature.commands.map((cmd, index) => (
|
||||
<div key={index} className="group">
|
||||
<div className="flex items-center gap-2 overflow-x-auto">
|
||||
<span className="text-zinc-600 font-mono text-xs flex-shrink-0">$</span>
|
||||
<code className="text-white font-mono text-xs sm:text-sm whitespace-nowrap">skillkit {cmd.cmd}</code>
|
||||
</div>
|
||||
<div className="pl-4 mt-1">
|
||||
<span className="text-zinc-500 font-mono text-[10px] sm:text-xs">→ {cmd.desc}</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Bottom CTA */}
|
||||
<div className="mt-12 pt-8 border-t border-zinc-800/50 text-center">
|
||||
<p className="text-zinc-500 text-sm font-mono mb-4">
|
||||
Ready to supercharge your AI agents?
|
||||
</p>
|
||||
<code className="inline-block bg-zinc-900 border border-zinc-700 px-4 py-2 text-sm font-mono text-zinc-300">
|
||||
npx skillkit@latest
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,277 +1,98 @@
|
||||
import React from 'react';
|
||||
|
||||
interface SkillSource {
|
||||
name: string;
|
||||
repo: string;
|
||||
description: string;
|
||||
official?: boolean;
|
||||
license?: string;
|
||||
skillCount?: string;
|
||||
}
|
||||
const OFFICIAL_SOURCES = [
|
||||
{ repo: 'anthropics/skills', name: 'Anthropic' },
|
||||
{ repo: 'vercel-labs/agent-skills', name: 'Vercel' },
|
||||
{ repo: 'expo/skills', name: 'Expo' },
|
||||
{ repo: 'remotion-dev/skills', name: 'Remotion' },
|
||||
{ repo: 'supabase/agent-skills', name: 'Supabase' },
|
||||
{ repo: 'stripe/ai', name: 'Stripe' },
|
||||
];
|
||||
|
||||
const SKILL_SOURCES: SkillSource[] = [
|
||||
{
|
||||
name: 'Anthropic Official',
|
||||
repo: 'anthropics/skills',
|
||||
description: 'Official Claude Code skills from Anthropic',
|
||||
official: true,
|
||||
license: 'Apache 2.0',
|
||||
skillCount: '21+',
|
||||
},
|
||||
{
|
||||
name: 'Vercel Labs',
|
||||
repo: 'vercel-labs/agent-skills',
|
||||
description: 'Next.js, React, and Vercel platform skills',
|
||||
official: true,
|
||||
license: 'MIT',
|
||||
skillCount: '15+',
|
||||
},
|
||||
{
|
||||
name: 'Expo / React Native',
|
||||
repo: 'expo/skills',
|
||||
description: 'Mobile development with Expo and React Native',
|
||||
official: true,
|
||||
license: 'MIT',
|
||||
skillCount: '12+',
|
||||
},
|
||||
{
|
||||
name: 'Remotion Video',
|
||||
repo: 'remotion-dev/skills',
|
||||
description: 'Programmatic video creation with React',
|
||||
official: true,
|
||||
license: 'MIT',
|
||||
skillCount: '8+',
|
||||
},
|
||||
{
|
||||
name: 'Supabase',
|
||||
repo: 'supabase/agent-skills',
|
||||
description: 'Database, auth, and backend skills',
|
||||
official: true,
|
||||
license: 'Apache 2.0',
|
||||
skillCount: '10+',
|
||||
},
|
||||
{
|
||||
name: 'Stripe Payments',
|
||||
repo: 'stripe/ai',
|
||||
description: 'Payment integration and Stripe API patterns',
|
||||
official: true,
|
||||
license: 'MIT',
|
||||
skillCount: '8+',
|
||||
},
|
||||
{
|
||||
name: 'Trail of Bits Security',
|
||||
repo: 'trailofbits/skills',
|
||||
description: 'Security analysis, auditing, and vulnerability detection',
|
||||
license: 'Apache 2.0',
|
||||
skillCount: '25+',
|
||||
},
|
||||
{
|
||||
name: 'Superpowers TDD',
|
||||
repo: 'obra/superpowers',
|
||||
description: 'Test-driven development and workflow automation by Jesse Obra',
|
||||
license: 'MIT',
|
||||
skillCount: '14+',
|
||||
},
|
||||
{
|
||||
name: 'Dev Patterns',
|
||||
repo: 'wshobson/agents',
|
||||
description: 'Development patterns and agent configurations',
|
||||
license: 'MIT',
|
||||
skillCount: '48+',
|
||||
},
|
||||
{
|
||||
name: 'Composio Awesome',
|
||||
repo: 'ComposioHQ/awesome-claude-skills',
|
||||
description: 'Curated collection of Claude Code skills',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'Travis Awesome',
|
||||
repo: 'travisvn/awesome-claude-skills',
|
||||
description: 'Community-curated skill collection',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'Skills Marketplace',
|
||||
repo: 'mhattingpete/claude-skills-marketplace',
|
||||
description: 'Community skill marketplace',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'Dify Frontend',
|
||||
repo: 'langgenius/dify',
|
||||
description: 'AI application development platform patterns',
|
||||
license: 'Apache 2.0',
|
||||
},
|
||||
{
|
||||
name: 'Better Auth',
|
||||
repo: 'better-auth/skills',
|
||||
description: 'Authentication and authorization patterns',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'Nuxt / Vue',
|
||||
repo: 'onmax/nuxt-skills',
|
||||
description: 'Vue.js and Nuxt framework skills',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'ElysiaJS / Bun',
|
||||
repo: 'elysiajs/skills',
|
||||
description: 'Bun runtime and ElysiaJS framework',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'NestJS',
|
||||
repo: 'kadajett/agent-nestjs-skills',
|
||||
description: 'NestJS backend framework patterns',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'Three.js',
|
||||
repo: 'cloudai-x/threejs-skills',
|
||||
description: '3D graphics and WebGL development',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'SwiftUI iOS',
|
||||
repo: 'dimillian/skills',
|
||||
description: 'iOS and SwiftUI development patterns',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'Convex Backend',
|
||||
repo: 'waynesutton/convexskills',
|
||||
description: 'Convex backend development',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'Obsidian Notes',
|
||||
repo: 'kepano/obsidian-skills',
|
||||
description: 'Obsidian plugin and vault management',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'Shadcn / Radix',
|
||||
repo: 'giuseppe-trisciuoglio/developer-kit',
|
||||
description: 'UI component libraries and design systems',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'OpenRouter SDK',
|
||||
repo: 'openrouterteam/agent-skills',
|
||||
description: 'OpenRouter API integration patterns',
|
||||
license: 'MIT',
|
||||
},
|
||||
{
|
||||
name: 'Context7',
|
||||
repo: 'intellectronica/agent-skills',
|
||||
description: 'Context management and documentation tools',
|
||||
license: 'MIT',
|
||||
},
|
||||
const COMMUNITY_SOURCES = [
|
||||
'trailofbits/skills',
|
||||
'obra/superpowers',
|
||||
'wshobson/agents',
|
||||
'ComposioHQ/awesome-claude-skills',
|
||||
'travisvn/awesome-claude-skills',
|
||||
'mhattingpete/claude-skills-marketplace',
|
||||
'langgenius/dify',
|
||||
'better-auth/skills',
|
||||
'onmax/nuxt-skills',
|
||||
'elysiajs/skills',
|
||||
'kadajett/agent-nestjs-skills',
|
||||
'cloudai-x/threejs-skills',
|
||||
'dimillian/skills',
|
||||
'waynesutton/convexskills',
|
||||
'kepano/obsidian-skills',
|
||||
'giuseppe-trisciuoglio/developer-kit',
|
||||
'openrouterteam/agent-skills',
|
||||
'intellectronica/agent-skills',
|
||||
];
|
||||
|
||||
export function Attribution(): React.ReactElement {
|
||||
const officialSources = SKILL_SOURCES.filter(s => s.official);
|
||||
const communitySources = SKILL_SOURCES.filter(s => !s.official);
|
||||
|
||||
return (
|
||||
<section className="py-12 border-b border-zinc-800 bg-black">
|
||||
<section className="py-12 border-b border-zinc-800">
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="text-center mb-6 sm:mb-8">
|
||||
<h2 className="text-lg sm:text-xl font-bold text-white mb-2 font-mono">Skill Sources</h2>
|
||||
<p className="text-zinc-500 font-mono text-[10px] sm:text-xs max-w-2xl mx-auto px-2">
|
||||
SkillKit aggregates skills from trusted sources. We credit and link back to all original creators.
|
||||
Each source retains its original license.
|
||||
<div className="text-center mb-8">
|
||||
<h2 className="text-xl font-bold text-white mb-2 font-mono">Skill Sources</h2>
|
||||
<p className="text-zinc-500 font-mono text-xs">
|
||||
Skills aggregated from open source repositories
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="mb-6 sm:mb-8">
|
||||
<h3 className="text-xs sm:text-sm font-mono text-zinc-400 uppercase tracking-wider mb-3 sm:mb-4 flex items-center gap-2">
|
||||
<span className="w-2 h-2 bg-blue-500 rounded-full"></span>
|
||||
Official Partner Sources
|
||||
</h3>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-3">
|
||||
{officialSources.map(source => (
|
||||
<div className="mb-8">
|
||||
<div className="text-xs font-mono text-zinc-500 uppercase tracking-wider mb-4">
|
||||
Official
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{OFFICIAL_SOURCES.map(source => (
|
||||
<a
|
||||
key={source.repo}
|
||||
href={`https://github.com/${source.repo}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="group bg-zinc-900/50 border border-zinc-800 p-3 sm:p-4 hover:border-blue-800 hover:bg-blue-950/20 transition-all"
|
||||
className="inline-flex items-center gap-2 bg-zinc-900 border border-zinc-800 px-3 py-2 hover:border-zinc-600 hover:text-white transition-colors text-zinc-400 font-mono text-xs"
|
||||
>
|
||||
<div className="flex items-start justify-between mb-1 sm:mb-2">
|
||||
<div className="font-mono text-xs sm:text-sm text-white group-hover:text-blue-400 transition-colors">
|
||||
{source.name}
|
||||
</div>
|
||||
{source.skillCount && (
|
||||
<span className="text-[9px] sm:text-[10px] bg-blue-900/50 text-blue-400 px-1 sm:px-1.5 py-0.5 border border-blue-800/50">
|
||||
{source.skillCount}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-[10px] sm:text-xs text-zinc-600 mb-2 line-clamp-2">{source.description}</div>
|
||||
<div className="flex items-center gap-1 sm:gap-2 text-[9px] sm:text-[10px] text-zinc-700">
|
||||
<svg className="w-3 h-3 flex-shrink-0" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path fillRule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clipRule="evenodd" />
|
||||
</svg>
|
||||
<span className="font-mono truncate">{source.repo}</span>
|
||||
{source.license && (
|
||||
<>
|
||||
<span className="hidden sm:inline">•</span>
|
||||
<span className="hidden sm:inline">{source.license}</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<svg className="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path fillRule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clipRule="evenodd" />
|
||||
</svg>
|
||||
{source.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 className="text-xs sm:text-sm font-mono text-zinc-400 uppercase tracking-wider mb-3 sm:mb-4 flex items-center gap-2">
|
||||
<span className="w-2 h-2 bg-purple-500 rounded-full"></span>
|
||||
Community Contributors
|
||||
</h3>
|
||||
<div className="grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4 gap-2">
|
||||
{communitySources.map(source => (
|
||||
<div className="mb-8">
|
||||
<div className="text-xs font-mono text-zinc-500 uppercase tracking-wider mb-4">
|
||||
Community
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{COMMUNITY_SOURCES.map(repo => (
|
||||
<a
|
||||
key={source.repo}
|
||||
href={`https://github.com/${source.repo}`}
|
||||
key={repo}
|
||||
href={`https://github.com/${repo}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="group bg-zinc-900/30 border border-zinc-800 p-2 sm:p-3 hover:border-purple-800/50 hover:bg-purple-950/10 transition-all"
|
||||
className="text-zinc-600 hover:text-white transition-colors font-mono text-[11px] px-2 py-1 bg-zinc-900/50 border border-zinc-800/50 hover:border-zinc-700"
|
||||
>
|
||||
<div className="flex items-center justify-between mb-0.5 sm:mb-1">
|
||||
<div className="font-mono text-[10px] sm:text-xs text-white group-hover:text-purple-400 transition-colors truncate">
|
||||
{source.name}
|
||||
</div>
|
||||
{source.skillCount && (
|
||||
<span className="text-[8px] sm:text-[9px] bg-purple-900/30 text-purple-500 px-1 py-0.5 flex-shrink-0 ml-1">
|
||||
{source.skillCount}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-[9px] sm:text-[10px] text-zinc-600 truncate">{source.repo}</div>
|
||||
{repo}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 sm:mt-8 pt-4 sm:pt-6 border-t border-zinc-800 text-center">
|
||||
<p className="text-zinc-600 text-[10px] sm:text-xs font-mono mb-2 sm:mb-3">
|
||||
Want to add your skills to SkillKit?
|
||||
</p>
|
||||
<div className="pt-6 border-t border-zinc-800 text-center">
|
||||
<a
|
||||
href="https://github.com/rohitg00/skillkit/issues/new?template=add-source.md"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1.5 sm:gap-2 bg-zinc-900 text-zinc-400 px-3 sm:px-4 py-1.5 sm:py-2 font-mono text-[10px] sm:text-xs border border-zinc-800 hover:border-zinc-600 hover:text-white transition-colors"
|
||||
className="inline-flex items-center gap-2 text-zinc-500 hover:text-white transition-colors font-mono text-xs"
|
||||
>
|
||||
<svg className="w-3 h-3 sm:w-4 sm:h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
|
||||
</svg>
|
||||
Add Your Repository
|
||||
Add your repository
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,8 +11,10 @@ const COMMAND_GROUPS: CommandGroup[] = [
|
||||
commands: [
|
||||
{ cmd: '', desc: 'Launch interactive TUI' },
|
||||
{ cmd: 'install <repo>', desc: 'Install from GitHub' },
|
||||
{ cmd: 'recommend', desc: 'Get suggestions for your project' },
|
||||
{ cmd: 'add <repo>', desc: 'Alias for install' },
|
||||
{ cmd: 'recommend', desc: 'Smart suggestions' },
|
||||
{ cmd: 'find <query>', desc: 'Search 15K+ skills' },
|
||||
{ cmd: 'marketplace', desc: 'Browse skills' },
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -22,33 +24,63 @@ const COMMAND_GROUPS: CommandGroup[] = [
|
||||
{ cmd: 'sync', desc: 'Deploy to all agents' },
|
||||
{ cmd: 'translate --to <agent>', desc: 'Convert formats' },
|
||||
{ cmd: 'update', desc: 'Update all skills' },
|
||||
{ cmd: 'remove <skill>', desc: 'Remove a skill' },
|
||||
{ cmd: 'status', desc: 'Show skill status' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Mesh',
|
||||
commands: [
|
||||
{ cmd: 'mesh init', desc: 'Initialize mesh network' },
|
||||
{ cmd: 'mesh init', desc: 'Initialize network' },
|
||||
{ cmd: 'mesh discover', desc: 'Find hosts on LAN' },
|
||||
{ cmd: 'message send', desc: 'Send to another agent' },
|
||||
{ cmd: 'mesh add <host>', desc: 'Add a host' },
|
||||
{ cmd: 'mesh security init', desc: 'Setup encryption' },
|
||||
{ cmd: 'mesh peer trust', desc: 'Trust a peer' },
|
||||
{ cmd: 'mesh health', desc: 'Check host health' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Message',
|
||||
commands: [
|
||||
{ cmd: 'message send', desc: 'Send to agent' },
|
||||
{ cmd: 'message inbox', desc: 'View inbox' },
|
||||
{ cmd: 'message read <id>', desc: 'Read message' },
|
||||
{ cmd: 'message reply <id>', desc: 'Reply to message' },
|
||||
{ cmd: 'message archive', desc: 'Archive messages' },
|
||||
{ cmd: 'message sent', desc: 'View sent' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Memory',
|
||||
commands: [
|
||||
{ cmd: 'memory status', desc: 'View memory status' },
|
||||
{ cmd: 'memory search <q>', desc: 'Search learnings' },
|
||||
{ cmd: 'memory compress', desc: 'Compress observations' },
|
||||
{ cmd: 'memory export', desc: 'Export as skill' },
|
||||
{ cmd: 'memory reinforce', desc: 'Boost memory' },
|
||||
{ cmd: 'memory --global', desc: 'Global memory' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Team',
|
||||
commands: [
|
||||
{ cmd: 'manifest init', desc: 'Create .skills file' },
|
||||
{ cmd: 'team init', desc: 'Initialize team' },
|
||||
{ cmd: 'team share', desc: 'Share via Git' },
|
||||
{ cmd: 'publish', desc: 'Submit to marketplace' },
|
||||
{ cmd: 'cicd init', desc: 'CI/CD templates' },
|
||||
{ cmd: 'team sync', desc: 'Sync team skills' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Advanced',
|
||||
commands: [
|
||||
{ cmd: 'primer', desc: 'Generate CLAUDE.md from code' },
|
||||
{ cmd: 'agent translate', desc: 'Batch convert agents' },
|
||||
{ cmd: 'command generate', desc: 'Create /slash commands' },
|
||||
{ cmd: 'memory export', desc: 'Save session learnings' },
|
||||
{ cmd: 'primer', desc: 'Generate CLAUDE.md' },
|
||||
{ cmd: 'agent translate', desc: 'Batch convert' },
|
||||
{ cmd: 'command generate', desc: 'Create /commands' },
|
||||
{ cmd: 'context init', desc: 'Project context' },
|
||||
{ cmd: 'workflow run', desc: 'Run workflow' },
|
||||
{ cmd: 'test', desc: 'Test skills' },
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -85,19 +117,19 @@ export function Commands(): React.ReactElement {
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="border border-zinc-800 bg-black/50 p-2 sm:p-4 font-mono text-[10px] sm:text-xs">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-1 sm:gap-2">
|
||||
<div className="border border-zinc-800 bg-black/50 p-3 sm:p-4 font-mono text-[10px] sm:text-xs">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-1 sm:gap-2">
|
||||
{group.commands.map((c) => (
|
||||
<div
|
||||
key={c.cmd || 'tui'}
|
||||
className="flex items-center gap-2 p-1.5 sm:p-2 hover:bg-zinc-900/50 transition-colors rounded"
|
||||
className="flex items-center gap-2 p-2 hover:bg-zinc-900/50 transition-colors rounded group"
|
||||
>
|
||||
<span className="text-zinc-600">$</span>
|
||||
<span className="text-white text-[10px] sm:text-xs">
|
||||
<span className="text-zinc-700 group-hover:text-zinc-500">$</span>
|
||||
<code className="text-white text-[10px] sm:text-xs whitespace-nowrap">
|
||||
{c.cmd ? `skillkit ${c.cmd}` : 'npx skillkit@latest'}
|
||||
</span>
|
||||
<span className="text-zinc-600 ml-auto">→</span>
|
||||
<span className="text-zinc-500 truncate max-w-[80px] sm:max-w-none">{c.desc}</span>
|
||||
</code>
|
||||
<span className="text-zinc-700 ml-auto hidden sm:inline">→</span>
|
||||
<span className="text-zinc-500 text-[9px] sm:text-[11px] hidden sm:inline">{c.desc}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -8,8 +8,8 @@ interface Feature {
|
||||
|
||||
const FEATURES: Feature[] = [
|
||||
{
|
||||
title: 'Primer',
|
||||
description: 'Generate AI instructions from codebase analysis.',
|
||||
title: 'Smart Recommendations',
|
||||
description: 'AI analyzes your codebase and suggests perfect skills.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" />
|
||||
@@ -17,85 +17,86 @@ const FEATURES: Feature[] = [
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Multi-Agent',
|
||||
description: 'Deploy to 32 AI coding agents with one command.',
|
||||
title: 'Auto Translation',
|
||||
description: 'Write once, deploy to 32 agents. Zero manual conversion.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Mesh Network',
|
||||
description: 'Multi-machine agent distribution with encrypted P2P.',
|
||||
title: 'Session Memory',
|
||||
description: 'AI learnings persist across sessions and projects.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Security',
|
||||
description: 'Ed25519 signing, TLS, and encrypted storage.',
|
||||
title: 'Primer',
|
||||
description: 'Auto-generate agent instructions for all 32 agents from your codebase.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M13 10V3L4 14h7v7l9-11h-7z" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Terminal UI',
|
||||
description: 'Beautiful interactive TUI for browsing & installing.',
|
||||
title: 'Workflows',
|
||||
description: 'Compose multi-step automated skill sequences.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Messaging',
|
||||
description: 'Inter-agent messaging across the mesh.',
|
||||
title: 'Team Sync',
|
||||
description: 'Git-based .skills manifest for consistency.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Plugins',
|
||||
description: 'Extend with custom plugins & hooks.',
|
||||
title: 'Testing',
|
||||
description: 'Built-in test framework with assertions.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M17 14v6m-3-3h6M6 10h2a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v2a2 2 0 002 2zm10 0h2a2 2 0 002-2V6a2 2 0 00-2-2h-2a2 2 0 00-2 2v2a2 2 0 002 2zM6 20h2a2 2 0 002-2v-2a2 2 0 00-2-2H6a2 2 0 00-2 2v2a2 2 0 002 2z" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Manifest',
|
||||
description: '.skills file for team-wide consistency.',
|
||||
title: 'CI/CD',
|
||||
description: 'GitHub Actions, GitLab CI, pre-commit.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Slash Commands',
|
||||
description: 'Generate /commands for Claude, Cursor & more.',
|
||||
title: 'TS API',
|
||||
description: 'Programmatic access for custom tooling.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
];
|
||||
|
||||
const COMPARISONS = [
|
||||
['Agents', '1', '32'],
|
||||
['Instructions', 'Manual', 'Primer Auto'],
|
||||
['Translation', 'Manual', 'Auto'],
|
||||
['Sharing', 'Copy/paste', '.skills manifest'],
|
||||
['Discovery', 'Forums', 'CLI + AI'],
|
||||
['Agent Support', '1 agent', '32 agents'],
|
||||
['Setup', 'Write rules manually', 'Auto-generate (Primer)'],
|
||||
['Learning', 'Lost each session', 'Persistent memory'],
|
||||
['Translation', 'Rewrite for each', 'One-click conversion'],
|
||||
['Team Sharing', 'Copy/paste files', '.skills manifest'],
|
||||
['Discovery', 'Search forums', 'AI recommendations'],
|
||||
] as const;
|
||||
|
||||
export function Features(): React.ReactElement {
|
||||
@@ -114,11 +115,11 @@ export function Features(): React.ReactElement {
|
||||
<div className="text-zinc-600 text-[10px] sm:text-xs font-mono">Agents</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">40+</div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">50+</div>
|
||||
<div className="text-zinc-600 text-[10px] sm:text-xs font-mono">Commands</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">15K</div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">15K+</div>
|
||||
<div className="text-zinc-600 text-[10px] sm:text-xs font-mono">Skills</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -146,7 +147,7 @@ export function Features(): React.ReactElement {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-8 gap-3">
|
||||
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3">
|
||||
{FEATURES.map((feature, index) => (
|
||||
<div
|
||||
key={feature.title}
|
||||
|
||||
@@ -16,15 +16,17 @@ interface TerminalLine {
|
||||
}
|
||||
|
||||
const TERMINAL_LINES: TerminalLine[] = [
|
||||
{ type: 'cmd', text: 'skillkit primer --all-agents' },
|
||||
{ type: 'out', text: '→ Analyzing codebase...' },
|
||||
{ type: 'out', text: ' ✓ Generated CLAUDE.md' },
|
||||
{ type: 'out', text: ' ✓ Generated .cursorrules' },
|
||||
{ type: 'cmd', text: 'skillkit recommend' },
|
||||
{ type: 'out', text: ' 92% react-best-practices' },
|
||||
{ type: 'out', text: ' 87% typescript-strict' },
|
||||
{ type: 'cmd', text: 'skillkit install anthropics/skills' },
|
||||
{ type: 'out', text: '→ Installed 3 skills' },
|
||||
{ type: 'cmd', text: 'skillkit sync --agent cursor,claude' },
|
||||
{ type: 'out', text: ' ✓ Synced to 2 agents' },
|
||||
{ type: 'cmd', text: 'skillkit translate my-skill --to codex' },
|
||||
{ type: 'out', text: '→ Converted to SKILL.md format' },
|
||||
{ type: 'out', text: ' 92% vercel-react-best-practices' },
|
||||
{ type: 'out', text: ' 87% typescript-strict-mode' },
|
||||
{ type: 'cmd', text: 'skillkit install anthropics/skills --agent all' },
|
||||
{ type: 'out', text: '→ Installed to 32 agents' },
|
||||
{ type: 'cmd', text: 'skillkit memory compress' },
|
||||
{ type: 'out', text: '→ 12 learnings persisted' },
|
||||
];
|
||||
|
||||
const FADE_ANIMATION_STYLES = `
|
||||
@@ -124,17 +126,18 @@ export function Hero(): React.ReactElement {
|
||||
<div className="animate-fade-in">
|
||||
<div className="inline-flex items-center space-x-2 border border-zinc-800 bg-zinc-900/50 px-2 py-0.5 mb-3 backdrop-blur-sm">
|
||||
<span className="flex h-1.5 w-1.5 bg-white rounded-full"></span>
|
||||
<span className="text-xs font-mono text-zinc-400">v1.7.11</span>
|
||||
<span className="text-xs font-mono text-zinc-400">v1.8.0</span>
|
||||
</div>
|
||||
|
||||
<h1 className="text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight text-white mb-3 font-mono">
|
||||
Universal Skills for<br />
|
||||
<span className="text-zinc-500">AI Coding Agents</span>
|
||||
Write Once.<br />
|
||||
<span className="text-zinc-500">Deploy to 32 Agents.</span>
|
||||
</h1>
|
||||
|
||||
<p className="text-sm text-zinc-400 mb-5 max-w-lg font-mono leading-relaxed">
|
||||
One CLI to install, sync, and manage skills across Claude Code, Cursor,
|
||||
Windsurf, Copilot, and 28 more agents. 15,000+ skills ready to use.
|
||||
The universal skill platform for AI coding agents. Auto-generate instructions
|
||||
with Primer, persist learnings with Memory, distribute across Mesh networks.
|
||||
One CLI for Claude, Cursor, Windsurf, Copilot, and 28 more.
|
||||
</p>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-3 mb-4">
|
||||
@@ -203,6 +206,32 @@ export function Hero(): React.ReactElement {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Video Demo */}
|
||||
<div className="mt-8 sm:mt-10 animate-fade-in-delay">
|
||||
<div className="relative mx-auto max-w-3xl">
|
||||
<div className="absolute -inset-1 bg-gradient-to-r from-zinc-800 via-zinc-600 to-zinc-800 rounded-lg opacity-30 blur-xl"></div>
|
||||
<div className="relative border border-zinc-800 bg-black rounded-lg overflow-hidden">
|
||||
<div className="flex items-center gap-1.5 px-3 py-2 border-b border-zinc-800 bg-zinc-900/50">
|
||||
<div className="w-2.5 h-2.5 rounded-full bg-red-500/80"></div>
|
||||
<div className="w-2.5 h-2.5 rounded-full bg-yellow-500/80"></div>
|
||||
<div className="w-2.5 h-2.5 rounded-full bg-green-500/80"></div>
|
||||
<span className="ml-2 text-zinc-500 text-xs font-mono">skillkit demo</span>
|
||||
</div>
|
||||
<video
|
||||
className="w-full"
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
playsInline
|
||||
poster="/og-image.png"
|
||||
>
|
||||
<source src="/skillkit.mp4" type="video/mp4" />
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>{FADE_ANIMATION_STYLES}</style>
|
||||
|
||||
@@ -1,651 +1,123 @@
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { Button } from './Button';
|
||||
import { Card } from './Card';
|
||||
import { generateAgentSkill } from '../services/geminiService';
|
||||
import React, { useState } from 'react';
|
||||
import { searchSkills, IndexedSkill } from '../data/skills-index';
|
||||
import { AgentSkill, LoadingState } from '../types';
|
||||
|
||||
interface PriorityBadgeProps {
|
||||
priority: string;
|
||||
}
|
||||
|
||||
type ViewMode = 'search' | 'marketplace' | 'generated' | 'content';
|
||||
|
||||
const PRIORITY_COLORS = {
|
||||
must: 'bg-red-900/50 text-red-300 border-red-800',
|
||||
should: 'bg-yellow-900/50 text-yellow-300 border-yellow-800',
|
||||
may: 'bg-blue-900/50 text-blue-300 border-blue-800',
|
||||
} as const;
|
||||
|
||||
function PriorityBadge({ priority }: PriorityBadgeProps): React.ReactElement {
|
||||
const colorClass = PRIORITY_COLORS[priority as keyof typeof PRIORITY_COLORS] || PRIORITY_COLORS.may;
|
||||
return (
|
||||
<span className={`text-xs px-2 py-0.5 border font-mono uppercase ${colorClass}`}>
|
||||
{priority}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function generateSkillMd(skill: AgentSkill): string {
|
||||
const frontmatter = `---
|
||||
name: "${skill.name}"
|
||||
description: "${skill.description}"
|
||||
version: "${skill.version}"
|
||||
tags: [${skill.tags.map(t => `"${t}"`).join(', ')}]
|
||||
${skill.filePatterns?.length ? `globs: [${skill.filePatterns.map(p => `"${p}"`).join(', ')}]` : ''}
|
||||
---`;
|
||||
|
||||
const principlesSection = skill.principles.map(p =>
|
||||
`### ${p.priority.toUpperCase()}: ${p.title}\n\n${p.description}`
|
||||
).join('\n\n');
|
||||
|
||||
const patternsSection = skill.patterns.map(p =>
|
||||
`### ${p.name}\n\n${p.description}\n\n\`\`\`${p.language || 'typescript'}\n${p.example}\n\`\`\``
|
||||
).join('\n\n');
|
||||
|
||||
const antiPatternsSection = skill.antiPatterns.map(ap => {
|
||||
let content = `### ${ap.name}\n\n${ap.description}`;
|
||||
if (ap.badExample) {
|
||||
content += `\n\n**Bad:**\n\`\`\`typescript\n${ap.badExample}\n\`\`\``;
|
||||
}
|
||||
if (ap.goodExample) {
|
||||
content += `\n\n**Good:**\n\`\`\`typescript\n${ap.goodExample}\n\`\`\``;
|
||||
}
|
||||
return content;
|
||||
}).join('\n\n');
|
||||
|
||||
const content = `# ${skill.title}
|
||||
|
||||
${skill.description}
|
||||
|
||||
## When to Apply
|
||||
|
||||
${skill.applicability}
|
||||
|
||||
${skill.filePatterns?.length ? `**File patterns:** ${skill.filePatterns.map(p => `\`${p}\``).join(', ')}` : ''}
|
||||
|
||||
## Principles
|
||||
|
||||
${principlesSection}
|
||||
|
||||
## Patterns
|
||||
|
||||
${patternsSection}
|
||||
|
||||
## Anti-Patterns
|
||||
|
||||
${antiPatternsSection}
|
||||
|
||||
${skill.references?.length ? `## References\n\n${skill.references.map(r => `- ${r}`).join('\n')}` : ''}
|
||||
`;
|
||||
|
||||
return `${frontmatter}\n\n${content}`;
|
||||
}
|
||||
|
||||
function downloadContent(content: string, filename: string): void {
|
||||
const blob = new Blob([content], { type: 'text/markdown' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
// localStorage cache for AI-generated skills
|
||||
const CACHE_KEY = 'skillkit_ai_cache';
|
||||
const CACHE_VERSION = 1;
|
||||
const MAX_CACHE_ENTRIES = 50;
|
||||
const CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
|
||||
|
||||
interface CachedSkill {
|
||||
skill: AgentSkill;
|
||||
query: string;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
interface SkillCache {
|
||||
version: number;
|
||||
skills: Record<string, CachedSkill>;
|
||||
}
|
||||
|
||||
function normalizeQuery(query: string): string {
|
||||
return query.toLowerCase().trim().replace(/\s+/g, ' ');
|
||||
}
|
||||
|
||||
function getSkillCache(): SkillCache {
|
||||
try {
|
||||
const cached = localStorage.getItem(CACHE_KEY);
|
||||
if (cached) {
|
||||
const parsed = JSON.parse(cached) as SkillCache;
|
||||
if (parsed.version === CACHE_VERSION) {
|
||||
// Prune expired entries
|
||||
const now = Date.now();
|
||||
let mutated = false;
|
||||
for (const [key, value] of Object.entries(parsed.skills)) {
|
||||
if (!value?.timestamp || now - value.timestamp >= CACHE_TTL_MS) {
|
||||
delete parsed.skills[key];
|
||||
mutated = true;
|
||||
}
|
||||
}
|
||||
if (mutated) {
|
||||
localStorage.setItem(CACHE_KEY, JSON.stringify(parsed));
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Ignore parse errors
|
||||
}
|
||||
return { version: CACHE_VERSION, skills: {} };
|
||||
}
|
||||
|
||||
function getCachedSkill(query: string): AgentSkill | null {
|
||||
const cache = getSkillCache();
|
||||
const key = normalizeQuery(query);
|
||||
const cached = cache.skills[key];
|
||||
if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {
|
||||
return cached.skill;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function setCachedSkill(query: string, skill: AgentSkill): void {
|
||||
try {
|
||||
const cache = getSkillCache();
|
||||
const key = normalizeQuery(query);
|
||||
cache.skills[key] = {
|
||||
skill,
|
||||
query: key,
|
||||
timestamp: Date.now(),
|
||||
};
|
||||
// Enforce max entries limit
|
||||
const entries = Object.entries(cache.skills);
|
||||
if (entries.length > MAX_CACHE_ENTRIES) {
|
||||
entries
|
||||
.sort((a, b) => a[1].timestamp - b[1].timestamp)
|
||||
.slice(0, entries.length - MAX_CACHE_ENTRIES)
|
||||
.forEach(([k]) => delete cache.skills[k]);
|
||||
}
|
||||
localStorage.setItem(CACHE_KEY, JSON.stringify(cache));
|
||||
} catch {
|
||||
// Ignore storage errors (quota exceeded, etc.)
|
||||
}
|
||||
}
|
||||
|
||||
export function SkillGenerator(): React.ReactElement {
|
||||
const [input, setInput] = useState('');
|
||||
const [status, setStatus] = useState<LoadingState>(LoadingState.IDLE);
|
||||
const [viewMode, setViewMode] = useState<ViewMode>('search');
|
||||
|
||||
const [marketplaceResults, setMarketplaceResults] = useState<IndexedSkill[]>([]);
|
||||
const [selectedSkill, setSelectedSkill] = useState<IndexedSkill | null>(null);
|
||||
const [skillContent, setSkillContent] = useState<string | null>(null);
|
||||
const [generatedSkill, setGeneratedSkill] = useState<AgentSkill | null>(null);
|
||||
const [isFromCache, setIsFromCache] = useState(false);
|
||||
const [activeTab, setActiveTab] = useState<'principles' | 'patterns' | 'antipatterns'>('principles');
|
||||
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const [query, setQuery] = useState('');
|
||||
const [results, setResults] = useState<IndexedSkill[]>([]);
|
||||
const [hasSearched, setHasSearched] = useState(false);
|
||||
const [copied, setCopied] = useState<string | null>(null);
|
||||
|
||||
function handleSearch(e: React.FormEvent): void {
|
||||
e.preventDefault();
|
||||
if (!input.trim()) return;
|
||||
|
||||
setError(null);
|
||||
setSelectedSkill(null);
|
||||
setSkillContent(null);
|
||||
setGeneratedSkill(null);
|
||||
|
||||
const results = searchSkills(input);
|
||||
setMarketplaceResults(results);
|
||||
setViewMode(results.length > 0 ? 'marketplace' : 'search');
|
||||
setStatus(LoadingState.SUCCESS);
|
||||
if (!query.trim()) return;
|
||||
const found = searchSkills(query);
|
||||
setResults(found);
|
||||
setHasSearched(true);
|
||||
}
|
||||
|
||||
async function handleViewSkill(skill: IndexedSkill): Promise<void> {
|
||||
setSelectedSkill(skill);
|
||||
setSkillContent(null);
|
||||
setViewMode('content');
|
||||
|
||||
if (skill.rawUrl) {
|
||||
setStatus(LoadingState.LOADING);
|
||||
try {
|
||||
const response = await fetch(skill.rawUrl);
|
||||
if (response.ok) {
|
||||
const content = await response.text();
|
||||
setSkillContent(content);
|
||||
}
|
||||
} catch {
|
||||
// Silently handle fetch errors
|
||||
}
|
||||
setStatus(LoadingState.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleGenerateWithAI(): Promise<void> {
|
||||
setError(null);
|
||||
|
||||
// Check cache first
|
||||
const cached = getCachedSkill(input);
|
||||
if (cached) {
|
||||
setGeneratedSkill(cached);
|
||||
setIsFromCache(true);
|
||||
setViewMode('generated');
|
||||
setStatus(LoadingState.SUCCESS);
|
||||
return;
|
||||
}
|
||||
|
||||
setStatus(LoadingState.LOADING);
|
||||
setIsFromCache(false);
|
||||
|
||||
async function copyInstall(skill: IndexedSkill): Promise<void> {
|
||||
const cmd = `npx skillkit@latest install ${skill.id.split('/').slice(0, 2).join('/')}`;
|
||||
try {
|
||||
const result = await generateAgentSkill(input);
|
||||
setGeneratedSkill(result);
|
||||
setCachedSkill(input, result); // Cache the result
|
||||
setViewMode('generated');
|
||||
setStatus(LoadingState.SUCCESS);
|
||||
await navigator.clipboard.writeText(cmd);
|
||||
setCopied(skill.id);
|
||||
setTimeout(() => setCopied(null), 2000);
|
||||
} catch {
|
||||
setError("Failed to generate skill. Please try again.");
|
||||
setStatus(LoadingState.ERROR);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
function submitToMarketplace(): void {
|
||||
if (!generatedSkill) return;
|
||||
|
||||
const slug = generatedSkill.name.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
|
||||
const skillContent = generateSkillMd(generatedSkill);
|
||||
|
||||
const body = `## 📤 AI-Generated Skill: ${generatedSkill.title}
|
||||
|
||||
### Skill Details
|
||||
- **Name:** ${generatedSkill.name}
|
||||
- **Description:** ${generatedSkill.description}
|
||||
- **Tags:** ${generatedSkill.tags.join(', ')}
|
||||
- **Version:** ${generatedSkill.version}
|
||||
|
||||
### SKILL.md Content
|
||||
|
||||
<details>
|
||||
<summary>Click to expand</summary>
|
||||
|
||||
\`\`\`markdown
|
||||
${skillContent.slice(0, 4000)}${skillContent.length > 4000 ? '\n...(truncated)' : ''}
|
||||
\`\`\`
|
||||
|
||||
</details>
|
||||
|
||||
### Checklist for Maintainer
|
||||
- [ ] Review skill content for quality
|
||||
- [ ] Add to \`marketplace/skills.json\`
|
||||
|
||||
---
|
||||
**Generated via:** AI Skill Generator
|
||||
**Search query:** "${input}"`;
|
||||
|
||||
const title = encodeURIComponent(`[AI Skill] ${generatedSkill.title}`);
|
||||
const encodedBody = encodeURIComponent(body);
|
||||
const url = `https://github.com/rohitg00/skillkit/issues/new?title=${title}&body=${encodedBody}&labels=ai-generated,skill-submission`;
|
||||
|
||||
window.open(url, '_blank', 'noopener,noreferrer');
|
||||
}
|
||||
|
||||
function handleBack(): void {
|
||||
switch (viewMode) {
|
||||
case 'content':
|
||||
setViewMode('marketplace');
|
||||
setSelectedSkill(null);
|
||||
setSkillContent(null);
|
||||
break;
|
||||
case 'generated':
|
||||
setViewMode(marketplaceResults.length > 0 ? 'marketplace' : 'search');
|
||||
setGeneratedSkill(null);
|
||||
break;
|
||||
default:
|
||||
setViewMode('search');
|
||||
setMarketplaceResults([]);
|
||||
}
|
||||
}
|
||||
|
||||
function downloadSkillMd(): void {
|
||||
if (skillContent) {
|
||||
downloadContent(skillContent, 'SKILL.md');
|
||||
}
|
||||
}
|
||||
|
||||
function downloadGeneratedSkillMd(): void {
|
||||
if (generatedSkill) {
|
||||
downloadContent(generateSkillMd(generatedSkill), 'SKILL.md');
|
||||
}
|
||||
}
|
||||
|
||||
// Focus input only after user interaction, not on initial page load
|
||||
useEffect(() => {
|
||||
if (status === LoadingState.SUCCESS && inputRef.current) {
|
||||
inputRef.current.focus({ preventScroll: true });
|
||||
}
|
||||
}, [status]);
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8 py-8">
|
||||
<div className="mb-6">
|
||||
<h2 className="text-xl font-bold text-white mb-1 font-sans">Skill Finder</h2>
|
||||
<p className="text-zinc-400 font-mono text-xs">
|
||||
Search the marketplace or generate new skills with AI.
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="text-center mb-8">
|
||||
<h2 className="text-xl font-bold text-white mb-2 font-mono">Find Skills</h2>
|
||||
<p className="text-zinc-500 font-mono text-xs">
|
||||
Search 15,000+ skills from the marketplace
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSearch} className="mb-6">
|
||||
<div className="flex flex-col sm:flex-row gap-3">
|
||||
<form onSubmit={handleSearch} className="max-w-2xl mx-auto mb-8">
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
ref={inputRef}
|
||||
type="text"
|
||||
value={input}
|
||||
onChange={(e) => setInput(e.target.value)}
|
||||
placeholder="e.g., React hooks, TypeScript, Next.js..."
|
||||
className="flex-1 bg-surface border border-zinc-700 text-white px-4 py-3 focus:ring-2 focus:ring-white focus:border-transparent outline-none font-mono text-sm placeholder-zinc-600"
|
||||
disabled={status === LoadingState.LOADING}
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="react, typescript, testing, kubernetes..."
|
||||
className="flex-1 bg-zinc-900 border border-zinc-800 text-white px-4 py-3 font-mono text-sm focus:border-zinc-600 outline-none placeholder-zinc-600"
|
||||
/>
|
||||
<Button type="submit" isLoading={status === LoadingState.LOADING} className="sm:w-auto w-full">
|
||||
SEARCH
|
||||
</Button>
|
||||
<button
|
||||
type="submit"
|
||||
className="bg-zinc-800 text-white px-6 py-3 font-mono text-sm hover:bg-zinc-700 transition-colors border border-zinc-700"
|
||||
>
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
{error && <p className="mt-2 text-red-400 font-mono text-xs">{error}</p>}
|
||||
</form>
|
||||
|
||||
{viewMode !== 'search' && status !== LoadingState.LOADING && (
|
||||
<button
|
||||
onClick={handleBack}
|
||||
className="mb-6 text-zinc-400 hover:text-white font-mono text-sm flex items-center gap-2 transition-colors"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
|
||||
</svg>
|
||||
Back
|
||||
</button>
|
||||
)}
|
||||
|
||||
{viewMode === 'marketplace' && status === LoadingState.SUCCESS && (
|
||||
<div className="animate-fade-in-up">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<h3 className="text-lg font-mono text-zinc-300">
|
||||
Found {marketplaceResults.length} skill{marketplaceResults.length !== 1 ? 's' : ''} in marketplace
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3 mb-8">
|
||||
{marketplaceResults.map((skill) => (
|
||||
<Card
|
||||
key={skill.id}
|
||||
className="hover:border-zinc-500 cursor-pointer transition-all"
|
||||
onClick={() => handleViewSkill(skill)}
|
||||
>
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="flex-1">
|
||||
<h4 className="text-lg font-semibold text-white mb-1">{skill.name}</h4>
|
||||
<p className="text-zinc-400 text-sm mb-2">{skill.description || 'No description'}</p>
|
||||
<div className="flex items-center gap-2 text-xs text-zinc-500 font-mono">
|
||||
<span>{skill.source}</span>
|
||||
{hasSearched && (
|
||||
<div className="max-w-2xl mx-auto">
|
||||
{results.length > 0 ? (
|
||||
<div className="space-y-2">
|
||||
<div className="text-xs font-mono text-zinc-500 mb-4">
|
||||
{results.length} result{results.length !== 1 ? 's' : ''} for "{query}"
|
||||
</div>
|
||||
{results.map((skill) => (
|
||||
<div
|
||||
key={skill.id}
|
||||
className="bg-zinc-900/50 border border-zinc-800 p-4 hover:border-zinc-700 transition-colors"
|
||||
>
|
||||
<div className="flex items-start justify-between gap-4">
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="font-mono text-sm text-white mb-1">{skill.name}</div>
|
||||
<div className="text-xs text-zinc-500 mb-2 truncate">{skill.description || 'No description'}</div>
|
||||
<div className="text-[11px] text-zinc-600 font-mono">{skill.source}</div>
|
||||
</div>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 text-zinc-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
</div>
|
||||
{skill.tags.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1 mt-3">
|
||||
{skill.tags.slice(0, 5).map((tag, idx) => (
|
||||
<span key={idx} className="text-xs bg-zinc-900 text-zinc-500 px-2 py-0.5 border border-zinc-800">
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="border-t border-zinc-800 pt-6">
|
||||
<p className="text-zinc-500 font-mono text-sm mb-4">
|
||||
Don't see what you need? Generate a custom skill with AI.
|
||||
</p>
|
||||
<Button onClick={handleGenerateWithAI} isLoading={status === LoadingState.LOADING}>
|
||||
GENERATE WITH AI
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{viewMode === 'search' && status === LoadingState.SUCCESS && marketplaceResults.length === 0 && input && (
|
||||
<div className="animate-fade-in-up text-center py-4">
|
||||
<div className="text-zinc-500 font-mono text-sm mb-4">
|
||||
No skills found for "{input}" in the marketplace.
|
||||
</div>
|
||||
<Button onClick={handleGenerateWithAI}>
|
||||
GENERATE WITH AI
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{viewMode === 'content' && selectedSkill && (
|
||||
<div className="animate-fade-in-up">
|
||||
<div className="flex items-start justify-between mb-6 border-b border-zinc-800 pb-6">
|
||||
<div>
|
||||
<h3 className="text-2xl font-bold text-white mb-2">{selectedSkill.name}</h3>
|
||||
<p className="text-zinc-400 font-mono text-sm mb-2">{selectedSkill.description}</p>
|
||||
<div className="flex items-center gap-2 text-xs text-zinc-500 font-mono">
|
||||
<span>{selectedSkill.source}</span>
|
||||
{selectedSkill.sourceUrl && (
|
||||
<>
|
||||
<span>•</span>
|
||||
<a href={selectedSkill.sourceUrl} target="_blank" rel="noopener noreferrer" className="hover:text-white">
|
||||
View on GitHub
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{skillContent && (
|
||||
<button
|
||||
onClick={downloadSkillMd}
|
||||
className="flex items-center gap-2 bg-white text-black px-4 py-2 font-mono text-sm hover:bg-zinc-200 transition-colors shrink-0 ml-4"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" />
|
||||
</svg>
|
||||
DOWNLOAD
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{status === LoadingState.LOADING ? (
|
||||
<div className="text-zinc-500 font-mono text-sm">Loading content...</div>
|
||||
) : skillContent ? (
|
||||
<pre className="border border-zinc-700 p-4 sm:p-6 overflow-x-auto text-xs sm:text-sm max-h-[600px] overflow-y-auto max-w-full" style={{ backgroundColor: '#18181b' }}>
|
||||
<code className="font-mono whitespace-pre-wrap break-words" style={{ color: '#f4f4f5' }}>{skillContent}</code>
|
||||
</pre>
|
||||
) : (
|
||||
<div className="border border-zinc-800 p-6" style={{ backgroundColor: '#09090b' }}>
|
||||
<p className="text-zinc-400 font-mono text-sm mb-4">
|
||||
Skill content not available for direct preview.
|
||||
</p>
|
||||
<a
|
||||
href={selectedSkill.sourceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-2 bg-zinc-800 text-white px-4 py-2 font-mono text-sm hover:bg-zinc-700 transition-colors"
|
||||
>
|
||||
View on GitHub
|
||||
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-6 pt-6 border-t border-zinc-800">
|
||||
<p className="text-zinc-500 font-mono text-sm mb-3">Install with SkillKit:</p>
|
||||
<pre className="border border-zinc-800 p-3 sm:p-4 text-sm overflow-x-auto max-w-full" style={{ backgroundColor: '#09090b' }}>
|
||||
<code className="font-mono text-xs sm:text-sm break-all sm:break-normal" style={{ color: '#d4d4d8' }}>
|
||||
npx skillkit@latest install {selectedSkill.id.split('/').slice(0, 2).join('/')}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{viewMode === 'generated' && generatedSkill && (
|
||||
<div className="animate-fade-in-up">
|
||||
<div className="flex items-start justify-between mb-8 border-b border-zinc-800 pb-6">
|
||||
<div className="flex-1">
|
||||
<div className="flex flex-wrap items-center gap-2 mb-2">
|
||||
<h3 className="text-xl sm:text-2xl font-bold text-white">{generatedSkill.title}</h3>
|
||||
<span className="text-xs font-mono text-zinc-500 bg-zinc-900 px-2 py-1 border border-zinc-800">
|
||||
v{generatedSkill.version}
|
||||
</span>
|
||||
<span className="text-xs font-mono text-purple-400 bg-purple-900/30 px-2 py-1 border border-purple-800/50">
|
||||
AI Generated
|
||||
</span>
|
||||
{isFromCache && (
|
||||
<span className="text-xs font-mono text-green-400 bg-green-900/30 px-2 py-1 border border-green-800/50">
|
||||
Cached
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-zinc-400 font-mono text-sm mb-4">{generatedSkill.description}</p>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{generatedSkill.tags.map((tag, idx) => (
|
||||
<span key={idx} className="text-xs bg-zinc-900 text-zinc-400 px-2 py-1 border border-zinc-800">
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col sm:flex-row gap-2 shrink-0 ml-4">
|
||||
<button
|
||||
onClick={downloadGeneratedSkillMd}
|
||||
className="flex items-center justify-center gap-2 bg-white text-black px-4 py-2 font-mono text-sm hover:bg-zinc-200 transition-colors"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" />
|
||||
</svg>
|
||||
DOWNLOAD
|
||||
</button>
|
||||
<button
|
||||
onClick={submitToMarketplace}
|
||||
className="flex items-center justify-center gap-2 bg-purple-600 text-white px-4 py-2 font-mono text-sm hover:bg-purple-500 transition-colors"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
|
||||
</svg>
|
||||
SUBMIT
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Card className="mb-6">
|
||||
<h4 className="text-sm font-mono text-zinc-500 uppercase tracking-wider mb-2">When to Apply</h4>
|
||||
<p className="text-zinc-300">{generatedSkill.applicability}</p>
|
||||
{generatedSkill.filePatterns && generatedSkill.filePatterns.length > 0 && (
|
||||
<div className="mt-3 flex flex-wrap gap-2">
|
||||
{generatedSkill.filePatterns.map((pattern, idx) => (
|
||||
<code key={idx} className="text-xs bg-zinc-900 text-zinc-300 px-2 py-1 border border-zinc-800">
|
||||
{pattern}
|
||||
</code>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
|
||||
<div className="flex overflow-x-auto border-b border-zinc-800 mb-6 -mx-4 px-4 sm:mx-0 sm:px-0">
|
||||
{(['principles', 'patterns', 'antipatterns'] as const).map((tab) => (
|
||||
<button
|
||||
key={tab}
|
||||
type="button"
|
||||
onClick={() => setActiveTab(tab)}
|
||||
className={`px-3 sm:px-6 py-3 font-mono text-xs sm:text-sm uppercase tracking-wider transition-colors whitespace-nowrap flex-shrink-0 ${
|
||||
activeTab === tab
|
||||
? 'text-white border-b-2 border-white -mb-px'
|
||||
: 'text-zinc-500 hover:text-zinc-300'
|
||||
}`}
|
||||
>
|
||||
{tab === 'antipatterns' ? 'Anti-Patterns' : tab}
|
||||
<span className="ml-1 sm:ml-2 text-xs text-zinc-600">
|
||||
({tab === 'principles' ? generatedSkill.principles.length : tab === 'patterns' ? generatedSkill.patterns.length : generatedSkill.antiPatterns.length})
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
{activeTab === 'principles' && generatedSkill.principles.map((principle, idx) => (
|
||||
<Card key={idx} className="hover:border-zinc-600 transition-colors">
|
||||
<div className="flex items-start justify-between gap-4 mb-2">
|
||||
<h4 className="text-lg font-semibold text-white">{principle.title}</h4>
|
||||
<PriorityBadge priority={principle.priority} />
|
||||
</div>
|
||||
<p className="text-zinc-400 leading-relaxed">{principle.description}</p>
|
||||
</Card>
|
||||
))}
|
||||
|
||||
{activeTab === 'patterns' && generatedSkill.patterns.map((pattern, idx) => (
|
||||
<Card key={idx} className="hover:border-zinc-600 transition-colors">
|
||||
<h4 className="text-lg font-semibold text-white mb-2">{pattern.name}</h4>
|
||||
<p className="text-zinc-400 mb-4">{pattern.description}</p>
|
||||
<pre className="border border-zinc-700 p-3 sm:p-4 overflow-x-auto text-xs sm:text-sm max-w-full" style={{ backgroundColor: '#18181b' }}>
|
||||
<code className="font-mono whitespace-pre-wrap break-words" style={{ color: '#f4f4f5' }}>{pattern.example}</code>
|
||||
</pre>
|
||||
</Card>
|
||||
))}
|
||||
|
||||
{activeTab === 'antipatterns' && generatedSkill.antiPatterns.map((ap, idx) => (
|
||||
<Card key={idx} className="hover:border-zinc-600 transition-colors border-red-900/30">
|
||||
<h4 className="text-lg font-semibold text-white mb-2">{ap.name}</h4>
|
||||
<p className="text-zinc-400 mb-4">{ap.description}</p>
|
||||
{ap.badExample && (
|
||||
<div className="mb-4">
|
||||
<div className="text-xs font-mono text-red-400 mb-1 uppercase">Bad</div>
|
||||
<pre className="border border-red-800/50 p-3 sm:p-4 overflow-x-auto text-xs sm:text-sm max-w-full" style={{ backgroundColor: '#450a0a' }}>
|
||||
<code className="font-mono whitespace-pre-wrap break-words" style={{ color: '#fecaca' }}>{ap.badExample}</code>
|
||||
</pre>
|
||||
</div>
|
||||
)}
|
||||
{ap.goodExample && (
|
||||
<div>
|
||||
<div className="text-xs font-mono text-green-400 mb-1 uppercase">Good</div>
|
||||
<pre className="border border-green-800/50 p-3 sm:p-4 overflow-x-auto text-xs sm:text-sm max-w-full" style={{ backgroundColor: '#052e16' }}>
|
||||
<code className="font-mono whitespace-pre-wrap break-words" style={{ color: '#bbf7d0' }}>{ap.goodExample}</code>
|
||||
</pre>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{generatedSkill.references && generatedSkill.references.length > 0 && (
|
||||
<div className="mt-8 pt-6 border-t border-zinc-800">
|
||||
<h4 className="text-sm font-mono text-zinc-500 uppercase tracking-wider mb-3">References</h4>
|
||||
<ul className="space-y-1">
|
||||
{generatedSkill.references.map((ref, idx) => (
|
||||
<li key={idx}>
|
||||
<a
|
||||
href={ref}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-400 hover:text-white font-mono text-sm transition-colors"
|
||||
<button
|
||||
onClick={() => copyInstall(skill)}
|
||||
className="text-xs font-mono text-zinc-500 hover:text-white transition-colors shrink-0"
|
||||
>
|
||||
{ref}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{copied === skill.id ? 'Copied' : 'Copy'}
|
||||
</button>
|
||||
</div>
|
||||
{skill.tags.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1 mt-3">
|
||||
{skill.tags.slice(0, 4).map((tag, idx) => (
|
||||
<span key={idx} className="text-[10px] text-zinc-600 px-1.5 py-0.5 bg-zinc-800/50">
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center text-zinc-500 font-mono text-sm py-8">
|
||||
No skills found for "{query}"
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!hasSearched && (
|
||||
<div className="max-w-2xl mx-auto text-center">
|
||||
<div className="flex flex-wrap justify-center gap-2 text-xs font-mono">
|
||||
{['react', 'typescript', 'nextjs', 'testing', 'docker', 'kubernetes', 'python', 'security'].map(tag => (
|
||||
<button
|
||||
key={tag}
|
||||
onClick={() => {
|
||||
setQuery(tag);
|
||||
const found = searchSkills(tag);
|
||||
setResults(found);
|
||||
setHasSearched(true);
|
||||
}}
|
||||
className="text-zinc-600 hover:text-white px-2 py-1 border border-zinc-800 hover:border-zinc-600 transition-colors"
|
||||
>
|
||||
{tag}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,549 +1,75 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { Card } from './Card';
|
||||
|
||||
type Mode = 'upload' | 'import';
|
||||
|
||||
interface SkillFormData {
|
||||
slug: string;
|
||||
displayName: string;
|
||||
description: string;
|
||||
version: string;
|
||||
tags: string;
|
||||
repoOwner: string;
|
||||
repoName: string;
|
||||
skillPath: string;
|
||||
authorGithub: string;
|
||||
skillContent: string;
|
||||
}
|
||||
|
||||
const INITIAL_FORM: SkillFormData = {
|
||||
slug: '',
|
||||
displayName: '',
|
||||
description: '',
|
||||
version: '1.0.0',
|
||||
tags: '',
|
||||
repoOwner: '',
|
||||
repoName: '',
|
||||
skillPath: '',
|
||||
authorGithub: '',
|
||||
skillContent: '',
|
||||
};
|
||||
|
||||
const TAG_SUGGESTIONS = [
|
||||
'react', 'typescript', 'nextjs', 'python', 'rust', 'go',
|
||||
'testing', 'api', 'database', 'devops', 'security', 'mobile',
|
||||
] as const;
|
||||
|
||||
const GITHUB_ICON = (
|
||||
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path fillRule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clipRule="evenodd" />
|
||||
</svg>
|
||||
);
|
||||
import React, { useState } from 'react';
|
||||
|
||||
export function SkillSubmitForm(): React.ReactElement {
|
||||
const [mode, setMode] = useState<Mode>('import');
|
||||
const [form, setForm] = useState<SkillFormData>(INITIAL_FORM);
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
const [fileName, setFileName] = useState<string | null>(null);
|
||||
const [githubUrl, setGithubUrl] = useState('');
|
||||
const [isDetecting, setIsDetecting] = useState(false);
|
||||
const [detectError, setDetectError] = useState<string | null>(null);
|
||||
const [repoUrl, setRepoUrl] = useState('');
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
function updateField(field: keyof SkillFormData, value: string): void {
|
||||
setForm(prev => {
|
||||
const updated = { ...prev, [field]: value };
|
||||
if (field === 'displayName' && !prev.slug) {
|
||||
updated.slug = value.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
|
||||
}
|
||||
return updated;
|
||||
});
|
||||
}
|
||||
const repoMatch = repoUrl.match(/github\.com\/([^\/]+)\/([^\/\s]+)/);
|
||||
const owner = repoMatch?.[1] || 'owner';
|
||||
const repo = repoMatch?.[2]?.replace(/\.git$/, '') || 'repo';
|
||||
const skillName = repo.replace(/-skill$/, '').replace(/-/g, '-');
|
||||
|
||||
function addTag(tag: string): void {
|
||||
const currentTags = form.tags.split(',').map(t => t.trim()).filter(Boolean);
|
||||
if (!currentTags.includes(tag)) {
|
||||
updateField('tags', [...currentTags, tag].join(', '));
|
||||
}
|
||||
}
|
||||
|
||||
function parseSkillContent(content: string): void {
|
||||
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
||||
if (frontmatterMatch) {
|
||||
const fm = frontmatterMatch[1];
|
||||
const nameMatch = fm.match(/name:\s*["']?([^"'\n]+)["']?/);
|
||||
const descMatch = fm.match(/description:\s*["']?([^"'\n]+)["']?/);
|
||||
const tagsMatch = fm.match(/tags:\s*\[([^\]]+)\]/);
|
||||
const versionMatch = fm.match(/version:\s*["']?([^"'\n]+)["']?/);
|
||||
|
||||
if (nameMatch) updateField('displayName', nameMatch[1].trim());
|
||||
if (descMatch) updateField('description', descMatch[1].trim());
|
||||
if (versionMatch) updateField('version', versionMatch[1].trim());
|
||||
if (tagsMatch) {
|
||||
const tags = tagsMatch[1].replace(/["']/g, '').split(',').map(t => t.trim()).join(', ');
|
||||
updateField('tags', tags);
|
||||
}
|
||||
}
|
||||
updateField('skillContent', content);
|
||||
}
|
||||
|
||||
async function handleDetect(): Promise<void> {
|
||||
if (!githubUrl) return;
|
||||
|
||||
setIsDetecting(true);
|
||||
setDetectError(null);
|
||||
const command = `npx skillkit@latest publish ${repoUrl || 'https://github.com/owner/repo'}`;
|
||||
|
||||
async function copyCommand(): Promise<void> {
|
||||
if (!repoUrl) return;
|
||||
try {
|
||||
const urlMatch = githubUrl.match(/github\.com\/([^\/]+)\/([^\/]+)(?:\/(?:tree|blob)\/[^\/]+\/(.+))?/);
|
||||
|
||||
if (!urlMatch) {
|
||||
throw new Error('Invalid GitHub URL');
|
||||
}
|
||||
|
||||
const [, owner, repo, path = ''] = urlMatch;
|
||||
|
||||
const apiUrl = `https://api.github.com/repos/${owner}/${repo}`;
|
||||
const response = await fetch(apiUrl);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Repository not found or not public');
|
||||
}
|
||||
|
||||
const repoData = await response.json();
|
||||
|
||||
updateField('repoOwner', owner);
|
||||
updateField('repoName', repo);
|
||||
updateField('authorGithub', owner);
|
||||
updateField('displayName', repoData.name.replace(/-/g, ' ').replace(/\b\w/g, (c: string) => c.toUpperCase()));
|
||||
updateField('description', repoData.description || '');
|
||||
|
||||
const slug = path ? path.split('/').filter(Boolean).pop() || repo : repo;
|
||||
updateField('slug', slug.toLowerCase().replace(/[^a-z0-9-]/g, '-'));
|
||||
|
||||
if (repoData.topics && repoData.topics.length > 0) {
|
||||
updateField('tags', repoData.topics.slice(0, 5).join(', '));
|
||||
} else {
|
||||
const inferredTags: string[] = [];
|
||||
const nameLC = (repo + ' ' + (repoData.description || '')).toLowerCase();
|
||||
if (nameLC.includes('react')) inferredTags.push('react');
|
||||
if (nameLC.includes('typescript') || nameLC.includes('ts')) inferredTags.push('typescript');
|
||||
if (nameLC.includes('python')) inferredTags.push('python');
|
||||
if (nameLC.includes('skill')) inferredTags.push('skills');
|
||||
if (inferredTags.length > 0) {
|
||||
updateField('tags', inferredTags.join(', '));
|
||||
}
|
||||
}
|
||||
|
||||
updateField('skillContent', `[Linked from GitHub: ${owner}/${repo}]`);
|
||||
updateField('skillPath', path || '/');
|
||||
|
||||
} catch (err) {
|
||||
setDetectError(err instanceof Error ? err.message : 'Detection failed');
|
||||
} finally {
|
||||
setIsDetecting(false);
|
||||
await navigator.clipboard.writeText(command);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
const handleDragOver = useCallback(function(e: React.DragEvent): void {
|
||||
e.preventDefault();
|
||||
setIsDragging(true);
|
||||
}, []);
|
||||
|
||||
const handleDragLeave = useCallback(function(e: React.DragEvent): void {
|
||||
e.preventDefault();
|
||||
setIsDragging(false);
|
||||
}, []);
|
||||
|
||||
const processMarkdownFile = useCallback(function(file: File): void {
|
||||
setFileName(file.name);
|
||||
const reader = new FileReader();
|
||||
reader.onload = (event) => {
|
||||
parseSkillContent(event.target?.result as string);
|
||||
};
|
||||
reader.readAsText(file);
|
||||
}, []);
|
||||
|
||||
const handleDrop = useCallback(function(e: React.DragEvent): void {
|
||||
e.preventDefault();
|
||||
setIsDragging(false);
|
||||
|
||||
const files = Array.from(e.dataTransfer.files);
|
||||
const mdFile = files.find(f => f.name.endsWith('.md'));
|
||||
|
||||
if (mdFile) {
|
||||
processMarkdownFile(mdFile);
|
||||
}
|
||||
}, [processMarkdownFile]);
|
||||
|
||||
function handleFileSelect(e: React.ChangeEvent<HTMLInputElement>): void {
|
||||
const file = e.target.files?.[0];
|
||||
if (file && file.name.endsWith('.md')) {
|
||||
processMarkdownFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
const validation = {
|
||||
slug: !form.slug ? 'Slug is required.' : null,
|
||||
displayName: !form.displayName ? 'Display name is required.' : null,
|
||||
content: mode === 'upload' && !form.skillContent ? 'Upload a SKILL.md file.' : null,
|
||||
repo: mode === 'import' && (!form.repoOwner || !form.repoName) ? 'Click Detect to import repo.' : null,
|
||||
tags: !form.tags ? 'Add at least one tag.' : null,
|
||||
};
|
||||
|
||||
const isImported = mode === 'import' && form.repoOwner && form.repoName;
|
||||
const errors = Object.values(validation).filter(Boolean);
|
||||
const isValid = errors.length === 0;
|
||||
const tagsArray = form.tags.split(',').map(t => t.trim()).filter(Boolean);
|
||||
|
||||
function generateIssueUrl(): string {
|
||||
const skillId = form.repoOwner && form.repoName
|
||||
? `${form.repoOwner}/${form.repoName}/${form.slug}`
|
||||
: `community/${form.authorGithub || 'anonymous'}/${form.slug}`;
|
||||
|
||||
const jsonEntry = JSON.stringify({
|
||||
id: skillId,
|
||||
name: form.displayName,
|
||||
description: form.description || '',
|
||||
source: `${form.repoOwner}/${form.repoName}`,
|
||||
tags: tagsArray,
|
||||
author: form.authorGithub || form.repoOwner
|
||||
}, null, 2);
|
||||
|
||||
const title = isImported
|
||||
? encodeURIComponent(`[Import] ${form.repoOwner}/${form.repoName}`)
|
||||
: encodeURIComponent(`[Skill] ${form.displayName}`);
|
||||
|
||||
const bodyContent = isImported
|
||||
? `## 📦 Import Request: ${form.repoOwner}/${form.repoName}
|
||||
|
||||
### Repository
|
||||
🔗 https://github.com/${form.repoOwner}/${form.repoName}
|
||||
|
||||
### Add to \`marketplace/skills.json\`
|
||||
|
||||
\`\`\`json
|
||||
${jsonEntry}
|
||||
\`\`\`
|
||||
|
||||
### Checklist for Maintainer
|
||||
- [ ] Verify repository is public
|
||||
- [ ] Add JSON entry to \`marketplace/skills.json\`
|
||||
|
||||
---
|
||||
**Submitted by:** @${form.authorGithub || 'anonymous'}
|
||||
**Owner:** @${form.repoOwner} (retains all rights)`
|
||||
: `## 📤 Skill Upload: ${form.displayName}
|
||||
|
||||
### Add to \`marketplace/skills.json\`
|
||||
|
||||
\`\`\`json
|
||||
${jsonEntry}
|
||||
\`\`\`
|
||||
|
||||
### SKILL.md Content
|
||||
|
||||
<details>
|
||||
<summary>Click to expand</summary>
|
||||
|
||||
\`\`\`markdown
|
||||
${form.skillContent.slice(0, 4000)}${form.skillContent.length > 4000 ? '\n...(truncated)' : ''}
|
||||
\`\`\`
|
||||
|
||||
</details>
|
||||
|
||||
### Checklist for Maintainer
|
||||
- [ ] Review SKILL.md content
|
||||
- [ ] Add JSON entry to \`marketplace/skills.json\`
|
||||
|
||||
---
|
||||
**Author:** @${form.authorGithub || 'anonymous'}`;
|
||||
|
||||
const body = encodeURIComponent(bodyContent);
|
||||
const labels = isImported ? 'skill-import' : 'skill-submission';
|
||||
return `https://github.com/rohitg00/skillkit/issues/new?title=${title}&body=${body}&labels=${labels}`;
|
||||
}
|
||||
|
||||
function handleSubmitClick(e: React.MouseEvent): void {
|
||||
e.preventDefault();
|
||||
if (isValid) {
|
||||
const url = generateIssueUrl();
|
||||
window.open(url, '_blank', 'noopener,noreferrer');
|
||||
}
|
||||
}
|
||||
const issueUrl = repoUrl
|
||||
? `https://github.com/rohitg00/skillkit/issues/new?title=${encodeURIComponent(`[Skill] ${owner}/${repo}`)}&body=${encodeURIComponent(`## Skill Submission\n\n**Repository:** ${repoUrl}\n\n**Description:** \n\n**Tags:** `)}&labels=skill-submission`
|
||||
: 'https://github.com/rohitg00/skillkit/issues/new?template=skill-submission.md';
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex border-b border-zinc-800">
|
||||
<button
|
||||
onClick={() => setMode('import')}
|
||||
className={`px-6 py-3 font-mono text-sm transition-colors ${
|
||||
mode === 'import'
|
||||
? 'text-white border-b-2 border-white -mb-px'
|
||||
: 'text-zinc-500 hover:text-zinc-300'
|
||||
}`}
|
||||
>
|
||||
Import from GitHub
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setMode('upload')}
|
||||
className={`px-6 py-3 font-mono text-sm transition-colors ${
|
||||
mode === 'upload'
|
||||
? 'text-white border-b-2 border-white -mb-px'
|
||||
: 'text-zinc-500 hover:text-zinc-300'
|
||||
}`}
|
||||
>
|
||||
Upload File
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||||
<div className="space-y-6">
|
||||
{mode === 'import' && (
|
||||
<Card>
|
||||
<div className="flex items-center justify-between mb-1">
|
||||
<label className="text-sm text-zinc-400">GitHub URL</label>
|
||||
<span className="text-xs text-zinc-600">Repo, tree path, or blob</span>
|
||||
</div>
|
||||
<div className="flex gap-3 mt-2">
|
||||
<input
|
||||
type="text"
|
||||
value={githubUrl}
|
||||
onChange={(e) => setGithubUrl(e.target.value)}
|
||||
placeholder="https://github.com/owner/repo"
|
||||
className="flex-1 bg-zinc-900 border border-zinc-700 text-white px-4 py-2.5 font-mono text-sm focus:ring-1 focus:ring-white focus:border-white outline-none placeholder-zinc-600"
|
||||
/>
|
||||
<button
|
||||
onClick={handleDetect}
|
||||
disabled={isDetecting || !githubUrl}
|
||||
className={`px-5 py-2.5 font-mono text-sm transition-colors ${
|
||||
isDetecting || !githubUrl
|
||||
? 'bg-zinc-800 text-zinc-600 cursor-not-allowed'
|
||||
: 'bg-white text-black hover:bg-zinc-200'
|
||||
}`}
|
||||
>
|
||||
{isDetecting ? 'Detecting...' : 'Detect'}
|
||||
</button>
|
||||
</div>
|
||||
{detectError && (
|
||||
<p className="text-red-400 text-xs mt-2 font-mono">{detectError}</p>
|
||||
)}
|
||||
{isImported && (
|
||||
<p className="text-zinc-300 text-xs mt-2 font-mono flex items-center gap-1">
|
||||
<svg className="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
|
||||
</svg>
|
||||
Repository detected - {form.repoOwner}/{form.repoName}
|
||||
</p>
|
||||
)}
|
||||
<p className="text-zinc-600 text-xs mt-3">
|
||||
Public repos only. We link to the original - owner retains all rights.
|
||||
</p>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{mode === 'upload' && (
|
||||
<Card
|
||||
className={`transition-colors ${isDragging ? 'border-white bg-zinc-900' : ''}`}
|
||||
onDragOver={handleDragOver}
|
||||
onDragLeave={handleDragLeave}
|
||||
onDrop={handleDrop}
|
||||
>
|
||||
<div className="text-center py-6">
|
||||
<div className="mb-3">
|
||||
<svg className="w-8 h-8 mx-auto text-zinc-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
|
||||
</svg>
|
||||
</div>
|
||||
<p className="text-zinc-400 text-sm mb-1">
|
||||
{fileName ? (
|
||||
<span className="text-white">{fileName}</span>
|
||||
) : (
|
||||
'Drop SKILL.md here'
|
||||
)}
|
||||
</p>
|
||||
<p className="text-zinc-600 text-xs mb-3">or</p>
|
||||
<label className="inline-block cursor-pointer">
|
||||
<span className="bg-zinc-800 hover:bg-zinc-700 text-white px-4 py-2 text-sm font-mono transition-colors">
|
||||
Choose file
|
||||
</span>
|
||||
<input
|
||||
type="file"
|
||||
accept=".md"
|
||||
onChange={handleFileSelect}
|
||||
className="hidden"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
<Card>
|
||||
<div className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm text-zinc-400 mb-1.5">Slug</label>
|
||||
<input
|
||||
type="text"
|
||||
value={form.slug}
|
||||
onChange={(e) => updateField('slug', e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, ''))}
|
||||
placeholder="my-skill"
|
||||
className="w-full bg-zinc-900 border border-zinc-700 text-white px-3 py-2 font-mono text-sm focus:ring-1 focus:ring-white focus:border-white outline-none placeholder-zinc-600"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm text-zinc-400 mb-1.5">Display name</label>
|
||||
<input
|
||||
type="text"
|
||||
value={form.displayName}
|
||||
onChange={(e) => updateField('displayName', e.target.value)}
|
||||
placeholder="My Skill"
|
||||
className="w-full bg-zinc-900 border border-zinc-700 text-white px-3 py-2 font-mono text-sm focus:ring-1 focus:ring-white focus:border-white outline-none placeholder-zinc-600"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm text-zinc-400 mb-1.5">Version</label>
|
||||
<input
|
||||
type="text"
|
||||
value={form.version}
|
||||
onChange={(e) => updateField('version', e.target.value)}
|
||||
placeholder="1.0.0"
|
||||
className="w-full bg-zinc-900 border border-zinc-700 text-white px-3 py-2 font-mono text-sm focus:ring-1 focus:ring-white focus:border-white outline-none placeholder-zinc-600"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm text-zinc-400 mb-1.5">Tags</label>
|
||||
<input
|
||||
type="text"
|
||||
value={form.tags}
|
||||
onChange={(e) => updateField('tags', e.target.value)}
|
||||
placeholder="react, typescript"
|
||||
className="w-full bg-zinc-900 border border-zinc-700 text-white px-3 py-2 font-mono text-sm focus:ring-1 focus:ring-white focus:border-white outline-none placeholder-zinc-600"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{TAG_SUGGESTIONS.map((tag) => (
|
||||
<button
|
||||
key={tag}
|
||||
type="button"
|
||||
onClick={() => addTag(tag)}
|
||||
className="text-xs text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 px-2 py-0.5 border border-zinc-800 transition-colors"
|
||||
>
|
||||
+{tag}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<div className="max-w-2xl mx-auto">
|
||||
<div className="space-y-6">
|
||||
<div>
|
||||
<label className="block text-xs font-mono text-zinc-500 mb-2">
|
||||
Your GitHub repository URL
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={repoUrl}
|
||||
onChange={(e) => setRepoUrl(e.target.value)}
|
||||
placeholder="https://github.com/username/my-skill"
|
||||
className="w-full bg-zinc-900 border border-zinc-800 text-white px-4 py-3 font-mono text-sm focus:border-zinc-600 outline-none placeholder-zinc-600"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-6">
|
||||
<Card>
|
||||
<h4 className="text-sm text-zinc-400 mb-4">Preview</h4>
|
||||
<div className="bg-zinc-950 border border-zinc-800 p-4">
|
||||
<div className="flex items-start justify-between mb-3">
|
||||
<div>
|
||||
<h5 className="text-white font-semibold">
|
||||
{form.displayName || 'Skill Name'}
|
||||
</h5>
|
||||
<p className="text-zinc-500 text-sm mt-1">
|
||||
{form.description || 'No description'}
|
||||
</p>
|
||||
</div>
|
||||
<span className="text-xs font-mono text-zinc-600 bg-zinc-900 px-2 py-1">
|
||||
v{form.version}
|
||||
</span>
|
||||
</div>
|
||||
{(form.repoOwner || form.authorGithub) && (
|
||||
<div className="flex items-center gap-2 text-xs text-zinc-600 font-mono mb-3">
|
||||
{form.repoOwner && form.repoName && <span>{form.repoOwner}/{form.repoName}</span>}
|
||||
{form.authorGithub && (
|
||||
<>
|
||||
{form.repoOwner && <span>•</span>}
|
||||
<span>@{form.authorGithub}</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{tagsArray.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{tagsArray.map((tag, i) => (
|
||||
<span key={i} className="text-xs bg-zinc-900 text-zinc-500 px-2 py-0.5 border border-zinc-800">
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
<div className="bg-black border border-zinc-800 p-4">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span className="text-xs font-mono text-zinc-500">Run this command</span>
|
||||
<button
|
||||
onClick={copyCommand}
|
||||
disabled={!repoUrl}
|
||||
className={`text-xs font-mono transition-colors ${
|
||||
repoUrl ? 'text-zinc-500 hover:text-white' : 'text-zinc-700'
|
||||
}`}
|
||||
>
|
||||
{copied ? 'Copied' : 'Copy'}
|
||||
</button>
|
||||
</div>
|
||||
<code className="block font-mono text-sm text-zinc-300 break-all">
|
||||
<span className="text-zinc-600">$</span> {command}
|
||||
</code>
|
||||
</div>
|
||||
|
||||
{isImported ? (
|
||||
<Card className="border-blue-900/50">
|
||||
<div className="flex items-center gap-3 mb-3">
|
||||
<div className="w-8 h-8 bg-blue-900/30 border border-blue-800 flex items-center justify-center">
|
||||
<svg className="w-4 h-4 text-blue-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" />
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-sm text-white font-medium">Linked Repository</h4>
|
||||
<p className="text-xs text-zinc-500">Skills hosted by @{form.repoOwner}</p>
|
||||
</div>
|
||||
</div>
|
||||
<a
|
||||
href={`https://github.com/${form.repoOwner}/${form.repoName}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-sm text-blue-400 hover:text-blue-300 font-mono flex items-center gap-2"
|
||||
>
|
||||
github.com/{form.repoOwner}/{form.repoName}
|
||||
<svg className="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
|
||||
</svg>
|
||||
</a>
|
||||
</Card>
|
||||
) : form.skillContent && !form.skillContent.startsWith('[Linked') ? (
|
||||
<Card>
|
||||
<h4 className="text-sm text-zinc-400 mb-3">SKILL.md</h4>
|
||||
<pre className="bg-zinc-950 border border-zinc-800 p-3 text-xs font-mono text-zinc-400 max-h-48 overflow-auto">
|
||||
{form.skillContent.slice(0, 1000)}
|
||||
{form.skillContent.length > 1000 && '\n...'}
|
||||
</pre>
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{errors.length > 0 && (
|
||||
<div className="space-y-1 text-xs font-mono text-yellow-500">
|
||||
{errors.map((error, i) => (
|
||||
<div key={i} className="flex items-center gap-1">
|
||||
<span className="text-yellow-600">•</span> {error}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleSubmitClick}
|
||||
disabled={!isValid}
|
||||
className={`flex items-center justify-center gap-3 w-full py-4 font-mono text-sm transition-all ${
|
||||
isValid
|
||||
? 'bg-white text-black hover:bg-zinc-200'
|
||||
: 'bg-zinc-800 text-zinc-600 cursor-not-allowed'
|
||||
}`}
|
||||
<div className="text-center text-xs font-mono text-zinc-600">
|
||||
or{' '}
|
||||
<a
|
||||
href={issueUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-400 hover:text-white underline"
|
||||
>
|
||||
{GITHUB_ICON}
|
||||
{isImported ? 'Import to marketplace' : 'Publish skill'}
|
||||
</button>
|
||||
|
||||
<p className="text-xs text-zinc-600 text-center font-mono">
|
||||
{isImported
|
||||
? 'Links to original repo → Owner retains rights'
|
||||
: 'Opens GitHub issue → We review → Added to marketplace'}
|
||||
</p>
|
||||
open a GitHub issue
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { searchSkills, IndexedSkill, SKILLS_INDEX } from '../data/skills-index';
|
||||
|
||||
interface StackItem extends IndexedSkill {
|
||||
addedAt: number;
|
||||
}
|
||||
|
||||
// Default starter skills to show on load
|
||||
const DEFAULT_SKILLS = ['react', 'typescript', 'nextjs'];
|
||||
|
||||
const POPULAR_STACKS = [
|
||||
{
|
||||
name: 'Full Stack TypeScript',
|
||||
@@ -13,19 +16,39 @@ const POPULAR_STACKS = [
|
||||
},
|
||||
{
|
||||
name: 'AI/ML Development',
|
||||
skills: ['python', 'langchain', 'openai', 'embeddings'],
|
||||
skills: ['python', 'langchain', 'openai', 'embeddings', 'llm'],
|
||||
icon: '🤖',
|
||||
},
|
||||
{
|
||||
name: 'DevOps & Cloud',
|
||||
skills: ['docker', 'kubernetes', 'terraform', 'github-actions'],
|
||||
skills: ['docker', 'kubernetes', 'terraform', 'github-actions', 'kubernetes-mcp'],
|
||||
icon: '☁️',
|
||||
},
|
||||
{
|
||||
name: 'Mobile Development',
|
||||
skills: ['react-native', 'expo', 'ios', 'android'],
|
||||
skills: ['react-native', 'expo', 'ios', 'android', 'swift'],
|
||||
icon: '📱',
|
||||
},
|
||||
{
|
||||
name: 'Backend & API',
|
||||
skills: ['nodejs', 'express', 'graphql', 'rest', 'nestjs'],
|
||||
icon: '🔧',
|
||||
},
|
||||
{
|
||||
name: 'Security',
|
||||
skills: ['security', 'auth', 'oauth', 'jwt', 'vulnerability'],
|
||||
icon: '🔒',
|
||||
},
|
||||
{
|
||||
name: 'Data Engineering',
|
||||
skills: ['sql', 'postgres', 'redis', 'elasticsearch', 'kafka'],
|
||||
icon: '📊',
|
||||
},
|
||||
{
|
||||
name: 'Web3 & Blockchain',
|
||||
skills: ['solidity', 'ethereum', 'web3', 'smart-contract'],
|
||||
icon: '⛓️',
|
||||
},
|
||||
];
|
||||
|
||||
export function StackBuilder(): React.ReactElement {
|
||||
@@ -34,6 +57,20 @@ export function StackBuilder(): React.ReactElement {
|
||||
const [searchResults, setSearchResults] = useState<IndexedSkill[]>([]);
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
// Load default skills on mount
|
||||
useEffect(() => {
|
||||
const initialStack: StackItem[] = [];
|
||||
DEFAULT_SKILLS.forEach(query => {
|
||||
const results = searchSkills(query);
|
||||
if (results.length > 0 && !initialStack.some(s => s.id === results[0].id)) {
|
||||
initialStack.push({ ...results[0], addedAt: Date.now() });
|
||||
}
|
||||
});
|
||||
if (initialStack.length > 0) {
|
||||
setStack(initialStack);
|
||||
}
|
||||
}, []);
|
||||
|
||||
function handleSearch(query: string): void {
|
||||
setSearchQuery(query);
|
||||
if (query.trim()) {
|
||||
@@ -186,42 +223,39 @@ export function StackBuilder(): React.ReactElement {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="lg:w-80 lg:flex-shrink-0">
|
||||
<div className="lg:sticky lg:top-20 bg-zinc-900/50 border border-zinc-800 p-3 sm:p-4">
|
||||
<div className="text-xs font-mono text-zinc-500 uppercase tracking-wider mb-3">
|
||||
Install Command
|
||||
</div>
|
||||
<div className="lg:w-72 lg:flex-shrink-0">
|
||||
<div className="lg:sticky lg:top-20 bg-zinc-900/30 border border-zinc-800 p-3">
|
||||
{stack.length > 0 ? (
|
||||
<>
|
||||
<pre className="bg-black border border-zinc-800 p-3 overflow-x-auto text-xs mb-3">
|
||||
<code className="font-mono text-green-400 whitespace-pre-wrap break-all">
|
||||
<pre className="bg-black/50 p-2 overflow-x-auto text-[11px] mb-2">
|
||||
<code className="font-mono text-zinc-300 whitespace-pre-wrap break-all">
|
||||
{generateInstallCommand()}
|
||||
</code>
|
||||
</pre>
|
||||
<button
|
||||
onClick={copyCommand}
|
||||
className="w-full bg-white text-black py-2 font-mono text-sm hover:bg-zinc-200 transition-colors flex items-center justify-center gap-2"
|
||||
className="w-full bg-zinc-800 text-zinc-300 py-1.5 font-mono text-xs hover:bg-zinc-700 hover:text-white transition-colors flex items-center justify-center gap-1.5 border border-zinc-700"
|
||||
>
|
||||
{copied ? (
|
||||
<>
|
||||
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg className="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
|
||||
</svg>
|
||||
COPIED!
|
||||
Copied
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg className="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" />
|
||||
</svg>
|
||||
COPY COMMAND
|
||||
Copy
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
<div className="text-zinc-600 text-xs font-mono text-center py-6">
|
||||
Add skills to generate install command
|
||||
<div className="text-zinc-600 text-xs font-mono text-center py-4">
|
||||
Add skills to generate command
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
import React from 'react';
|
||||
|
||||
interface TeamFeature {
|
||||
title: string;
|
||||
description: string;
|
||||
icon: React.ReactNode;
|
||||
}
|
||||
|
||||
const TEAM_FEATURES: TeamFeature[] = [
|
||||
{
|
||||
title: '.skills Manifest',
|
||||
description: 'Define your team\'s skill stack in a single file. Everyone gets the same capabilities.',
|
||||
icon: (
|
||||
<svg className="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'Git-Based Sync',
|
||||
description: 'Skills live in your repo. Push to share. Pull to update. Works with your existing workflow.',
|
||||
icon: (
|
||||
<svg className="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M8 7v8a2 2 0 002 2h6M8 7V5a2 2 0 012-2h4.586a1 1 0 01.707.293l4.414 4.414a1 1 0 01.293.707V15a2 2 0 01-2 2h-2M8 7H6a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2v-2" />
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'CI/CD Integration',
|
||||
description: 'Auto-validate and deploy skills on every commit. GitHub Actions, GitLab CI, pre-commit hooks.',
|
||||
icon: (
|
||||
<svg className="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'Private Registries',
|
||||
description: 'Host internal skills in private repos. Control access and maintain proprietary knowledge.',
|
||||
icon: (
|
||||
<svg className="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
export function TeamEnterprise(): React.ReactElement {
|
||||
return (
|
||||
<section className="py-12 sm:py-16 border-b border-zinc-800 bg-gradient-to-b from-zinc-950 to-black">
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
{/* Section Header */}
|
||||
<div className="text-center mb-8 sm:mb-12">
|
||||
<div className="inline-flex items-center gap-2 border border-zinc-700 bg-zinc-900/80 px-2 sm:px-3 py-1 mb-4 backdrop-blur-sm">
|
||||
<span className="text-[10px] sm:text-xs font-mono text-zinc-300 uppercase tracking-wider">For Teams</span>
|
||||
</div>
|
||||
<h2 className="text-2xl sm:text-3xl lg:text-4xl font-bold text-white mb-3 font-mono tracking-tight">
|
||||
Scale Across Your Organization
|
||||
</h2>
|
||||
<p className="text-zinc-400 font-mono text-xs sm:text-sm max-w-2xl mx-auto">
|
||||
From solo developers to enterprise teams. SkillKit grows with you.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Team Features Grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 sm:gap-4 mb-8 sm:mb-12">
|
||||
{TEAM_FEATURES.map((feature, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="group p-4 sm:p-5 border border-zinc-800 bg-zinc-900/30 hover:border-zinc-700 hover:bg-zinc-900/60 transition-all duration-300"
|
||||
>
|
||||
<div className="flex items-start gap-3 sm:gap-4">
|
||||
<div className="p-2 bg-zinc-800/50 border border-zinc-700 text-zinc-400 group-hover:text-white transition-colors flex-shrink-0">
|
||||
{feature.icon}
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-base sm:text-lg font-bold text-white font-mono mb-1">{feature.title}</h3>
|
||||
<p className="text-zinc-500 text-xs sm:text-sm">{feature.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* API Teaser */}
|
||||
<div className="border border-zinc-800 bg-black/30 p-4 sm:p-6">
|
||||
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4">
|
||||
<div>
|
||||
<h3 className="text-base sm:text-lg font-bold text-white font-mono mb-1">TypeScript API</h3>
|
||||
<p className="text-zinc-500 text-xs sm:text-sm">
|
||||
Full programmatic access. Import <code className="text-zinc-400">translateSkill</code>, <code className="text-zinc-400">analyzeProject</code> and more.
|
||||
</p>
|
||||
</div>
|
||||
<a
|
||||
href="https://agenstskills.com/docs/api-reference"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-2 px-3 sm:px-4 py-2 bg-zinc-800 text-white font-mono text-xs sm:text-sm hover:bg-zinc-700 transition-colors border border-zinc-700 whitespace-nowrap"
|
||||
>
|
||||
<span>View API</span>
|
||||
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Bottom CTA */}
|
||||
<div className="mt-6 sm:mt-8 text-center">
|
||||
<a
|
||||
href="https://agenstskills.com/docs"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-2 px-4 sm:px-6 py-2.5 sm:py-3 bg-white text-black font-mono text-xs sm:text-sm hover:bg-zinc-200 transition-colors cursor-pointer"
|
||||
>
|
||||
<span>Read the Documentation</span>
|
||||
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
import React from 'react';
|
||||
|
||||
interface UseCase {
|
||||
persona: string;
|
||||
problem: string;
|
||||
solution: string;
|
||||
command: string;
|
||||
icon: React.ReactNode;
|
||||
gradient: string;
|
||||
}
|
||||
|
||||
const USE_CASES: UseCase[] = [
|
||||
{
|
||||
persona: 'Multi-Agent Developer',
|
||||
problem: 'You\'ve built skills for Claude Code. Now your team wants Cursor, and you want to try Windsurf.',
|
||||
solution: 'SkillKit translates skills between all 32 agents. Write once, deploy everywhere.',
|
||||
command: 'skillkit translate --to cursor,windsurf',
|
||||
gradient: 'from-violet-500/10 to-purple-500/10',
|
||||
icon: (
|
||||
<svg className="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" />
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
persona: 'Team Lead',
|
||||
problem: 'Each developer has different skills. Onboarding takes weeks. Knowledge is scattered.',
|
||||
solution: 'Shared .skills manifest ensures everyone has the same capabilities. Git-based sync keeps teams aligned.',
|
||||
command: 'skillkit team init && skillkit team share',
|
||||
gradient: 'from-blue-500/10 to-cyan-500/10',
|
||||
icon: (
|
||||
<svg className="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
persona: 'New Project Starter',
|
||||
problem: 'Configuring AI agents for each new project is tedious. You forget best practices.',
|
||||
solution: 'Primer analyzes your codebase and auto-generates optimized instructions for all agents.',
|
||||
command: 'skillkit primer --all-agents',
|
||||
gradient: 'from-emerald-500/10 to-teal-500/10',
|
||||
icon: (
|
||||
<svg className="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M13 10V3L4 14h7v7l9-11h-7z" />
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
persona: 'Enterprise Architect',
|
||||
problem: 'Running AI agents across multiple machines and keeping them in sync is a nightmare.',
|
||||
solution: 'Mesh network with encrypted P2P, peer trust, and inter-agent messaging.',
|
||||
command: 'skillkit mesh init && skillkit mesh discover',
|
||||
gradient: 'from-orange-500/10 to-amber-500/10',
|
||||
icon: (
|
||||
<svg className="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const WORKFLOW_FEATURES = [
|
||||
{
|
||||
title: 'Workflow Orchestration',
|
||||
description: 'Compose skills into multi-step workflows. Chain operations, handle errors, and automate complex tasks.',
|
||||
command: 'skillkit workflow run feature-development',
|
||||
},
|
||||
{
|
||||
title: 'Skill Testing',
|
||||
description: 'Built-in test framework with assertions. Validate skills work correctly before deployment.',
|
||||
command: 'skillkit test --tags unit,integration',
|
||||
},
|
||||
{
|
||||
title: 'CI/CD Integration',
|
||||
description: 'Generate GitHub Actions, GitLab CI, and pre-commit hooks for automated skill management.',
|
||||
command: 'skillkit cicd init --provider github',
|
||||
},
|
||||
{
|
||||
title: 'Slash Commands',
|
||||
description: 'Auto-generate /commands for Claude, Cursor, and other agents from your skills.',
|
||||
command: 'skillkit command generate',
|
||||
},
|
||||
];
|
||||
|
||||
export function UseCases(): React.ReactElement {
|
||||
return (
|
||||
<section className="py-12 sm:py-16 border-b border-zinc-800 bg-zinc-950">
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
{/* Section Header */}
|
||||
<div className="text-center mb-8 sm:mb-12">
|
||||
<h2 className="text-2xl sm:text-3xl lg:text-4xl font-bold text-white mb-3 font-mono tracking-tight">
|
||||
Built for Real Workflows
|
||||
</h2>
|
||||
<p className="text-zinc-400 font-mono text-xs sm:text-sm max-w-2xl mx-auto">
|
||||
Whether you're a solo developer or managing enterprise infrastructure,
|
||||
SkillKit adapts to your needs.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Use Cases Grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 sm:gap-4 mb-12">
|
||||
{USE_CASES.map((useCase, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className={`relative group p-4 sm:p-6 border border-zinc-800 bg-gradient-to-br ${useCase.gradient} hover:border-zinc-700 transition-all duration-300`}
|
||||
>
|
||||
<div className="flex items-start gap-3 sm:gap-4 mb-4">
|
||||
<div className="p-2 bg-zinc-800/80 border border-zinc-700 text-zinc-300 group-hover:text-white transition-colors flex-shrink-0">
|
||||
{useCase.icon}
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-base sm:text-lg font-bold text-white font-mono">{useCase.persona}</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-start gap-2">
|
||||
<span className="text-red-400 text-[10px] sm:text-xs mt-0.5 font-mono flex-shrink-0">PAIN:</span>
|
||||
<p className="text-zinc-400 text-xs sm:text-sm">{useCase.problem}</p>
|
||||
</div>
|
||||
<div className="flex items-start gap-2">
|
||||
<span className="text-emerald-400 text-[10px] sm:text-xs mt-0.5 font-mono flex-shrink-0">FIX:</span>
|
||||
<p className="text-zinc-300 text-xs sm:text-sm">{useCase.solution}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 pt-4 border-t border-zinc-800/50">
|
||||
<code className="text-[10px] sm:text-xs font-mono text-zinc-500 bg-black/30 px-2 py-1 block overflow-x-auto whitespace-nowrap">
|
||||
$ {useCase.command}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Workflow Features */}
|
||||
<div className="border border-zinc-800 bg-black/30 p-4 sm:p-6">
|
||||
<h3 className="text-base sm:text-lg font-bold text-white mb-4 sm:mb-6 font-mono text-center">
|
||||
Developer Tools Built-In
|
||||
</h3>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
|
||||
{WORKFLOW_FEATURES.map((feature, index) => (
|
||||
<div key={index} className="flex items-start gap-2 sm:gap-3 p-2 sm:p-3 hover:bg-zinc-900/50 transition-colors">
|
||||
<span className="text-zinc-500 mt-1 flex-shrink-0">▸</span>
|
||||
<div className="min-w-0">
|
||||
<h4 className="text-xs sm:text-sm font-bold text-white font-mono mb-1">{feature.title}</h4>
|
||||
<p className="text-[10px] sm:text-xs text-zinc-500 mb-2">{feature.description}</p>
|
||||
<code className="text-[9px] sm:text-[10px] font-mono text-zinc-600 break-all">{feature.command}</code>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -4,20 +4,24 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>SkillKit - Universal Skills for AI Coding Agents</title>
|
||||
<meta name="description" content="Portable, reusable skills that work across Claude Code, Cursor, Codex, Windsurf, GitHub Copilot, and 12 more AI coding agents.">
|
||||
<meta name="description" content="Write once, deploy to 32 AI coding agents. Skills for Claude Code, Cursor, Codex, Windsurf, GitHub Copilot, and more.">
|
||||
|
||||
<!-- Open Graph -->
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:url" content="https://skillkit.dev/">
|
||||
<meta property="og:url" content="https://agenstskills.com/">
|
||||
<meta property="og:title" content="SkillKit - Universal Skills for AI Coding Agents">
|
||||
<meta property="og:description" content="Portable, reusable skills that work across Claude Code, Cursor, Codex, Windsurf, GitHub Copilot, and 12 more AI coding agents.">
|
||||
<meta property="og:image" content="/og-image.png">
|
||||
<meta property="og:description" content="Write once, deploy to 32 AI coding agents. Skills for Claude Code, Cursor, Codex, Windsurf, GitHub Copilot, and more.">
|
||||
<meta property="og:image" content="https://agenstskills.com/og-image.png">
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="630">
|
||||
<meta property="og:site_name" content="SkillKit">
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:url" content="https://agenstskills.com/">
|
||||
<meta name="twitter:title" content="SkillKit - Universal Skills for AI Coding Agents">
|
||||
<meta name="twitter:description" content="Portable, reusable skills that work across Claude Code, Cursor, Codex, Windsurf, GitHub Copilot, and 12 more AI coding agents.">
|
||||
<meta name="twitter:image" content="/og-image.png">
|
||||
<meta name="twitter:description" content="Write once, deploy to 32 AI coding agents. Skills for Claude Code, Cursor, Codex, Windsurf, GitHub Copilot, and more.">
|
||||
<meta name="twitter:image" content="https://agenstskills.com/og-image.png">
|
||||
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "skillkit",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"version": "1.8.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
Binary file not shown.
@@ -3,11 +3,11 @@
|
||||
body {
|
||||
background-color: #000000;
|
||||
color: #e4e4e7;
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6, .font-mono {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
|
||||
}
|
||||
|
||||
::selection {
|
||||
@@ -29,6 +29,18 @@ h1, h2, h3, h4, h5, h6, .font-mono {
|
||||
background: #3f3f46;
|
||||
}
|
||||
|
||||
/* Smooth scrolling - respects user preferences */
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* Terminal scanline effect */
|
||||
.terminal-scanline {
|
||||
background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1));
|
||||
background-size: 100% 4px;
|
||||
@@ -41,3 +53,58 @@ h1, h2, h3, h4, h5, h6, .font-mono {
|
||||
z-index: 10;
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
/* Glow effect for important elements */
|
||||
.glow-effect {
|
||||
box-shadow: 0 0 40px rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
/* Subtle gradient animation for hero */
|
||||
@keyframes gradient-shift {
|
||||
0%, 100% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.gradient-animate {
|
||||
background-size: 200% 200%;
|
||||
animation: gradient-shift 15s ease infinite;
|
||||
}
|
||||
|
||||
/* Grid pattern overlay */
|
||||
.grid-pattern {
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
|
||||
background-size: 60px 60px;
|
||||
}
|
||||
|
||||
/* Text shadow for headings */
|
||||
.text-glow {
|
||||
text-shadow: 0 0 60px rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
/* Hover scale animation */
|
||||
.hover-lift {
|
||||
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||
}
|
||||
|
||||
.hover-lift:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
/* Border gradient effect */
|
||||
.border-gradient {
|
||||
background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
/* Focus ring for accessibility */
|
||||
*:focus-visible {
|
||||
outline: 2px solid rgba(255, 255, 255, 0.5);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
+28
-1
@@ -2,7 +2,7 @@
|
||||
"$schema": "./schema.json",
|
||||
"version": 1,
|
||||
"updatedAt": "2026-01-26",
|
||||
"totalSkills": 15062,
|
||||
"totalSkills": 15064,
|
||||
"curatedCollections": 31,
|
||||
"skills": [
|
||||
{
|
||||
@@ -354,6 +354,19 @@
|
||||
"react"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "rohitg00/skillkit/find-skills",
|
||||
"name": "Find Skills",
|
||||
"description": "Universal skill discovery across all AI agent marketplaces. Search 15K+ skills and install with one command.",
|
||||
"source": "rohitg00/skillkit",
|
||||
"tags": [
|
||||
"meta",
|
||||
"discovery",
|
||||
"marketplace",
|
||||
"skills",
|
||||
"find-skills"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "anthropics/skills/frontend-design",
|
||||
"name": "Frontend Design",
|
||||
@@ -33085,6 +33098,20 @@
|
||||
"source": "oldwinter/skills",
|
||||
"tags": []
|
||||
},
|
||||
{
|
||||
"id": "rohitg00/kubectl-mcp-server/kubernetes-mcp",
|
||||
"name": "Kubernetes MCP Server",
|
||||
"description": "MCP server for Kubernetes with 127+ tools, 8 resources, 8 prompts. Full cluster management via Claude/Cursor.",
|
||||
"source": "rohitg00/kubectl-mcp-server",
|
||||
"tags": [
|
||||
"kubernetes",
|
||||
"mcp",
|
||||
"kubernetes-mcp",
|
||||
"devops",
|
||||
"kubectl",
|
||||
"k8s"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "itsmostafa/aws-agent-skills/cognito",
|
||||
"name": "Cognito",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "skillkit-monorepo",
|
||||
"version": "2.0.0",
|
||||
"version": "1.8.1",
|
||||
"private": true,
|
||||
"description": "Universal skills loader for AI coding agents - Monorepo",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/agents",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "Agent adapters for SkillKit - supports 32 AI coding agents",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/cli",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "CLI commands for SkillKit",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/core",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "Core functionality for SkillKit - skill discovery, parsing, and translation",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/mcp-memory",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "MCP (Model Context Protocol) server for SkillKit persistent memory",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/memory",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "CozoDB-backed semantic memory with embeddings for SkillKit",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/mesh",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "Peer mesh network for multi-machine agent distribution",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/messaging",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "Inter-agent messaging system for SkillKit",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/resources",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "Bundled resources for SkillKit - agents, commands, profiles, guidelines, and hooks",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/tui",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"description": "Unified Terminal UI for SkillKit - Built on OpenTUI",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
@@ -21,15 +21,15 @@
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@skillkit/core": "workspace:*",
|
||||
"@skillkit/agents": "workspace:*",
|
||||
"@opentui/core": "^0.1.75",
|
||||
"@opentui/react": "^0.1.75",
|
||||
"react": "^19.0.0"
|
||||
"@opentui/solid": "^0.1.75",
|
||||
"@skillkit/agents": "workspace:*",
|
||||
"@skillkit/core": "workspace:*",
|
||||
"solid-js": "^1.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.10.5",
|
||||
"@types/react": "^19.0.0",
|
||||
"esbuild-plugin-solid": "^0.6.0",
|
||||
"tsup": "^8.3.5",
|
||||
"typescript": "^5.7.2",
|
||||
"vitest": "^2.1.8"
|
||||
|
||||
+91
-67
@@ -1,9 +1,10 @@
|
||||
import { useState, useCallback, useEffect } from 'react';
|
||||
import { useKeyboard } from '@opentui/react';
|
||||
import { exec } from 'node:child_process';
|
||||
import { createSignal, createEffect, onCleanup, Show, Switch, Match } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { execFile } from 'node:child_process';
|
||||
import { type Screen, NAV_KEYS } from './state/types.js';
|
||||
import { Sidebar } from './components/Sidebar.js';
|
||||
import { Splash } from './components/Splash.js';
|
||||
import { Sidebar } from './components/Sidebar.js';
|
||||
import { StatusBar } from './components/StatusBar.js';
|
||||
import {
|
||||
Home, Browse, Installed, Marketplace, Settings, Recommend,
|
||||
Translate, Context, Memory, Team, Plugins, Methodology,
|
||||
@@ -13,23 +14,28 @@ import {
|
||||
const DOCS_URL = 'https://agenstskills.com/docs';
|
||||
|
||||
function openUrl(url: string): void {
|
||||
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
|
||||
exec(`${cmd} ${url}`);
|
||||
if (process.platform === 'win32') {
|
||||
execFile('cmd', ['/c', 'start', '', url]);
|
||||
} else {
|
||||
const cmd = process.platform === 'darwin' ? 'open' : 'xdg-open';
|
||||
execFile(cmd, [url]);
|
||||
}
|
||||
}
|
||||
|
||||
interface AppProps {
|
||||
onExit?: (code?: number) => void;
|
||||
}
|
||||
|
||||
export function App({ onExit }: AppProps = {}) {
|
||||
const [showSplash, setShowSplash] = useState(true);
|
||||
const [screen, setScreen] = useState<Screen>('home');
|
||||
const [dimensions, setDimensions] = useState({
|
||||
export function App(props: AppProps) {
|
||||
const [showSplash, setShowSplash] = createSignal(true);
|
||||
const [currentScreen, setCurrentScreen] = createSignal<Screen>('home');
|
||||
const [showSidebar, setShowSidebar] = createSignal(true);
|
||||
const [dimensions, setDimensions] = createSignal({
|
||||
cols: process.stdout.columns || 80,
|
||||
rows: process.stdout.rows || 24,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
createEffect(() => {
|
||||
const handleResize = () => {
|
||||
setDimensions({
|
||||
cols: process.stdout.columns || 80,
|
||||
@@ -37,28 +43,38 @@ export function App({ onExit }: AppProps = {}) {
|
||||
});
|
||||
};
|
||||
process.stdout.on('resize', handleResize);
|
||||
return () => { process.stdout.off('resize', handleResize); };
|
||||
}, []);
|
||||
onCleanup(() => {
|
||||
process.stdout.off('resize', handleResize);
|
||||
});
|
||||
});
|
||||
|
||||
const { cols, rows } = dimensions;
|
||||
const showSidebar = cols >= 60;
|
||||
const cols = () => dimensions().cols;
|
||||
const rows = () => dimensions().rows;
|
||||
const sidebarVisible = () => showSidebar() && cols() >= 80;
|
||||
const sidebarWidth = () => {
|
||||
if (!sidebarVisible()) return 0;
|
||||
if (cols() >= 100) return 24;
|
||||
return 18;
|
||||
};
|
||||
const statusBarHeight = 2;
|
||||
const contentHeight = () => rows() - statusBarHeight;
|
||||
|
||||
const handleNavigate = useCallback((newScreen: Screen) => {
|
||||
setScreen(newScreen);
|
||||
}, []);
|
||||
const handleNavigate = (newScreen: Screen) => {
|
||||
setCurrentScreen(newScreen);
|
||||
};
|
||||
|
||||
const handleSplashComplete = useCallback(() => {
|
||||
const handleSplashComplete = () => {
|
||||
setShowSplash(false);
|
||||
}, []);
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string; ctrl?: boolean }) => {
|
||||
if (showSplash) {
|
||||
useKeyboard((key: { name?: string; ctrl?: boolean; sequence?: string }) => {
|
||||
if (showSplash()) {
|
||||
setShowSplash(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.name === 'q' || (key.ctrl && key.name === 'c')) {
|
||||
onExit ? onExit(0) : process.exit(0);
|
||||
props.onExit ? props.onExit(0) : process.exit(0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -67,59 +83,67 @@ export function App({ onExit }: AppProps = {}) {
|
||||
return;
|
||||
}
|
||||
|
||||
const targetScreen = NAV_KEYS[key.name || ''];
|
||||
if (targetScreen) {
|
||||
setScreen(targetScreen);
|
||||
if (key.sequence === '\\') {
|
||||
setShowSidebar((v) => !v);
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.name === 'escape' && screen !== 'home') {
|
||||
setScreen('home');
|
||||
const targetScreen = NAV_KEYS[key.name || ''];
|
||||
if (targetScreen) {
|
||||
setCurrentScreen(targetScreen);
|
||||
}
|
||||
|
||||
if (key.name === 'escape' && currentScreen() !== 'home') {
|
||||
setCurrentScreen('home');
|
||||
}
|
||||
});
|
||||
|
||||
if (showSplash) {
|
||||
return <Splash onComplete={handleSplashComplete} duration={3000} />;
|
||||
}
|
||||
|
||||
const screenProps = {
|
||||
const screenProps = () => ({
|
||||
onNavigate: handleNavigate,
|
||||
cols: cols - (showSidebar ? 20 : 0),
|
||||
rows,
|
||||
};
|
||||
|
||||
const renderScreen = () => {
|
||||
switch (screen) {
|
||||
case 'home': return <Home {...screenProps} />;
|
||||
case 'browse': return <Browse {...screenProps} />;
|
||||
case 'installed': return <Installed {...screenProps} />;
|
||||
case 'marketplace': return <Marketplace {...screenProps} />;
|
||||
case 'settings': return <Settings {...screenProps} />;
|
||||
case 'recommend': return <Recommend {...screenProps} />;
|
||||
case 'translate': return <Translate {...screenProps} />;
|
||||
case 'context': return <Context {...screenProps} />;
|
||||
case 'memory': return <Memory {...screenProps} />;
|
||||
case 'team': return <Team {...screenProps} />;
|
||||
case 'plugins': return <Plugins {...screenProps} />;
|
||||
case 'methodology': return <Methodology {...screenProps} />;
|
||||
case 'plan': return <Plan {...screenProps} />;
|
||||
case 'workflow': return <Workflow {...screenProps} />;
|
||||
case 'execute': return <Execute {...screenProps} />;
|
||||
case 'history': return <History {...screenProps} />;
|
||||
case 'sync': return <Sync {...screenProps} />;
|
||||
case 'help': return <Help {...screenProps} />;
|
||||
case 'mesh': return <Mesh {...screenProps} />;
|
||||
case 'message': return <Message {...screenProps} />;
|
||||
default: return <Home {...screenProps} />;
|
||||
}
|
||||
};
|
||||
cols: Math.max(1, cols() - sidebarWidth() - 2),
|
||||
rows: Math.max(1, contentHeight() - 1),
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="row" height={rows}>
|
||||
{showSidebar && <Sidebar screen={screen} onNavigate={handleNavigate} />}
|
||||
<box flexDirection="column" flexGrow={1} marginLeft={showSidebar ? 1 : 0} paddingRight={1}>
|
||||
{renderScreen()}
|
||||
<Show when={!showSplash()} fallback={<Splash onComplete={handleSplashComplete} duration={3000} />}>
|
||||
<box flexDirection="column" height={rows()}>
|
||||
<box flexDirection="row" height={contentHeight()}>
|
||||
<Show when={sidebarVisible()}>
|
||||
<Sidebar
|
||||
screen={currentScreen()}
|
||||
onNavigate={handleNavigate}
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<box flexDirection="column" flexGrow={1} paddingX={1}>
|
||||
<Switch fallback={<Home {...screenProps()} />}>
|
||||
<Match when={currentScreen() === 'home'}><Home {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'browse'}><Browse {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'installed'}><Installed {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'marketplace'}><Marketplace {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'settings'}><Settings {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'recommend'}><Recommend {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'translate'}><Translate {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'context'}><Context {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'memory'}><Memory {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'team'}><Team {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'plugins'}><Plugins {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'methodology'}><Methodology {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'plan'}><Plan {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'workflow'}><Workflow {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'execute'}><Execute {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'history'}><History {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'sync'}><Sync {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'help'}><Help {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'mesh'}><Mesh {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'message'}><Message {...screenProps()} /></Match>
|
||||
</Switch>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<StatusBar />
|
||||
</box>
|
||||
</box>
|
||||
</Show>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +1,32 @@
|
||||
/**
|
||||
* AgentGrid Component
|
||||
* Displays monochromatic agent logos in a grid layout
|
||||
*/
|
||||
import { Show, For, createMemo } from 'solid-js';
|
||||
import { AGENT_LOGOS, type AgentLogo } from '../theme/symbols.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
interface AgentGridProps {
|
||||
/** Maximum number of agents to display */
|
||||
maxVisible?: number;
|
||||
/** Show status indicators for detected agents */
|
||||
showStatus?: boolean;
|
||||
/** Agent types that are detected/active */
|
||||
detectedAgents?: string[];
|
||||
/** Number of columns in the grid */
|
||||
columns?: number;
|
||||
}
|
||||
|
||||
export function AgentGrid({
|
||||
maxVisible = 12,
|
||||
showStatus = true,
|
||||
detectedAgents = [],
|
||||
columns = 4,
|
||||
}: AgentGridProps) {
|
||||
const safeColumns = Math.max(1, columns);
|
||||
const allAgents = Object.entries(AGENT_LOGOS);
|
||||
const visibleAgents = allAgents.slice(0, maxVisible);
|
||||
const hiddenCount = allAgents.length - maxVisible;
|
||||
export function AgentGrid(props: AgentGridProps) {
|
||||
const maxVisible = () => props.maxVisible ?? 12;
|
||||
const showStatus = () => props.showStatus ?? true;
|
||||
const detectedAgents = () => props.detectedAgents ?? [];
|
||||
const columns = () => Math.max(1, props.columns ?? 4);
|
||||
|
||||
const rows: [string, AgentLogo][][] = [];
|
||||
for (let i = 0; i < visibleAgents.length; i += safeColumns) {
|
||||
rows.push(visibleAgents.slice(i, i + safeColumns));
|
||||
}
|
||||
const allAgents = Object.entries(AGENT_LOGOS);
|
||||
const visibleAgents = () => allAgents.slice(0, maxVisible());
|
||||
const hiddenCount = () => allAgents.length - maxVisible();
|
||||
|
||||
const rows = createMemo((): [string, AgentLogo][][] => {
|
||||
const result: [string, AgentLogo][][] = [];
|
||||
const visible = visibleAgents();
|
||||
for (let i = 0; i < visible.length; i += columns()) {
|
||||
result.push(visible.slice(i, i + columns()));
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="column">
|
||||
@@ -38,31 +34,36 @@ export function AgentGrid({
|
||||
<b>Works with</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
{rows.map((row, rowIndex) => (
|
||||
<box key={`row-${rowIndex}`} flexDirection="row">
|
||||
{row.map(([agentType, agent]) => {
|
||||
const isDetected = detectedAgents.includes(agentType);
|
||||
const statusIcon = showStatus ? (isDetected ? '●' : '○') : '';
|
||||
const fg = isDetected ? terminalColors.accent : terminalColors.text;
|
||||
<For each={rows()}>
|
||||
{(row, rowIndex) => (
|
||||
<box flexDirection="row">
|
||||
<For each={row}>
|
||||
{([agentType, agent]) => {
|
||||
const isDetected = () => detectedAgents().includes(agentType);
|
||||
const statusIcon = () => (showStatus() ? (isDetected() ? '●' : '○') : '');
|
||||
const fg = () => (isDetected() ? terminalColors.accent : terminalColors.text);
|
||||
|
||||
return (
|
||||
<box key={agentType} width={18}>
|
||||
<text fg={fg}>
|
||||
{agent.icon} {agent.name}
|
||||
{showStatus && (
|
||||
<span fg={isDetected ? terminalColors.success : terminalColors.textMuted}>
|
||||
{' '}{statusIcon}
|
||||
</span>
|
||||
)}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
})}
|
||||
</box>
|
||||
))}
|
||||
{hiddenCount > 0 && (
|
||||
<text fg={terminalColors.textMuted}>+{hiddenCount} more agents</text>
|
||||
)}
|
||||
return (
|
||||
<box width={18}>
|
||||
<text fg={fg()}>
|
||||
{agent.icon} {agent.name}
|
||||
<Show when={showStatus()}>
|
||||
<span fg={isDetected() ? terminalColors.success : terminalColors.textMuted}>
|
||||
{' '}
|
||||
{statusIcon()}
|
||||
</span>
|
||||
</Show>
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
<Show when={hiddenCount() > 0}>
|
||||
<text fg={terminalColors.textMuted}>+{hiddenCount()} more agents</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
/**
|
||||
* AnimatedText Component
|
||||
* Text with fade/slide animations
|
||||
*/
|
||||
|
||||
import { Show, createSignal, createEffect, onCleanup } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { scrambleText } from '../theme/animations.js';
|
||||
|
||||
interface AnimatedTextProps {
|
||||
text: string;
|
||||
animation?: 'fadeIn' | 'typewriter' | 'scramble' | 'countUp' | 'none';
|
||||
duration?: number;
|
||||
delay?: number;
|
||||
color?: string;
|
||||
onComplete?: () => void;
|
||||
}
|
||||
|
||||
export function AnimatedText(props: AnimatedTextProps) {
|
||||
const [progress, setProgress] = createSignal(0);
|
||||
const [isComplete, setIsComplete] = createSignal(false);
|
||||
|
||||
const animation = () => props.animation ?? 'fadeIn';
|
||||
const duration = () => Math.max(1, props.duration ?? 500);
|
||||
const delay = () => Math.max(0, props.delay ?? 0);
|
||||
const color = () => props.color ?? terminalColors.text;
|
||||
|
||||
createEffect(() => {
|
||||
const anim = animation();
|
||||
const dur = duration();
|
||||
const dly = delay();
|
||||
|
||||
setProgress(0);
|
||||
setIsComplete(false);
|
||||
|
||||
if (anim === 'none') {
|
||||
setProgress(100);
|
||||
setIsComplete(true);
|
||||
return;
|
||||
}
|
||||
|
||||
let delayTimeoutId: ReturnType<typeof setTimeout> | undefined;
|
||||
let animationTimeoutId: ReturnType<typeof setTimeout> | undefined;
|
||||
let startTime: number | undefined;
|
||||
let cancelled = false;
|
||||
|
||||
const animate = () => {
|
||||
if (cancelled) return;
|
||||
|
||||
const now = Date.now();
|
||||
if (!startTime) startTime = now;
|
||||
const elapsed = now - startTime;
|
||||
const p = Math.min((elapsed / dur) * 100, 100);
|
||||
|
||||
setProgress(p);
|
||||
|
||||
if (p < 100) {
|
||||
animationTimeoutId = setTimeout(animate, 16);
|
||||
} else {
|
||||
setIsComplete(true);
|
||||
props.onComplete?.();
|
||||
}
|
||||
};
|
||||
|
||||
if (dly > 0) {
|
||||
delayTimeoutId = setTimeout(() => {
|
||||
animationTimeoutId = setTimeout(animate, 16);
|
||||
}, dly);
|
||||
} else {
|
||||
animationTimeoutId = setTimeout(animate, 16);
|
||||
}
|
||||
|
||||
onCleanup(() => {
|
||||
cancelled = true;
|
||||
if (delayTimeoutId) clearTimeout(delayTimeoutId);
|
||||
if (animationTimeoutId) clearTimeout(animationTimeoutId);
|
||||
});
|
||||
});
|
||||
|
||||
const displayText = () => {
|
||||
switch (animation()) {
|
||||
case 'typewriter': {
|
||||
const charCount = Math.floor((progress() / 100) * props.text.length);
|
||||
return props.text.slice(0, charCount);
|
||||
}
|
||||
case 'scramble': {
|
||||
return scrambleText(props.text, progress());
|
||||
}
|
||||
case 'countUp': {
|
||||
const num = parseFloat(props.text);
|
||||
if (!isNaN(num)) {
|
||||
return String(Math.round((progress() / 100) * num));
|
||||
}
|
||||
return props.text;
|
||||
}
|
||||
case 'fadeIn':
|
||||
case 'none':
|
||||
default:
|
||||
return props.text;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<text fg={color()}>
|
||||
{displayText()}
|
||||
<Show when={animation() === 'typewriter' && !isComplete()}>
|
||||
<text fg={terminalColors.accent}>▌</text>
|
||||
</Show>
|
||||
</text>
|
||||
);
|
||||
}
|
||||
|
||||
interface CountUpTextProps {
|
||||
value: number;
|
||||
duration?: number;
|
||||
delay?: number;
|
||||
prefix?: string;
|
||||
suffix?: string;
|
||||
color?: string;
|
||||
formatter?: (value: number) => string;
|
||||
}
|
||||
|
||||
export function CountUpText(props: CountUpTextProps) {
|
||||
const [displayValue, setDisplayValue] = createSignal(0);
|
||||
const duration = () => Math.max(1, props.duration ?? 1000);
|
||||
const delay = () => Math.max(0, props.delay ?? 0);
|
||||
const color = () => props.color ?? terminalColors.text;
|
||||
const formatter = () => props.formatter ?? ((v: number) => String(Math.round(v)));
|
||||
|
||||
createEffect(() => {
|
||||
const target = props.value;
|
||||
const dur = duration();
|
||||
const dly = delay();
|
||||
|
||||
setDisplayValue(0);
|
||||
|
||||
let delayTimeoutId: ReturnType<typeof setTimeout> | undefined;
|
||||
let animationTimeoutId: ReturnType<typeof setTimeout> | undefined;
|
||||
let startTime: number | undefined;
|
||||
let cancelled = false;
|
||||
|
||||
const animate = () => {
|
||||
if (cancelled) return;
|
||||
|
||||
const now = Date.now();
|
||||
if (!startTime) startTime = now;
|
||||
const elapsed = now - startTime;
|
||||
const progress = Math.min(elapsed / dur, 1);
|
||||
const eased = 1 - Math.pow(1 - progress, 4);
|
||||
|
||||
setDisplayValue(eased * target);
|
||||
|
||||
if (progress < 1) {
|
||||
animationTimeoutId = setTimeout(animate, 16);
|
||||
}
|
||||
};
|
||||
|
||||
if (dly > 0) {
|
||||
delayTimeoutId = setTimeout(() => {
|
||||
animationTimeoutId = setTimeout(animate, 16);
|
||||
}, dly);
|
||||
} else {
|
||||
animationTimeoutId = setTimeout(animate, 16);
|
||||
}
|
||||
|
||||
onCleanup(() => {
|
||||
cancelled = true;
|
||||
if (delayTimeoutId) clearTimeout(delayTimeoutId);
|
||||
if (animationTimeoutId) clearTimeout(animationTimeoutId);
|
||||
});
|
||||
});
|
||||
|
||||
return (
|
||||
<text fg={color()}>
|
||||
{props.prefix ?? ''}
|
||||
{formatter()(displayValue())}
|
||||
{props.suffix ?? ''}
|
||||
</text>
|
||||
);
|
||||
}
|
||||
|
||||
interface BlinkingTextProps {
|
||||
text: string;
|
||||
interval?: number;
|
||||
color?: string;
|
||||
blinkColor?: string;
|
||||
}
|
||||
|
||||
export function BlinkingText(props: BlinkingTextProps) {
|
||||
const [visible, setVisible] = createSignal(true);
|
||||
const interval = () => props.interval ?? 500;
|
||||
const color = () => props.color ?? terminalColors.text;
|
||||
const blinkColor = () => props.blinkColor ?? terminalColors.textMuted;
|
||||
|
||||
createEffect(() => {
|
||||
const timer = setInterval(() => {
|
||||
setVisible((v) => !v);
|
||||
}, interval());
|
||||
|
||||
onCleanup(() => clearInterval(timer));
|
||||
});
|
||||
|
||||
return <text fg={visible() ? color() : blinkColor()}>{props.text}</text>;
|
||||
}
|
||||
|
||||
interface PulsingTextProps {
|
||||
text: string;
|
||||
color?: string;
|
||||
pulseColor?: string;
|
||||
interval?: number;
|
||||
}
|
||||
|
||||
export function PulsingText(props: PulsingTextProps) {
|
||||
const [phase, setPhase] = createSignal(0);
|
||||
const interval = () => props.interval ?? 100;
|
||||
const color = () => props.color ?? terminalColors.accent;
|
||||
const pulseColor = () => props.pulseColor ?? terminalColors.text;
|
||||
|
||||
createEffect(() => {
|
||||
const timer = setInterval(() => {
|
||||
setPhase((p) => (p + 1) % 20);
|
||||
}, interval());
|
||||
|
||||
onCleanup(() => clearInterval(timer));
|
||||
});
|
||||
|
||||
const currentColor = () => {
|
||||
const p = phase();
|
||||
if (p < 10) return color();
|
||||
return pulseColor();
|
||||
};
|
||||
|
||||
return <text fg={currentColor()}>{props.text}</text>;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import { type Screen } from '../state/types.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { symbols } from '../theme/symbols.js';
|
||||
import { getVersion } from '../utils/helpers.js';
|
||||
|
||||
interface BottomStatusBarProps {
|
||||
currentScreen: Screen;
|
||||
}
|
||||
|
||||
const SCREEN_LABELS: Record<Screen, string> = {
|
||||
home: 'Home',
|
||||
browse: 'Browse',
|
||||
marketplace: 'Marketplace',
|
||||
installed: 'Installed',
|
||||
settings: 'Settings',
|
||||
recommend: 'Recommend',
|
||||
translate: 'Translate',
|
||||
context: 'Context',
|
||||
memory: 'Memory',
|
||||
team: 'Team',
|
||||
plugins: 'Plugins',
|
||||
methodology: 'Methodology',
|
||||
plan: 'Plan',
|
||||
workflow: 'Workflow',
|
||||
execute: 'Execute',
|
||||
history: 'History',
|
||||
sync: 'Sync',
|
||||
help: 'Help',
|
||||
mesh: 'Mesh',
|
||||
message: 'Message',
|
||||
};
|
||||
|
||||
export function BottomStatusBar(props: BottomStatusBarProps) {
|
||||
const version = getVersion();
|
||||
|
||||
return (
|
||||
<box
|
||||
flexDirection="row"
|
||||
height={1}
|
||||
borderTop
|
||||
borderColor={terminalColors.border}
|
||||
paddingX={1}
|
||||
>
|
||||
<text fg={terminalColors.accent}>
|
||||
<b>{symbols.brandIcon} skillkit</b> v{version}
|
||||
</text>
|
||||
<text fg={terminalColors.border}> {symbols.verticalLine} </text>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>{SCREEN_LABELS[props.currentScreen]}</b>
|
||||
</text>
|
||||
<text fg={terminalColors.border}> {symbols.verticalLine} </text>
|
||||
<text fg={terminalColors.textMuted}>/ cmd h home m market q quit</text>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* Breadcrumb Component
|
||||
* Clickable breadcrumb navigation
|
||||
*/
|
||||
|
||||
import { For, Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
export interface BreadcrumbItem {
|
||||
id: string;
|
||||
label: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
interface BreadcrumbProps {
|
||||
items: BreadcrumbItem[];
|
||||
separator?: string;
|
||||
hoveredId?: string | null;
|
||||
onNavigate?: (id: string) => void;
|
||||
}
|
||||
|
||||
export function Breadcrumb(props: BreadcrumbProps) {
|
||||
const separator = () => props.separator ?? ' / ';
|
||||
|
||||
const handleClick = (id: string) => {
|
||||
props.onNavigate?.(id);
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="row">
|
||||
<For each={props.items}>
|
||||
{(item, index) => {
|
||||
const isLast = () => index() === props.items.length - 1;
|
||||
const isHovered = () => item.id === props.hoveredId;
|
||||
|
||||
const fg = () => {
|
||||
if (isLast()) return terminalColors.text;
|
||||
if (isHovered()) return terminalColors.accent;
|
||||
return terminalColors.textMuted;
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<box
|
||||
flexDirection="row"
|
||||
onClick={() => handleClick(item.id)}
|
||||
>
|
||||
<Show when={item.icon}>
|
||||
<text fg={fg()}>{item.icon} </text>
|
||||
</Show>
|
||||
<text fg={fg()}>
|
||||
{isLast() ? <b>{item.label}</b> : item.label}
|
||||
</text>
|
||||
</box>
|
||||
<Show when={!isLast()}>
|
||||
<text fg={terminalColors.textMuted}>{separator()}</text>
|
||||
</Show>
|
||||
</>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface PathBreadcrumbProps {
|
||||
path: string;
|
||||
separator?: string;
|
||||
maxSegments?: number;
|
||||
hoveredSegment?: number | null;
|
||||
onNavigate?: (path: string, segmentIndex: number) => void;
|
||||
}
|
||||
|
||||
export function PathBreadcrumb(props: PathBreadcrumbProps) {
|
||||
const separator = () => props.separator ?? '/';
|
||||
const maxSegments = () => props.maxSegments ?? 5;
|
||||
|
||||
const segments = () => {
|
||||
const parts = props.path.split('/').filter(Boolean);
|
||||
if (parts.length <= maxSegments()) {
|
||||
return parts;
|
||||
}
|
||||
return ['...', ...parts.slice(-(maxSegments() - 1))];
|
||||
};
|
||||
|
||||
const getPathAtIndex = (index: number): string => {
|
||||
const parts = props.path.split('/').filter(Boolean);
|
||||
const segs = segments();
|
||||
let actualIndex: number;
|
||||
|
||||
if (segs[0] === '...') {
|
||||
const offset = parts.length - (segs.length - 1);
|
||||
actualIndex = offset + index - 1;
|
||||
} else {
|
||||
actualIndex = index;
|
||||
}
|
||||
|
||||
return '/' + parts.slice(0, actualIndex + 1).join('/');
|
||||
};
|
||||
|
||||
const handleClick = (segment: string, index: number) => {
|
||||
if (segment === '...') return;
|
||||
props.onNavigate?.(getPathAtIndex(index), index);
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.textMuted}>{separator()}</text>
|
||||
<For each={segments()}>
|
||||
{(segment, index) => {
|
||||
const isLast = () => index() === segments().length - 1;
|
||||
const isHovered = () => index() === props.hoveredSegment;
|
||||
const isEllipsis = () => segment === '...';
|
||||
|
||||
const fg = () => {
|
||||
if (isEllipsis()) return terminalColors.textMuted;
|
||||
if (isLast()) return terminalColors.text;
|
||||
if (isHovered()) return terminalColors.accent;
|
||||
return terminalColors.textMuted;
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<text
|
||||
fg={fg()}
|
||||
onClick={() => handleClick(segment, index())}
|
||||
>
|
||||
{isLast() ? <b>{segment}</b> : segment}
|
||||
</text>
|
||||
<Show when={!isLast()}>
|
||||
<text fg={terminalColors.textMuted}>{separator()}</text>
|
||||
</Show>
|
||||
</>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface NavigationTrailProps {
|
||||
items: Array<{ screen: string; label: string }>;
|
||||
currentIndex: number;
|
||||
hoveredIndex?: number | null;
|
||||
}
|
||||
|
||||
export function NavigationTrail(props: NavigationTrailProps) {
|
||||
return (
|
||||
<box flexDirection="row">
|
||||
<For each={props.items}>
|
||||
{(item, index) => {
|
||||
const isCurrent = () => index() === props.currentIndex;
|
||||
const isPast = () => index() < props.currentIndex;
|
||||
const isHovered = () => index() === props.hoveredIndex;
|
||||
|
||||
const fg = () => {
|
||||
if (isCurrent()) return terminalColors.accent;
|
||||
if (isHovered()) return terminalColors.text;
|
||||
if (isPast()) return terminalColors.textSecondary;
|
||||
return terminalColors.textMuted;
|
||||
};
|
||||
|
||||
const indicator = () => {
|
||||
if (isCurrent()) return '●';
|
||||
if (isPast()) return '○';
|
||||
return '○';
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="row" marginRight={2}>
|
||||
<text fg={fg()}>{indicator()} </text>
|
||||
<text fg={fg()}>{item.label}</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
/**
|
||||
* Button Component
|
||||
* Clickable button with hover/active states
|
||||
*/
|
||||
|
||||
import { Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
||||
export type ButtonSize = 'sm' | 'md' | 'lg';
|
||||
|
||||
interface ButtonProps {
|
||||
label: string;
|
||||
shortcut?: string;
|
||||
icon?: string;
|
||||
variant?: ButtonVariant;
|
||||
size?: ButtonSize;
|
||||
disabled?: boolean;
|
||||
focused?: boolean;
|
||||
pressed?: boolean;
|
||||
hovered?: boolean;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
const VARIANT_COLORS: Record<
|
||||
ButtonVariant,
|
||||
{ fg: string; bg: string; border: string; hoverFg: string }
|
||||
> = {
|
||||
primary: {
|
||||
fg: terminalColors.text,
|
||||
bg: terminalColors.accent,
|
||||
border: terminalColors.accent,
|
||||
hoverFg: terminalColors.accent,
|
||||
},
|
||||
secondary: {
|
||||
fg: terminalColors.text,
|
||||
bg: terminalColors.surface,
|
||||
border: terminalColors.border,
|
||||
hoverFg: terminalColors.text,
|
||||
},
|
||||
ghost: {
|
||||
fg: terminalColors.textSecondary,
|
||||
bg: 'transparent',
|
||||
border: 'transparent',
|
||||
hoverFg: terminalColors.text,
|
||||
},
|
||||
danger: {
|
||||
fg: terminalColors.text,
|
||||
bg: terminalColors.error,
|
||||
border: terminalColors.error,
|
||||
hoverFg: terminalColors.error,
|
||||
},
|
||||
};
|
||||
|
||||
export function Button(props: ButtonProps) {
|
||||
const variant = () => props.variant ?? 'secondary';
|
||||
const size = () => props.size ?? 'md';
|
||||
const disabled = () => props.disabled ?? false;
|
||||
const focused = () => props.focused ?? false;
|
||||
const pressed = () => props.pressed ?? false;
|
||||
const hovered = () => props.hovered ?? false;
|
||||
|
||||
const colors = () => VARIANT_COLORS[variant()];
|
||||
|
||||
const fg = () => {
|
||||
if (disabled()) return terminalColors.textMuted;
|
||||
if (pressed()) return colors().hoverFg;
|
||||
if (hovered() || focused()) return colors().hoverFg;
|
||||
return colors().fg;
|
||||
};
|
||||
|
||||
const borderColor = () => {
|
||||
if (disabled()) return terminalColors.textMuted;
|
||||
if (focused()) return terminalColors.accent;
|
||||
return colors().border;
|
||||
};
|
||||
|
||||
const paddingX = () => {
|
||||
switch (size()) {
|
||||
case 'sm':
|
||||
return 1;
|
||||
case 'lg':
|
||||
return 3;
|
||||
default:
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
const brackets = () => {
|
||||
if (variant() === 'ghost') return { left: '', right: '' };
|
||||
if (pressed()) return { left: '▸', right: '◂' };
|
||||
return { left: '[', right: ']' };
|
||||
};
|
||||
|
||||
const padding = ' '.repeat(paddingX());
|
||||
|
||||
const handleClick = () => {
|
||||
if (!disabled() && props.onClick) {
|
||||
props.onClick();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="row" onClick={handleClick}>
|
||||
<text fg={borderColor()}>{brackets().left}</text>
|
||||
<text fg={fg()}>{padding}</text>
|
||||
<Show when={props.icon}>
|
||||
<text fg={fg()}>{props.icon} </text>
|
||||
</Show>
|
||||
<text fg={fg()}>{props.label}</text>
|
||||
<Show when={props.shortcut}>
|
||||
<text fg={terminalColors.textMuted}> ({props.shortcut})</text>
|
||||
</Show>
|
||||
<text fg={fg()}>{padding}</text>
|
||||
<text fg={borderColor()}>{brackets().right}</text>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface ButtonGroupProps {
|
||||
buttons: Array<{
|
||||
id: string;
|
||||
label: string;
|
||||
shortcut?: string;
|
||||
icon?: string;
|
||||
variant?: ButtonVariant;
|
||||
disabled?: boolean;
|
||||
onClick?: () => void;
|
||||
}>;
|
||||
selectedId?: string;
|
||||
focusedId?: string;
|
||||
direction?: 'horizontal' | 'vertical';
|
||||
gap?: number;
|
||||
}
|
||||
|
||||
export function ButtonGroup(props: ButtonGroupProps) {
|
||||
const direction = () => props.direction ?? 'horizontal';
|
||||
const gap = () => props.gap ?? 2;
|
||||
|
||||
return (
|
||||
<box flexDirection={direction() === 'horizontal' ? 'row' : 'column'}>
|
||||
{props.buttons.map((btn, index) => (
|
||||
<box
|
||||
marginRight={direction() === 'horizontal' && index < props.buttons.length - 1 ? gap() : 0}
|
||||
marginBottom={direction() === 'vertical' && index < props.buttons.length - 1 ? gap() : 0}
|
||||
>
|
||||
<Button
|
||||
label={btn.label}
|
||||
shortcut={btn.shortcut}
|
||||
icon={btn.icon}
|
||||
variant={btn.variant}
|
||||
disabled={btn.disabled}
|
||||
focused={btn.id === props.focusedId}
|
||||
hovered={btn.id === props.selectedId}
|
||||
onClick={btn.onClick}
|
||||
/>
|
||||
</box>
|
||||
))}
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface IconButtonProps {
|
||||
icon: string;
|
||||
label?: string;
|
||||
disabled?: boolean;
|
||||
focused?: boolean;
|
||||
hovered?: boolean;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
export function IconButton(props: IconButtonProps) {
|
||||
const disabled = () => props.disabled ?? false;
|
||||
const focused = () => props.focused ?? false;
|
||||
const hovered = () => props.hovered ?? false;
|
||||
|
||||
const fg = () => {
|
||||
if (disabled()) return terminalColors.textMuted;
|
||||
if (focused() || hovered()) return terminalColors.accent;
|
||||
return terminalColors.textSecondary;
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
if (!disabled() && props.onClick) {
|
||||
props.onClick();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="row" onClick={handleClick}>
|
||||
<text fg={fg()}>{props.icon}</text>
|
||||
<Show when={props.label}>
|
||||
<text fg={fg()}> {props.label}</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
/**
|
||||
* Clickable Component
|
||||
* Wrapper to make any element clickable with hover effects
|
||||
*/
|
||||
|
||||
import { type JSX, Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
interface ClickableProps {
|
||||
children: JSX.Element;
|
||||
onClick?: () => void;
|
||||
onDoubleClick?: () => void;
|
||||
onRightClick?: () => void;
|
||||
disabled?: boolean;
|
||||
hovered?: boolean;
|
||||
pressed?: boolean;
|
||||
focusable?: boolean;
|
||||
focused?: boolean;
|
||||
cursor?: string;
|
||||
hoverEffect?: 'highlight' | 'underline' | 'pointer' | 'none';
|
||||
}
|
||||
|
||||
export function Clickable(props: ClickableProps) {
|
||||
const disabled = () => props.disabled ?? false;
|
||||
const hovered = () => props.hovered ?? false;
|
||||
const focused = () => props.focused ?? false;
|
||||
const hoverEffect = () => props.hoverEffect ?? 'highlight';
|
||||
|
||||
const showHighlight = () => {
|
||||
if (disabled()) return false;
|
||||
return hovered() || focused();
|
||||
};
|
||||
|
||||
const cursor = () => {
|
||||
if (disabled()) return '';
|
||||
if (hovered()) return props.cursor ?? '▸';
|
||||
return '';
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
if (!disabled() && props.onClick) {
|
||||
props.onClick();
|
||||
}
|
||||
};
|
||||
|
||||
const handleDoubleClick = () => {
|
||||
if (!disabled() && props.onDoubleClick) {
|
||||
props.onDoubleClick();
|
||||
}
|
||||
};
|
||||
|
||||
const handleRightClick = () => {
|
||||
if (!disabled() && props.onRightClick) {
|
||||
props.onRightClick();
|
||||
}
|
||||
};
|
||||
|
||||
const renderContent = () => {
|
||||
if (hoverEffect() === 'underline' && showHighlight()) {
|
||||
return <text>{props.children}</text>;
|
||||
}
|
||||
return props.children;
|
||||
};
|
||||
|
||||
return (
|
||||
<box
|
||||
flexDirection="row"
|
||||
onClick={handleClick}
|
||||
onDoubleClick={handleDoubleClick}
|
||||
onContextMenu={handleRightClick}
|
||||
>
|
||||
<Show when={hoverEffect() === 'pointer' && showHighlight()}>
|
||||
<text fg={terminalColors.accent}>{cursor()} </text>
|
||||
</Show>
|
||||
<box
|
||||
fg={hoverEffect() === 'highlight' && showHighlight() ? terminalColors.accent : undefined}
|
||||
>
|
||||
{renderContent()}
|
||||
</box>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface ClickableTextProps {
|
||||
children: string;
|
||||
onClick?: () => void;
|
||||
disabled?: boolean;
|
||||
hovered?: boolean;
|
||||
color?: string;
|
||||
hoverColor?: string;
|
||||
underlineOnHover?: boolean;
|
||||
}
|
||||
|
||||
export function ClickableText(props: ClickableTextProps) {
|
||||
const disabled = () => props.disabled ?? false;
|
||||
const hovered = () => props.hovered ?? false;
|
||||
const underlineOnHover = () => props.underlineOnHover ?? false;
|
||||
|
||||
const color = () => {
|
||||
if (disabled()) return terminalColors.textMuted;
|
||||
if (hovered()) return props.hoverColor ?? terminalColors.accent;
|
||||
return props.color ?? terminalColors.text;
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
if (!disabled() && props.onClick) {
|
||||
props.onClick();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<text fg={color()} onClick={handleClick}>
|
||||
{underlineOnHover() && hovered() ? (
|
||||
<u>{props.children}</u>
|
||||
) : (
|
||||
props.children
|
||||
)}
|
||||
</text>
|
||||
);
|
||||
}
|
||||
|
||||
interface ClickableRowProps {
|
||||
children: JSX.Element;
|
||||
selected?: boolean;
|
||||
hovered?: boolean;
|
||||
disabled?: boolean;
|
||||
showIndicator?: boolean;
|
||||
indicatorChar?: string;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
export function ClickableRow(props: ClickableRowProps) {
|
||||
const selected = () => props.selected ?? false;
|
||||
const hovered = () => props.hovered ?? false;
|
||||
const disabled = () => props.disabled ?? false;
|
||||
const showIndicator = () => props.showIndicator ?? true;
|
||||
const indicatorChar = () => props.indicatorChar ?? '▸';
|
||||
|
||||
const indicator = () => {
|
||||
if (!showIndicator()) return ' ';
|
||||
if (selected()) return `${indicatorChar()} `;
|
||||
if (hovered()) return '▹ ';
|
||||
return ' ';
|
||||
};
|
||||
|
||||
const fg = () => {
|
||||
if (disabled()) return terminalColors.textMuted;
|
||||
if (selected()) return terminalColors.accent;
|
||||
if (hovered()) return terminalColors.text;
|
||||
return terminalColors.textSecondary;
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
if (!disabled() && props.onClick) {
|
||||
props.onClick();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="row" onClick={handleClick}>
|
||||
<text fg={fg()}>{indicator()}</text>
|
||||
{props.children}
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface InteractiveAreaProps {
|
||||
children: JSX.Element;
|
||||
x?: number;
|
||||
y?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
onMouseOver?: () => void;
|
||||
onMouseOut?: () => void;
|
||||
onClick?: () => void;
|
||||
onMouseDown?: () => void;
|
||||
onMouseUp?: () => void;
|
||||
}
|
||||
|
||||
export function InteractiveArea(props: InteractiveAreaProps) {
|
||||
return (
|
||||
<box
|
||||
flexDirection="column"
|
||||
width={props.width}
|
||||
height={props.height}
|
||||
style={{ left: props.x, top: props.y }}
|
||||
onMouseEnter={props.onMouseOver}
|
||||
onMouseLeave={props.onMouseOut}
|
||||
onClick={props.onClick}
|
||||
onMouseDown={props.onMouseDown}
|
||||
onMouseUp={props.onMouseUp}
|
||||
>
|
||||
{props.children}
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
/**
|
||||
* CodeBlock Component
|
||||
* Basic syntax highlighting for code display
|
||||
*/
|
||||
|
||||
import { For, Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
interface CodeBlockProps {
|
||||
code: string;
|
||||
language?: string;
|
||||
showLineNumbers?: boolean;
|
||||
maxLines?: number;
|
||||
highlightLines?: number[];
|
||||
title?: string;
|
||||
}
|
||||
|
||||
const KEYWORDS = new Set([
|
||||
'const',
|
||||
'let',
|
||||
'var',
|
||||
'function',
|
||||
'return',
|
||||
'if',
|
||||
'else',
|
||||
'for',
|
||||
'while',
|
||||
'import',
|
||||
'export',
|
||||
'from',
|
||||
'class',
|
||||
'extends',
|
||||
'async',
|
||||
'await',
|
||||
'try',
|
||||
'catch',
|
||||
'throw',
|
||||
'new',
|
||||
'this',
|
||||
'true',
|
||||
'false',
|
||||
'null',
|
||||
'undefined',
|
||||
'type',
|
||||
'interface',
|
||||
]);
|
||||
|
||||
function tokenizeLine(line: string): Array<{ type: string; value: string }> {
|
||||
const tokens: Array<{ type: string; value: string }> = [];
|
||||
let remaining = line;
|
||||
|
||||
while (remaining.length > 0) {
|
||||
if (remaining.startsWith('//')) {
|
||||
tokens.push({ type: 'comment', value: remaining });
|
||||
break;
|
||||
}
|
||||
|
||||
const stringMatch = remaining.match(/^(['"`])(?:\\.|[^\\])*?\1/);
|
||||
if (stringMatch) {
|
||||
tokens.push({ type: 'string', value: stringMatch[0] });
|
||||
remaining = remaining.slice(stringMatch[0].length);
|
||||
continue;
|
||||
}
|
||||
|
||||
const numberMatch = remaining.match(/^\d+\.?\d*/);
|
||||
if (numberMatch) {
|
||||
tokens.push({ type: 'number', value: numberMatch[0] });
|
||||
remaining = remaining.slice(numberMatch[0].length);
|
||||
continue;
|
||||
}
|
||||
|
||||
const wordMatch = remaining.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*/);
|
||||
if (wordMatch) {
|
||||
const word = wordMatch[0];
|
||||
const type = KEYWORDS.has(word) ? 'keyword' : 'identifier';
|
||||
tokens.push({ type, value: word });
|
||||
remaining = remaining.slice(word.length);
|
||||
continue;
|
||||
}
|
||||
|
||||
const spaceMatch = remaining.match(/^\s+/);
|
||||
if (spaceMatch) {
|
||||
tokens.push({ type: 'space', value: spaceMatch[0] });
|
||||
remaining = remaining.slice(spaceMatch[0].length);
|
||||
continue;
|
||||
}
|
||||
|
||||
tokens.push({ type: 'punctuation', value: remaining[0] });
|
||||
remaining = remaining.slice(1);
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
function getTokenColor(type: string): string {
|
||||
switch (type) {
|
||||
case 'keyword':
|
||||
return terminalColors.accent;
|
||||
case 'string':
|
||||
return terminalColors.warning;
|
||||
case 'number':
|
||||
return terminalColors.info;
|
||||
case 'comment':
|
||||
return terminalColors.textMuted;
|
||||
default:
|
||||
return terminalColors.text;
|
||||
}
|
||||
}
|
||||
|
||||
export function CodeBlock(props: CodeBlockProps) {
|
||||
const showLineNumbers = () => props.showLineNumbers ?? true;
|
||||
const highlightLines = () => new Set(props.highlightLines ?? []);
|
||||
|
||||
const lines = () => {
|
||||
const allLines = props.code.split('\n');
|
||||
if (props.maxLines && allLines.length > props.maxLines) {
|
||||
return allLines.slice(0, props.maxLines);
|
||||
}
|
||||
return allLines;
|
||||
};
|
||||
|
||||
const lineNumberWidth = () => String(lines().length).length + 1;
|
||||
|
||||
const isTruncated = () => {
|
||||
const allLines = props.code.split('\n');
|
||||
return props.maxLines !== undefined && allLines.length > props.maxLines;
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column">
|
||||
<Show when={props.title}>
|
||||
<box marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{props.title}
|
||||
</text>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<box
|
||||
flexDirection="column"
|
||||
borderStyle="round"
|
||||
borderColor={terminalColors.border}
|
||||
paddingX={1}
|
||||
>
|
||||
<For each={lines()}>
|
||||
{(line, index) => {
|
||||
const lineNum = index() + 1;
|
||||
const isHighlighted = highlightLines().has(lineNum);
|
||||
const tokens = tokenizeLine(line);
|
||||
|
||||
return (
|
||||
<box flexDirection="row">
|
||||
<Show when={showLineNumbers()}>
|
||||
<text
|
||||
fg={isHighlighted ? terminalColors.accent : terminalColors.textMuted}
|
||||
width={lineNumberWidth()}
|
||||
>
|
||||
{isHighlighted ? '▸' : ' '}
|
||||
{String(lineNum).padStart(lineNumberWidth() - 1, ' ')}{' '}
|
||||
</text>
|
||||
</Show>
|
||||
<For each={tokens}>
|
||||
{(token) => (
|
||||
<text fg={isHighlighted ? terminalColors.accent : getTokenColor(token.type)}>
|
||||
{token.value}
|
||||
</text>
|
||||
)}
|
||||
</For>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
|
||||
<Show when={isTruncated()}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
... {props.code.split('\n').length - (props.maxLines ?? 0)} more lines
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface InlineCodeProps {
|
||||
children: string;
|
||||
}
|
||||
|
||||
export function InlineCode(props: InlineCodeProps) {
|
||||
return (
|
||||
<text fg={terminalColors.accent}>
|
||||
`{props.children}`
|
||||
</text>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/**
|
||||
* DetailPane Component
|
||||
* Right-side detail panel with animated slide-in
|
||||
*/
|
||||
|
||||
import { Show, For, createSignal, createEffect, onCleanup, type JSX } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
export interface DetailField {
|
||||
label: string;
|
||||
value: string | string[];
|
||||
color?: string;
|
||||
}
|
||||
|
||||
interface DetailPaneProps {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
icon?: string;
|
||||
fields?: DetailField[];
|
||||
content?: string;
|
||||
actions?: Array<{ key: string; label: string }>;
|
||||
width?: number;
|
||||
visible?: boolean;
|
||||
onClose?: () => void;
|
||||
children?: JSX.Element;
|
||||
}
|
||||
|
||||
export function DetailPane(props: DetailPaneProps) {
|
||||
const [slideProgress, setSlideProgress] = createSignal(0);
|
||||
const width = () => props.width ?? 30;
|
||||
const visible = () => props.visible ?? true;
|
||||
|
||||
createEffect(() => {
|
||||
if (visible()) {
|
||||
let frame = 0;
|
||||
let timeoutId: ReturnType<typeof setTimeout>;
|
||||
const animate = () => {
|
||||
frame++;
|
||||
const progress = Math.min(frame / 10, 1);
|
||||
setSlideProgress(progress);
|
||||
if (progress < 1) {
|
||||
timeoutId = setTimeout(animate, 16);
|
||||
}
|
||||
};
|
||||
timeoutId = setTimeout(animate, 16);
|
||||
onCleanup(() => clearTimeout(timeoutId));
|
||||
} else {
|
||||
setSlideProgress(0);
|
||||
}
|
||||
});
|
||||
|
||||
const effectiveWidth = () => Math.round(width() * slideProgress());
|
||||
|
||||
return (
|
||||
<Show when={visible() && slideProgress() > 0}>
|
||||
<box
|
||||
flexDirection="column"
|
||||
width={effectiveWidth()}
|
||||
borderStyle="round"
|
||||
borderColor={terminalColors.border}
|
||||
paddingX={1}
|
||||
paddingY={1}
|
||||
>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<Show when={props.icon}>
|
||||
<text fg={terminalColors.accent}>{props.icon} </text>
|
||||
</Show>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>{props.title}</b>
|
||||
</text>
|
||||
<Show when={props.onClose}>
|
||||
<box onClick={() => props.onClose?.()}>
|
||||
<text fg={terminalColors.textMuted}> [x]</text>
|
||||
</box>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<Show when={props.subtitle}>
|
||||
<box marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>{props.subtitle}</text>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={props.fields && props.fields.length > 0}>
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<For each={props.fields}>
|
||||
{(field) => (
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>{field.label}</text>
|
||||
<Show
|
||||
when={Array.isArray(field.value)}
|
||||
fallback={
|
||||
<text fg={field.color || terminalColors.text}>
|
||||
{field.value as string}
|
||||
</text>
|
||||
}
|
||||
>
|
||||
<For each={field.value as string[]}>
|
||||
{(val) => (
|
||||
<text fg={field.color || terminalColors.text}>• {val}</text>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={props.content}>
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<text fg={terminalColors.text}>{props.content}</text>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={props.children}>
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
{props.children}
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={props.actions && props.actions.length > 0}>
|
||||
<text fg={terminalColors.textMuted}>─────</text>
|
||||
<For each={props.actions}>
|
||||
{(action) => (
|
||||
<text fg={terminalColors.textMuted}>
|
||||
<text fg={terminalColors.accent}>{action.key}</text> {action.label}
|
||||
</text>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
</box>
|
||||
</Show>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* EmptyState Component
|
||||
* Consistent "no data" display
|
||||
*/
|
||||
|
||||
import { Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
interface EmptyStateProps {
|
||||
icon?: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
action?: {
|
||||
label: string;
|
||||
key?: string;
|
||||
};
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
export function EmptyState(props: EmptyStateProps) {
|
||||
const compact = () => props.compact ?? false;
|
||||
|
||||
return (
|
||||
<box flexDirection="column" alignItems="center" paddingY={compact() ? 1 : 3}>
|
||||
<Show when={props.icon}>
|
||||
<box marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{props.icon}
|
||||
</text>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<box marginBottom={1}>
|
||||
<text fg={terminalColors.textSecondary}>
|
||||
{props.title}
|
||||
</text>
|
||||
</box>
|
||||
|
||||
<Show when={props.description}>
|
||||
<text fg={terminalColors.textMuted}>{props.description}</text>
|
||||
</Show>
|
||||
|
||||
<Show when={props.action}>
|
||||
<box marginTop={1}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
<Show when={props.action!.key}>
|
||||
<text fg={terminalColors.accent}>{props.action!.key}</text>{' '}
|
||||
</Show>
|
||||
{props.action!.label}
|
||||
</text>
|
||||
</box>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface LoadingStateProps {
|
||||
message?: string;
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
export function LoadingState(props: LoadingStateProps) {
|
||||
const compact = () => props.compact ?? false;
|
||||
const message = () => props.message ?? 'Loading...';
|
||||
|
||||
return (
|
||||
<box flexDirection="column" alignItems="center" paddingY={compact() ? 1 : 3}>
|
||||
<text fg={terminalColors.accent}>⟳ {message()}</text>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface ErrorStateProps {
|
||||
title?: string;
|
||||
message: string;
|
||||
action?: {
|
||||
label: string;
|
||||
key?: string;
|
||||
};
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
export function ErrorState(props: ErrorStateProps) {
|
||||
const compact = () => props.compact ?? false;
|
||||
const title = () => props.title ?? 'Error';
|
||||
|
||||
return (
|
||||
<box flexDirection="column" alignItems="center" paddingY={compact() ? 1 : 3}>
|
||||
<box marginBottom={1}>
|
||||
<text fg={terminalColors.error}>
|
||||
✗ {title()}
|
||||
</text>
|
||||
</box>
|
||||
|
||||
<text fg={terminalColors.textMuted}>{props.message}</text>
|
||||
|
||||
<Show when={props.action}>
|
||||
<box marginTop={1}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
<Show when={props.action!.key}>
|
||||
<text fg={terminalColors.accent}>{props.action!.key}</text>{' '}
|
||||
</Show>
|
||||
{props.action!.label}
|
||||
</text>
|
||||
</box>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* ErrorBoundary Component
|
||||
* Catch and display errors gracefully
|
||||
*/
|
||||
|
||||
import { ErrorBoundary as SolidErrorBoundary, type JSX, Show } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
interface ErrorBoundaryProps {
|
||||
children: JSX.Element;
|
||||
fallback?: JSX.Element | ((error: Error, reset: () => void) => JSX.Element);
|
||||
onError?: (error: Error) => void;
|
||||
}
|
||||
|
||||
function DefaultErrorFallback(props: { error: Error; reset: () => void }) {
|
||||
const errorMessage = () => {
|
||||
if (props.error instanceof Error) {
|
||||
return props.error.message;
|
||||
}
|
||||
return String(props.error);
|
||||
};
|
||||
|
||||
const errorStack = () => {
|
||||
if (props.error instanceof Error && props.error.stack) {
|
||||
const lines = props.error.stack.split('\n').slice(1, 4);
|
||||
return lines.join('\n');
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
useKeyboard((key) => {
|
||||
if (key.name === 'r') {
|
||||
props.reset();
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="column" paddingY={2} paddingX={1}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.error}>✗ Something went wrong</text>
|
||||
</box>
|
||||
|
||||
<box
|
||||
flexDirection="column"
|
||||
borderStyle="round"
|
||||
borderColor={terminalColors.error}
|
||||
paddingX={1}
|
||||
paddingY={1}
|
||||
>
|
||||
<text fg={terminalColors.text}>{errorMessage()}</text>
|
||||
|
||||
<Show when={errorStack()}>
|
||||
<box marginTop={1}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{errorStack()}
|
||||
</text>
|
||||
</box>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<box marginTop={1}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Press <text fg={terminalColors.accent}>r</text> to retry or{' '}
|
||||
<text fg={terminalColors.accent}>Esc</text> to go back
|
||||
</text>
|
||||
</box>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
export function ErrorBoundary(props: ErrorBoundaryProps) {
|
||||
let handledErrorRef: Error | null = null;
|
||||
|
||||
const fallbackComponent = (error: Error, reset: () => void) => {
|
||||
if (props.onError && handledErrorRef !== error) {
|
||||
handledErrorRef = error;
|
||||
props.onError(error);
|
||||
}
|
||||
|
||||
const wrappedReset = () => {
|
||||
handledErrorRef = null;
|
||||
reset();
|
||||
};
|
||||
|
||||
if (typeof props.fallback === 'function') {
|
||||
return props.fallback(error, wrappedReset);
|
||||
}
|
||||
|
||||
if (props.fallback) {
|
||||
return props.fallback;
|
||||
}
|
||||
|
||||
return <DefaultErrorFallback error={error} reset={wrappedReset} />;
|
||||
};
|
||||
|
||||
return (
|
||||
<SolidErrorBoundary fallback={fallbackComponent}>
|
||||
{props.children}
|
||||
</SolidErrorBoundary>
|
||||
);
|
||||
}
|
||||
|
||||
interface TryProps {
|
||||
children: JSX.Element;
|
||||
catch?: JSX.Element;
|
||||
}
|
||||
|
||||
export function Try(props: TryProps) {
|
||||
return (
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
props.catch ?? (
|
||||
<text fg={terminalColors.error}>Error loading component</text>
|
||||
)
|
||||
}
|
||||
>
|
||||
{props.children}
|
||||
</ErrorBoundary>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
/**
|
||||
* FeatureList Component
|
||||
* Colored feature keywords with descriptions
|
||||
*/
|
||||
import { For } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
interface Feature {
|
||||
@@ -24,19 +21,25 @@ interface FeatureListProps {
|
||||
features?: Feature[];
|
||||
}
|
||||
|
||||
export function FeatureList({ features = FEATURES }: FeatureListProps) {
|
||||
export function FeatureList(props: FeatureListProps) {
|
||||
const features = () => props.features ?? FEATURES;
|
||||
|
||||
return (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}><b>Features</b></text>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Features</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
{features.map((feat) => (
|
||||
<box key={feat.key} flexDirection="row">
|
||||
<text fg={terminalColors[feat.color]}>
|
||||
<b>{' '}{feat.label.padEnd(12)}</b>
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{feat.description}</text>
|
||||
</box>
|
||||
))}
|
||||
<For each={features()}>
|
||||
{(feat) => (
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors[feat.color]}>
|
||||
<b>{' '}{feat.label.padEnd(12)}</b>
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{feat.description}</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
/**
|
||||
* FormField Component
|
||||
* Input with label and validation
|
||||
*/
|
||||
|
||||
import { Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
interface FormFieldProps {
|
||||
label: string;
|
||||
value: string;
|
||||
placeholder?: string;
|
||||
error?: string;
|
||||
hint?: string;
|
||||
required?: boolean;
|
||||
disabled?: boolean;
|
||||
focused?: boolean;
|
||||
type?: 'text' | 'password' | 'search';
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export function FormField(props: FormFieldProps) {
|
||||
const type = () => props.type ?? 'text';
|
||||
const focused = () => props.focused ?? false;
|
||||
const disabled = () => props.disabled ?? false;
|
||||
const width = () => props.width ?? 30;
|
||||
|
||||
const displayValue = () => {
|
||||
if (type() === 'password') {
|
||||
return '•'.repeat(props.value.length);
|
||||
}
|
||||
return props.value;
|
||||
};
|
||||
|
||||
const borderColor = () => {
|
||||
if (props.error) return terminalColors.error;
|
||||
if (focused()) return terminalColors.accent;
|
||||
if (disabled()) return terminalColors.textMuted;
|
||||
return terminalColors.border;
|
||||
};
|
||||
|
||||
const labelColor = () => {
|
||||
if (props.error) return terminalColors.error;
|
||||
if (focused()) return terminalColors.accent;
|
||||
return terminalColors.textSecondary;
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<box flexDirection="row">
|
||||
<text fg={labelColor()}>
|
||||
{props.label}
|
||||
<Show when={props.required}>
|
||||
<text fg={terminalColors.error}>*</text>
|
||||
</Show>
|
||||
</text>
|
||||
</box>
|
||||
|
||||
<box
|
||||
flexDirection="row"
|
||||
width={width()}
|
||||
borderStyle="round"
|
||||
borderColor={borderColor()}
|
||||
paddingX={1}
|
||||
>
|
||||
<Show when={type() === 'search'}>
|
||||
<text fg={terminalColors.textMuted}>/ </text>
|
||||
</Show>
|
||||
<text fg={disabled() ? terminalColors.textMuted : terminalColors.text}>
|
||||
{displayValue() || (
|
||||
<text fg={terminalColors.textMuted}>{props.placeholder ?? ''}</text>
|
||||
)}
|
||||
</text>
|
||||
<Show when={focused()}>
|
||||
<text fg={terminalColors.accent}>▌</text>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<Show when={props.error}>
|
||||
<text fg={terminalColors.error}>✗ {props.error}</text>
|
||||
</Show>
|
||||
|
||||
<Show when={props.hint && !props.error}>
|
||||
<text fg={terminalColors.textMuted}>{props.hint}</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface TextAreaFieldProps {
|
||||
label: string;
|
||||
value: string;
|
||||
placeholder?: string;
|
||||
error?: string;
|
||||
rows?: number;
|
||||
width?: number;
|
||||
focused?: boolean;
|
||||
}
|
||||
|
||||
export function TextAreaField(props: TextAreaFieldProps) {
|
||||
const rows = () => props.rows ?? 3;
|
||||
const width = () => props.width ?? 40;
|
||||
const focused = () => props.focused ?? false;
|
||||
|
||||
const lines = () => props.value.split('\n').slice(0, rows());
|
||||
|
||||
const hasContent = () => props.value !== '' && props.value !== undefined;
|
||||
|
||||
const borderColor = () => {
|
||||
if (props.error) return terminalColors.error;
|
||||
if (focused()) return terminalColors.accent;
|
||||
return terminalColors.border;
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<text fg={terminalColors.textSecondary}>{props.label}</text>
|
||||
|
||||
<box
|
||||
flexDirection="column"
|
||||
width={width()}
|
||||
height={rows() + 2}
|
||||
borderStyle="round"
|
||||
borderColor={borderColor()}
|
||||
paddingX={1}
|
||||
>
|
||||
<Show
|
||||
when={hasContent()}
|
||||
fallback={<text fg={terminalColors.textMuted}>{props.placeholder ?? ''}</text>}
|
||||
>
|
||||
{lines().map((line) => (
|
||||
<text fg={terminalColors.text}>{line}</text>
|
||||
))}
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<Show when={props.error}>
|
||||
<text fg={terminalColors.error}>✗ {props.error}</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface SelectFieldProps {
|
||||
label: string;
|
||||
value: string;
|
||||
options: Array<{ value: string; label: string }>;
|
||||
focused?: boolean;
|
||||
expanded?: boolean;
|
||||
selectedOptionIndex?: number;
|
||||
}
|
||||
|
||||
export function SelectField(props: SelectFieldProps) {
|
||||
const focused = () => props.focused ?? false;
|
||||
const expanded = () => props.expanded ?? false;
|
||||
|
||||
const selectedLabel = () => {
|
||||
const option = props.options.find((o) => o.value === props.value);
|
||||
return option?.label ?? props.value ?? 'Select...';
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<text fg={terminalColors.textSecondary}>{props.label}</text>
|
||||
|
||||
<box
|
||||
flexDirection="row"
|
||||
borderStyle="round"
|
||||
borderColor={focused() ? terminalColors.accent : terminalColors.border}
|
||||
paddingX={1}
|
||||
>
|
||||
<text fg={terminalColors.text}>{selectedLabel()}</text>
|
||||
<text fg={terminalColors.textMuted}> {expanded() ? '▲' : '▼'}</text>
|
||||
</box>
|
||||
|
||||
<Show when={expanded()}>
|
||||
<box
|
||||
flexDirection="column"
|
||||
borderStyle="round"
|
||||
borderColor={terminalColors.border}
|
||||
paddingX={1}
|
||||
>
|
||||
{props.options.map((option, index) => {
|
||||
const isSelected = index === props.selectedOptionIndex;
|
||||
return (
|
||||
<text
|
||||
fg={
|
||||
option.value === props.value
|
||||
? terminalColors.accent
|
||||
: isSelected
|
||||
? terminalColors.text
|
||||
: terminalColors.textSecondary
|
||||
}
|
||||
>
|
||||
{isSelected ? '▸ ' : ' '}
|
||||
{option.label}
|
||||
</text>
|
||||
);
|
||||
})}
|
||||
</box>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
/**
|
||||
* Header Component
|
||||
* Screen header with title and optional badge/count
|
||||
*/
|
||||
import { Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { symbols } from '../theme/symbols.js';
|
||||
|
||||
interface HeaderProps {
|
||||
title: string;
|
||||
@@ -13,23 +9,26 @@ interface HeaderProps {
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
export function Header({ title, subtitle, count, badge, icon }: HeaderProps) {
|
||||
export function Header(props: HeaderProps) {
|
||||
return (
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<box flexDirection="row" gap={2}>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>{icon && `${icon} `}{title}</b>
|
||||
<b>
|
||||
{props.icon && `${props.icon} `}
|
||||
{props.title}
|
||||
</b>
|
||||
</text>
|
||||
{count !== undefined && (
|
||||
<text fg={terminalColors.textMuted}>({count})</text>
|
||||
)}
|
||||
{badge && (
|
||||
<text fg={terminalColors.accent}>[{badge}]</text>
|
||||
)}
|
||||
<Show when={props.count !== undefined}>
|
||||
<text fg={terminalColors.textMuted}>({props.count})</text>
|
||||
</Show>
|
||||
<Show when={props.badge}>
|
||||
<text fg={terminalColors.accent}>[{props.badge}]</text>
|
||||
</Show>
|
||||
</box>
|
||||
{subtitle && (
|
||||
<text fg={terminalColors.textSecondary}>{subtitle}</text>
|
||||
)}
|
||||
<Show when={props.subtitle}>
|
||||
<text fg={terminalColors.textSecondary}>{props.subtitle}</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* HoverHighlight Component
|
||||
* Hover highlight effect for list items and buttons
|
||||
* Note: Terminal background colors are limited, so we use text color changes for highlighting
|
||||
*/
|
||||
|
||||
import { type JSX, Show, createSignal, createEffect } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
interface HoverHighlightProps {
|
||||
children: JSX.Element;
|
||||
isHovered?: boolean;
|
||||
isSelected?: boolean;
|
||||
isDisabled?: boolean;
|
||||
highlightColor?: string;
|
||||
selectedColor?: string;
|
||||
transitionMs?: number;
|
||||
}
|
||||
|
||||
export function HoverHighlight(props: HoverHighlightProps) {
|
||||
return <box>{props.children}</box>;
|
||||
}
|
||||
|
||||
interface HighlightableListItemProps {
|
||||
children: JSX.Element;
|
||||
index: number;
|
||||
selectedIndex?: number;
|
||||
hoveredIndex?: number | null;
|
||||
showPrefix?: boolean;
|
||||
prefixWidth?: number;
|
||||
}
|
||||
|
||||
export function HighlightableListItem(props: HighlightableListItemProps) {
|
||||
const showPrefix = () => props.showPrefix ?? true;
|
||||
const prefixWidth = () => props.prefixWidth ?? 3;
|
||||
|
||||
const isSelected = () => props.index === props.selectedIndex;
|
||||
const isHovered = () => props.index === props.hoveredIndex;
|
||||
|
||||
const prefix = () => {
|
||||
if (!showPrefix()) return '';
|
||||
if (isSelected()) return '▸ ';
|
||||
if (isHovered()) return '▹ ';
|
||||
return ' ';
|
||||
};
|
||||
|
||||
const fg = () => {
|
||||
if (isSelected()) return terminalColors.accent;
|
||||
if (isHovered()) return terminalColors.text;
|
||||
return terminalColors.textSecondary;
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="row">
|
||||
<Show when={showPrefix()}>
|
||||
<text fg={fg()} width={prefixWidth()}>
|
||||
{prefix()}
|
||||
</text>
|
||||
</Show>
|
||||
{props.children}
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface FocusRingProps {
|
||||
children: JSX.Element;
|
||||
isFocused?: boolean;
|
||||
ringColor?: string;
|
||||
}
|
||||
|
||||
export function FocusRing(props: FocusRingProps) {
|
||||
const ringColor = () => props.ringColor ?? terminalColors.accent;
|
||||
|
||||
return (
|
||||
<box
|
||||
borderStyle={props.isFocused ? 'round' : undefined}
|
||||
borderColor={props.isFocused ? ringColor() : undefined}
|
||||
>
|
||||
{props.children}
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface PressEffectProps {
|
||||
children: JSX.Element;
|
||||
isPressed?: boolean;
|
||||
pressColor?: string;
|
||||
}
|
||||
|
||||
export function PressEffect(props: PressEffectProps) {
|
||||
return <box>{props.children}</box>;
|
||||
}
|
||||
@@ -1,41 +1,36 @@
|
||||
/**
|
||||
* ProgressBar Component
|
||||
* Animated progress bar display
|
||||
*/
|
||||
import { Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { symbols } from '../theme/symbols.js';
|
||||
|
||||
interface ProgressBarProps {
|
||||
progress: number; // 0-100
|
||||
progress: number;
|
||||
width?: number;
|
||||
showPercentage?: boolean;
|
||||
color?: keyof typeof terminalColors;
|
||||
}
|
||||
|
||||
export function ProgressBar({
|
||||
progress,
|
||||
width = 20,
|
||||
showPercentage = true,
|
||||
color = 'accent',
|
||||
}: ProgressBarProps) {
|
||||
const clampedProgress = Math.max(0, Math.min(100, progress));
|
||||
const filledWidth = Math.round((clampedProgress / 100) * width);
|
||||
const emptyWidth = width - filledWidth;
|
||||
export function ProgressBar(props: ProgressBarProps) {
|
||||
const width = () => Math.max(1, Math.round(props.width ?? 20));
|
||||
const safeProgress = () => (Number.isFinite(props.progress) ? props.progress : 0);
|
||||
const showPercentage = () => props.showPercentage ?? true;
|
||||
const color = () => props.color ?? 'accent';
|
||||
|
||||
const filled = symbols.progressFilled.repeat(filledWidth);
|
||||
const empty = symbols.progressEmpty.repeat(emptyWidth);
|
||||
const clampedProgress = () => Math.max(0, Math.min(100, safeProgress()));
|
||||
const filledWidth = () => Math.round((clampedProgress() / 100) * width());
|
||||
const emptyWidth = () => Math.max(0, width() - filledWidth());
|
||||
|
||||
const filled = () => symbols.progressFilled.repeat(filledWidth());
|
||||
const empty = () => symbols.progressEmpty.repeat(emptyWidth());
|
||||
|
||||
return (
|
||||
<box flexDirection="row" gap={1}>
|
||||
<text>
|
||||
<span fg={terminalColors[color]}>{filled}</span>
|
||||
<span fg={terminalColors.textMuted}>{empty}</span>
|
||||
<span fg={terminalColors[color()]}>{filled()}</span>
|
||||
<span fg={terminalColors.textMuted}>{empty()}</span>
|
||||
</text>
|
||||
{showPercentage && (
|
||||
<text fg={terminalColors.textSecondary}>
|
||||
{Math.round(clampedProgress)}%
|
||||
</text>
|
||||
)}
|
||||
<Show when={showPercentage()}>
|
||||
<text fg={terminalColors.textSecondary}>{Math.round(clampedProgress())}%</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import { Show, For, createSignal } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { symbols, AGENT_LOGOS } from '../theme/symbols.js';
|
||||
|
||||
interface RightSidebarProps {
|
||||
width: number;
|
||||
rows: number;
|
||||
}
|
||||
|
||||
const TOP_AGENTS = ['claude-code', 'cursor', 'codex'] as const;
|
||||
|
||||
export function RightSidebar(props: RightSidebarProps) {
|
||||
const [sections] = createSignal({
|
||||
context: true,
|
||||
agents: true,
|
||||
tasks: false,
|
||||
});
|
||||
|
||||
return (
|
||||
<box
|
||||
flexDirection="column"
|
||||
width={props.width}
|
||||
borderLeft
|
||||
borderColor={terminalColors.border}
|
||||
paddingLeft={1}
|
||||
>
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<text fg={terminalColors.text}>
|
||||
{sections().context ? '▼' : '▸'} Context
|
||||
</text>
|
||||
<Show when={sections().context}>
|
||||
<text fg={terminalColors.textSecondary}> Skills: 127</text>
|
||||
<text fg={terminalColors.textSecondary}> Agents: 32 (3{symbols.active})</text>
|
||||
<text fg={terminalColors.textSecondary}> Workflows: 4</text>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<text fg={terminalColors.text}>
|
||||
{sections().agents ? '▼' : '▸'} Agents (3)
|
||||
</text>
|
||||
<Show when={sections().agents}>
|
||||
<For each={[...TOP_AGENTS]}>
|
||||
{(agent) => {
|
||||
const logo = AGENT_LOGOS[agent];
|
||||
return (
|
||||
<text fg={terminalColors.text}>
|
||||
{' '}{logo.icon} {logo.name} {symbols.active}
|
||||
</text>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
<text fg={terminalColors.textMuted}> +29 more</text>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<text fg={terminalColors.text}>
|
||||
{sections().tasks ? '▼' : '▸'} Tasks (2)
|
||||
</text>
|
||||
<Show when={sections().tasks}>
|
||||
<text fg={terminalColors.textSecondary}> {symbols.pending} Syncing...</text>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<box flexGrow={1} />
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
/**
|
||||
* SearchInput Component
|
||||
* Rounded search input with icon
|
||||
*/
|
||||
import { Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
interface SearchInputProps {
|
||||
@@ -11,19 +8,19 @@ interface SearchInputProps {
|
||||
onChange?: (value: string) => void;
|
||||
}
|
||||
|
||||
export function SearchInput({
|
||||
value,
|
||||
placeholder = 'Search...',
|
||||
focused = false,
|
||||
}: SearchInputProps) {
|
||||
const display = value || placeholder;
|
||||
const textColor = value ? terminalColors.text : terminalColors.textMuted;
|
||||
export function SearchInput(props: SearchInputProps) {
|
||||
const placeholder = () => props.placeholder ?? 'Search...';
|
||||
const focused = () => props.focused ?? false;
|
||||
const display = () => props.value || placeholder();
|
||||
const textColor = () => (props.value ? terminalColors.text : terminalColors.textMuted);
|
||||
|
||||
return (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>⌕ </text>
|
||||
<text fg={textColor}>{display}</text>
|
||||
{focused && <text fg={terminalColors.accent}>▏</text>}
|
||||
<text fg={textColor()}>{display()}</text>
|
||||
<Show when={focused()}>
|
||||
<text fg={terminalColors.accent}>▏</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
* SelectList Component
|
||||
* Reusable list with j/k + mouse navigation
|
||||
*/
|
||||
|
||||
import { For, Show, createMemo } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
export interface SelectListItem {
|
||||
id: string;
|
||||
label: string;
|
||||
description?: string;
|
||||
icon?: string;
|
||||
meta?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
interface SelectListProps {
|
||||
items: SelectListItem[];
|
||||
selectedIndex: number;
|
||||
hoveredIndex?: number | null;
|
||||
onSelect?: (item: SelectListItem, index: number) => void;
|
||||
onHover?: (index: number) => void;
|
||||
maxVisible?: number;
|
||||
showIndex?: boolean;
|
||||
emptyText?: string;
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
export function SelectList(props: SelectListProps) {
|
||||
const maxVisible = () => props.maxVisible ?? 10;
|
||||
const showIndex = () => props.showIndex ?? false;
|
||||
const compact = () => props.compact ?? false;
|
||||
|
||||
const scrollOffset = createMemo(() => {
|
||||
const selected = props.selectedIndex;
|
||||
const visible = maxVisible();
|
||||
const total = props.items.length;
|
||||
|
||||
if (total <= visible) return 0;
|
||||
if (selected < visible / 2) return 0;
|
||||
if (selected > total - visible / 2) return total - visible;
|
||||
return Math.floor(selected - visible / 2);
|
||||
});
|
||||
|
||||
const visibleItems = createMemo(() => {
|
||||
const offset = scrollOffset();
|
||||
return props.items.slice(offset, offset + maxVisible()).map((item, i) => ({
|
||||
item,
|
||||
originalIndex: offset + i,
|
||||
}));
|
||||
});
|
||||
|
||||
const hasScrollUp = createMemo(() => scrollOffset() > 0);
|
||||
const hasScrollDown = createMemo(
|
||||
() => scrollOffset() + maxVisible() < props.items.length
|
||||
);
|
||||
|
||||
const handleItemClick = (item: SelectListItem, index: number) => {
|
||||
if (!item.disabled && props.onSelect) {
|
||||
props.onSelect(item, index);
|
||||
}
|
||||
};
|
||||
|
||||
const handleItemHover = (index: number) => {
|
||||
if (props.onHover) {
|
||||
props.onHover(index);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column">
|
||||
<Show when={props.items.length === 0}>
|
||||
<text fg={terminalColors.textMuted}>{props.emptyText || 'No items'}</text>
|
||||
</Show>
|
||||
|
||||
<Show when={hasScrollUp()}>
|
||||
<text fg={terminalColors.textMuted}> ▲ {scrollOffset()} more</text>
|
||||
</Show>
|
||||
|
||||
<For each={visibleItems()}>
|
||||
{({ item, originalIndex }) => {
|
||||
const isSelected = () => originalIndex === props.selectedIndex;
|
||||
const isHovered = () => originalIndex === props.hoveredIndex;
|
||||
const isDisabled = () => item.disabled ?? false;
|
||||
|
||||
const fg = () => {
|
||||
if (isDisabled()) return terminalColors.textMuted;
|
||||
if (isSelected()) return terminalColors.accent;
|
||||
if (isHovered()) return terminalColors.text;
|
||||
return terminalColors.textSecondary;
|
||||
};
|
||||
|
||||
const prefix = () => {
|
||||
if (isSelected()) return '▸ ';
|
||||
if (isHovered()) return '▹ ';
|
||||
return ' ';
|
||||
};
|
||||
|
||||
return (
|
||||
<box
|
||||
flexDirection={compact() ? 'row' : 'column'}
|
||||
marginBottom={compact() ? 0 : 1}
|
||||
onClick={() => handleItemClick(item, originalIndex)}
|
||||
onMouseEnter={() => handleItemHover(originalIndex)}
|
||||
>
|
||||
<box flexDirection="row">
|
||||
<text fg={fg()}>{prefix()}</text>
|
||||
<Show when={showIndex()}>
|
||||
<text fg={terminalColors.textMuted} width={4}>
|
||||
{String(originalIndex + 1).padStart(2, ' ')}.{' '}
|
||||
</text>
|
||||
</Show>
|
||||
<Show when={item.icon}>
|
||||
<text fg={fg()}>{item.icon} </text>
|
||||
</Show>
|
||||
<text fg={fg()}>{item.label}</text>
|
||||
<Show when={item.meta}>
|
||||
<text fg={terminalColors.textMuted}> ({item.meta})</text>
|
||||
</Show>
|
||||
</box>
|
||||
<Show when={item.description && !compact()}>
|
||||
<box marginLeft={2}>
|
||||
<text fg={terminalColors.textMuted}>{item.description}</text>
|
||||
</box>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
|
||||
<Show when={hasScrollDown()}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{' '}▼ {props.items.length - scrollOffset() - maxVisible()} more
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { For, Show } from 'solid-js';
|
||||
import { type Screen, SIDEBAR_NAV } from '../state/types.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { symbols } from '../theme/symbols.js';
|
||||
@@ -8,7 +9,7 @@ interface SidebarProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
}
|
||||
|
||||
export function Sidebar({ screen }: SidebarProps) {
|
||||
export function Sidebar(props: SidebarProps) {
|
||||
const version = getVersion();
|
||||
|
||||
return (
|
||||
@@ -19,22 +20,36 @@ export function Sidebar({ screen }: SidebarProps) {
|
||||
<text fg={terminalColors.textMuted}>v{version}</text>
|
||||
<text> </text>
|
||||
|
||||
{SIDEBAR_NAV.map(({ section, items }, idx) => (
|
||||
<box key={section} flexDirection="column">
|
||||
{idx > 0 && <text> </text>}
|
||||
<text fg={terminalColors.textMuted}>
|
||||
<i>{section}</i>
|
||||
</text>
|
||||
{items.map((item) => {
|
||||
const active = screen === item.screen;
|
||||
return (
|
||||
<text key={item.key} fg={active ? terminalColors.accent : terminalColors.text}>
|
||||
{active ? <b>{symbols.pointer} {item.label}</b> : <>{symbols.pointerInactive} {item.label}</>}
|
||||
</text>
|
||||
);
|
||||
})}
|
||||
</box>
|
||||
))}
|
||||
<For each={SIDEBAR_NAV}>
|
||||
{(nav, idx) => (
|
||||
<box flexDirection="column">
|
||||
<Show when={idx() > 0}>
|
||||
<text> </text>
|
||||
</Show>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
<i>{nav.section}</i>
|
||||
</text>
|
||||
<For each={nav.items}>
|
||||
{(item) => {
|
||||
const active = () => props.screen === item.screen;
|
||||
return (
|
||||
<text fg={active() ? terminalColors.accent : terminalColors.text}>
|
||||
{active() ? (
|
||||
<b>
|
||||
{symbols.pointer} {item.label}
|
||||
</b>
|
||||
) : (
|
||||
<>
|
||||
{symbols.pointerInactive} {item.label}
|
||||
</>
|
||||
)}
|
||||
</text>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
|
||||
<box flexGrow={1} />
|
||||
<text fg={terminalColors.textMuted}>{symbols.horizontalLine.repeat(14)}</text>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
/**
|
||||
* SkillList Component
|
||||
* Paginated list of skills with selection
|
||||
*/
|
||||
import { Show, For } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { symbols } from '../theme/symbols.js';
|
||||
import { calculatePagination, type PaginationResult } from '../utils/list.js';
|
||||
import { calculatePagination } from '../utils/list.js';
|
||||
import type { SkillItem } from '../state/types.js';
|
||||
|
||||
interface SkillListProps {
|
||||
@@ -14,56 +11,44 @@ interface SkillListProps {
|
||||
onSelect?: (skill: SkillItem) => void;
|
||||
}
|
||||
|
||||
export function SkillList({
|
||||
skills,
|
||||
selectedIndex,
|
||||
maxVisible = 10,
|
||||
onSelect,
|
||||
}: SkillListProps) {
|
||||
if (skills.length === 0) {
|
||||
return (
|
||||
<text fg={terminalColors.textMuted}>No skills found</text>
|
||||
);
|
||||
}
|
||||
export function SkillList(props: SkillListProps) {
|
||||
const maxVisible = () => props.maxVisible ?? 10;
|
||||
|
||||
const pagination = calculatePagination(skills.length, selectedIndex, maxVisible);
|
||||
const visibleSkills = skills.slice(pagination.start, pagination.end);
|
||||
const pagination = () => calculatePagination(props.skills.length, props.selectedIndex, maxVisible());
|
||||
const visibleSkills = () => props.skills.slice(pagination().start, pagination().end);
|
||||
|
||||
return (
|
||||
<box flexDirection="column">
|
||||
{/* Items above indicator */}
|
||||
{pagination.itemsAbove > 0 && (
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{symbols.arrowUp} {pagination.itemsAbove} more above
|
||||
</text>
|
||||
)}
|
||||
|
||||
{/* Skill list */}
|
||||
{visibleSkills.map((skill, idx) => {
|
||||
const actualIndex = pagination.start + idx;
|
||||
const isSelected = actualIndex === selectedIndex;
|
||||
const pointer = isSelected ? symbols.pointer : symbols.pointerInactive;
|
||||
const fg = isSelected ? terminalColors.accent : terminalColors.text;
|
||||
const statusIcon = skill.enabled ? symbols.active : symbols.pending;
|
||||
const descPart = skill.description
|
||||
? ` - ${skill.description.slice(0, 40)}${skill.description.length > 40 ? '...' : ''}`
|
||||
: '';
|
||||
// Use single text element to avoid rendering overlap
|
||||
const line = `${pointer} ${skill.name} ${statusIcon}${descPart}`;
|
||||
|
||||
return (
|
||||
<text key={skill.name} fg={fg}>
|
||||
{isSelected ? <b>{line}</b> : line}
|
||||
<Show when={props.skills.length > 0} fallback={<text fg={terminalColors.textMuted}>No skills found</text>}>
|
||||
<box flexDirection="column">
|
||||
<Show when={pagination().itemsAbove > 0}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{symbols.arrowUp} {pagination().itemsAbove} more above
|
||||
</text>
|
||||
);
|
||||
})}
|
||||
</Show>
|
||||
|
||||
{/* Items below indicator */}
|
||||
{pagination.itemsBelow > 0 && (
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{symbols.arrowDown} {pagination.itemsBelow} more below
|
||||
</text>
|
||||
)}
|
||||
</box>
|
||||
<For each={visibleSkills()}>
|
||||
{(skill, idx) => {
|
||||
const actualIndex = () => pagination().start + idx();
|
||||
const isSelected = () => actualIndex() === props.selectedIndex;
|
||||
const pointer = () => (isSelected() ? symbols.pointer : symbols.pointerInactive);
|
||||
const fg = () => (isSelected() ? terminalColors.accent : terminalColors.text);
|
||||
const statusIcon = () => (skill.enabled ? symbols.active : symbols.pending);
|
||||
const descPart = () =>
|
||||
skill.description
|
||||
? ` - ${skill.description.slice(0, 40)}${skill.description.length > 40 ? '...' : ''}`
|
||||
: '';
|
||||
const line = () => `${pointer()} ${skill.name} ${statusIcon()}${descPart()}`;
|
||||
|
||||
return <text fg={fg()}>{isSelected() ? <b>{line()}</b> : line()}</text>;
|
||||
}}
|
||||
</For>
|
||||
|
||||
<Show when={pagination().itemsBelow > 0}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{symbols.arrowDown} {pagination().itemsBelow} more below
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
</Show>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
/**
|
||||
* Spinner Component
|
||||
* Loading indicator with animated frames
|
||||
*/
|
||||
import { useState, useEffect } from 'react';
|
||||
import { createSignal, createEffect, onCleanup, Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { symbols } from '../theme/symbols.js';
|
||||
|
||||
@@ -11,20 +7,24 @@ interface SpinnerProps {
|
||||
color?: keyof typeof terminalColors;
|
||||
}
|
||||
|
||||
export function Spinner({ label, color = 'accent' }: SpinnerProps) {
|
||||
const [frame, setFrame] = useState(0);
|
||||
export function Spinner(props: SpinnerProps) {
|
||||
const [frame, setFrame] = createSignal(0);
|
||||
|
||||
useEffect(() => {
|
||||
createEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
setFrame((f) => (f + 1) % symbols.spinner.length);
|
||||
}, 80);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
onCleanup(() => clearInterval(interval));
|
||||
});
|
||||
|
||||
const color = () => props.color ?? 'accent';
|
||||
|
||||
return (
|
||||
<box flexDirection="row" gap={1}>
|
||||
<text fg={terminalColors[color]}>{symbols.spinner[frame]}</text>
|
||||
{label && <text fg={terminalColors.text}>{label}</text>}
|
||||
<text fg={terminalColors[color()]}>{symbols.spinner[frame()]}</text>
|
||||
<Show when={props.label}>
|
||||
<text fg={terminalColors.text}>{props.label}</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,39 +1,28 @@
|
||||
/**
|
||||
* Splash Component
|
||||
* Cinematic ASCII art intro with elegant animations
|
||||
* Premium terminal experience
|
||||
*/
|
||||
import { useState, useEffect, useMemo, useCallback } from 'react';
|
||||
import { createSignal, createEffect, onCleanup, createMemo, Show, For } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { getVersion } from '../utils/helpers.js';
|
||||
|
||||
// Premium ASCII art logo - clean geometric design
|
||||
const LOGO_FRAMES = [
|
||||
// Frame 1 - Dots appear
|
||||
[
|
||||
' ',
|
||||
' · · · · · · · · · · · · · · · ',
|
||||
' ',
|
||||
],
|
||||
// Frame 2 - Lines form
|
||||
[
|
||||
' ',
|
||||
' ━━━ ━ ━ ━ ━ ━ ━ ━ ━━━ ',
|
||||
' ',
|
||||
],
|
||||
// Frame 3 - Structure emerges
|
||||
[
|
||||
' ┌──┐ ┬ ┌─ ┬ ┬ ┬ ┬ ┌─ ┬ ┌─┐ ',
|
||||
' └──┐ │ │ │ │ │ │ │ │ │ ',
|
||||
' └──┘ ┴ └─ ┴ ┴─┘ ┴─┘ ┴ └─ ┴ ┴ ',
|
||||
],
|
||||
// Frame 4 - Bold letters
|
||||
[
|
||||
' ╔═╗ ╦╔═ ╦ ╦ ╦ ╦╔═ ╦╔╦╗ ',
|
||||
' ╚═╗ ╠╩╗ ║ ║ ║ ╠╩╗ ║ ║ ',
|
||||
' ╚═╝ ╩ ╩ ╩ ╩═╝ ╩═╝ ╩ ╩ ╩ ╩ ',
|
||||
],
|
||||
// Frame 5 - Final premium logo
|
||||
[
|
||||
' ███████╗██╗ ██╗██╗██╗ ██╗ ██╗ ██╗██╗████████╗',
|
||||
' ██╔════╝██║ ██╔╝██║██║ ██║ ██║ ██╔╝██║╚══██╔══╝',
|
||||
@@ -44,24 +33,20 @@ const LOGO_FRAMES = [
|
||||
],
|
||||
];
|
||||
|
||||
// Compact logo for smaller terminals
|
||||
const LOGO_SMALL = [
|
||||
' ╔═╗╦╔═╦╦ ╦ ╦╔═╦╔╦╗ ',
|
||||
' ╚═╗╠╩╗║║ ║ ╠╩╗║ ║ ',
|
||||
' ╚═╝╩ ╩╩╩═╝╩═╝╩ ╩╩ ╩ ',
|
||||
];
|
||||
|
||||
// Elegant spinner frames
|
||||
const SPINNER = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
||||
|
||||
// Progress bar characters
|
||||
const PROGRESS = {
|
||||
empty: '░',
|
||||
filled: '█',
|
||||
head: '▓',
|
||||
};
|
||||
|
||||
// Loading phases with elegant messaging
|
||||
const PHASES = [
|
||||
{ message: 'Initializing', detail: 'skill engine' },
|
||||
{ message: 'Connecting', detail: 'agent network' },
|
||||
@@ -75,48 +60,48 @@ interface SplashProps {
|
||||
duration?: number;
|
||||
}
|
||||
|
||||
export function Splash({ onComplete, duration = 3500 }: SplashProps) {
|
||||
const [frame, setFrame] = useState(0);
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [spinnerFrame, setSpinnerFrame] = useState(0);
|
||||
const [phase, setPhase] = useState(0);
|
||||
const [fadeIn, setFadeIn] = useState(0);
|
||||
const [particles, setParticles] = useState<string[]>([]);
|
||||
export function Splash(props: SplashProps) {
|
||||
const [frame, setFrame] = createSignal(0);
|
||||
const [progress, setProgress] = createSignal(0);
|
||||
const [spinnerFrame, setSpinnerFrame] = createSignal(0);
|
||||
const [phase, setPhase] = createSignal(0);
|
||||
const [fadeIn, setFadeIn] = createSignal(0);
|
||||
const [particles, setParticles] = createSignal<string[]>([]);
|
||||
|
||||
// Cache version to avoid repeated sync file I/O on every render
|
||||
const version = useMemo(() => getVersion(), []);
|
||||
const version = createMemo(() => getVersion());
|
||||
const cols = process.stdout.columns || 80;
|
||||
const rows = process.stdout.rows || 24;
|
||||
const useSmallLogo = cols < 70;
|
||||
const currentLogo = useSmallLogo ? LOGO_SMALL : (LOGO_FRAMES[Math.min(frame, 4)] || LOGO_FRAMES[4]);
|
||||
const maxWidth = Math.max(...currentLogo.map(l => l.length));
|
||||
|
||||
// Generate ambient particles - returns fresh randomized string each call
|
||||
const generateParticles = useCallback(() => {
|
||||
const currentLogo = () => {
|
||||
return useSmallLogo ? LOGO_SMALL : (LOGO_FRAMES[Math.min(frame(), 4)] || LOGO_FRAMES[4]);
|
||||
};
|
||||
|
||||
const maxWidth = () => Math.max(...currentLogo().map((l) => l.length));
|
||||
|
||||
const generateParticles = () => {
|
||||
const chars = ['·', '∙', '•', '○', '◦', '◌', '◍', '◎'];
|
||||
return Array(cols).fill(0).map(() =>
|
||||
Math.random() > 0.97 ? chars[Math.floor(Math.random() * chars.length)] : ' '
|
||||
).join('');
|
||||
}, [cols]);
|
||||
return Array(cols)
|
||||
.fill(0)
|
||||
.map(() => (Math.random() > 0.97 ? chars[Math.floor(Math.random() * chars.length)] : ' '))
|
||||
.join('');
|
||||
};
|
||||
|
||||
// Logo reveal animation
|
||||
useEffect(() => {
|
||||
if (frame >= 4) return;
|
||||
const timer = setTimeout(() => setFrame(f => f + 1), 200);
|
||||
return () => clearTimeout(timer);
|
||||
}, [frame]);
|
||||
createEffect(() => {
|
||||
if (frame() >= 4) return;
|
||||
const timer = setTimeout(() => setFrame((f) => f + 1), 200);
|
||||
onCleanup(() => clearTimeout(timer));
|
||||
});
|
||||
|
||||
// Fade in effect
|
||||
useEffect(() => {
|
||||
if (fadeIn >= 10) return;
|
||||
const timer = setTimeout(() => setFadeIn(f => f + 1), 50);
|
||||
return () => clearTimeout(timer);
|
||||
}, [fadeIn]);
|
||||
createEffect(() => {
|
||||
if (fadeIn() >= 10) return;
|
||||
const timer = setTimeout(() => setFadeIn((f) => f + 1), 50);
|
||||
onCleanup(() => clearTimeout(timer));
|
||||
});
|
||||
|
||||
// Progress animation
|
||||
useEffect(() => {
|
||||
createEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
setProgress(p => {
|
||||
setProgress((p) => {
|
||||
const newProgress = p + (Math.random() * 3 + 1);
|
||||
if (newProgress >= 100) {
|
||||
clearInterval(interval);
|
||||
@@ -125,137 +110,130 @@ export function Splash({ onComplete, duration = 3500 }: SplashProps) {
|
||||
return newProgress;
|
||||
});
|
||||
}, 50);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
onCleanup(() => clearInterval(interval));
|
||||
});
|
||||
|
||||
// Phase progression
|
||||
useEffect(() => {
|
||||
const phaseProgress = progress / 20;
|
||||
createEffect(() => {
|
||||
const phaseProgress = progress() / 20;
|
||||
setPhase(Math.min(Math.floor(phaseProgress), PHASES.length - 1));
|
||||
}, [progress]);
|
||||
});
|
||||
|
||||
// Spinner animation
|
||||
useEffect(() => {
|
||||
createEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
setSpinnerFrame(f => (f + 1) % SPINNER.length);
|
||||
setSpinnerFrame((f) => (f + 1) % SPINNER.length);
|
||||
}, 80);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
onCleanup(() => clearInterval(interval));
|
||||
});
|
||||
|
||||
// Particle animation
|
||||
useEffect(() => {
|
||||
createEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
setParticles(prev => {
|
||||
setParticles((prev) => {
|
||||
const newParticles = [...prev];
|
||||
if (newParticles.length > 3) newParticles.shift();
|
||||
newParticles.push(generateParticles());
|
||||
return newParticles;
|
||||
});
|
||||
}, 150);
|
||||
return () => clearInterval(interval);
|
||||
}, [generateParticles]);
|
||||
onCleanup(() => clearInterval(interval));
|
||||
});
|
||||
|
||||
// Auto-complete
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(onComplete, duration);
|
||||
return () => clearTimeout(timer);
|
||||
}, [onComplete, duration]);
|
||||
createEffect(() => {
|
||||
const timer = setTimeout(props.onComplete, props.duration ?? 3500);
|
||||
onCleanup(() => clearTimeout(timer));
|
||||
});
|
||||
|
||||
const pad = ' '.repeat(Math.max(0, Math.floor((cols - maxWidth) / 2)));
|
||||
const pad = () => ' '.repeat(Math.max(0, Math.floor((cols - maxWidth()) / 2)));
|
||||
const progressWidth = Math.max(1, Math.min(40, cols - 20));
|
||||
const progressPad = ' '.repeat(Math.max(0, Math.floor((cols - progressWidth) / 2)));
|
||||
|
||||
const filledWidth = Math.min(Math.floor((progress / 100) * progressWidth), progressWidth);
|
||||
const emptyWidth = Math.max(0, progressWidth - filledWidth - 1);
|
||||
const progressBar = PROGRESS.filled.repeat(filledWidth) +
|
||||
(filledWidth < progressWidth ? PROGRESS.head : '') +
|
||||
PROGRESS.empty.repeat(emptyWidth);
|
||||
const filledWidth = () => Math.min(Math.floor((progress() / 100) * progressWidth), progressWidth);
|
||||
const emptyWidth = () => Math.max(0, progressWidth - filledWidth() - 1);
|
||||
const progressBar = () =>
|
||||
PROGRESS.filled.repeat(filledWidth()) +
|
||||
(filledWidth() < progressWidth ? PROGRESS.head : '') +
|
||||
PROGRESS.empty.repeat(emptyWidth());
|
||||
|
||||
const currentPhase = PHASES[phase];
|
||||
const currentPhase = () => PHASES[phase()];
|
||||
|
||||
return (
|
||||
<box flexDirection="column" height={rows}>
|
||||
{/* Top ambient particles */}
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{particles[0] || ''}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{particles()[0] || ''}</text>
|
||||
|
||||
{/* Spacer */}
|
||||
<box flexGrow={1} />
|
||||
|
||||
{/* Logo */}
|
||||
<box flexDirection="column" alignItems="center">
|
||||
{currentLogo.map((line, idx) => (
|
||||
<text key={idx} fg={frame >= 4 ? terminalColors.accent : terminalColors.textMuted}>
|
||||
{frame >= 4 ? <b>{pad}{line}</b> : <>{pad}{line}</>}
|
||||
</text>
|
||||
))}
|
||||
<For each={currentLogo()}>
|
||||
{(line, idx) => (
|
||||
<text fg={frame() >= 4 ? terminalColors.accent : terminalColors.textMuted}>
|
||||
{frame() >= 4 ? (
|
||||
<b>
|
||||
{pad()}
|
||||
{line}
|
||||
</b>
|
||||
) : (
|
||||
<>
|
||||
{pad()}
|
||||
{line}
|
||||
</>
|
||||
)}
|
||||
</text>
|
||||
)}
|
||||
</For>
|
||||
</box>
|
||||
|
||||
{/* Tagline with fade-in */}
|
||||
<text> </text>
|
||||
{fadeIn > 3 && (
|
||||
<Show when={fadeIn() > 3}>
|
||||
<text fg={terminalColors.textSecondary}>
|
||||
{pad}{' '}universal skills for ai coding agents
|
||||
{pad()}
|
||||
{' '}universal skills for ai coding agents
|
||||
</text>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Version badge */}
|
||||
{fadeIn > 5 && (
|
||||
<>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{pad}{' '}v{version}
|
||||
</text>
|
||||
</>
|
||||
)}
|
||||
<Show when={fadeIn() > 5}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{pad()}
|
||||
{' '}v{version()}
|
||||
</text>
|
||||
</Show>
|
||||
|
||||
{/* Spacer */}
|
||||
<text> </text>
|
||||
<text> </text>
|
||||
|
||||
{/* Progress section */}
|
||||
{fadeIn > 7 && (
|
||||
<Show when={fadeIn() > 7}>
|
||||
<box flexDirection="column" alignItems="center">
|
||||
{/* Status line */}
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.accent}>
|
||||
{progressPad}{SPINNER[spinnerFrame]}{' '}
|
||||
{progressPad}
|
||||
{SPINNER[spinnerFrame()]}{' '}
|
||||
</text>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>{currentPhase.message}</b>
|
||||
<b>{currentPhase().message}</b>
|
||||
</text>
|
||||
{currentPhase.detail && (
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{' '}{currentPhase.detail}
|
||||
</text>
|
||||
)}
|
||||
<Show when={currentPhase().detail}>
|
||||
<text fg={terminalColors.textMuted}> {currentPhase().detail}</text>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
{/* Progress bar */}
|
||||
<text> </text>
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.textMuted}>{progressPad}[</text>
|
||||
<text fg={terminalColors.accent}>{progressBar}</text>
|
||||
<text fg={terminalColors.accent}>{progressBar()}</text>
|
||||
<text fg={terminalColors.textMuted}>]</text>
|
||||
<text fg={terminalColors.textSecondary}>{' '}{Math.floor(progress)}%</text>
|
||||
<text fg={terminalColors.textSecondary}> {Math.floor(progress())}%</text>
|
||||
</box>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Spacer */}
|
||||
<box flexGrow={1} />
|
||||
|
||||
{/* Bottom hint */}
|
||||
<box flexDirection="column" alignItems="center">
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{progressPad}{' '}press any key to skip
|
||||
{progressPad}
|
||||
{' '}press any key to skip
|
||||
</text>
|
||||
<text> </text>
|
||||
{/* Bottom particles */}
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{particles[1] || ''}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{particles()[1] || ''}</text>
|
||||
</box>
|
||||
</box>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* SplitPane Component
|
||||
* Horizontal/vertical split layout
|
||||
*/
|
||||
|
||||
import { Show, type JSX } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
interface SplitPaneProps {
|
||||
direction?: 'horizontal' | 'vertical';
|
||||
primarySize?: number | string;
|
||||
secondarySize?: number | string;
|
||||
showDivider?: boolean;
|
||||
dividerChar?: string;
|
||||
primary: JSX.Element;
|
||||
secondary?: JSX.Element;
|
||||
gap?: number;
|
||||
}
|
||||
|
||||
export function SplitPane(props: SplitPaneProps) {
|
||||
const direction = () => props.direction ?? 'horizontal';
|
||||
const showDivider = () => props.showDivider ?? true;
|
||||
const dividerChar = () => props.dividerChar ?? (direction() === 'horizontal' ? '│' : '─');
|
||||
const gap = () => props.gap ?? 1;
|
||||
|
||||
const flexDir = () => (direction() === 'horizontal' ? 'row' : 'column');
|
||||
|
||||
const primaryWidth = () => {
|
||||
if (direction() === 'vertical') return undefined;
|
||||
if (props.primarySize !== undefined) return props.primarySize;
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const primaryHeight = () => {
|
||||
if (direction() === 'horizontal') return undefined;
|
||||
if (props.primarySize !== undefined) return props.primarySize;
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const secondaryWidth = () => {
|
||||
if (direction() === 'vertical') return undefined;
|
||||
if (props.secondarySize !== undefined) return props.secondarySize;
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const secondaryHeight = () => {
|
||||
if (direction() === 'horizontal') return undefined;
|
||||
if (props.secondarySize !== undefined) return props.secondarySize;
|
||||
return undefined;
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection={flexDir()}>
|
||||
<box
|
||||
width={primaryWidth()}
|
||||
height={primaryHeight()}
|
||||
flexGrow={primaryWidth() === undefined && primaryHeight() === undefined ? 1 : undefined}
|
||||
>
|
||||
{props.primary}
|
||||
</box>
|
||||
|
||||
<Show when={props.secondary && showDivider()}>
|
||||
<box
|
||||
width={direction() === 'horizontal' ? gap() : undefined}
|
||||
height={direction() === 'vertical' ? gap() : undefined}
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
>
|
||||
<text fg={terminalColors.border}>{dividerChar()}</text>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={props.secondary}>
|
||||
<box
|
||||
width={secondaryWidth()}
|
||||
height={secondaryHeight()}
|
||||
flexGrow={secondaryWidth() === undefined && secondaryHeight() === undefined ? 1 : undefined}
|
||||
>
|
||||
{props.secondary}
|
||||
</box>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface ThreePaneLayoutProps {
|
||||
left?: JSX.Element;
|
||||
center: JSX.Element;
|
||||
right?: JSX.Element;
|
||||
leftWidth?: number;
|
||||
rightWidth?: number;
|
||||
showLeftDivider?: boolean;
|
||||
showRightDivider?: boolean;
|
||||
}
|
||||
|
||||
export function ThreePaneLayout(props: ThreePaneLayoutProps) {
|
||||
const leftWidth = () => props.leftWidth ?? 20;
|
||||
const rightWidth = () => props.rightWidth ?? 30;
|
||||
|
||||
return (
|
||||
<box flexDirection="row" flexGrow={1}>
|
||||
<Show when={props.left}>
|
||||
<box width={leftWidth()}>{props.left}</box>
|
||||
<Show when={props.showLeftDivider !== false}>
|
||||
<box width={1}>
|
||||
<text fg={terminalColors.border}>│</text>
|
||||
</box>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<box flexGrow={1}>{props.center}</box>
|
||||
|
||||
<Show when={props.right}>
|
||||
<Show when={props.showRightDivider !== false}>
|
||||
<box width={1}>
|
||||
<text fg={terminalColors.border}>│</text>
|
||||
</box>
|
||||
</Show>
|
||||
<box width={rightWidth()}>{props.right}</box>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
/**
|
||||
* StatsCard Component
|
||||
* OpenSync-style stats display with optional animations
|
||||
*/
|
||||
import { useState, useEffect } from 'react';
|
||||
import { createSignal, createEffect, onCleanup, For } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { animations } from '../theme/animations.js';
|
||||
|
||||
@@ -17,27 +13,26 @@ interface StatsCardProps {
|
||||
animated?: boolean;
|
||||
}
|
||||
|
||||
export function StatsCard({ items, animated = true }: StatsCardProps) {
|
||||
const [displayValues, setDisplayValues] = useState<number[]>(() =>
|
||||
animated ? items.map(() => 0) : items.map((item) => item.value)
|
||||
export function StatsCard(props: StatsCardProps) {
|
||||
const animated = () => props.animated ?? true;
|
||||
|
||||
const [displayValues, setDisplayValues] = createSignal<number[]>(
|
||||
animated() ? props.items.map(() => 0) : props.items.map((item) => item.value)
|
||||
);
|
||||
const [animComplete, setAnimComplete] = useState(!animated);
|
||||
const [prevItemsLength, setPrevItemsLength] = useState(items.length);
|
||||
const [animComplete, setAnimComplete] = createSignal(!animated());
|
||||
|
||||
useEffect(() => {
|
||||
if (items.length !== prevItemsLength) {
|
||||
setPrevItemsLength(items.length);
|
||||
setDisplayValues(animated ? items.map(() => 0) : items.map((item) => item.value));
|
||||
setAnimComplete(!animated);
|
||||
}
|
||||
}, [items, prevItemsLength, animated]);
|
||||
createEffect(() => {
|
||||
const newValues = animated() ? props.items.map(() => 0) : props.items.map((item) => item.value);
|
||||
setDisplayValues(newValues);
|
||||
setAnimComplete(!animated());
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!animated || animComplete) return;
|
||||
createEffect(() => {
|
||||
if (!animated() || animComplete()) return;
|
||||
|
||||
const duration = animations.countUp.duration;
|
||||
const startTime = Date.now();
|
||||
const targetValues = items.map((item) => item.value);
|
||||
const targetValues = props.items.map((item) => item.value);
|
||||
const frameInterval = 16;
|
||||
|
||||
const intervalId = setInterval(() => {
|
||||
@@ -45,10 +40,7 @@ export function StatsCard({ items, animated = true }: StatsCardProps) {
|
||||
const progress = Math.min(elapsed / duration, 1);
|
||||
const eased = 1 - Math.pow(1 - progress, 4);
|
||||
|
||||
const newValues = targetValues.map((target) =>
|
||||
Math.round(target * eased)
|
||||
);
|
||||
|
||||
const newValues = targetValues.map((target) => Math.round(target * eased));
|
||||
setDisplayValues(newValues);
|
||||
|
||||
if (progress >= 1) {
|
||||
@@ -57,32 +49,31 @@ export function StatsCard({ items, animated = true }: StatsCardProps) {
|
||||
}
|
||||
}, frameInterval);
|
||||
|
||||
return () => clearInterval(intervalId);
|
||||
}, [animated, animComplete, items]);
|
||||
onCleanup(() => clearInterval(intervalId));
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="row" gap={2}>
|
||||
{items.map((item, index) => {
|
||||
const fg = item.color
|
||||
? terminalColors[item.color]
|
||||
: terminalColors.text;
|
||||
<For each={props.items}>
|
||||
{(item, index) => {
|
||||
const fg = () => (item.color ? terminalColors[item.color] : terminalColors.text);
|
||||
|
||||
return (
|
||||
<box
|
||||
key={item.label}
|
||||
flexDirection="column"
|
||||
alignItems="center"
|
||||
padding={2}
|
||||
borderStyle="single"
|
||||
borderColor={terminalColors.border}
|
||||
>
|
||||
<text fg={fg}>
|
||||
<b>{String(displayValues[index])}</b>
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{item.label}</text>
|
||||
</box>
|
||||
);
|
||||
})}
|
||||
return (
|
||||
<box
|
||||
flexDirection="column"
|
||||
alignItems="center"
|
||||
padding={2}
|
||||
borderStyle="single"
|
||||
borderColor={terminalColors.border}
|
||||
>
|
||||
<text fg={fg()}>
|
||||
<b>{String(displayValues()[index()])}</b>
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{item.label}</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/**
|
||||
* StatusBar Component
|
||||
* Bottom status bar with keyboard shortcuts
|
||||
*/
|
||||
import { Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { STATUS_BAR_SHORTCUTS } from '../state/types.js';
|
||||
|
||||
@@ -11,11 +8,10 @@ interface StatusBarProps {
|
||||
shortcuts?: string;
|
||||
}
|
||||
|
||||
export function StatusBar({
|
||||
message,
|
||||
messageType = 'info',
|
||||
shortcuts = STATUS_BAR_SHORTCUTS,
|
||||
}: StatusBarProps) {
|
||||
export function StatusBar(props: StatusBarProps) {
|
||||
const messageType = () => props.messageType ?? 'info';
|
||||
const shortcuts = () => props.shortcuts ?? STATUS_BAR_SHORTCUTS;
|
||||
|
||||
const messageColors = {
|
||||
info: terminalColors.info,
|
||||
success: terminalColors.success,
|
||||
@@ -25,14 +21,10 @@ export function StatusBar({
|
||||
|
||||
return (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{'\u2500'.repeat(70)}
|
||||
</text>
|
||||
{message ? (
|
||||
<text fg={messageColors[messageType]}>{message}</text>
|
||||
) : (
|
||||
<text fg={terminalColors.textMuted}>{shortcuts}</text>
|
||||
)}
|
||||
<text fg={terminalColors.textMuted}>{'\u2500'.repeat(70)}</text>
|
||||
<Show when={props.message} fallback={<text fg={terminalColors.textMuted}>{shortcuts()}</text>}>
|
||||
<text fg={messageColors[messageType()]}>{props.message}</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* StatusIndicator Component
|
||||
* Loading/success/error/warning indicator
|
||||
*/
|
||||
|
||||
import { Show, createSignal, createEffect, onCleanup } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
export type StatusType = 'loading' | 'success' | 'error' | 'warning' | 'info' | 'pending';
|
||||
|
||||
interface StatusIndicatorProps {
|
||||
status: StatusType;
|
||||
label?: string;
|
||||
showLabel?: boolean;
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
animated?: boolean;
|
||||
}
|
||||
|
||||
const STATUS_ICONS: Record<StatusType, string> = {
|
||||
loading: '⟳',
|
||||
success: '✓',
|
||||
error: '✗',
|
||||
warning: '⚠',
|
||||
info: 'ℹ',
|
||||
pending: '○',
|
||||
};
|
||||
|
||||
const STATUS_COLORS: Record<StatusType, string> = {
|
||||
loading: terminalColors.accent,
|
||||
success: terminalColors.success,
|
||||
error: terminalColors.error,
|
||||
warning: terminalColors.warning,
|
||||
info: terminalColors.info,
|
||||
pending: terminalColors.textMuted,
|
||||
};
|
||||
|
||||
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
||||
|
||||
export function StatusIndicator(props: StatusIndicatorProps) {
|
||||
const [spinnerFrame, setSpinnerFrame] = createSignal(0);
|
||||
const showLabel = () => props.showLabel ?? true;
|
||||
const animated = () => props.animated ?? true;
|
||||
|
||||
createEffect(() => {
|
||||
if (props.status === 'loading' && animated()) {
|
||||
const interval = setInterval(() => {
|
||||
setSpinnerFrame((f) => (f + 1) % SPINNER_FRAMES.length);
|
||||
}, 80);
|
||||
onCleanup(() => clearInterval(interval));
|
||||
}
|
||||
});
|
||||
|
||||
const icon = () => {
|
||||
if (props.status === 'loading' && animated()) {
|
||||
return SPINNER_FRAMES[spinnerFrame()];
|
||||
}
|
||||
return STATUS_ICONS[props.status];
|
||||
};
|
||||
|
||||
const color = () => STATUS_COLORS[props.status];
|
||||
|
||||
const defaultLabel = () => {
|
||||
switch (props.status) {
|
||||
case 'loading':
|
||||
return 'Loading...';
|
||||
case 'success':
|
||||
return 'Success';
|
||||
case 'error':
|
||||
return 'Error';
|
||||
case 'warning':
|
||||
return 'Warning';
|
||||
case 'info':
|
||||
return 'Info';
|
||||
case 'pending':
|
||||
return 'Pending';
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="row">
|
||||
<text fg={color()}>{icon()}</text>
|
||||
<Show when={showLabel()}>
|
||||
<text fg={color()}> {props.label ?? defaultLabel()}</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface InlineStatusProps {
|
||||
status: StatusType;
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
export function InlineStatus(props: InlineStatusProps) {
|
||||
const icon = () => {
|
||||
if (props.status === 'loading' || props.status === 'pending') {
|
||||
return '○';
|
||||
}
|
||||
return '●';
|
||||
};
|
||||
|
||||
return <text fg={STATUS_COLORS[props.status]}>{icon()}</text>;
|
||||
}
|
||||
|
||||
interface StatusBadgeProps {
|
||||
status: StatusType;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export function StatusBadge(props: StatusBadgeProps) {
|
||||
return (
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.textMuted}>[</text>
|
||||
<text fg={STATUS_COLORS[props.status]}>{props.label}</text>
|
||||
<text fg={terminalColors.textMuted}>]</text>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* TabBar Component
|
||||
* Clickable tab navigation
|
||||
*/
|
||||
|
||||
import { For, Show } from 'solid-js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
export interface Tab {
|
||||
id: string;
|
||||
label: string;
|
||||
icon?: string;
|
||||
badge?: string | number;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
interface TabBarProps {
|
||||
tabs: Tab[];
|
||||
activeId: string;
|
||||
hoveredId?: string | null;
|
||||
onSelect?: (id: string) => void;
|
||||
variant?: 'default' | 'pills' | 'underline';
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
showShortcuts?: boolean;
|
||||
}
|
||||
|
||||
export function TabBar(props: TabBarProps) {
|
||||
const variant = () => props.variant ?? 'default';
|
||||
const size = () => props.size ?? 'md';
|
||||
const showShortcuts = () => props.showShortcuts ?? false;
|
||||
|
||||
const gap = () => {
|
||||
switch (size()) {
|
||||
case 'sm':
|
||||
return 1;
|
||||
case 'lg':
|
||||
return 3;
|
||||
default:
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="row">
|
||||
<For each={props.tabs}>
|
||||
{(tab, index) => {
|
||||
const isActive = () => tab.id === props.activeId;
|
||||
const isHovered = () => tab.id === props.hoveredId;
|
||||
const isDisabled = () => tab.disabled ?? false;
|
||||
|
||||
const fg = () => {
|
||||
if (isDisabled()) return terminalColors.textMuted;
|
||||
if (isActive()) return terminalColors.accent;
|
||||
if (isHovered()) return terminalColors.text;
|
||||
return terminalColors.textSecondary;
|
||||
};
|
||||
|
||||
const decoration = () => {
|
||||
if (variant() === 'underline' && isActive()) {
|
||||
return '─';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
const brackets = () => {
|
||||
if (variant() === 'pills') {
|
||||
if (isActive()) return { left: '[', right: ']' };
|
||||
return { left: ' ', right: ' ' };
|
||||
}
|
||||
return { left: '', right: '' };
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
if (!isDisabled() && props.onSelect) {
|
||||
props.onSelect(tab.id);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column" marginRight={index() < props.tabs.length - 1 ? gap() : 0} onClick={handleClick}>
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.border}>{brackets().left}</text>
|
||||
<Show when={tab.icon}>
|
||||
<text fg={fg()}>{tab.icon} </text>
|
||||
</Show>
|
||||
<text fg={fg()}>{tab.label}</text>
|
||||
<Show when={tab.badge !== undefined}>
|
||||
<text fg={terminalColors.textMuted}> ({tab.badge})</text>
|
||||
</Show>
|
||||
<Show when={showShortcuts()}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{' '}
|
||||
{String(index() + 1)}
|
||||
</text>
|
||||
</Show>
|
||||
<text fg={terminalColors.border}>{brackets().right}</text>
|
||||
</box>
|
||||
<Show when={variant() === 'underline'}>
|
||||
<text fg={isActive() ? terminalColors.accent : 'transparent'}>
|
||||
{decoration().repeat(tab.label.length + (tab.icon ? 2 : 0))}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
interface VerticalTabBarProps {
|
||||
tabs: Tab[];
|
||||
activeId: string;
|
||||
hoveredId?: string | null;
|
||||
onSelect?: (id: string) => void;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export function VerticalTabBar(props: VerticalTabBarProps) {
|
||||
const width = () => props.width ?? 20;
|
||||
|
||||
return (
|
||||
<box flexDirection="column" width={width()}>
|
||||
<For each={props.tabs}>
|
||||
{(tab) => {
|
||||
const isActive = () => tab.id === props.activeId;
|
||||
const isHovered = () => tab.id === props.hoveredId;
|
||||
const isDisabled = () => tab.disabled ?? false;
|
||||
|
||||
const fg = () => {
|
||||
if (isDisabled()) return terminalColors.textMuted;
|
||||
if (isActive()) return terminalColors.accent;
|
||||
if (isHovered()) return terminalColors.text;
|
||||
return terminalColors.textSecondary;
|
||||
};
|
||||
|
||||
const prefix = () => {
|
||||
if (isActive()) return '▸ ';
|
||||
if (isHovered()) return '▹ ';
|
||||
return ' ';
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
if (!isDisabled() && props.onSelect) {
|
||||
props.onSelect(tab.id);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<box
|
||||
flexDirection="row"
|
||||
marginBottom={1}
|
||||
onClick={handleClick}
|
||||
>
|
||||
<text fg={fg()}>{prefix()}</text>
|
||||
<Show when={tab.icon}>
|
||||
<text fg={fg()}>{tab.icon} </text>
|
||||
</Show>
|
||||
<text fg={fg()}>{tab.label}</text>
|
||||
<Show when={tab.badge !== undefined}>
|
||||
<text fg={terminalColors.textMuted}> ({tab.badge})</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
* Components module for SkillKit TUI
|
||||
*/
|
||||
|
||||
// Existing components
|
||||
export { AgentGrid } from './AgentGrid.js';
|
||||
export { StatsCard } from './StatsCard.js';
|
||||
export { Header } from './Header.js';
|
||||
export { Sidebar } from './Sidebar.js';
|
||||
export { RightSidebar } from './RightSidebar.js';
|
||||
export { BottomStatusBar } from './BottomStatusBar.js';
|
||||
export { StatusBar } from './StatusBar.js';
|
||||
export { SkillList } from './SkillList.js';
|
||||
export { SearchInput } from './SearchInput.js';
|
||||
@@ -13,3 +16,50 @@ export { Spinner } from './Spinner.js';
|
||||
export { ProgressBar } from './ProgressBar.js';
|
||||
export { FeatureList, FEATURES, type Feature } from './FeatureList.js';
|
||||
export { Splash } from './Splash.js';
|
||||
|
||||
// New components (Phase 1.3)
|
||||
export { SelectList, type SelectListItem } from './SelectList.js';
|
||||
export { DetailPane, type DetailField } from './DetailPane.js';
|
||||
export { SplitPane, ThreePaneLayout } from './SplitPane.js';
|
||||
export { EmptyState, LoadingState, ErrorState } from './EmptyState.js';
|
||||
export {
|
||||
StatusIndicator,
|
||||
InlineStatus,
|
||||
StatusBadge,
|
||||
type StatusType,
|
||||
} from './StatusIndicator.js';
|
||||
export { CodeBlock, InlineCode } from './CodeBlock.js';
|
||||
export { FormField, TextAreaField, SelectField } from './FormField.js';
|
||||
export { ErrorBoundary, Try } from './ErrorBoundary.js';
|
||||
export {
|
||||
Button,
|
||||
ButtonGroup,
|
||||
IconButton,
|
||||
type ButtonVariant,
|
||||
type ButtonSize,
|
||||
} from './Button.js';
|
||||
export {
|
||||
Clickable,
|
||||
ClickableText,
|
||||
ClickableRow,
|
||||
InteractiveArea,
|
||||
} from './Clickable.js';
|
||||
export {
|
||||
HoverHighlight,
|
||||
HighlightableListItem,
|
||||
FocusRing,
|
||||
PressEffect,
|
||||
} from './HoverHighlight.js';
|
||||
export {
|
||||
AnimatedText,
|
||||
CountUpText,
|
||||
BlinkingText,
|
||||
PulsingText,
|
||||
} from './AnimatedText.js';
|
||||
export { TabBar, VerticalTabBar, type Tab } from './TabBar.js';
|
||||
export {
|
||||
Breadcrumb,
|
||||
PathBreadcrumb,
|
||||
NavigationTrail,
|
||||
type BreadcrumbItem,
|
||||
} from './Breadcrumb.js';
|
||||
|
||||
+34
-22
@@ -1,40 +1,52 @@
|
||||
import { createCliRenderer } from '@opentui/core';
|
||||
import { createRoot } from '@opentui/react';
|
||||
import { render } from '@opentui/solid';
|
||||
import { App } from './App.js';
|
||||
|
||||
let rootInstance: ReturnType<typeof createRoot> | null = null;
|
||||
let isRunning = true;
|
||||
let renderer: Awaited<ReturnType<typeof createCliRenderer>> | null = null;
|
||||
|
||||
export function exitTUI(code = 0): void {
|
||||
if (!isRunning) return;
|
||||
isRunning = false;
|
||||
|
||||
try {
|
||||
// Unmount React tree first
|
||||
if (rootInstance) {
|
||||
try {
|
||||
rootInstance.unmount();
|
||||
} catch {
|
||||
// Ignore unmount errors
|
||||
}
|
||||
rootInstance = null;
|
||||
if (renderer && 'dispose' in renderer) {
|
||||
(renderer as { dispose?: () => void }).dispose?.();
|
||||
}
|
||||
} catch {}
|
||||
|
||||
// Restore terminal state: exit alt screen, show cursor, reset attributes, clear
|
||||
try {
|
||||
process.stdout.write('\x1b[?1049l\x1b[?25h\x1b[0m\x1b[H\x1b[2J');
|
||||
} catch {
|
||||
// Ignore write errors
|
||||
}
|
||||
} catch {}
|
||||
|
||||
// Use setImmediate to allow any pending operations to complete
|
||||
setImmediate(() => process.exit(code));
|
||||
}
|
||||
|
||||
export async function startTUI(): Promise<never> {
|
||||
// Setup signal handlers for clean exit
|
||||
const handleSignal = () => exitTUI(0);
|
||||
process.on('SIGINT', handleSignal);
|
||||
process.on('SIGTERM', handleSignal);
|
||||
process.on('SIGINT', () => exitTUI(0));
|
||||
process.on('SIGTERM', () => exitTUI(0));
|
||||
process.on('uncaughtException', (err) => {
|
||||
console.error('TUI Error:', err.message);
|
||||
exitTUI(1);
|
||||
});
|
||||
process.on('unhandledRejection', (err) => {
|
||||
console.error('TUI Error:', err);
|
||||
exitTUI(1);
|
||||
});
|
||||
|
||||
renderer = await createCliRenderer({
|
||||
exitOnCtrlC: false,
|
||||
useMouse: true,
|
||||
enableMouseMovement: true,
|
||||
});
|
||||
|
||||
try {
|
||||
await render(() => <App onExit={exitTUI} />, renderer);
|
||||
} catch (err) {
|
||||
console.error('Render failed:', err);
|
||||
exitTUI(1);
|
||||
}
|
||||
|
||||
const renderer = await createCliRenderer({ exitOnCtrlC: false });
|
||||
rootInstance = createRoot(renderer);
|
||||
rootInstance.render(<App onExit={exitTUI} />);
|
||||
return new Promise(() => {});
|
||||
}
|
||||
|
||||
|
||||
Vendored
-55
@@ -1,55 +0,0 @@
|
||||
/**
|
||||
* Type declarations for OpenTUI React JSX elements
|
||||
* Overrides React's JSX namespace to include OpenTUI elements
|
||||
*/
|
||||
import * as React from 'react';
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
box: React.PropsWithChildren<{
|
||||
flexDirection?: 'row' | 'column';
|
||||
flexGrow?: number;
|
||||
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch';
|
||||
justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around';
|
||||
width?: number | string;
|
||||
height?: number | string;
|
||||
padding?: number;
|
||||
paddingLeft?: number;
|
||||
paddingRight?: number;
|
||||
paddingTop?: number;
|
||||
paddingBottom?: number;
|
||||
paddingX?: number;
|
||||
paddingY?: number;
|
||||
margin?: number;
|
||||
marginLeft?: number;
|
||||
marginRight?: number;
|
||||
marginTop?: number;
|
||||
marginBottom?: number;
|
||||
marginX?: number;
|
||||
marginY?: number;
|
||||
gap?: number;
|
||||
border?: boolean;
|
||||
borderStyle?: 'single' | 'double' | 'rounded';
|
||||
borderColor?: string;
|
||||
backgroundColor?: string;
|
||||
color?: string;
|
||||
bold?: boolean;
|
||||
dim?: boolean;
|
||||
title?: string;
|
||||
style?: Record<string, unknown>;
|
||||
key?: React.Key;
|
||||
}>;
|
||||
text: React.PropsWithChildren<{
|
||||
color?: string;
|
||||
bold?: boolean;
|
||||
dim?: boolean;
|
||||
attributes?: number;
|
||||
width?: number;
|
||||
key?: React.Key;
|
||||
}>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
+302
-131
@@ -1,7 +1,19 @@
|
||||
import { useState, useEffect, useMemo, useCallback } from 'react';
|
||||
import { useKeyboard } from '@opentui/react';
|
||||
import { type Screen, DEFAULT_REPOS } from '../state/index.js';
|
||||
import { createSignal, createEffect, createMemo, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import {
|
||||
type Screen,
|
||||
DEFAULT_REPOS,
|
||||
getMarketplaceRepos,
|
||||
fetchRepoSkills,
|
||||
type FetchedSkill,
|
||||
type RepoInfo,
|
||||
} from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { DetailPane } from '../components/DetailPane.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
|
||||
interface BrowseProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -9,55 +21,139 @@ interface BrowseProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Browse({ onNavigate, cols = 80, rows = 24 }: BrowseProps) {
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [searchMode, setSearchMode] = useState(false);
|
||||
const [animPhase, setAnimPhase] = useState(0);
|
||||
interface RepoWithSkills extends RepoInfo {
|
||||
skills: FetchedSkill[];
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
const isCompact = cols < 60;
|
||||
const contentWidth = Math.max(1, Math.min(cols - 4, 60));
|
||||
export function Browse(props: BrowseProps) {
|
||||
const [repos, setRepos] = createSignal<RepoWithSkills[]>([]);
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [searchQuery, setSearchQuery] = createSignal('');
|
||||
const [searchMode, setSearchMode] = createSignal(false);
|
||||
const [showSkills, setShowSkills] = createSignal(false);
|
||||
const [loading, setLoading] = createSignal(true);
|
||||
const [error, setError] = createSignal<string | null>(null);
|
||||
|
||||
// Entrance animation
|
||||
useEffect(() => {
|
||||
if (animPhase >= 2) return;
|
||||
const timer = setTimeout(() => setAnimPhase(p => p + 1), 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, [animPhase]);
|
||||
const rows = () => props.rows ?? 24;
|
||||
|
||||
const repos = useMemo(() =>
|
||||
DEFAULT_REPOS.map((r) => ({
|
||||
name: r.name,
|
||||
source: r.source,
|
||||
})),
|
||||
[]
|
||||
);
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
const filteredRepos = useMemo(() =>
|
||||
searchQuery
|
||||
? repos.filter(
|
||||
(r) =>
|
||||
r.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
r.source.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
const loadData = async () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
const marketplaceRepos = getMarketplaceRepos();
|
||||
const reposWithState: RepoWithSkills[] = marketplaceRepos.map((repo) => ({
|
||||
...repo,
|
||||
skills: [],
|
||||
loading: false,
|
||||
error: null,
|
||||
}));
|
||||
setRepos(reposWithState);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to load repos');
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const loadRepoSkills = async (index: number) => {
|
||||
const repo = repos()[index];
|
||||
if (!repo || repo.skills.length > 0 || repo.loading) return;
|
||||
|
||||
setRepos((prev) =>
|
||||
prev.map((r, i) => (i === index ? { ...r, loading: true, error: null } : r))
|
||||
);
|
||||
|
||||
try {
|
||||
const result = await fetchRepoSkills(repo.source, DEFAULT_REPOS);
|
||||
setRepos((prev) =>
|
||||
prev.map((r, i) =>
|
||||
i === index
|
||||
? {
|
||||
...r,
|
||||
skills: result.skills,
|
||||
loading: false,
|
||||
error: result.error || null,
|
||||
}
|
||||
: r
|
||||
)
|
||||
: repos,
|
||||
[repos, searchQuery]
|
||||
);
|
||||
);
|
||||
} catch (err) {
|
||||
setRepos((prev) =>
|
||||
prev.map((r, i) =>
|
||||
i === index
|
||||
? {
|
||||
...r,
|
||||
loading: false,
|
||||
error: err instanceof Error ? err.message : 'Failed to fetch',
|
||||
}
|
||||
: r
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyNav = useCallback((delta: number) => {
|
||||
setSelectedIndex(prev => Math.max(0, Math.min(prev + delta, filteredRepos.length - 1)));
|
||||
}, [filteredRepos.length]);
|
||||
const filteredRepos = createMemo(() => {
|
||||
if (!searchQuery()) return repos();
|
||||
|
||||
const query = searchQuery().toLowerCase();
|
||||
return repos().filter(
|
||||
(r) =>
|
||||
r.name.toLowerCase().includes(query) ||
|
||||
r.source.toLowerCase().includes(query)
|
||||
);
|
||||
});
|
||||
|
||||
const maxVisible = () => Math.max(5, rows() - 12);
|
||||
const startIdx = () =>
|
||||
Math.max(
|
||||
0,
|
||||
Math.min(
|
||||
selectedIndex() - Math.floor(maxVisible() / 2),
|
||||
filteredRepos().length - maxVisible()
|
||||
)
|
||||
);
|
||||
const visibleRepos = () =>
|
||||
filteredRepos().slice(startIdx(), startIdx() + maxVisible());
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
const max = filteredRepos().length - 1;
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
};
|
||||
|
||||
const handleOpenRepo = () => {
|
||||
const repo = filteredRepos()[selectedIndex()];
|
||||
if (repo) {
|
||||
const actualIndex = repos().findIndex(
|
||||
(r) => r.source === repo.source && r.name === repo.name
|
||||
);
|
||||
if (actualIndex !== -1) {
|
||||
loadRepoSkills(actualIndex);
|
||||
}
|
||||
setShowSkills(true);
|
||||
}
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string; sequence?: string }) => {
|
||||
if (searchMode) {
|
||||
if (searchMode()) {
|
||||
if (key.name === 'escape') {
|
||||
setSearchMode(false);
|
||||
} else if (key.name === 'backspace') {
|
||||
setSearchQuery(prev => prev.slice(0, -1));
|
||||
setSearchQuery((prev) => prev.slice(0, -1));
|
||||
} else if (key.name === 'return') {
|
||||
setSearchMode(false);
|
||||
} else if (key.sequence && key.sequence.length === 1 && /[a-zA-Z0-9\-_.]/.test(key.sequence)) {
|
||||
setSearchQuery(prev => prev + key.sequence);
|
||||
} else if (
|
||||
key.sequence &&
|
||||
key.sequence.length === 1 &&
|
||||
/[a-zA-Z0-9\-_.]/.test(key.sequence)
|
||||
) {
|
||||
setSearchQuery((prev) => prev + key.sequence);
|
||||
setSelectedIndex(0);
|
||||
}
|
||||
return;
|
||||
@@ -66,114 +162,189 @@ export function Browse({ onNavigate, cols = 80, rows = 24 }: BrowseProps) {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.sequence === '/') setSearchMode(true);
|
||||
else if (key.name === 'return') {
|
||||
const repo = filteredRepos[selectedIndex];
|
||||
if (repo) {
|
||||
// Open/view the selected repo (navigate to installed to see skills from this repo)
|
||||
onNavigate('installed');
|
||||
}
|
||||
else if (key.name === 'return') handleOpenRepo();
|
||||
else if (key.name === 'r') loadData();
|
||||
else if (key.name === 'escape') {
|
||||
if (showSkills()) setShowSkills(false);
|
||||
else if (searchQuery()) setSearchQuery('');
|
||||
else props.onNavigate('home');
|
||||
}
|
||||
else if (key.name === 'escape') onNavigate('home');
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedIndex >= filteredRepos.length && filteredRepos.length > 0) {
|
||||
setSelectedIndex(filteredRepos.length - 1);
|
||||
createEffect(() => {
|
||||
if (selectedIndex() >= filteredRepos().length && filteredRepos().length > 0) {
|
||||
setSelectedIndex(filteredRepos().length - 1);
|
||||
}
|
||||
}, [filteredRepos.length, selectedIndex]);
|
||||
});
|
||||
|
||||
// Calculate visible repos
|
||||
const maxVisible = Math.max(5, rows - 10);
|
||||
const startIdx = Math.max(0, Math.min(selectedIndex - Math.floor(maxVisible / 2), filteredRepos.length - maxVisible));
|
||||
const visibleRepos = filteredRepos.slice(startIdx, startIdx + maxVisible);
|
||||
const selectedRepo = () => {
|
||||
const repoList = filteredRepos();
|
||||
if (repoList.length === 0) return null;
|
||||
return repoList[selectedIndex()];
|
||||
};
|
||||
|
||||
const divider = useMemo(() =>
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth)}</text>,
|
||||
[contentWidth]
|
||||
);
|
||||
const repoDetailFields = () => {
|
||||
const repo = selectedRepo();
|
||||
if (!repo) return [];
|
||||
|
||||
const shortcuts = isCompact
|
||||
? 'j/k nav enter open / search esc back'
|
||||
: 'j/k navigate enter open / search esc back';
|
||||
return [
|
||||
{ label: 'Name', value: repo.name },
|
||||
{ label: 'Source', value: repo.source },
|
||||
{ label: 'Skills', value: String(repo.skills.length) },
|
||||
{
|
||||
label: 'Status',
|
||||
value: repo.loading ? 'Loading...' : repo.error ? 'Error' : 'Ready',
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
{/* Header */}
|
||||
{animPhase >= 1 && (
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth}>
|
||||
<text fg={terminalColors.browse}>⌕ Browse</text>
|
||||
<text fg={terminalColors.textMuted}>{filteredRepos.length} repos</text>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}>explore skill repositories</text>
|
||||
<text> </text>
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Browse"
|
||||
subtitle="Explore skill repositories"
|
||||
icon="⌕"
|
||||
count={repos().length}
|
||||
/>
|
||||
|
||||
<Show when={error()}>
|
||||
<ErrorState
|
||||
message={error()!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={loading()}>
|
||||
<Spinner label="Loading repositories..." />
|
||||
</Show>
|
||||
|
||||
<Show when={!loading() && !error()}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>/ </text>
|
||||
<text
|
||||
fg={
|
||||
searchQuery() || searchMode()
|
||||
? terminalColors.text
|
||||
: terminalColors.textMuted
|
||||
}
|
||||
>
|
||||
{searchQuery() || (searchMode() ? '|' : 'type to filter...')}
|
||||
</text>
|
||||
</box>
|
||||
)}
|
||||
|
||||
{/* Search */}
|
||||
{animPhase >= 2 && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text> </text>
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.textMuted}>/ </text>
|
||||
<text fg={searchQuery ? terminalColors.text : terminalColors.textMuted}>
|
||||
{searchQuery || 'type to filter...'}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<box flexDirection="row">
|
||||
<box flexDirection="column" flexGrow={1}>
|
||||
<Show
|
||||
when={filteredRepos().length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
icon="⌕"
|
||||
title="No repositories found"
|
||||
description={
|
||||
searchQuery()
|
||||
? 'Try a different search term'
|
||||
: 'No repositories configured'
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Repositories</b>{' '}
|
||||
<text fg={terminalColors.textMuted}>
|
||||
({filteredRepos().length})
|
||||
</text>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<For each={visibleRepos()}>
|
||||
{(repo, idx) => {
|
||||
const actualIdx = () => startIdx() + idx();
|
||||
const selected = () => actualIdx() === selectedIndex();
|
||||
return (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{selected() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={25}
|
||||
>
|
||||
{repo.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={10}>
|
||||
{repo.skills.length > 0
|
||||
? `${repo.skills.length} skills`
|
||||
: repo.loading
|
||||
? 'loading...'
|
||||
: ''}
|
||||
</text>
|
||||
<Show when={repo.error}>
|
||||
<text fg={terminalColors.error}>✗</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
|
||||
<Show when={filteredRepos().length > maxVisible()}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
showing {startIdx() + 1}-
|
||||
{Math.min(startIdx() + maxVisible(), filteredRepos().length)} of{' '}
|
||||
{filteredRepos().length}
|
||||
</text>
|
||||
</Show>
|
||||
</Show>
|
||||
</box>
|
||||
<text> </text>
|
||||
{divider}
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
|
||||
{/* Repository list */}
|
||||
{animPhase >= 2 && (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>Repositories</text>
|
||||
<text> </text>
|
||||
|
||||
{filteredRepos.length === 0 ? (
|
||||
<text fg={terminalColors.textMuted}>No repositories match your search</text>
|
||||
) : (
|
||||
<box flexDirection="column">
|
||||
{visibleRepos.map((repo, idx) => {
|
||||
const actualIdx = startIdx + idx;
|
||||
const selected = actualIdx === selectedIndex;
|
||||
const indicator = selected ? '▸' : ' ';
|
||||
// Truncate source if needed - clamp to avoid negative slicing
|
||||
const maxSourceLen = Math.max(0, contentWidth - repo.name.length - 6);
|
||||
const displaySource = maxSourceLen > 3 && repo.source.length > maxSourceLen
|
||||
? repo.source.slice(0, maxSourceLen - 3) + '...'
|
||||
: repo.source;
|
||||
// Use single text element to avoid rendering overlap issues
|
||||
const line = `${indicator}${repo.name} · ${displaySource}`;
|
||||
return (
|
||||
<text key={repo.source} fg={selected ? terminalColors.accent : terminalColors.text}>
|
||||
{line}
|
||||
<Show when={showSkills() && selectedRepo()}>
|
||||
<DetailPane
|
||||
title={selectedRepo()!.name}
|
||||
subtitle={`${selectedRepo()!.skills.length} skills`}
|
||||
icon="⌕"
|
||||
fields={repoDetailFields()}
|
||||
actions={[
|
||||
{ key: 'Enter', label: 'Install' },
|
||||
{ key: 'Esc', label: 'Close' },
|
||||
]}
|
||||
width={35}
|
||||
visible={showSkills()}
|
||||
onClose={() => setShowSkills(false)}
|
||||
>
|
||||
<Show when={selectedRepo()!.loading}>
|
||||
<StatusIndicator status="loading" label="Loading skills..." />
|
||||
</Show>
|
||||
<Show when={selectedRepo()!.skills.length > 0}>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Skills:</b>
|
||||
</text>
|
||||
<For each={selectedRepo()!.skills.slice(0, 5)}>
|
||||
{(skill) => (
|
||||
<text fg={terminalColors.textSecondary}>• {skill.name}</text>
|
||||
)}
|
||||
</For>
|
||||
<Show when={selectedRepo()!.skills.length > 5}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
+{selectedRepo()!.skills.length - 5} more
|
||||
</text>
|
||||
);
|
||||
})}
|
||||
</box>
|
||||
)}
|
||||
|
||||
{/* Scroll indicator */}
|
||||
{filteredRepos.length > maxVisible && (
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{'\n'}showing {startIdx + 1}-{Math.min(startIdx + maxVisible, filteredRepos.length)} of {filteredRepos.length}
|
||||
</text>
|
||||
)}
|
||||
<text> </text>
|
||||
</Show>
|
||||
</Show>
|
||||
</DetailPane>
|
||||
</Show>
|
||||
</box>
|
||||
)}
|
||||
|
||||
{/* Footer */}
|
||||
{animPhase >= 2 && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text fg={terminalColors.textMuted}>{shortcuts}</text>
|
||||
</box>
|
||||
)}
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
j/k navigate Enter open / search r refresh Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
/**
|
||||
* Context Screen
|
||||
* Project context analysis
|
||||
*/
|
||||
import { useState, useEffect } from 'react';
|
||||
import { createSignal, createEffect, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
import {
|
||||
loadProjectContext,
|
||||
analyzeProjectContext,
|
||||
refreshContext,
|
||||
exportContext,
|
||||
getStackTags,
|
||||
type ContextServiceState,
|
||||
} from '../services/context.service.js';
|
||||
|
||||
interface ContextProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -14,43 +21,279 @@ interface ContextProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Context({ onNavigate, cols = 80, rows = 24 }: ContextProps) {
|
||||
const [loading, setLoading] = useState(true);
|
||||
export function Context(props: ContextProps) {
|
||||
const [state, setState] = createSignal<ContextServiceState>({
|
||||
context: null,
|
||||
stack: null,
|
||||
loading: true,
|
||||
analyzing: false,
|
||||
error: null,
|
||||
});
|
||||
const [tags, setTags] = createSignal<string[]>([]);
|
||||
const [selectedSection, setSelectedSection] = createSignal(0);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => setLoading(false), 500);
|
||||
return () => clearTimeout(timer);
|
||||
}, []);
|
||||
const sections = ['Overview', 'Languages', 'Frameworks', 'Libraries', 'Patterns'];
|
||||
|
||||
const contextInfo = [
|
||||
{ label: 'Working Directory', value: process.cwd() },
|
||||
{ label: 'Node Version', value: process.version },
|
||||
{ label: 'Platform', value: process.platform },
|
||||
{ label: 'Architecture', value: process.arch },
|
||||
];
|
||||
const moveSection = (delta: number) => {
|
||||
setSelectedSection((i) =>
|
||||
Math.max(0, Math.min(sections.length - 1, i + delta))
|
||||
);
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'h' || key.name === 'left') moveSection(-1);
|
||||
else if (key.name === 'l' || key.name === 'right') moveSection(1);
|
||||
else if (key.name === 'r') handleRefresh();
|
||||
else if (key.name === 'e') handleExport();
|
||||
else if (key.name === 'escape') props.onNavigate('home');
|
||||
});
|
||||
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
const loadData = async () => {
|
||||
setState((s) => ({ ...s, loading: true, error: null }));
|
||||
try {
|
||||
let result = await loadProjectContext();
|
||||
if (!result.context) {
|
||||
result = await analyzeProjectContext();
|
||||
}
|
||||
setState(result);
|
||||
setTags(await getStackTags());
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
loading: false,
|
||||
analyzing: false,
|
||||
error: err instanceof Error ? err.message : 'Failed to load context',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setState((s) => ({ ...s, analyzing: true, error: null }));
|
||||
try {
|
||||
const result = await refreshContext();
|
||||
setState(result);
|
||||
setTags(await getStackTags());
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
analyzing: false,
|
||||
error: err instanceof Error ? err.message : 'Failed to refresh context',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
await exportContext(undefined, 'json');
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Failed to export context',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const currentSection = () => sections[selectedSection()];
|
||||
const ctx = () => state().context;
|
||||
|
||||
return (
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Project Context"
|
||||
subtitle="Analyze your project environment"
|
||||
icon="◉"
|
||||
icon="◉"
|
||||
count={tags().length}
|
||||
/>
|
||||
|
||||
{loading ? (
|
||||
<Spinner label="Analyzing project context..." />
|
||||
) : (
|
||||
<Show when={state().error}>
|
||||
<ErrorState
|
||||
message={state().error!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={state().loading || state().analyzing}>
|
||||
<Spinner
|
||||
label={state().analyzing ? 'Analyzing project...' : 'Loading context...'}
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={!state().loading && !state().error && ctx()}>
|
||||
<box flexDirection="column">
|
||||
{contextInfo.map((info) => (
|
||||
<box key={info.label} flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted} width={20}>
|
||||
{info.label}:
|
||||
</text>
|
||||
<text fg={terminalColors.text}>{info.value}</text>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<For each={sections}>
|
||||
{(section, idx) => (
|
||||
<box marginRight={2}>
|
||||
<text
|
||||
fg={
|
||||
idx() === selectedSection()
|
||||
? terminalColors.accent
|
||||
: terminalColors.textMuted
|
||||
}
|
||||
>
|
||||
{idx() === selectedSection() ? '▸ ' : ' '}
|
||||
{section}
|
||||
</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</box>
|
||||
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<Show when={currentSection() === 'Overview'}>
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted} width={18}>Project:</text>
|
||||
<text fg={terminalColors.text}>{ctx()!.projectName}</text>
|
||||
</box>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted} width={18}>Path:</text>
|
||||
<text fg={terminalColors.textSecondary}>{ctx()!.rootPath}</text>
|
||||
</box>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted} width={18}>Languages:</text>
|
||||
<text fg={terminalColors.accent}>{ctx()!.languages.length}</text>
|
||||
</box>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted} width={18}>Frameworks:</text>
|
||||
<text fg={terminalColors.accent}>{ctx()!.frameworks.length}</text>
|
||||
</box>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted} width={18}>Libraries:</text>
|
||||
<text fg={terminalColors.accent}>{ctx()!.libraries.length}</text>
|
||||
</box>
|
||||
<Show when={ctx()!.lastUpdated}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted} width={18}>Last Updated:</text>
|
||||
<text fg={terminalColors.textSecondary}>{ctx()!.lastUpdated}</text>
|
||||
</box>
|
||||
</Show>
|
||||
</box>
|
||||
))}
|
||||
</Show>
|
||||
|
||||
<Show when={currentSection() === 'Languages'}>
|
||||
<box flexDirection="column">
|
||||
<Show
|
||||
when={ctx()!.languages.length > 0}
|
||||
fallback={<EmptyState title="No languages detected" compact />}
|
||||
>
|
||||
<For each={ctx()!.languages}>
|
||||
{(lang) => (
|
||||
<box marginBottom={1}>
|
||||
<text fg={terminalColors.text}>
|
||||
• {lang}
|
||||
</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={currentSection() === 'Frameworks'}>
|
||||
<box flexDirection="column">
|
||||
<Show
|
||||
when={ctx()!.frameworks.length > 0}
|
||||
fallback={<EmptyState title="No frameworks detected" compact />}
|
||||
>
|
||||
<For each={ctx()!.frameworks}>
|
||||
{(fw) => (
|
||||
<box marginBottom={1}>
|
||||
<text fg={terminalColors.text}>
|
||||
• {fw}
|
||||
</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={currentSection() === 'Libraries'}>
|
||||
<box flexDirection="column">
|
||||
<Show
|
||||
when={ctx()!.libraries.length > 0}
|
||||
fallback={<EmptyState title="No libraries detected" compact />}
|
||||
>
|
||||
<For each={ctx()!.libraries.slice(0, 15)}>
|
||||
{(lib) => (
|
||||
<box marginBottom={1}>
|
||||
<text fg={terminalColors.text}>
|
||||
• {lib}
|
||||
</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
<Show when={ctx()!.libraries.length > 15}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
+{ctx()!.libraries.length - 15} more
|
||||
</text>
|
||||
</Show>
|
||||
</Show>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={currentSection() === 'Patterns'}>
|
||||
<box flexDirection="column">
|
||||
<Show
|
||||
when={Object.keys(ctx()!.patterns).length > 0}
|
||||
fallback={<EmptyState title="No patterns detected" compact />}
|
||||
>
|
||||
<For each={Object.entries(ctx()!.patterns)}>
|
||||
{([key, value]) => (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted} width={18}>{key}:</text>
|
||||
<text fg={terminalColors.text}>{String(value)}</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<Show when={tags().length > 0}>
|
||||
<box flexDirection="row" flexWrap="wrap">
|
||||
<text fg={terminalColors.textMuted}>Tags: </text>
|
||||
<For each={tags().slice(0, 8)}>
|
||||
{(tag, idx) => (
|
||||
<text fg={terminalColors.textSecondary}>
|
||||
{tag}
|
||||
{idx() < Math.min(tags().length, 8) - 1 ? ', ' : ''}
|
||||
</text>
|
||||
)}
|
||||
</For>
|
||||
<Show when={tags().length > 8}>
|
||||
<text fg={terminalColors.textMuted}> +{tags().length - 8}</text>
|
||||
</Show>
|
||||
</box>
|
||||
</Show>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
<Show when={!state().loading && !state().error && !ctx()}>
|
||||
<EmptyState
|
||||
icon="◉"
|
||||
title="No context found"
|
||||
description="Run analysis to detect project context"
|
||||
action={{ label: 'Analyze', key: 'r' }}
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
←/→ sections r refresh e export Esc back
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
/**
|
||||
* Execute Screen
|
||||
* Live skill execution
|
||||
*/
|
||||
import { useState } from 'react';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { createSignal, createEffect, createMemo, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen, loadSkillsWithDetails, type SkillWithDetails } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { ProgressBar } from '../components/ProgressBar.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
import {
|
||||
getAgentAvailability,
|
||||
executeSkillWithAgent,
|
||||
listAvailableAgents,
|
||||
type AgentAvailability,
|
||||
} from '../services/executor.service.js';
|
||||
import type { AgentType } from '@skillkit/core';
|
||||
|
||||
interface ExecuteProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -15,39 +21,333 @@ interface ExecuteProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Execute({ onNavigate, cols = 80, rows = 24 }: ExecuteProps) {
|
||||
const [executing, setExecuting] = useState(false);
|
||||
const [progress, setProgress] = useState(0);
|
||||
export function Execute(props: ExecuteProps) {
|
||||
const [skills, setSkills] = createSignal<SkillWithDetails[]>([]);
|
||||
const [agents, setAgents] = createSignal<AgentAvailability[]>([]);
|
||||
const [selectedSkillIndex, setSelectedSkillIndex] = createSignal(0);
|
||||
const [selectedAgentIndex, setSelectedAgentIndex] = createSignal(0);
|
||||
const [focusedPane, setFocusedPane] = createSignal<'skills' | 'agents'>('skills');
|
||||
const [executing, setExecuting] = createSignal(false);
|
||||
const [executionResult, setExecutionResult] = createSignal<{
|
||||
success: boolean;
|
||||
output: string;
|
||||
error?: string;
|
||||
} | null>(null);
|
||||
const [loading, setLoading] = createSignal(true);
|
||||
const [loadError, setLoadError] = createSignal<string | null>(null);
|
||||
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
const loadData = async () => {
|
||||
setLoading(true);
|
||||
setLoadError(null);
|
||||
|
||||
try {
|
||||
const skillsWithDetails = loadSkillsWithDetails();
|
||||
setSkills(skillsWithDetails);
|
||||
|
||||
const agentAvailability = await getAgentAvailability();
|
||||
setAgents(agentAvailability);
|
||||
} catch (err) {
|
||||
setLoadError(err instanceof Error ? err.message : 'Failed to load');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleExecute = async () => {
|
||||
if (executing()) return;
|
||||
|
||||
const skillList = skills();
|
||||
const agentList = agents();
|
||||
|
||||
if (skillList.length === 0 || agentList.length === 0) return;
|
||||
|
||||
const skill = skillList[selectedSkillIndex()];
|
||||
const agent = agentList[selectedAgentIndex()];
|
||||
|
||||
if (!skill || !agent || !agent.available) return;
|
||||
|
||||
setExecuting(true);
|
||||
setExecutionResult(null);
|
||||
|
||||
try {
|
||||
const result = await executeSkillWithAgent(
|
||||
skill.path,
|
||||
agent.agent,
|
||||
{ timeout: 60000 }
|
||||
);
|
||||
|
||||
setExecutionResult({
|
||||
success: result.success,
|
||||
output: result.output || '',
|
||||
error: result.error,
|
||||
});
|
||||
} catch (err) {
|
||||
setExecutionResult({
|
||||
success: false,
|
||||
output: '',
|
||||
error: err instanceof Error ? err.message : 'Execution failed',
|
||||
});
|
||||
} finally {
|
||||
setExecuting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
if (focusedPane() === 'skills') {
|
||||
const max = skills().length - 1;
|
||||
setSelectedSkillIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
} else {
|
||||
const max = agents().length - 1;
|
||||
setSelectedAgentIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
}
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'tab' || key.name === 'l' || key.name === 'right') {
|
||||
setFocusedPane((p) => (p === 'skills' ? 'agents' : 'skills'));
|
||||
}
|
||||
else if (key.name === 'h' || key.name === 'left') {
|
||||
setFocusedPane((p) => (p === 'agents' ? 'skills' : 'agents'));
|
||||
}
|
||||
else if (key.name === 'return' || key.name === 'x') handleExecute();
|
||||
else if (key.name === 'r') loadData();
|
||||
else if (key.name === 'escape') {
|
||||
if (executionResult()) setExecutionResult(null);
|
||||
else props.onNavigate('home');
|
||||
}
|
||||
});
|
||||
|
||||
const selectedSkill = () => {
|
||||
const list = skills();
|
||||
if (list.length === 0) return null;
|
||||
return list[selectedSkillIndex()];
|
||||
};
|
||||
|
||||
const selectedAgent = () => {
|
||||
const list = agents();
|
||||
if (list.length === 0) return null;
|
||||
return list[selectedAgentIndex()];
|
||||
};
|
||||
|
||||
const MAX_VISIBLE = 8;
|
||||
|
||||
const skillsWindow = createMemo(() => {
|
||||
const list = skills();
|
||||
const selected = selectedSkillIndex();
|
||||
const total = list.length;
|
||||
if (total <= MAX_VISIBLE) return { start: 0, items: list };
|
||||
let start = Math.max(0, selected - Math.floor(MAX_VISIBLE / 2));
|
||||
start = Math.min(start, total - MAX_VISIBLE);
|
||||
return { start, items: list.slice(start, start + MAX_VISIBLE) };
|
||||
});
|
||||
|
||||
const agentsWindow = createMemo(() => {
|
||||
const list = agents();
|
||||
const selected = selectedAgentIndex();
|
||||
const total = list.length;
|
||||
if (total <= MAX_VISIBLE) return { start: 0, items: list };
|
||||
let start = Math.max(0, selected - Math.floor(MAX_VISIBLE / 2));
|
||||
start = Math.min(start, total - MAX_VISIBLE);
|
||||
return { start, items: list.slice(start, start + MAX_VISIBLE) };
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Execute"
|
||||
subtitle="Run skills in real-time"
|
||||
icon="▶"
|
||||
subtitle="Run skills with AI agents"
|
||||
icon="▶"
|
||||
/>
|
||||
|
||||
{executing ? (
|
||||
<box flexDirection="column">
|
||||
<Spinner label="Executing skill..." />
|
||||
<text> </text>
|
||||
<ProgressBar progress={progress} width={40} />
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>Press Esc to cancel</text>
|
||||
<Show when={loading()}>
|
||||
<Spinner label="Loading..." />
|
||||
</Show>
|
||||
|
||||
<Show when={loadError()}>
|
||||
<ErrorState
|
||||
message={loadError()!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={!loading() && !loadError()}>
|
||||
<box flexDirection="row">
|
||||
<box flexDirection="column" width={30}>
|
||||
<text
|
||||
fg={
|
||||
focusedPane() === 'skills'
|
||||
? terminalColors.accent
|
||||
: terminalColors.text
|
||||
}
|
||||
>
|
||||
<b>Skills</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<Show
|
||||
when={skills().length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
title="No skills installed"
|
||||
description="Browse to install"
|
||||
action={{ label: 'Browse', key: 'b' }}
|
||||
compact
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Show when={skillsWindow().start > 0}>
|
||||
<text fg={terminalColors.textMuted}> ▲ {skillsWindow().start} more</text>
|
||||
</Show>
|
||||
<For each={skillsWindow().items}>
|
||||
{(skill, idx) => {
|
||||
const originalIndex = () => skillsWindow().start + idx();
|
||||
const isSelected = () =>
|
||||
focusedPane() === 'skills' && originalIndex() === selectedSkillIndex();
|
||||
return (
|
||||
<box marginBottom={1}>
|
||||
<text
|
||||
fg={isSelected() ? terminalColors.accent : terminalColors.textSecondary}
|
||||
>
|
||||
{isSelected() ? '▸ ' : ' '}
|
||||
{skill.name}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
<Show when={skillsWindow().start + MAX_VISIBLE < skills().length}>
|
||||
<text fg={terminalColors.textMuted}> ▼ {skills().length - skillsWindow().start - MAX_VISIBLE} more</text>
|
||||
</Show>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<box width={2}>
|
||||
<text fg={terminalColors.border}>│</text>
|
||||
</box>
|
||||
|
||||
<box flexDirection="column" width={25}>
|
||||
<text
|
||||
fg={
|
||||
focusedPane() === 'agents'
|
||||
? terminalColors.accent
|
||||
: terminalColors.text
|
||||
}
|
||||
>
|
||||
<b>Agents</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<Show
|
||||
when={agents().length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
title="No agents found"
|
||||
compact
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Show when={agentsWindow().start > 0}>
|
||||
<text fg={terminalColors.textMuted}> ▲ {agentsWindow().start} more</text>
|
||||
</Show>
|
||||
<For each={agentsWindow().items}>
|
||||
{(agent, idx) => {
|
||||
const originalIndex = () => agentsWindow().start + idx();
|
||||
const isSelected = () =>
|
||||
focusedPane() === 'agents' && originalIndex() === selectedAgentIndex();
|
||||
const available = agent.available;
|
||||
return (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={
|
||||
isSelected()
|
||||
? terminalColors.accent
|
||||
: available
|
||||
? terminalColors.textSecondary
|
||||
: terminalColors.textMuted
|
||||
}
|
||||
>
|
||||
{isSelected() ? '▸ ' : ' '}
|
||||
{agent.agent}
|
||||
</text>
|
||||
<text fg={available ? terminalColors.success : terminalColors.error}>
|
||||
{' '}
|
||||
{available ? '●' : '○'}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
<Show when={agentsWindow().start + MAX_VISIBLE < agents().length}>
|
||||
<text fg={terminalColors.textMuted}> ▼ {agents().length - agentsWindow().start - MAX_VISIBLE} more</text>
|
||||
</Show>
|
||||
</Show>
|
||||
</box>
|
||||
</box>
|
||||
) : (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>Select a skill to execute:</text>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<Show when={selectedSkill() && selectedAgent()}>
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.textMuted}>Selected: </text>
|
||||
<text fg={terminalColors.accent}>{selectedSkill()!.name}</text>
|
||||
<text fg={terminalColors.textMuted}> → </text>
|
||||
<text
|
||||
fg={
|
||||
selectedAgent()!.available
|
||||
? terminalColors.accent
|
||||
: terminalColors.textMuted
|
||||
}
|
||||
>
|
||||
{selectedAgent()!.agent}
|
||||
</text>
|
||||
<Show when={!selectedAgent()!.available}>
|
||||
<text fg={terminalColors.warning}> (unavailable)</text>
|
||||
</Show>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={executing()}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
No skills available. Install skills first using 'b' (browse) or 'm' (marketplace).
|
||||
</text>
|
||||
<StatusIndicator status="loading" label="Executing skill..." />
|
||||
</Show>
|
||||
|
||||
<Show when={executionResult() && !executing()}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Press Enter to execute, 'i' to view installed skills
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text
|
||||
fg={
|
||||
executionResult()!.success
|
||||
? terminalColors.success
|
||||
: terminalColors.error
|
||||
}
|
||||
>
|
||||
{executionResult()!.success ? '✓ Execution completed' : '✗ Execution failed'}
|
||||
</text>
|
||||
</box>
|
||||
)}
|
||||
<Show when={executionResult()!.error}>
|
||||
<text fg={terminalColors.error}>{executionResult()!.error}</text>
|
||||
</Show>
|
||||
<Show when={executionResult()!.output}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{executionResult()!.output.slice(0, 200)}
|
||||
{executionResult()!.output.length > 200 ? '...' : ''}
|
||||
</text>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Tab/←/→ switch pane j/k navigate Enter execute r refresh Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, useMemo } from 'react';
|
||||
import { createSignal, createEffect, onCleanup, createMemo, Show, For } from 'solid-js';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { getVersion } from '../utils/helpers.js';
|
||||
@@ -44,84 +44,100 @@ const SHORTCUTS = [
|
||||
]},
|
||||
];
|
||||
|
||||
function ShortcutSection({ section, items, isLast }: { section: string; items: { key: string; desc: string }[]; isLast: boolean }) {
|
||||
interface ShortcutSectionProps {
|
||||
section: string;
|
||||
items: { key: string; desc: string }[];
|
||||
isLast: boolean;
|
||||
}
|
||||
|
||||
function ShortcutSection(props: ShortcutSectionProps) {
|
||||
return (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>{section}</text>
|
||||
{items.map((item) => (
|
||||
<box key={item.key} flexDirection="row">
|
||||
<text fg={terminalColors.accent} width={8}> {item.key}</text>
|
||||
<text fg={terminalColors.textMuted}>{item.desc}</text>
|
||||
</box>
|
||||
))}
|
||||
{!isLast && <text> </text>}
|
||||
<text fg={terminalColors.text}>{props.section}</text>
|
||||
<For each={props.items}>
|
||||
{(item) => (
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.accent} width={8}> {item.key}</text>
|
||||
<text fg={terminalColors.textMuted}>{item.desc}</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
<Show when={!props.isLast}>
|
||||
<text> </text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
export function Help({ cols = 80 }: HelpProps) {
|
||||
const [animPhase, setAnimPhase] = useState(0);
|
||||
const isCompact = cols < 60;
|
||||
const rawWidth = cols - 4;
|
||||
const contentWidth = Math.max(1, Math.min(rawWidth, 60));
|
||||
export function Help(props: HelpProps) {
|
||||
const [animPhase, setAnimPhase] = createSignal(0);
|
||||
const cols = () => props.cols ?? 80;
|
||||
const isCompact = () => cols() < 60;
|
||||
const rawWidth = () => cols() - 4;
|
||||
const contentWidth = () => Math.max(1, Math.min(rawWidth(), 60));
|
||||
const version = getVersion();
|
||||
|
||||
useEffect(() => {
|
||||
if (animPhase >= 2) return;
|
||||
createEffect(() => {
|
||||
if (animPhase() >= 2) return;
|
||||
const timer = setTimeout(() => setAnimPhase(p => p + 1), 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, [animPhase]);
|
||||
onCleanup(() => clearTimeout(timer));
|
||||
});
|
||||
|
||||
const divider = useMemo(() =>
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth)}</text>,
|
||||
[contentWidth]
|
||||
const divider = createMemo(() =>
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth())}</text>
|
||||
);
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
{animPhase >= 1 && (
|
||||
<Show when={animPhase() >= 1}>
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth}>
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth()}>
|
||||
<text fg={terminalColors.text}>/ Help</text>
|
||||
<text fg={terminalColors.textMuted}>skillkit v{version}</text>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}>keyboard shortcuts and navigation</text>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{animPhase >= 2 && (
|
||||
<Show when={animPhase() >= 2}>
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
{divider()}
|
||||
<text> </text>
|
||||
{isCompact ? (
|
||||
SHORTCUTS.map((s, idx) => (
|
||||
<ShortcutSection key={s.section} section={s.section} items={s.items} isLast={idx === SHORTCUTS.length - 1} />
|
||||
))
|
||||
) : (
|
||||
<Show when={isCompact()} fallback={
|
||||
<box flexDirection="row">
|
||||
<box flexDirection="column" width={Math.floor(contentWidth / 2)}>
|
||||
{SHORTCUTS.slice(0, 2).map((s, idx) => (
|
||||
<ShortcutSection key={s.section} section={s.section} items={s.items} isLast={idx === 1} />
|
||||
))}
|
||||
<box flexDirection="column" width={Math.floor(contentWidth() / 2)}>
|
||||
<For each={SHORTCUTS.slice(0, 2)}>
|
||||
{(s, idx) => (
|
||||
<ShortcutSection section={s.section} items={s.items} isLast={idx() === 1} />
|
||||
)}
|
||||
</For>
|
||||
</box>
|
||||
<box flexDirection="column" width={Math.floor(contentWidth / 2)}>
|
||||
{SHORTCUTS.slice(2).map((s, idx) => (
|
||||
<ShortcutSection key={s.section} section={s.section} items={s.items} isLast={idx === 1} />
|
||||
))}
|
||||
<box flexDirection="column" width={Math.floor(contentWidth() / 2)}>
|
||||
<For each={SHORTCUTS.slice(2)}>
|
||||
{(s, idx) => (
|
||||
<ShortcutSection section={s.section} items={s.items} isLast={idx() === 1} />
|
||||
)}
|
||||
</For>
|
||||
</box>
|
||||
</box>
|
||||
)}
|
||||
}>
|
||||
<For each={SHORTCUTS}>
|
||||
{(s, idx) => (
|
||||
<ShortcutSection section={s.section} items={s.items} isLast={idx() === SHORTCUTS.length - 1} />
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{animPhase >= 2 && (
|
||||
<Show when={animPhase() >= 2}>
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
{divider()}
|
||||
<text fg={terminalColors.textMuted}>esc back h home q quit</text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/**
|
||||
* History Screen
|
||||
* Execution history
|
||||
*/
|
||||
import { For } from 'solid-js';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
@@ -12,7 +9,7 @@ interface HistoryProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function History({ onNavigate, cols = 80, rows = 24 }: HistoryProps) {
|
||||
export function History(props: HistoryProps) {
|
||||
const history = [
|
||||
{ skill: 'tdd-workflow', time: '10:32 AM', duration: '2.3s', status: 'success' },
|
||||
{ skill: 'code-review', time: '10:15 AM', duration: '5.1s', status: 'success' },
|
||||
@@ -32,23 +29,25 @@ export function History({ onNavigate, cols = 80, rows = 24 }: HistoryProps) {
|
||||
<text fg={terminalColors.text}><b>Recent Executions</b></text>
|
||||
<text> </text>
|
||||
|
||||
{history.map((item, idx) => (
|
||||
<box key={`${item.skill}-${item.time}`} flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={idx === 0 ? terminalColors.accent : terminalColors.text}
|
||||
width={18}
|
||||
>
|
||||
{idx === 0 ? '\u25B8 ' : ' '}{item.skill}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={12}>{item.time}</text>
|
||||
<text fg={terminalColors.textMuted} width={10}>{item.duration}</text>
|
||||
<text
|
||||
fg={item.status === 'success' ? terminalColors.success : terminalColors.error}
|
||||
>
|
||||
{item.status === 'success' ? '\u2713 success' : '\u2717 failed'}
|
||||
</text>
|
||||
</box>
|
||||
))}
|
||||
<For each={history}>
|
||||
{(item, idx) => (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={idx() === 0 ? terminalColors.accent : terminalColors.text}
|
||||
width={18}
|
||||
>
|
||||
{idx() === 0 ? '\u25B8 ' : ' '}{item.skill}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={12}>{item.time}</text>
|
||||
<text fg={terminalColors.textMuted} width={10}>{item.duration}</text>
|
||||
<text
|
||||
fg={item.status === 'success' ? terminalColors.success : terminalColors.error}
|
||||
>
|
||||
{item.status === 'success' ? '\u2713 success' : '\u2717 failed'}
|
||||
</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, useMemo } from 'react';
|
||||
import { createSignal, createEffect, onCleanup, createMemo, Show, For } from 'solid-js';
|
||||
import { type Screen, loadSkills, TOTAL_AGENTS } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { symbols, AGENT_LOGOS } from '../theme/symbols.js';
|
||||
@@ -19,24 +19,25 @@ const FEATURES = [
|
||||
{ key: 'Team', color: terminalColors.text, desc: 'collaborate' },
|
||||
];
|
||||
|
||||
export function Home({ cols = 80 }: HomeProps) {
|
||||
const [animPhase, setAnimPhase] = useState(0);
|
||||
const [stats, setStats] = useState({ skills: 0, agents: TOTAL_AGENTS, synced: 0 });
|
||||
const [detectedAgents, setDetectedAgents] = useState<string[]>([]);
|
||||
export function Home(props: HomeProps) {
|
||||
const [animPhase, setAnimPhase] = createSignal(0);
|
||||
const [stats, setStats] = createSignal({ skills: 0, agents: TOTAL_AGENTS, synced: 0 });
|
||||
const [detectedAgents, setDetectedAgents] = createSignal<string[]>([]);
|
||||
|
||||
const cols = () => props.cols ?? 80;
|
||||
const version = getVersion();
|
||||
const isCompact = cols < 70;
|
||||
const isNarrow = cols < 50;
|
||||
const contentWidth = Math.min(cols - 4, 55);
|
||||
const line = '─'.repeat(contentWidth);
|
||||
const isCompact = () => cols() < 70;
|
||||
const isNarrow = () => cols() < 50;
|
||||
const contentWidth = () => Math.min(cols() - 4, 55);
|
||||
const line = () => '─'.repeat(contentWidth());
|
||||
|
||||
useEffect(() => {
|
||||
if (animPhase >= 5) return;
|
||||
const timer = setTimeout(() => setAnimPhase(p => p + 1), 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, [animPhase]);
|
||||
createEffect(() => {
|
||||
if (animPhase() >= 5) return;
|
||||
const timer = setTimeout(() => setAnimPhase((p) => p + 1), 100);
|
||||
onCleanup(() => clearTimeout(timer));
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
createEffect(() => {
|
||||
const skillsData = loadSkills();
|
||||
setStats({
|
||||
skills: skillsData.skills.length,
|
||||
@@ -44,112 +45,144 @@ export function Home({ cols = 80 }: HomeProps) {
|
||||
synced: Math.min(skillsData.skills.length, 3),
|
||||
});
|
||||
setDetectedAgents(['claude-code', 'cursor', 'github-copilot']);
|
||||
}, []);
|
||||
});
|
||||
|
||||
const visibleAgents = useMemo(() => {
|
||||
const visibleAgents = createMemo(() => {
|
||||
const allAgents = Object.entries(AGENT_LOGOS);
|
||||
const perRow = isNarrow || isCompact ? 2 : 3;
|
||||
const maxAgents = isNarrow ? 4 : isCompact ? 6 : 9;
|
||||
const perRow = isNarrow() || isCompact() ? 2 : 3;
|
||||
const maxAgents = isNarrow() ? 4 : isCompact() ? 6 : 9;
|
||||
return {
|
||||
agents: allAgents.slice(0, maxAgents),
|
||||
perRow,
|
||||
remaining: allAgents.length - maxAgents,
|
||||
};
|
||||
}, [isCompact, isNarrow]);
|
||||
});
|
||||
|
||||
const getAgentWidth = () => {
|
||||
if (isNarrow) return 22;
|
||||
if (isCompact) return 26;
|
||||
if (isNarrow()) return 22;
|
||||
if (isCompact()) return 26;
|
||||
return 18;
|
||||
};
|
||||
|
||||
const agentRows = createMemo(() => {
|
||||
const { agents, perRow } = visibleAgents();
|
||||
const rows: typeof agents[] = [];
|
||||
for (let i = 0; i < agents.length; i += perRow) {
|
||||
rows.push(agents.slice(i, i + perRow));
|
||||
}
|
||||
return rows;
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
{animPhase >= 1 && (
|
||||
<Show when={animPhase() >= 1}>
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.text}>{symbols.brandIcon} skillkit</text>
|
||||
<text fg={terminalColors.text}>
|
||||
{symbols.brandIcon} skillkit
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}> v{version}</text>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}>universal skills for ai coding agents</text>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{animPhase >= 2 && (
|
||||
<Show when={animPhase() >= 2}>
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.textMuted}>{line}</text>
|
||||
<text fg={terminalColors.textMuted}>{line()}</text>
|
||||
<text> </text>
|
||||
<box flexDirection="row">
|
||||
<box width={14}><text fg={terminalColors.accent}>{stats.skills}</text></box>
|
||||
<box width={14}><text fg={terminalColors.text}>{stats.agents}</text></box>
|
||||
<box width={14}><text fg={terminalColors.text}>{stats.synced}</text></box>
|
||||
<box width={14}>
|
||||
<text fg={terminalColors.accent}>{stats().skills}</text>
|
||||
</box>
|
||||
<box width={14}>
|
||||
<text fg={terminalColors.text}>{stats().agents}</text>
|
||||
</box>
|
||||
<box width={14}>
|
||||
<text fg={terminalColors.text}>{stats().synced}</text>
|
||||
</box>
|
||||
</box>
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.textMuted} width={14}>skills</text>
|
||||
<text fg={terminalColors.textMuted} width={14}>agents</text>
|
||||
<text fg={terminalColors.textMuted} width={14}>synced</text>
|
||||
<text fg={terminalColors.textMuted} width={14}>
|
||||
skills
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={14}>
|
||||
agents
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={14}>
|
||||
synced
|
||||
</text>
|
||||
</box>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>{line}</text>
|
||||
<text fg={terminalColors.textMuted}>{line()}</text>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{animPhase >= 3 && (
|
||||
<Show when={animPhase() >= 3}>
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>Works with</text>
|
||||
<text> </text>
|
||||
{Array(Math.ceil(visibleAgents.agents.length / visibleAgents.perRow))
|
||||
.fill(0)
|
||||
.map((_, rowIdx) => (
|
||||
<box key={rowIdx} flexDirection="row">
|
||||
{visibleAgents.agents
|
||||
.slice(rowIdx * visibleAgents.perRow, (rowIdx + 1) * visibleAgents.perRow)
|
||||
.map(([type, agent]) => {
|
||||
const isDetected = detectedAgents.includes(type);
|
||||
<For each={agentRows()}>
|
||||
{(row) => (
|
||||
<box flexDirection="row">
|
||||
<For each={row}>
|
||||
{([type, agent]) => {
|
||||
const isDetected = () => detectedAgents().includes(type);
|
||||
return (
|
||||
<box key={type} width={getAgentWidth()} flexDirection="row">
|
||||
<text fg={terminalColors.text}>{agent.icon} {agent.name} </text>
|
||||
<text fg={isDetected ? terminalColors.accent : terminalColors.textMuted}>
|
||||
{isDetected ? '●' : '○'}
|
||||
<box width={getAgentWidth()} flexDirection="row">
|
||||
<text fg={terminalColors.text}>
|
||||
{agent.icon} {agent.name}{' '}
|
||||
</text>
|
||||
<text fg={isDetected() ? terminalColors.accent : terminalColors.textMuted}>
|
||||
{isDetected() ? '●' : '○'}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
})}
|
||||
}}
|
||||
</For>
|
||||
</box>
|
||||
))}
|
||||
{visibleAgents.remaining > 0 && (
|
||||
<text fg={terminalColors.textMuted}>+{visibleAgents.remaining} more</text>
|
||||
)}
|
||||
)}
|
||||
</For>
|
||||
<Show when={visibleAgents().remaining > 0}>
|
||||
<text fg={terminalColors.textMuted}>+{visibleAgents().remaining} more</text>
|
||||
</Show>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>{line}</text>
|
||||
<text fg={terminalColors.textMuted}>{line()}</text>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{animPhase >= 4 && (
|
||||
<Show when={animPhase() >= 4}>
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>Features</text>
|
||||
<text> </text>
|
||||
{FEATURES.map((feat) => (
|
||||
<box key={feat.key} flexDirection="row">
|
||||
<text fg={feat.color} width={12}> {feat.key}</text>
|
||||
<text fg={terminalColors.textMuted}>{feat.desc}</text>
|
||||
</box>
|
||||
))}
|
||||
<For each={FEATURES}>
|
||||
{(feat) => (
|
||||
<box flexDirection="row">
|
||||
<text fg={feat.color} width={12}>
|
||||
{' '}
|
||||
{feat.key}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{feat.desc}</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{animPhase >= 5 && (
|
||||
<Show when={animPhase() >= 5}>
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.textMuted}>{line}</text>
|
||||
<text fg={terminalColors.textMuted}>{line()}</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{isCompact ? 'b browse m market / help q quit' : 'b browse m market i installed / help q quit'}
|
||||
{isCompact()
|
||||
? 'b browse m market / help q quit'
|
||||
: 'b browse m market i installed / help q quit'}
|
||||
</text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect, useMemo, useCallback } from 'react';
|
||||
import { useKeyboard } from '@opentui/react';
|
||||
import { createSignal, createEffect, onCleanup, createMemo, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen, loadSkills, filterSkills } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
@@ -11,75 +11,69 @@ interface InstalledProps {
|
||||
|
||||
const SPINNER = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
||||
|
||||
export function Installed({ onNavigate, cols = 80, rows = 24 }: InstalledProps) {
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [searchMode, setSearchMode] = useState(false);
|
||||
const [animPhase, setAnimPhase] = useState(0);
|
||||
const [spinnerFrame, setSpinnerFrame] = useState(0);
|
||||
const [skills, setSkills] = useState<ReturnType<typeof loadSkills>>({
|
||||
export function Installed(props: InstalledProps) {
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [searchQuery, setSearchQuery] = createSignal('');
|
||||
const [searchMode, setSearchMode] = createSignal(false);
|
||||
const [animPhase, setAnimPhase] = createSignal(0);
|
||||
const [spinnerFrame, setSpinnerFrame] = createSignal(0);
|
||||
const [skills, setSkills] = createSignal<ReturnType<typeof loadSkills>>({
|
||||
skills: [],
|
||||
loading: true,
|
||||
error: null,
|
||||
});
|
||||
|
||||
const isCompact = cols < 60;
|
||||
const contentWidth = Math.max(1, Math.min(cols - 4, 60));
|
||||
const cols = () => props.cols ?? 80;
|
||||
const rows = () => props.rows ?? 24;
|
||||
const isCompact = () => cols() < 60;
|
||||
const contentWidth = () => Math.max(1, Math.min(cols() - 4, 60));
|
||||
|
||||
// Entrance animation
|
||||
useEffect(() => {
|
||||
if (animPhase >= 2) return;
|
||||
const timer = setTimeout(() => setAnimPhase(p => p + 1), 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, [animPhase]);
|
||||
createEffect(() => {
|
||||
if (animPhase() >= 2) return;
|
||||
const timer = setTimeout(() => setAnimPhase((p) => p + 1), 100);
|
||||
onCleanup(() => clearTimeout(timer));
|
||||
});
|
||||
|
||||
// Loading spinner
|
||||
useEffect(() => {
|
||||
if (!skills.loading) return;
|
||||
createEffect(() => {
|
||||
if (!skills().loading) return;
|
||||
const interval = setInterval(() => {
|
||||
setSpinnerFrame(f => (f + 1) % SPINNER.length);
|
||||
setSpinnerFrame((f) => (f + 1) % SPINNER.length);
|
||||
}, 80);
|
||||
return () => clearInterval(interval);
|
||||
}, [skills.loading]);
|
||||
onCleanup(() => clearInterval(interval));
|
||||
});
|
||||
|
||||
// Load skills
|
||||
useEffect(() => {
|
||||
createEffect(() => {
|
||||
const data = loadSkills();
|
||||
setSkills(data);
|
||||
}, []);
|
||||
});
|
||||
|
||||
const filteredSkills = useMemo(() =>
|
||||
filterSkills(skills.skills, searchQuery),
|
||||
[skills.skills, searchQuery]
|
||||
);
|
||||
const filteredSkills = createMemo(() => filterSkills(skills().skills, searchQuery()));
|
||||
|
||||
const handleKeyNav = useCallback((delta: number) => {
|
||||
setSelectedIndex(prev => Math.max(0, Math.min(prev + delta, filteredSkills.length - 1)));
|
||||
}, [filteredSkills.length]);
|
||||
const handleKeyNav = (delta: number) => {
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev + delta, filteredSkills().length - 1)));
|
||||
};
|
||||
|
||||
const handleToggle = useCallback(() => {
|
||||
if (filteredSkills.length === 0) return;
|
||||
const skill = filteredSkills[selectedIndex];
|
||||
const handleToggle = () => {
|
||||
if (filteredSkills().length === 0) return;
|
||||
const skill = filteredSkills()[selectedIndex()];
|
||||
if (skill) {
|
||||
setSkills(prev => ({
|
||||
setSkills((prev) => ({
|
||||
...prev,
|
||||
skills: prev.skills.map(s =>
|
||||
s.name === skill.name ? { ...s, enabled: s.enabled === false } : s
|
||||
),
|
||||
skills: prev.skills.map((s) => (s.name === skill.name ? { ...s, enabled: s.enabled === false } : s)),
|
||||
}));
|
||||
}
|
||||
}, [filteredSkills, selectedIndex]);
|
||||
};
|
||||
|
||||
const handleKeyboard = useCallback((key: { name?: string; sequence?: string }) => {
|
||||
if (searchMode) {
|
||||
useKeyboard((key: { name?: string; sequence?: string }) => {
|
||||
if (searchMode()) {
|
||||
if (key.name === 'escape') {
|
||||
setSearchMode(false);
|
||||
} else if (key.name === 'backspace') {
|
||||
setSearchQuery(prev => prev.slice(0, -1));
|
||||
setSearchQuery((prev) => prev.slice(0, -1));
|
||||
} else if (key.name === 'return') {
|
||||
setSearchMode(false);
|
||||
} else if (key.sequence && key.sequence.length === 1 && /[a-zA-Z0-9\-_.]/.test(key.sequence)) {
|
||||
setSearchQuery(prev => prev + key.sequence);
|
||||
setSearchQuery((prev) => prev + key.sequence);
|
||||
setSelectedIndex(0);
|
||||
}
|
||||
return;
|
||||
@@ -90,136 +84,140 @@ export function Installed({ onNavigate, cols = 80, rows = 24 }: InstalledProps)
|
||||
else if (key.sequence === '/') setSearchMode(true);
|
||||
else if (key.name === 'return') handleToggle();
|
||||
else if (key.name === 'd') handleToggle();
|
||||
else if (key.name === 'escape') onNavigate('home');
|
||||
}, [searchMode, handleKeyNav, handleToggle, onNavigate]);
|
||||
else if (key.name === 'escape') props.onNavigate('home');
|
||||
});
|
||||
|
||||
useKeyboard(handleKeyboard);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedIndex >= filteredSkills.length && filteredSkills.length > 0) {
|
||||
setSelectedIndex(filteredSkills.length - 1);
|
||||
createEffect(() => {
|
||||
if (selectedIndex() >= filteredSkills().length && filteredSkills().length > 0) {
|
||||
setSelectedIndex(filteredSkills().length - 1);
|
||||
}
|
||||
}, [filteredSkills.length, selectedIndex]);
|
||||
});
|
||||
|
||||
// Calculate visible items
|
||||
const maxVisible = Math.max(5, rows - 10);
|
||||
const startIdx = Math.max(0, Math.min(selectedIndex - Math.floor(maxVisible / 2), filteredSkills.length - maxVisible));
|
||||
const visibleSkills = filteredSkills.slice(startIdx, startIdx + maxVisible);
|
||||
const maxVisible = () => Math.max(5, rows() - 10);
|
||||
const startIdx = () =>
|
||||
Math.max(0, Math.min(selectedIndex() - Math.floor(maxVisible() / 2), filteredSkills().length - maxVisible()));
|
||||
const visibleSkills = () => filteredSkills().slice(startIdx(), startIdx() + maxVisible());
|
||||
|
||||
const divider = useMemo(() =>
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth)}</text>,
|
||||
[contentWidth]
|
||||
);
|
||||
const divider = () => <text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth())}</text>;
|
||||
|
||||
// Stats
|
||||
const enabledCount = skills.skills.filter(s => s.enabled !== false).length;
|
||||
const totalCount = skills.skills.length;
|
||||
const enabledCount = () => skills().skills.filter((s) => s.enabled !== false).length;
|
||||
const totalCount = () => skills().skills.length;
|
||||
|
||||
const shortcuts = isCompact
|
||||
? 'j/k nav enter toggle d disable esc back'
|
||||
: 'j/k navigate enter toggle d disable esc back';
|
||||
const shortcuts = () =>
|
||||
isCompact()
|
||||
? 'j/k nav enter toggle d disable esc back'
|
||||
: 'j/k navigate enter toggle d disable esc back';
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
{/* Header */}
|
||||
{animPhase >= 1 && (
|
||||
<Show when={animPhase() >= 1}>
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth}>
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth()}>
|
||||
<text fg={terminalColors.success}>✓ Installed</text>
|
||||
<text fg={terminalColors.textMuted}>{enabledCount}/{totalCount} active</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{enabledCount()}/{totalCount()} active
|
||||
</text>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}>manage your skills</text>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Search */}
|
||||
{animPhase >= 2 && (
|
||||
<Show when={animPhase() >= 2}>
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
{divider()}
|
||||
<text> </text>
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.textMuted}>/ </text>
|
||||
<text fg={searchQuery ? terminalColors.text : terminalColors.textMuted}>
|
||||
{searchQuery || 'type to filter...'}
|
||||
<text fg={searchQuery() ? terminalColors.text : terminalColors.textMuted}>
|
||||
{searchQuery() || 'type to filter...'}
|
||||
</text>
|
||||
</box>
|
||||
<text> </text>
|
||||
{divider}
|
||||
{divider()}
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Skills list */}
|
||||
{animPhase >= 2 && (
|
||||
<Show when={animPhase() >= 2}>
|
||||
<box flexDirection="column">
|
||||
{skills.loading ? (
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.accent}>{SPINNER[spinnerFrame]} </text>
|
||||
<text fg={terminalColors.text}>Loading skills...</text>
|
||||
</box>
|
||||
) : skills.error ? (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.error}>✗ Error loading skills</text>
|
||||
<text fg={terminalColors.textMuted}>{skills.error}</text>
|
||||
</box>
|
||||
) : filteredSkills.length === 0 ? (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{skills.skills.length === 0
|
||||
? 'No skills installed yet'
|
||||
: 'No skills match your search'}
|
||||
</text>
|
||||
{skills.skills.length === 0 && (
|
||||
<>
|
||||
<Show
|
||||
when={!skills().loading}
|
||||
fallback={
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.accent}>{SPINNER[spinnerFrame()]} </text>
|
||||
<text fg={terminalColors.text}>Loading skills...</text>
|
||||
</box>
|
||||
}
|
||||
>
|
||||
<Show
|
||||
when={!skills().error}
|
||||
fallback={
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.error}>✗ Error loading skills</text>
|
||||
<text fg={terminalColors.textMuted}>{skills().error}</text>
|
||||
</box>
|
||||
}
|
||||
>
|
||||
<Show
|
||||
when={filteredSkills().length > 0}
|
||||
fallback={
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{skills().skills.length === 0 ? 'No skills installed yet' : 'No skills match your search'}
|
||||
</text>
|
||||
<Show when={skills().skills.length === 0}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>Press 'b' to browse or 'm' for marketplace</text>
|
||||
</Show>
|
||||
</box>
|
||||
}
|
||||
>
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>Skills</text>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Press 'b' to browse or 'm' for marketplace
|
||||
</text>
|
||||
</>
|
||||
)}
|
||||
</box>
|
||||
) : (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>Skills</text>
|
||||
<text> </text>
|
||||
{visibleSkills.map((skill, idx) => {
|
||||
const actualIdx = startIdx + idx;
|
||||
const selected = actualIdx === selectedIndex;
|
||||
const indicator = selected ? '▸' : ' ';
|
||||
const statusIcon = skill.enabled !== false ? '●' : '○';
|
||||
const qualityBadge = skill.grade ? ` [${skill.grade}]` : '';
|
||||
const warningIndicator = skill.warnings && skill.warnings > 2 ? ' ⚠' : '';
|
||||
const line = `${indicator}${statusIcon} ${skill.name}${qualityBadge}${warningIndicator}`;
|
||||
const badgeColor = skill.quality !== undefined
|
||||
? (skill.quality >= 80 ? terminalColors.success : skill.quality >= 60 ? terminalColors.warning : terminalColors.error)
|
||||
: terminalColors.text;
|
||||
return (
|
||||
<text key={skill.name} fg={selected ? terminalColors.accent : badgeColor}>
|
||||
{line}
|
||||
</text>
|
||||
);
|
||||
})}
|
||||
<For each={visibleSkills()}>
|
||||
{(skill, idx) => {
|
||||
const actualIdx = () => startIdx() + idx();
|
||||
const selected = () => actualIdx() === selectedIndex();
|
||||
const indicator = () => (selected() ? '▸' : ' ');
|
||||
const statusIcon = () => (skill.enabled !== false ? '●' : '○');
|
||||
const qualityBadge = () => (skill.grade ? ` [${skill.grade}]` : '');
|
||||
const warningIndicator = () => (skill.warnings && skill.warnings > 2 ? ' ⚠' : '');
|
||||
const line = () =>
|
||||
`${indicator()}${statusIcon()} ${skill.name}${qualityBadge()}${warningIndicator()}`;
|
||||
const badgeColor = () =>
|
||||
skill.quality !== undefined
|
||||
? skill.quality >= 80
|
||||
? terminalColors.success
|
||||
: skill.quality >= 60
|
||||
? terminalColors.warning
|
||||
: terminalColors.error
|
||||
: terminalColors.text;
|
||||
return <text fg={selected() ? terminalColors.accent : badgeColor()}>{line()}</text>;
|
||||
}}
|
||||
</For>
|
||||
|
||||
{/* Scroll indicator */}
|
||||
{filteredSkills.length > maxVisible && (
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{'\n'}showing {startIdx + 1}-{Math.min(startIdx + maxVisible, filteredSkills.length)} of {filteredSkills.length}
|
||||
</text>
|
||||
)}
|
||||
</box>
|
||||
)}
|
||||
<Show when={filteredSkills().length > maxVisible()}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{'\n'}showing {startIdx() + 1}-{Math.min(startIdx() + maxVisible(), filteredSkills().length)} of{' '}
|
||||
{filteredSkills().length}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
</Show>
|
||||
</Show>
|
||||
</Show>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Footer */}
|
||||
{animPhase >= 2 && (
|
||||
<Show when={animPhase() >= 2}>
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text fg={terminalColors.textMuted}>{shortcuts}</text>
|
||||
{divider()}
|
||||
<text fg={terminalColors.textMuted}>{shortcuts()}</text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
import { useState, useEffect, useMemo, useCallback } from 'react';
|
||||
import { useKeyboard } from '@opentui/react';
|
||||
import { type Screen, DEFAULT_REPOS } from '../state/index.js';
|
||||
import { createSignal, createEffect, createMemo, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import {
|
||||
type Screen,
|
||||
DEFAULT_REPOS,
|
||||
fetchRepoSkills,
|
||||
filterMarketplaceSkills,
|
||||
type FetchedSkill,
|
||||
} from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { SearchInput } from '../components/SearchInput.js';
|
||||
|
||||
interface MarketplaceProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -10,136 +20,287 @@ interface MarketplaceProps {
|
||||
}
|
||||
|
||||
const CATEGORIES = [
|
||||
{ name: 'Development', count: 24 },
|
||||
{ name: 'Testing', count: 18 },
|
||||
{ name: 'DevOps', count: 15 },
|
||||
{ name: 'Security', count: 12 },
|
||||
{ name: 'Development', tag: 'development' },
|
||||
{ name: 'Testing', tag: 'testing' },
|
||||
{ name: 'DevOps', tag: 'devops' },
|
||||
{ name: 'Security', tag: 'security' },
|
||||
{ name: 'AI/ML', tag: 'ai' },
|
||||
];
|
||||
|
||||
export function Marketplace({ onNavigate, cols = 80, rows = 24 }: MarketplaceProps) {
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const [animPhase, setAnimPhase] = useState(0);
|
||||
export function Marketplace(props: MarketplaceProps) {
|
||||
const [allSkills, setAllSkills] = createSignal<FetchedSkill[]>([]);
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [selectedCategory, setSelectedCategory] = createSignal<string | null>(null);
|
||||
const [searchQuery, setSearchQuery] = createSignal('');
|
||||
const [loading, setLoading] = createSignal(true);
|
||||
const [error, setError] = createSignal<string | null>(null);
|
||||
const [loadedRepos, setLoadedRepos] = createSignal<string[]>([]);
|
||||
const [failedRepos, setFailedRepos] = createSignal<string[]>([]);
|
||||
|
||||
const isCompact = cols < 60;
|
||||
const contentWidth = Math.max(1, Math.min(cols - 4, 60));
|
||||
const rows = () => props.rows ?? 24;
|
||||
|
||||
// Entrance animation
|
||||
useEffect(() => {
|
||||
if (animPhase >= 3) return;
|
||||
const timer = setTimeout(() => setAnimPhase(p => p + 1), 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, [animPhase]);
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
// Featured repos
|
||||
const featured = useMemo(() =>
|
||||
DEFAULT_REPOS.slice(0, 5).map((r, i) => ({
|
||||
name: r.name,
|
||||
stars: Math.floor(100 - i * 15),
|
||||
source: r.source,
|
||||
})),
|
||||
[]
|
||||
);
|
||||
const loadData = async () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
const maxVisible = Math.max(3, Math.floor((rows - 14) / 1));
|
||||
const visibleFeatured = featured.slice(0, maxVisible);
|
||||
const skills: FetchedSkill[] = [];
|
||||
const loaded: string[] = [];
|
||||
const failed: string[] = [];
|
||||
|
||||
const handleKeyNav = useCallback((delta: number) => {
|
||||
setSelectedIndex(prev => Math.max(0, Math.min(prev + delta, visibleFeatured.length - 1)));
|
||||
}, [visibleFeatured.length]);
|
||||
|
||||
const handleInstall = useCallback(() => {
|
||||
const item = visibleFeatured[selectedIndex];
|
||||
if (item) {
|
||||
// Navigate to installed after "installing"
|
||||
onNavigate('installed');
|
||||
for (const repo of DEFAULT_REPOS.slice(0, 5)) {
|
||||
try {
|
||||
const result = await fetchRepoSkills(repo.source, DEFAULT_REPOS);
|
||||
if (result.skills.length > 0) {
|
||||
skills.push(...result.skills);
|
||||
loaded.push(repo.name);
|
||||
} else if (result.error) {
|
||||
failed.push(repo.name);
|
||||
}
|
||||
} catch {
|
||||
failed.push(repo.name);
|
||||
}
|
||||
}
|
||||
}, [selectedIndex, visibleFeatured, onNavigate]);
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
setAllSkills(skills);
|
||||
setLoadedRepos(loaded);
|
||||
setFailedRepos(failed);
|
||||
|
||||
const attemptedCount = DEFAULT_REPOS.slice(0, 5).length;
|
||||
if (failed.length === attemptedCount) {
|
||||
setError(`Failed to load all repos: ${failed.join(', ')}`);
|
||||
} else if (failed.length > 0 && skills.length === 0) {
|
||||
setError(`Some repos failed (${failed.join(', ')}) and no skills loaded`);
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const filteredSkills = createMemo(() => {
|
||||
let skills = allSkills();
|
||||
|
||||
if (selectedCategory()) {
|
||||
skills = skills.filter(
|
||||
(s) =>
|
||||
s.name.toLowerCase().includes(selectedCategory()!.toLowerCase()) ||
|
||||
s.description?.toLowerCase().includes(selectedCategory()!.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
if (searchQuery()) {
|
||||
skills = filterMarketplaceSkills(skills, searchQuery());
|
||||
}
|
||||
|
||||
return skills;
|
||||
});
|
||||
|
||||
createEffect(() => {
|
||||
const list = filteredSkills();
|
||||
const maxIndex = Math.max(0, list.length - 1);
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev, maxIndex)));
|
||||
});
|
||||
|
||||
const maxVisible = () => Math.max(4, Math.floor((rows() - 14) / 2));
|
||||
|
||||
const skillsWindow = createMemo(() => {
|
||||
const list = filteredSkills();
|
||||
const selected = selectedIndex();
|
||||
const visible = maxVisible();
|
||||
const total = list.length;
|
||||
if (total <= visible) return { start: 0, items: list };
|
||||
let start = Math.max(0, selected - Math.floor(visible / 2));
|
||||
start = Math.min(start, total - visible);
|
||||
return { start, items: list.slice(start, start + visible) };
|
||||
});
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
const max = filteredSkills().length - 1;
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
};
|
||||
|
||||
const handleInstall = () => {
|
||||
const skill = filteredSkills()[selectedIndex()];
|
||||
if (skill) {
|
||||
props.onNavigate('installed');
|
||||
}
|
||||
};
|
||||
|
||||
const handleCategorySelect = (idx: number) => {
|
||||
const cat = CATEGORIES[idx];
|
||||
if (cat) {
|
||||
setSelectedCategory((prev) => (prev === cat.tag ? null : cat.tag));
|
||||
setSelectedIndex(0);
|
||||
}
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string; sequence?: string }) => {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'return') handleInstall();
|
||||
else if (key.name === 'b') onNavigate('browse');
|
||||
else if (key.name === 'escape') onNavigate('home');
|
||||
else if (key.name === 'b') props.onNavigate('browse');
|
||||
else if (key.name === 'r') loadData();
|
||||
else if (key.sequence && ['1', '2', '3', '4', '5'].includes(key.sequence)) {
|
||||
handleCategorySelect(parseInt(key.sequence) - 1);
|
||||
} else if (key.name === 'escape') {
|
||||
if (searchQuery() || selectedCategory()) {
|
||||
setSearchQuery('');
|
||||
setSelectedCategory(null);
|
||||
} else {
|
||||
props.onNavigate('home');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const divider = useMemo(() =>
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth)}</text>,
|
||||
[contentWidth]
|
||||
);
|
||||
|
||||
const shortcuts = isCompact
|
||||
? 'j/k nav enter install b browse esc back'
|
||||
: 'j/k navigate enter install b full browse esc back';
|
||||
const selectedSkill = () => {
|
||||
const skills = filteredSkills();
|
||||
if (skills.length === 0) return null;
|
||||
return skills[selectedIndex()];
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
{/* Header */}
|
||||
{animPhase >= 1 && (
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Marketplace"
|
||||
subtitle="Discover and install skills"
|
||||
icon="★"
|
||||
count={allSkills().length}
|
||||
/>
|
||||
|
||||
<Show when={error()}>
|
||||
<ErrorState
|
||||
message={error()!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={loading()}>
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth}>
|
||||
<text fg={terminalColors.recommend}>★ Marketplace</text>
|
||||
<text fg={terminalColors.textMuted}>{DEFAULT_REPOS.length} available</text>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}>discover featured skills</text>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
|
||||
{/* Categories */}
|
||||
{animPhase >= 2 && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text> </text>
|
||||
<text fg={terminalColors.text}>Categories</text>
|
||||
<text> </text>
|
||||
<box flexDirection="row" gap={2}>
|
||||
{CATEGORIES.map(cat => (
|
||||
<text key={cat.name} fg={terminalColors.textMuted}>
|
||||
{cat.name} ({cat.count})
|
||||
</text>
|
||||
))}
|
||||
</box>
|
||||
<text> </text>
|
||||
{divider}
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
|
||||
{/* Featured section */}
|
||||
{animPhase >= 3 && (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>Featured · <text fg={terminalColors.textMuted}>trending</text></text>
|
||||
<text> </text>
|
||||
|
||||
{visibleFeatured.map((item, idx) => {
|
||||
const selected = idx === selectedIndex;
|
||||
const indicator = selected ? '▸' : ' ';
|
||||
// Use single text element to avoid rendering overlap
|
||||
const line = `${indicator}${item.name} ★${item.stars}`;
|
||||
return (
|
||||
<text key={item.source} fg={selected ? terminalColors.accent : terminalColors.text}>
|
||||
{line}
|
||||
</text>
|
||||
);
|
||||
})}
|
||||
|
||||
{featured.length > maxVisible && (
|
||||
<Spinner label="Loading marketplace skills..." />
|
||||
<Show when={loadedRepos().length > 0}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{'\n'}+{featured.length - maxVisible} more
|
||||
Loaded: {loadedRepos().join(', ')}
|
||||
</text>
|
||||
)}
|
||||
<text> </text>
|
||||
</Show>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Footer */}
|
||||
{animPhase >= 3 && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text fg={terminalColors.textMuted}>{shortcuts}</text>
|
||||
<Show when={!loading() && !error()}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.success}>
|
||||
● {loadedRepos().length} repos
|
||||
</text>
|
||||
<Show when={failedRepos().length > 0}>
|
||||
<text fg={terminalColors.textMuted}> | </text>
|
||||
<text fg={terminalColors.warning}>
|
||||
○ {failedRepos().length} failed
|
||||
</text>
|
||||
</Show>
|
||||
<text fg={terminalColors.textMuted}> | </text>
|
||||
<text fg={terminalColors.text}>{allSkills().length} skills</text>
|
||||
</box>
|
||||
)}
|
||||
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.text}>Categories: </text>
|
||||
<For each={CATEGORIES}>
|
||||
{(cat, idx) => (
|
||||
<text
|
||||
fg={
|
||||
selectedCategory() === cat.tag
|
||||
? terminalColors.accent
|
||||
: terminalColors.textMuted
|
||||
}
|
||||
>
|
||||
[{idx() + 1}]{cat.name}{' '}
|
||||
</text>
|
||||
)}
|
||||
</For>
|
||||
</box>
|
||||
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<Show
|
||||
when={filteredSkills().length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
icon="★"
|
||||
title="No skills found"
|
||||
description={
|
||||
searchQuery() || selectedCategory()
|
||||
? 'Try a different search or category'
|
||||
: 'No skills loaded yet'
|
||||
}
|
||||
action={{ label: 'Clear Filter', key: 'Esc' }}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>
|
||||
{selectedCategory() ? `${selectedCategory()} Skills` : 'Featured Skills'}
|
||||
</b>{' '}
|
||||
<text fg={terminalColors.textMuted}>
|
||||
({filteredSkills().length} results)
|
||||
</text>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<Show when={skillsWindow().start > 0}>
|
||||
<text fg={terminalColors.textMuted}> ▲ {skillsWindow().start} more</text>
|
||||
</Show>
|
||||
<For each={skillsWindow().items}>
|
||||
{(skill, idx) => {
|
||||
const originalIndex = () => skillsWindow().start + idx();
|
||||
const isSelected = () => originalIndex() === selectedIndex();
|
||||
return (
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<box flexDirection="row">
|
||||
<text
|
||||
fg={isSelected() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{isSelected() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={isSelected() ? terminalColors.accent : terminalColors.text}
|
||||
width={25}
|
||||
>
|
||||
{skill.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{skill.repoName}
|
||||
</text>
|
||||
</box>
|
||||
<Show when={skill.description}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{' '}{skill.description?.slice(0, 50)}
|
||||
{(skill.description?.length || 0) > 50 ? '...' : ''}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
|
||||
<Show when={skillsWindow().start + maxVisible() < filteredSkills().length}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
▼ {filteredSkills().length - skillsWindow().start - maxVisible()} more
|
||||
</text>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
j/k navigate Enter install 1-5 category b browse r refresh Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
/**
|
||||
* Memory Screen
|
||||
* Session memory management
|
||||
*/
|
||||
import { createSignal, createEffect, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { DetailPane } from '../components/DetailPane.js';
|
||||
import {
|
||||
loadMemories,
|
||||
deleteMemoryEntry,
|
||||
clearMemory,
|
||||
initializeMemory,
|
||||
type MemoryServiceState,
|
||||
type MemoryEntry,
|
||||
} from '../services/memory.service.js';
|
||||
|
||||
interface MemoryProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -12,38 +21,268 @@ interface MemoryProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Memory({ onNavigate, cols = 80, rows = 24 }: MemoryProps) {
|
||||
const memories = [
|
||||
{ key: 'project-context', size: '2.4 KB', updated: '2 min ago' },
|
||||
{ key: 'user-preferences', size: '1.1 KB', updated: '5 min ago' },
|
||||
{ key: 'session-history', size: '4.7 KB', updated: '1 min ago' },
|
||||
];
|
||||
export function Memory(props: MemoryProps) {
|
||||
const [state, setState] = createSignal<MemoryServiceState>({
|
||||
entries: [],
|
||||
status: null,
|
||||
paths: null,
|
||||
loading: true,
|
||||
error: null,
|
||||
});
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [showDetail, setShowDetail] = createSignal(false);
|
||||
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
const loadData = async () => {
|
||||
setState((s) => ({ ...s, loading: true, error: null }));
|
||||
try {
|
||||
const result = await loadMemories();
|
||||
setState(result);
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
loading: false,
|
||||
error: err instanceof Error ? err.message : 'Failed to load memories',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = async () => {
|
||||
const entries = state().entries;
|
||||
if (entries.length === 0) return;
|
||||
|
||||
const entry = entries[selectedIndex()];
|
||||
if (!entry) return;
|
||||
|
||||
try {
|
||||
const success = await deleteMemoryEntry(entry.key);
|
||||
if (success) {
|
||||
loadData();
|
||||
}
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Failed to delete entry',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleClearAll = async () => {
|
||||
try {
|
||||
const success = await clearMemory(undefined, 'all');
|
||||
if (success) {
|
||||
loadData();
|
||||
}
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Failed to clear memory',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleInitialize = async () => {
|
||||
try {
|
||||
const success = await initializeMemory();
|
||||
if (success) {
|
||||
loadData();
|
||||
}
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Failed to initialize memory',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const getTypeIcon = (type: MemoryEntry['type']): string => {
|
||||
switch (type) {
|
||||
case 'index':
|
||||
return '◈';
|
||||
case 'learning':
|
||||
return '◇';
|
||||
case 'observation':
|
||||
return '○';
|
||||
default:
|
||||
return '•';
|
||||
}
|
||||
};
|
||||
|
||||
const selectedEntry = () => {
|
||||
const entries = state().entries;
|
||||
if (entries.length === 0) return null;
|
||||
return entries[selectedIndex()];
|
||||
};
|
||||
|
||||
const detailFields = () => {
|
||||
const entry = selectedEntry();
|
||||
if (!entry) return [];
|
||||
|
||||
return [
|
||||
{ label: 'Key', value: entry.key },
|
||||
{ label: 'Type', value: entry.type },
|
||||
{ label: 'Size', value: entry.size },
|
||||
{ label: 'Updated', value: entry.updated },
|
||||
];
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
const entries = state().entries;
|
||||
const maxIndex = Math.max(0, entries.length - 1);
|
||||
|
||||
if (key.name === 'j' || key.name === 'down') {
|
||||
setSelectedIndex((prev) => Math.min(prev + 1, maxIndex));
|
||||
} else if (key.name === 'k' || key.name === 'up') {
|
||||
setSelectedIndex((prev) => Math.max(prev - 1, 0));
|
||||
} else if (key.name === 'return') {
|
||||
if (entries.length > 0) {
|
||||
setShowDetail(true);
|
||||
}
|
||||
} else if (key.name === 'd') {
|
||||
handleDelete();
|
||||
} else if (key.name === 'c') {
|
||||
handleClearAll();
|
||||
} else if (key.name === 'i') {
|
||||
handleInitialize();
|
||||
} else if (key.name === 'r') {
|
||||
loadData();
|
||||
} else if (key.name === 'escape') {
|
||||
if (showDetail()) {
|
||||
setShowDetail(false);
|
||||
} else {
|
||||
props.onNavigate('home');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Memory"
|
||||
subtitle="Manage persistent session memory"
|
||||
count={memories.length}
|
||||
icon="◎"
|
||||
count={state().entries.length}
|
||||
icon="◎"
|
||||
/>
|
||||
|
||||
<text fg={terminalColors.text}><b>Stored Memories</b></text>
|
||||
<text> </text>
|
||||
<Show when={state().error}>
|
||||
<ErrorState
|
||||
message={state().error!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
{memories.map((mem, idx) => (
|
||||
<box key={mem.key} flexDirection="row" marginBottom={1}>
|
||||
<text fg={idx === 0 ? terminalColors.accent : terminalColors.text} width={25}>
|
||||
{idx === 0 ? '\u25B8 ' : ' '}{mem.key}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={12}>{mem.size}</text>
|
||||
<text fg={terminalColors.textMuted}>{mem.updated}</text>
|
||||
<Show when={state().loading}>
|
||||
<Spinner label="Loading memories..." />
|
||||
</Show>
|
||||
|
||||
<Show when={!state().loading && !state().error}>
|
||||
<box flexDirection="row">
|
||||
<box flexDirection="column" flexGrow={1}>
|
||||
<Show when={state().status}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>Status: </text>
|
||||
<text
|
||||
fg={
|
||||
state().status?.projectMemoryExists || state().status?.globalMemoryExists
|
||||
? terminalColors.success
|
||||
: terminalColors.warning
|
||||
}
|
||||
>
|
||||
{state().status?.projectMemoryExists ? 'Project ✓' : 'Project ✗'}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}> | </text>
|
||||
<text
|
||||
fg={state().status?.globalMemoryExists ? terminalColors.success : terminalColors.warning}
|
||||
>
|
||||
{state().status?.globalMemoryExists ? 'Global ✓' : 'Global ✗'}
|
||||
</text>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<Show
|
||||
when={state().entries.length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
icon="◎"
|
||||
title="No memories stored"
|
||||
description="Memory will be created as you use skills"
|
||||
action={{ label: 'Initialize', key: 'i' }}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<text fg={terminalColors.text}><b>Stored Memories</b></text>
|
||||
<text> </text>
|
||||
|
||||
<For each={state().entries}>
|
||||
{(mem, idx) => (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={idx() === selectedIndex() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{idx() === selectedIndex() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={idx() === selectedIndex() ? terminalColors.accent : terminalColors.text}
|
||||
>
|
||||
{getTypeIcon(mem.type)}{' '}
|
||||
</text>
|
||||
<text
|
||||
fg={idx() === selectedIndex() ? terminalColors.accent : terminalColors.text}
|
||||
width={20}
|
||||
>
|
||||
{mem.key}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={12}>
|
||||
{mem.size}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{mem.updated}</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<Show when={showDetail() && selectedEntry()}>
|
||||
<DetailPane
|
||||
title={selectedEntry()!.key}
|
||||
icon={getTypeIcon(selectedEntry()!.type)}
|
||||
fields={detailFields()}
|
||||
actions={[
|
||||
{ key: 'd', label: 'Delete' },
|
||||
{ key: 'Esc', label: 'Close' },
|
||||
]}
|
||||
width={30}
|
||||
visible={showDetail()}
|
||||
onClose={() => setShowDetail(false)}
|
||||
/>
|
||||
</Show>
|
||||
</box>
|
||||
))}
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<Show when={state().paths}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Project: {state().paths?.projectMemoryDir || 'Not initialized'}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Global: {state().paths?.globalMemoryDir || 'Not initialized'}
|
||||
</text>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Press Enter to view, 'd' to delete, 'c' to clear all
|
||||
j/k navigate Enter view d delete c clear all i init Esc back
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/**
|
||||
* Mesh Screen
|
||||
* Mesh network and peer management
|
||||
*/
|
||||
import { For } from 'solid-js';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
@@ -12,7 +9,7 @@ interface MeshProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Mesh({ onNavigate, cols = 80, rows = 24 }: MeshProps) {
|
||||
export function Mesh(props: MeshProps) {
|
||||
const hosts = [
|
||||
{ name: 'workstation-1', address: '192.168.1.10', status: 'online', peers: 3 },
|
||||
{ name: 'laptop-dev', address: '192.168.1.15', status: 'online', peers: 2 },
|
||||
@@ -37,7 +34,7 @@ export function Mesh({ onNavigate, cols = 80, rows = 24 }: MeshProps) {
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.text}><b>Security: </b></text>
|
||||
<text fg={securityStatus.initialized ? terminalColors.success : terminalColors.warning}>
|
||||
{securityStatus.initialized ? '● Initialized' : '○ Not initialized'}
|
||||
{securityStatus.initialized ? '* Initialized' : 'o Not initialized'}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}> Fingerprint: {securityStatus.fingerprint}</text>
|
||||
</box>
|
||||
@@ -45,18 +42,20 @@ export function Mesh({ onNavigate, cols = 80, rows = 24 }: MeshProps) {
|
||||
<text fg={terminalColors.text}><b>Known Hosts</b></text>
|
||||
<text> </text>
|
||||
|
||||
{hosts.map((host, idx) => (
|
||||
<box key={host.name} flexDirection="row" marginBottom={1}>
|
||||
<text fg={host.status === 'online' ? terminalColors.success : terminalColors.textMuted} width={3}>
|
||||
{host.status === 'online' ? '●' : '○'}
|
||||
</text>
|
||||
<text fg={idx === 0 ? terminalColors.accent : terminalColors.text} width={20}>
|
||||
{idx === 0 ? '\u25B8 ' : ' '}{host.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={18}>{host.address}</text>
|
||||
<text fg={terminalColors.textMuted}>{host.peers} peers</text>
|
||||
</box>
|
||||
))}
|
||||
<For each={hosts}>
|
||||
{(host, idx) => (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={host.status === 'online' ? terminalColors.success : terminalColors.textMuted} width={3}>
|
||||
{host.status === 'online' ? '*' : 'o'}
|
||||
</text>
|
||||
<text fg={idx() === 0 ? terminalColors.accent : terminalColors.text} width={20}>
|
||||
{idx() === 0 ? '\u25B8 ' : ' '}{host.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={18}>{host.address}</text>
|
||||
<text fg={terminalColors.textMuted}>{host.peers} peers</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/**
|
||||
* Message Screen
|
||||
* Inter-agent messaging
|
||||
*/
|
||||
import { For } from 'solid-js';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
@@ -12,7 +9,7 @@ interface MessageProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Message({ onNavigate, cols = 80, rows = 24 }: MessageProps) {
|
||||
export function Message(props: MessageProps) {
|
||||
const messages = [
|
||||
{ id: '1', from: 'claude@laptop', subject: 'Code review completed', time: '2 min ago', unread: true },
|
||||
{ id: '2', from: 'cursor@workstation', subject: 'Build artifacts ready', time: '15 min ago', unread: true },
|
||||
@@ -37,20 +34,22 @@ export function Message({ onNavigate, cols = 80, rows = 24 }: MessageProps) {
|
||||
|
||||
<text> </text>
|
||||
|
||||
{messages.map((msg, idx) => (
|
||||
<box key={msg.id} flexDirection="row" marginBottom={1}>
|
||||
<text fg={msg.unread ? terminalColors.accent : terminalColors.textMuted} width={3}>
|
||||
{msg.unread ? '●' : '○'}
|
||||
</text>
|
||||
<text fg={idx === 0 ? terminalColors.accent : terminalColors.text} width={22}>
|
||||
{idx === 0 ? '\u25B8 ' : ' '}{msg.from}
|
||||
</text>
|
||||
<text fg={msg.unread ? terminalColors.text : terminalColors.textMuted} width={30}>
|
||||
{msg.subject.slice(0, 28)}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{msg.time}</text>
|
||||
</box>
|
||||
))}
|
||||
<For each={messages}>
|
||||
{(msg, idx) => (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={msg.unread ? terminalColors.accent : terminalColors.textMuted} width={3}>
|
||||
{msg.unread ? '*' : 'o'}
|
||||
</text>
|
||||
<text fg={idx() === 0 ? terminalColors.accent : terminalColors.text} width={22}>
|
||||
{idx() === 0 ? '\u25B8 ' : ' '}{msg.from}
|
||||
</text>
|
||||
<text fg={msg.unread ? terminalColors.text : terminalColors.textMuted} width={30}>
|
||||
{msg.subject.slice(0, 28)}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{msg.time}</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
/**
|
||||
* Methodology Screen
|
||||
* Development methodology packs
|
||||
*/
|
||||
import { createSignal, createEffect, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { DetailPane } from '../components/DetailPane.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
import {
|
||||
loadMethodologies,
|
||||
installMethodologyPack,
|
||||
uninstallMethodologyPack,
|
||||
syncMethodologyPack,
|
||||
type MethodologyServiceState,
|
||||
type MethodologyPackDisplay,
|
||||
} from '../services/methodology.service.js';
|
||||
|
||||
interface MethodologyProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -12,48 +22,304 @@ interface MethodologyProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Methodology({ onNavigate, cols = 80, rows = 24 }: MethodologyProps) {
|
||||
const methodologies = [
|
||||
{ name: 'TDD', description: 'Test-Driven Development', skills: 5, active: true },
|
||||
{ name: 'BDD', description: 'Behavior-Driven Development', skills: 4, active: false },
|
||||
{ name: 'Clean Code', description: 'SOLID principles', skills: 6, active: false },
|
||||
{ name: 'Security First', description: 'OWASP guidelines', skills: 8, active: false },
|
||||
];
|
||||
export function Methodology(props: MethodologyProps) {
|
||||
const [state, setState] = createSignal<MethodologyServiceState>({
|
||||
packs: [],
|
||||
installedPacks: [],
|
||||
manager: null,
|
||||
loading: true,
|
||||
error: null,
|
||||
});
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [showDetail, setShowDetail] = createSignal(false);
|
||||
const [installing, setInstalling] = createSignal(false);
|
||||
const [syncing, setSyncing] = createSignal(false);
|
||||
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
const loadData = async () => {
|
||||
setState((s) => ({ ...s, loading: true, error: null }));
|
||||
try {
|
||||
const result = await loadMethodologies();
|
||||
setState(result);
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
loading: false,
|
||||
error: err instanceof Error ? err.message : 'Failed to load methodologies',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleInstall = async () => {
|
||||
const packs = state().packs;
|
||||
if (packs.length === 0 || installing()) return;
|
||||
|
||||
const pack = packs[selectedIndex()];
|
||||
if (!pack || pack.installed) return;
|
||||
|
||||
setInstalling(true);
|
||||
try {
|
||||
const result = await installMethodologyPack(pack.name);
|
||||
if (result) {
|
||||
await loadData();
|
||||
}
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Failed to install pack',
|
||||
}));
|
||||
} finally {
|
||||
setInstalling(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleUninstall = async () => {
|
||||
const packs = state().packs;
|
||||
if (packs.length === 0 || installing()) return;
|
||||
|
||||
const pack = packs[selectedIndex()];
|
||||
if (!pack || !pack.installed) return;
|
||||
|
||||
setInstalling(true);
|
||||
try {
|
||||
const success = await uninstallMethodologyPack(pack.name);
|
||||
if (success) {
|
||||
await loadData();
|
||||
}
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Failed to uninstall pack',
|
||||
}));
|
||||
} finally {
|
||||
setInstalling(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSync = async () => {
|
||||
const packs = state().packs;
|
||||
if (packs.length === 0 || syncing()) return;
|
||||
|
||||
const pack = packs[selectedIndex()];
|
||||
if (!pack || !pack.installed) return;
|
||||
|
||||
setSyncing(true);
|
||||
try {
|
||||
const result = await syncMethodologyPack(pack.name);
|
||||
if (result) {
|
||||
await loadData();
|
||||
}
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Failed to sync pack',
|
||||
}));
|
||||
} finally {
|
||||
setSyncing(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
const max = state().packs.length - 1;
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'return') setShowDetail(true);
|
||||
else if (key.name === 'i') handleInstall();
|
||||
else if (key.name === 'u') handleUninstall();
|
||||
else if (key.name === 's') handleSync();
|
||||
else if (key.name === 'r') loadData();
|
||||
else if (key.name === 'escape') {
|
||||
if (showDetail()) setShowDetail(false);
|
||||
else props.onNavigate('home');
|
||||
}
|
||||
});
|
||||
|
||||
const getStatusIcon = (status: MethodologyPackDisplay['status']): string => {
|
||||
switch (status) {
|
||||
case 'synced':
|
||||
return '✓';
|
||||
case 'installed':
|
||||
return '●';
|
||||
default:
|
||||
return '○';
|
||||
}
|
||||
};
|
||||
|
||||
const getStatusColor = (status: MethodologyPackDisplay['status']): string => {
|
||||
switch (status) {
|
||||
case 'synced':
|
||||
return terminalColors.success;
|
||||
case 'installed':
|
||||
return terminalColors.accent;
|
||||
default:
|
||||
return terminalColors.textMuted;
|
||||
}
|
||||
};
|
||||
|
||||
const selectedPack = () => {
|
||||
const packs = state().packs;
|
||||
if (packs.length === 0) return null;
|
||||
return packs[selectedIndex()];
|
||||
};
|
||||
|
||||
const detailFields = () => {
|
||||
const pack = selectedPack();
|
||||
if (!pack) return [];
|
||||
|
||||
return [
|
||||
{ label: 'Name', value: pack.name },
|
||||
{ label: 'Version', value: pack.version },
|
||||
{ label: 'Description', value: pack.description || 'No description' },
|
||||
{ label: 'Skills', value: String(pack.skills) },
|
||||
{ label: 'Tags', value: pack.tags.join(', ') || 'None' },
|
||||
{ label: 'Status', value: pack.status },
|
||||
];
|
||||
};
|
||||
|
||||
const installedCount = () => state().packs.filter((p) => p.installed).length;
|
||||
|
||||
return (
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Methodologies"
|
||||
subtitle="Development methodology skill packs"
|
||||
count={methodologies.length}
|
||||
icon="◎"
|
||||
count={state().packs.length}
|
||||
icon="◎"
|
||||
/>
|
||||
|
||||
<text fg={terminalColors.text}><b>Available Packs</b></text>
|
||||
<text> </text>
|
||||
<Show when={state().error}>
|
||||
<ErrorState
|
||||
message={state().error!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
{methodologies.map((meth, idx) => (
|
||||
<box key={meth.name} flexDirection="column" marginBottom={1}>
|
||||
<box flexDirection="row">
|
||||
<text
|
||||
fg={idx === 0 ? terminalColors.accent : terminalColors.text}
|
||||
width={15}
|
||||
<Show when={state().loading}>
|
||||
<Spinner label="Loading methodologies..." />
|
||||
</Show>
|
||||
|
||||
<Show when={!state().loading && !state().error}>
|
||||
<box flexDirection="row">
|
||||
<box flexDirection="column" flexGrow={1}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>Installed: </text>
|
||||
<text fg={terminalColors.success}>{installedCount()}</text>
|
||||
<text fg={terminalColors.textMuted}> / </text>
|
||||
<text fg={terminalColors.text}>{state().packs.length}</text>
|
||||
<text fg={terminalColors.textMuted}> packs</text>
|
||||
</box>
|
||||
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<Show
|
||||
when={state().packs.length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
icon="◎"
|
||||
title="No methodology packs found"
|
||||
description="Check .skillkit/methodology/packs/"
|
||||
/>
|
||||
}
|
||||
>
|
||||
{idx === 0 ? <b>{'\u25B8 '}{meth.name}</b> : <>{'\u25B8 '}{meth.name}</>}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{meth.skills} skills</text>
|
||||
{meth.active && (
|
||||
<text fg={terminalColors.success}> [active]</text>
|
||||
)}
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}> {meth.description}</text>
|
||||
</box>
|
||||
))}
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Available Packs</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Press Enter to activate, 'v' to view skills
|
||||
</text>
|
||||
<For each={state().packs}>
|
||||
{(pack, idx) => {
|
||||
const selected = () => idx() === selectedIndex();
|
||||
return (
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<box flexDirection="row">
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{selected() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={20}
|
||||
>
|
||||
{pack.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={8}>
|
||||
v{pack.version}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={10}>
|
||||
{pack.skills} skills
|
||||
</text>
|
||||
<text fg={getStatusColor(pack.status)}>
|
||||
{getStatusIcon(pack.status)} {pack.status}
|
||||
</text>
|
||||
</box>
|
||||
<Show when={pack.description}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{' '}{pack.description.slice(0, 45)}
|
||||
{pack.description.length > 45 ? '...' : ''}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</Show>
|
||||
|
||||
<Show when={installing()}>
|
||||
<text> </text>
|
||||
<StatusIndicator
|
||||
status="loading"
|
||||
label={selectedPack()?.installed ? 'Uninstalling...' : 'Installing...'}
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={syncing()}>
|
||||
<text> </text>
|
||||
<StatusIndicator status="loading" label="Syncing to agents..." />
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<Show when={showDetail() && selectedPack()}>
|
||||
<DetailPane
|
||||
title={selectedPack()!.name}
|
||||
subtitle={`v${selectedPack()!.version}`}
|
||||
icon="◎"
|
||||
fields={detailFields()}
|
||||
actions={
|
||||
selectedPack()!.installed
|
||||
? [
|
||||
{ key: 's', label: 'Sync' },
|
||||
{ key: 'u', label: 'Uninstall' },
|
||||
{ key: 'Esc', label: 'Close' },
|
||||
]
|
||||
: [
|
||||
{ key: 'i', label: 'Install' },
|
||||
{ key: 'Esc', label: 'Close' },
|
||||
]
|
||||
}
|
||||
width={35}
|
||||
visible={showDetail()}
|
||||
onClose={() => setShowDetail(false)}
|
||||
/>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
j/k navigate Enter details i install u uninstall s sync r refresh Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/**
|
||||
* Plan Screen
|
||||
* Structured plan execution
|
||||
*/
|
||||
import { createSignal, createEffect, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { ProgressBar } from '../components/ProgressBar.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
import {
|
||||
loadPlansList,
|
||||
loadPlan,
|
||||
validatePlan,
|
||||
executePlan,
|
||||
executePlanDryRun,
|
||||
type PlanServiceState,
|
||||
type PlanListItem,
|
||||
} from '../services/plan.service.js';
|
||||
|
||||
interface PlanProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -13,58 +23,274 @@ interface PlanProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Plan({ onNavigate, cols = 80, rows = 24 }: PlanProps) {
|
||||
const steps = [
|
||||
{ name: 'Analyze codebase', status: 'done', duration: '2.3s' },
|
||||
{ name: 'Generate tests', status: 'done', duration: '5.1s' },
|
||||
{ name: 'Run linter', status: 'running', duration: '-' },
|
||||
{ name: 'Apply fixes', status: 'pending', duration: '-' },
|
||||
{ name: 'Verify changes', status: 'pending', duration: '-' },
|
||||
];
|
||||
export function Plan(props: PlanProps) {
|
||||
const [state, setState] = createSignal<PlanServiceState>({
|
||||
plans: [],
|
||||
current: null,
|
||||
validation: null,
|
||||
execution: null,
|
||||
loading: true,
|
||||
error: null,
|
||||
});
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [executionProgress, setExecutionProgress] = createSignal(0);
|
||||
const [executing, setExecuting] = createSignal(false);
|
||||
const [validating, setValidating] = createSignal(false);
|
||||
|
||||
const completedSteps = steps.filter((s) => s.status === 'done').length;
|
||||
const progress = (completedSteps / steps.length) * 100;
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
const loadData = async () => {
|
||||
setState((s) => ({ ...s, loading: true, error: null }));
|
||||
try {
|
||||
const result = await loadPlansList();
|
||||
setState(result);
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
loading: false,
|
||||
error: err instanceof Error ? err.message : 'Failed to load plans',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleValidate = async () => {
|
||||
const plans = state().plans;
|
||||
if (plans.length === 0 || validating()) return;
|
||||
|
||||
const planItem = plans[selectedIndex()];
|
||||
if (!planItem) return;
|
||||
|
||||
setValidating(true);
|
||||
try {
|
||||
const plan = await loadPlan(planItem.path);
|
||||
if (plan) {
|
||||
const validation = await validatePlan(plan);
|
||||
setState((s) => ({ ...s, current: plan, validation }));
|
||||
}
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Validation failed',
|
||||
}));
|
||||
} finally {
|
||||
setValidating(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleExecute = async (dryRun: boolean = false) => {
|
||||
const plans = state().plans;
|
||||
if (plans.length === 0 || executing()) return;
|
||||
|
||||
const planItem = plans[selectedIndex()];
|
||||
if (!planItem) return;
|
||||
|
||||
setExecuting(true);
|
||||
setExecutionProgress(0);
|
||||
|
||||
try {
|
||||
const plan = await loadPlan(planItem.path);
|
||||
if (!plan) {
|
||||
setExecuting(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const executeFn = dryRun ? executePlanDryRun : executePlan;
|
||||
let completedCount = 0;
|
||||
const totalTasks = plan.tasks?.length || 0;
|
||||
const result = await executeFn(plan, undefined, (event) => {
|
||||
if (event === 'plan:task_completed') {
|
||||
completedCount++;
|
||||
setExecutionProgress(totalTasks > 0 ? (completedCount / totalTasks) * 100 : 100);
|
||||
}
|
||||
});
|
||||
|
||||
setState((s) => ({ ...s, execution: result }));
|
||||
loadData();
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Execution failed',
|
||||
}));
|
||||
} finally {
|
||||
setExecuting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
const max = state().plans.length - 1;
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'v') handleValidate();
|
||||
else if (key.name === 'x') handleExecute(false);
|
||||
else if (key.name === 'd') handleExecute(true);
|
||||
else if (key.name === 'r') loadData();
|
||||
else if (key.name === 'escape') props.onNavigate('home');
|
||||
});
|
||||
|
||||
const getStatusIcon = (status: PlanListItem['status']): string => {
|
||||
switch (status) {
|
||||
case 'completed':
|
||||
return '✓';
|
||||
case 'failed':
|
||||
return '✗';
|
||||
case 'in_progress':
|
||||
return '⟳';
|
||||
default:
|
||||
return '○';
|
||||
}
|
||||
};
|
||||
|
||||
const getStatusColor = (status: PlanListItem['status']): string => {
|
||||
switch (status) {
|
||||
case 'completed':
|
||||
return terminalColors.success;
|
||||
case 'failed':
|
||||
return terminalColors.error;
|
||||
case 'in_progress':
|
||||
return terminalColors.accent;
|
||||
default:
|
||||
return terminalColors.textMuted;
|
||||
}
|
||||
};
|
||||
|
||||
const selectedPlan = () => {
|
||||
const plans = state().plans;
|
||||
if (plans.length === 0) return null;
|
||||
return plans[selectedIndex()];
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Plan Execution"
|
||||
subtitle="Structured multi-step execution"
|
||||
icon="▣"
|
||||
icon="▣"
|
||||
count={state().plans.length}
|
||||
/>
|
||||
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.text}>Progress: </text>
|
||||
<ProgressBar progress={progress} width={30} />
|
||||
</box>
|
||||
<Show when={state().error}>
|
||||
<ErrorState
|
||||
message={state().error!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<text fg={terminalColors.text}><b>Steps</b></text>
|
||||
<text> </text>
|
||||
<Show when={state().loading}>
|
||||
<Spinner label="Loading plans..." />
|
||||
</Show>
|
||||
|
||||
{steps.map((step, idx) => {
|
||||
const statusIcon = step.status === 'done' ? '\u2713' : step.status === 'running' ? '\u27F3' : '\u25CB';
|
||||
const statusColor =
|
||||
step.status === 'done'
|
||||
? terminalColors.success
|
||||
: step.status === 'running'
|
||||
? terminalColors.accent
|
||||
: terminalColors.textMuted;
|
||||
<Show when={!state().loading && !state().error}>
|
||||
<Show
|
||||
when={state().plans.length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
icon="▣"
|
||||
title="No plans found"
|
||||
description="Create plans in .skillkit/plans/"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Available Plans</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
return (
|
||||
<box key={step.name} flexDirection="row" marginBottom={1}>
|
||||
<text fg={statusColor} width={3}>{statusIcon}</text>
|
||||
<text fg={step.status === 'pending' ? terminalColors.textMuted : terminalColors.text} width={25}>
|
||||
{step.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{step.duration}</text>
|
||||
<For each={state().plans}>
|
||||
{(plan, idx) => {
|
||||
const selected = () => idx() === selectedIndex();
|
||||
return (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{selected() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={25}
|
||||
>
|
||||
{plan.name}
|
||||
</text>
|
||||
<text fg={getStatusColor(plan.status)} width={3}>
|
||||
{getStatusIcon(plan.status)}{' '}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={10}>
|
||||
{plan.tasks} tasks
|
||||
</text>
|
||||
<Show when={plan.lastModified}>
|
||||
<text fg={terminalColors.textMuted}> • {plan.lastModified}</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</Show>
|
||||
|
||||
<Show when={validating()}>
|
||||
<text> </text>
|
||||
<StatusIndicator status="loading" label="Validating plan..." />
|
||||
</Show>
|
||||
|
||||
<Show when={state().validation && !validating()}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Validation Result</b>
|
||||
</text>
|
||||
<text
|
||||
fg={state().validation!.valid ? terminalColors.success : terminalColors.error}
|
||||
>
|
||||
{state().validation!.valid ? '✓ Valid' : '✗ Invalid'}
|
||||
</text>
|
||||
<Show when={state().validation!.issues && state().validation!.issues!.length > 0}>
|
||||
<For each={state().validation!.issues!.slice(0, 3)}>
|
||||
{(issue) => (
|
||||
<text fg={terminalColors.warning}>• {issue.message}</text>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<Show when={executing()}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<StatusIndicator status="loading" label="Executing plan..." />
|
||||
<box flexDirection="row" marginTop={1}>
|
||||
<text fg={terminalColors.text}>Progress: </text>
|
||||
<ProgressBar progress={executionProgress()} width={30} />
|
||||
</box>
|
||||
);
|
||||
})}
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Press Enter to continue, Esc to cancel
|
||||
</text>
|
||||
<Show when={state().execution && !executing()}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Execution Result</b>
|
||||
</text>
|
||||
<text
|
||||
fg={state().execution!.success ? terminalColors.success : terminalColors.error}
|
||||
>
|
||||
{state().execution!.success ? '✓ Completed' : '✗ Failed'}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Completed: {state().execution!.completedTasks.length} | Failed: {state().execution!.failedTasks.length}
|
||||
</text>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
j/k navigate v validate x execute d dry-run r refresh Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
/**
|
||||
* Plugins Screen
|
||||
* Plugin management
|
||||
*/
|
||||
import { createSignal, createEffect, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { DetailPane } from '../components/DetailPane.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
import {
|
||||
loadPluginsList,
|
||||
enablePlugin,
|
||||
disablePlugin,
|
||||
getPluginInfo,
|
||||
type PluginServiceState,
|
||||
type PluginListItem,
|
||||
} from '../services/plugin.service.js';
|
||||
import type { PluginManager, Plugin } from '@skillkit/core';
|
||||
|
||||
interface PluginsProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -12,46 +23,256 @@ interface PluginsProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Plugins({ onNavigate, cols = 80, rows = 24 }: PluginsProps) {
|
||||
const plugins = [
|
||||
{ name: 'git-hooks', enabled: true, version: '1.2.0' },
|
||||
{ name: 'ai-suggest', enabled: true, version: '0.9.1' },
|
||||
{ name: 'metrics', enabled: false, version: '2.0.0' },
|
||||
];
|
||||
export function Plugins(props: PluginsProps) {
|
||||
const [state, setState] = createSignal<PluginServiceState>({
|
||||
plugins: [],
|
||||
manager: null,
|
||||
loading: true,
|
||||
error: null,
|
||||
});
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [showDetail, setShowDetail] = createSignal(false);
|
||||
const [selectedPlugin, setSelectedPlugin] = createSignal<Plugin | null>(null);
|
||||
const [toggling, setToggling] = createSignal(false);
|
||||
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
const loadData = async () => {
|
||||
setState((s) => ({ ...s, loading: true, error: null }));
|
||||
try {
|
||||
const result = await loadPluginsList();
|
||||
setState(result);
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
loading: false,
|
||||
error: err instanceof Error ? err.message : 'Failed to load plugins',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleToggle = async () => {
|
||||
const plugins = state().plugins;
|
||||
const manager = state().manager;
|
||||
if (plugins.length === 0 || !manager) return;
|
||||
|
||||
const plugin = plugins[selectedIndex()];
|
||||
if (!plugin) return;
|
||||
|
||||
setToggling(true);
|
||||
|
||||
try {
|
||||
if (plugin.enabled) {
|
||||
await disablePlugin(plugin.name, manager);
|
||||
} else {
|
||||
await enablePlugin(plugin.name, manager);
|
||||
}
|
||||
|
||||
await loadData();
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Failed to toggle plugin',
|
||||
}));
|
||||
} finally {
|
||||
setToggling(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleShowDetail = async () => {
|
||||
const plugins = state().plugins;
|
||||
const manager = state().manager;
|
||||
if (plugins.length === 0 || !manager) return;
|
||||
|
||||
const plugin = plugins[selectedIndex()];
|
||||
if (!plugin) return;
|
||||
|
||||
try {
|
||||
const info = await getPluginInfo(plugin.name, manager);
|
||||
setSelectedPlugin(info as Plugin | null);
|
||||
setShowDetail(true);
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Failed to load plugin details',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
const max = state().plugins.length - 1;
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'return') handleShowDetail();
|
||||
else if (key.name === 'space' || key.name === 't') handleToggle();
|
||||
else if (key.name === 'r') loadData();
|
||||
else if (key.name === 'escape') {
|
||||
if (showDetail()) setShowDetail(false);
|
||||
else props.onNavigate('home');
|
||||
}
|
||||
});
|
||||
|
||||
const getTypeIcon = (type: PluginListItem['type']): string => {
|
||||
switch (type) {
|
||||
case 'translator':
|
||||
return '⇄';
|
||||
case 'provider':
|
||||
return '◆';
|
||||
case 'command':
|
||||
return '⌘';
|
||||
default:
|
||||
return '◈';
|
||||
}
|
||||
};
|
||||
|
||||
const currentPlugin = () => {
|
||||
const plugins = state().plugins;
|
||||
if (plugins.length === 0) return null;
|
||||
return plugins[selectedIndex()];
|
||||
};
|
||||
|
||||
const detailFields = () => {
|
||||
const plugin = selectedPlugin();
|
||||
if (!plugin) return [];
|
||||
|
||||
const current = currentPlugin();
|
||||
return [
|
||||
{ label: 'Name', value: plugin.metadata.name },
|
||||
{ label: 'Version', value: plugin.metadata.version },
|
||||
{ label: 'Description', value: plugin.metadata.description || 'No description' },
|
||||
{ label: 'Type', value: current?.type || 'unknown' },
|
||||
{ label: 'Status', value: current?.enabled ? 'Enabled' : 'Disabled' },
|
||||
{ label: 'Path', value: current?.path || 'N/A' },
|
||||
];
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Plugins"
|
||||
subtitle="Extend SkillKit with plugins"
|
||||
count={plugins.length}
|
||||
icon="◈"
|
||||
count={state().plugins.length}
|
||||
icon="◈"
|
||||
/>
|
||||
|
||||
<text fg={terminalColors.text}><b>Installed Plugins</b></text>
|
||||
<text> </text>
|
||||
<Show when={state().error}>
|
||||
<ErrorState
|
||||
message={state().error!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
{plugins.map((plugin, idx) => (
|
||||
<box key={plugin.name} flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={idx === 0 ? terminalColors.accent : terminalColors.text}
|
||||
width={18}
|
||||
>
|
||||
{idx === 0 ? '\u25B8 ' : ' '}{plugin.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={10}>v{plugin.version}</text>
|
||||
<text
|
||||
fg={plugin.enabled ? terminalColors.success : terminalColors.textMuted}
|
||||
>
|
||||
{plugin.enabled ? '\u25CF enabled' : '\u25CB disabled'}
|
||||
</text>
|
||||
<Show when={state().loading}>
|
||||
<Spinner label="Loading plugins..." />
|
||||
</Show>
|
||||
|
||||
<Show when={!state().loading && !state().error}>
|
||||
<box flexDirection="row">
|
||||
<box flexDirection="column" flexGrow={1}>
|
||||
<Show
|
||||
when={state().plugins.length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
icon="◈"
|
||||
title="No plugins installed"
|
||||
description="Install plugins from ~/.skillkit/plugins/"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Installed Plugins</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<For each={state().plugins}>
|
||||
{(plugin, idx) => {
|
||||
const selected = () => idx() === selectedIndex();
|
||||
return (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{selected() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.textSecondary}
|
||||
width={3}
|
||||
>
|
||||
{getTypeIcon(plugin.type)}{' '}
|
||||
</text>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={20}
|
||||
>
|
||||
{plugin.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={10}>
|
||||
v{plugin.version}
|
||||
</text>
|
||||
<text
|
||||
fg={
|
||||
plugin.enabled
|
||||
? terminalColors.success
|
||||
: terminalColors.textMuted
|
||||
}
|
||||
>
|
||||
{plugin.enabled ? '● enabled' : '○ disabled'}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</Show>
|
||||
|
||||
<Show when={toggling()}>
|
||||
<text> </text>
|
||||
<StatusIndicator status="loading" label="Toggling plugin..." />
|
||||
</Show>
|
||||
|
||||
<Show when={currentPlugin() && !toggling()}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{currentPlugin()!.description || 'No description available'}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<Show when={showDetail() && selectedPlugin()}>
|
||||
<DetailPane
|
||||
title={selectedPlugin()!.metadata.name}
|
||||
subtitle={`v${selectedPlugin()!.metadata.version}`}
|
||||
icon={getTypeIcon(currentPlugin()?.type || 'mixed')}
|
||||
fields={detailFields()}
|
||||
actions={[
|
||||
{
|
||||
key: 't',
|
||||
label: currentPlugin()?.enabled ? 'Disable' : 'Enable',
|
||||
},
|
||||
{ key: 'Esc', label: 'Close' },
|
||||
]}
|
||||
width={35}
|
||||
visible={showDetail()}
|
||||
onClose={() => setShowDetail(false)}
|
||||
/>
|
||||
</Show>
|
||||
</box>
|
||||
))}
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Press Enter to toggle, 'a' to add new, 'u' to update
|
||||
</text>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
j/k navigate Enter details Space toggle r refresh Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
import { useState, useEffect, useMemo, useCallback } from 'react';
|
||||
import { useKeyboard } from '@opentui/react';
|
||||
import { createSignal, createEffect, createMemo, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
import { DetailPane } from '../components/DetailPane.js';
|
||||
import {
|
||||
getRecommendations,
|
||||
analyzeProject,
|
||||
type RecommendServiceState,
|
||||
type RecommendationDisplay,
|
||||
} from '../services/recommend.service.js';
|
||||
|
||||
interface RecommendProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -9,193 +20,281 @@ interface RecommendProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
const SPINNER = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
||||
export function Recommend(props: RecommendProps) {
|
||||
const [state, setState] = createSignal<RecommendServiceState>({
|
||||
recommendations: [],
|
||||
analyzing: false,
|
||||
loading: true,
|
||||
error: null,
|
||||
});
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [showDetail, setShowDetail] = createSignal(false);
|
||||
const [projectInfo, setProjectInfo] = createSignal<{
|
||||
languages: string[];
|
||||
frameworks: string[];
|
||||
} | null>(null);
|
||||
|
||||
export function Recommend({ onNavigate, cols = 80, rows = 24 }: RecommendProps) {
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const [analyzing, setAnalyzing] = useState(true);
|
||||
const [spinnerFrame, setSpinnerFrame] = useState(0);
|
||||
const [animPhase, setAnimPhase] = useState(0);
|
||||
const [analysisProgress, setAnalysisProgress] = useState(0);
|
||||
const rows = () => props.rows ?? 24;
|
||||
|
||||
const isCompact = cols < 60;
|
||||
const contentWidth = Math.max(1, Math.min(cols - 4, 60));
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (animPhase >= 3) return;
|
||||
const timer = setTimeout(() => setAnimPhase(p => p + 1), 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, [animPhase]);
|
||||
const loadData = async () => {
|
||||
setState((s) => ({ ...s, loading: true, analyzing: true, error: null }));
|
||||
|
||||
useEffect(() => {
|
||||
if (!analyzing) return;
|
||||
const interval = setInterval(() => {
|
||||
setSpinnerFrame(f => (f + 1) % SPINNER.length);
|
||||
}, 80);
|
||||
return () => clearInterval(interval);
|
||||
}, [analyzing]);
|
||||
try {
|
||||
const analysis = await analyzeProject();
|
||||
if (analysis) {
|
||||
setProjectInfo({
|
||||
languages: analysis.languages,
|
||||
frameworks: analysis.frameworks,
|
||||
});
|
||||
}
|
||||
|
||||
// Simulate analysis
|
||||
useEffect(() => {
|
||||
if (!analyzing) return;
|
||||
const interval = setInterval(() => {
|
||||
setAnalysisProgress(p => {
|
||||
if (p >= 100) {
|
||||
setAnalyzing(false);
|
||||
return 100;
|
||||
}
|
||||
return p + Math.random() * 15 + 5;
|
||||
});
|
||||
}, 200);
|
||||
return () => clearInterval(interval);
|
||||
}, [analyzing]);
|
||||
const result = await getRecommendations();
|
||||
setState(result);
|
||||
|
||||
// Recommendations data (with quality scores)
|
||||
const recommendations = useMemo(() => [
|
||||
{ name: 'tdd-workflow', reason: 'Based on your test files and coverage patterns', confidence: 95, quality: 92, grade: 'A' },
|
||||
{ name: 'react-patterns', reason: 'Detected React in package.json with hooks usage', confidence: 88, quality: 85, grade: 'B' },
|
||||
{ name: 'typescript-strict', reason: 'tsconfig.json found with strict mode disabled', confidence: 82, quality: 78, grade: 'C' },
|
||||
{ name: 'git-workflow', reason: '.git directory with complex branching detected', confidence: 75, quality: 82, grade: 'B' },
|
||||
{ name: 'api-design', reason: 'REST endpoints found in your codebase', confidence: 68, quality: 71, grade: 'C' },
|
||||
{ name: 'docker-compose', reason: 'docker-compose.yml detected for orchestration', confidence: 62, quality: 65, grade: 'D' },
|
||||
], []);
|
||||
|
||||
const maxVisible = Math.max(3, Math.floor((rows - 10) / 2));
|
||||
const visibleRecs = recommendations.slice(0, maxVisible);
|
||||
|
||||
const handleKeyNav = useCallback((delta: number) => {
|
||||
setSelectedIndex(prev => Math.max(0, Math.min(prev + delta, visibleRecs.length - 1)));
|
||||
}, [visibleRecs.length]);
|
||||
|
||||
const handleRefresh = useCallback(() => {
|
||||
setAnalyzing(true);
|
||||
setAnalysisProgress(0);
|
||||
setSelectedIndex(0);
|
||||
}, []);
|
||||
|
||||
const handleInstall = useCallback(() => {
|
||||
if (analyzing) return;
|
||||
const rec = visibleRecs[selectedIndex];
|
||||
if (rec) {
|
||||
// Navigate to installed after "installing"
|
||||
onNavigate('installed');
|
||||
const maxIndex = Math.max(0, result.recommendations.length - 1);
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev, maxIndex)));
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
loading: false,
|
||||
analyzing: false,
|
||||
error: err instanceof Error ? err.message : 'Failed to load recommendations',
|
||||
}));
|
||||
}
|
||||
}, [analyzing, selectedIndex, visibleRecs, onNavigate]);
|
||||
};
|
||||
|
||||
const handleRefresh = async () => {
|
||||
loadData();
|
||||
};
|
||||
|
||||
const handleInstall = () => {
|
||||
const recs = state().recommendations;
|
||||
if (recs.length === 0) return;
|
||||
|
||||
const rec = recs[selectedIndex()];
|
||||
if (rec) {
|
||||
props.onNavigate('installed');
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
const max = state().recommendations.length - 1;
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'return') handleInstall();
|
||||
else if (key.name === 'r') handleRefresh();
|
||||
else if (key.name === 'escape') onNavigate('home');
|
||||
else if (key.name === 'return') {
|
||||
if (showDetail()) handleInstall();
|
||||
else setShowDetail(true);
|
||||
} else if (key.name === 'r') handleRefresh();
|
||||
else if (key.name === 'escape') {
|
||||
if (showDetail()) setShowDetail(false);
|
||||
else props.onNavigate('home');
|
||||
}
|
||||
});
|
||||
|
||||
const divider = useMemo(() =>
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth)}</text>,
|
||||
[contentWidth]
|
||||
);
|
||||
|
||||
// Confidence color
|
||||
const getConfColor = (conf: number) => {
|
||||
if (conf >= 80) return terminalColors.success;
|
||||
if (conf >= 60) return terminalColors.recommend;
|
||||
const getScoreColor = (score: number): string => {
|
||||
if (score >= 80) return terminalColors.success;
|
||||
if (score >= 60) return terminalColors.accent;
|
||||
if (score >= 40) return terminalColors.warning;
|
||||
return terminalColors.textMuted;
|
||||
};
|
||||
|
||||
const shortcuts = isCompact
|
||||
? 'j/k nav enter install r refresh esc back'
|
||||
: 'j/k navigate enter install r refresh esc back';
|
||||
const getGrade = (score: number): string => {
|
||||
if (score >= 90) return 'A';
|
||||
if (score >= 80) return 'B';
|
||||
if (score >= 70) return 'C';
|
||||
if (score >= 60) return 'D';
|
||||
return 'F';
|
||||
};
|
||||
|
||||
const selectedRec = () => {
|
||||
const recs = state().recommendations;
|
||||
if (recs.length === 0) return null;
|
||||
return recs[selectedIndex()];
|
||||
};
|
||||
|
||||
const detailFields = () => {
|
||||
const rec = selectedRec();
|
||||
if (!rec) return [];
|
||||
|
||||
return [
|
||||
{ label: 'Name', value: rec.name },
|
||||
{ label: 'Score', value: `${rec.score}%` },
|
||||
{ label: 'Source', value: rec.source },
|
||||
{ label: 'Tags', value: rec.tags.join(', ') || 'None' },
|
||||
{ label: 'Install', value: rec.installCommand || `skillkit install ${rec.name}` },
|
||||
];
|
||||
};
|
||||
|
||||
const maxVisible = () => Math.max(4, Math.floor((rows() - 12) / 3));
|
||||
|
||||
const recsWindow = createMemo(() => {
|
||||
const list = state().recommendations;
|
||||
const selected = selectedIndex();
|
||||
const visible = maxVisible();
|
||||
const total = list.length;
|
||||
if (total <= visible) return { start: 0, items: list };
|
||||
let start = Math.max(0, selected - Math.floor(visible / 2));
|
||||
start = Math.min(start, total - visible);
|
||||
return { start, items: list.slice(start, start + visible) };
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
{/* Header */}
|
||||
{animPhase >= 1 && (
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Recommendations"
|
||||
subtitle="AI skill suggestions based on your project"
|
||||
icon="✦"
|
||||
count={state().recommendations.length}
|
||||
/>
|
||||
|
||||
<Show when={state().error}>
|
||||
<ErrorState
|
||||
message={state().error!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={state().loading && state().analyzing}>
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth}>
|
||||
<text fg={terminalColors.recommend}>◎ Recommendations</text>
|
||||
<Spinner label="Analyzing your project..." />
|
||||
<Show when={projectInfo()}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{analyzing ? 'analyzing...' : `${recommendations.length} found`}
|
||||
Detected: {projectInfo()!.languages.slice(0, 3).join(', ')}
|
||||
{projectInfo()!.frameworks.length > 0
|
||||
? ` + ${projectInfo()!.frameworks.slice(0, 2).join(', ')}`
|
||||
: ''}
|
||||
</text>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}>AI skill suggestions</text>
|
||||
<text> </text>
|
||||
</Show>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Analysis progress */}
|
||||
{animPhase >= 2 && analyzing && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text> </text>
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.accent}>{SPINNER[spinnerFrame]} </text>
|
||||
<text fg={terminalColors.text}>Analyzing</text>
|
||||
<text fg={terminalColors.textMuted}> your project...</text>
|
||||
</box>
|
||||
<text> </text>
|
||||
{divider}
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
|
||||
{/* Results summary */}
|
||||
{animPhase >= 2 && !analyzing && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text> </text>
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.success}>✓ </text>
|
||||
<text fg={terminalColors.text}>Analysis complete</text>
|
||||
<text fg={terminalColors.textMuted}> · found {recommendations.length} matching skills</text>
|
||||
</box>
|
||||
<text> </text>
|
||||
{divider}
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
|
||||
{/* Recommendations list */}
|
||||
{animPhase >= 3 && !analyzing && (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>Suggested Skills</text>
|
||||
<text> </text>
|
||||
|
||||
{visibleRecs.map((rec, idx) => {
|
||||
const selected = idx === selectedIndex;
|
||||
const indicator = selected ? '▸' : ' ';
|
||||
const qualityColor = rec.quality >= 80 ? terminalColors.success : rec.quality >= 60 ? terminalColors.warning : terminalColors.error;
|
||||
return (
|
||||
<box key={rec.name} flexDirection="column">
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.text}>{indicator}</text>
|
||||
<text fg={selected ? terminalColors.accent : terminalColors.text}>
|
||||
{rec.name}
|
||||
</text>
|
||||
<text fg={getConfColor(rec.confidence)}> {rec.confidence}%</text>
|
||||
<text fg={qualityColor}> [{rec.grade}]</text>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}> {rec.reason}</text>
|
||||
<text> </text>
|
||||
<Show when={!state().loading && !state().error}>
|
||||
<box flexDirection="row">
|
||||
<box flexDirection="column" flexGrow={1}>
|
||||
<Show when={projectInfo()}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>Stack: </text>
|
||||
<text fg={terminalColors.accent}>
|
||||
{[
|
||||
...projectInfo()!.languages.slice(0, 2),
|
||||
...projectInfo()!.frameworks.slice(0, 2),
|
||||
].join(' • ')}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
})}
|
||||
</Show>
|
||||
|
||||
{recommendations.length > maxVisible && (
|
||||
<text fg={terminalColors.textMuted}>
|
||||
+{recommendations.length - maxVisible} more
|
||||
</text>
|
||||
)}
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
{/* Footer */}
|
||||
{animPhase >= 3 && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text fg={terminalColors.textMuted}>{shortcuts}</text>
|
||||
<Show
|
||||
when={state().recommendations.length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
icon="✦"
|
||||
title="No recommendations found"
|
||||
description="Try refreshing to analyze your project again"
|
||||
action={{ label: 'Refresh', key: 'r' }}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Suggested Skills</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<Show when={recsWindow().start > 0}>
|
||||
<text fg={terminalColors.textMuted}> ▲ {recsWindow().start} more</text>
|
||||
</Show>
|
||||
<For each={recsWindow().items}>
|
||||
{(rec, idx) => {
|
||||
const originalIndex = () => recsWindow().start + idx();
|
||||
const isSelected = () => originalIndex() === selectedIndex();
|
||||
return (
|
||||
<box flexDirection="column" marginBottom={1}>
|
||||
<box flexDirection="row">
|
||||
<text
|
||||
fg={isSelected() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{isSelected() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={isSelected() ? terminalColors.accent : terminalColors.text}
|
||||
width={25}
|
||||
>
|
||||
{rec.name}
|
||||
</text>
|
||||
<text fg={getScoreColor(rec.score)} width={6}>
|
||||
{rec.score}%
|
||||
</text>
|
||||
<text fg={getScoreColor(rec.score)} width={4}>
|
||||
[{getGrade(rec.score)}]
|
||||
</text>
|
||||
</box>
|
||||
<Show when={rec.reasons.length > 0}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{' '}{rec.reasons[0]}
|
||||
</text>
|
||||
</Show>
|
||||
<Show when={rec.description && rec.reasons.length === 0}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{' '}{rec.description.slice(0, 50)}
|
||||
{rec.description.length > 50 ? '...' : ''}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
|
||||
<Show when={recsWindow().start + maxVisible() < state().recommendations.length}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
▼ {state().recommendations.length - recsWindow().start - maxVisible()} more
|
||||
</text>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<Show when={state().lastAnalyzed}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Last analyzed: {new Date(state().lastAnalyzed!).toLocaleTimeString()}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<Show when={showDetail() && selectedRec()}>
|
||||
<DetailPane
|
||||
title={selectedRec()!.name}
|
||||
subtitle={`Score: ${selectedRec()!.score}%`}
|
||||
icon="✦"
|
||||
fields={detailFields()}
|
||||
actions={[
|
||||
{ key: 'Enter', label: 'Install' },
|
||||
{ key: 'Esc', label: 'Close' },
|
||||
]}
|
||||
width={35}
|
||||
visible={showDetail()}
|
||||
onClose={() => setShowDetail(false)}
|
||||
/>
|
||||
</Show>
|
||||
</box>
|
||||
)}
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
j/k navigate Enter details/install r refresh Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect, useMemo, useCallback } from 'react';
|
||||
import { useKeyboard } from '@opentui/react';
|
||||
import { createSignal, createEffect, onCleanup, createMemo, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
|
||||
@@ -24,117 +24,113 @@ const DEFAULT_SETTINGS: SettingItem[] = [
|
||||
{ key: 'telemetry', label: 'Telemetry', value: 'disabled', type: 'toggle' },
|
||||
];
|
||||
|
||||
export function Settings({ onNavigate, cols = 80 }: SettingsProps) {
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const [settings, setSettings] = useState<SettingItem[]>(DEFAULT_SETTINGS);
|
||||
const [animPhase, setAnimPhase] = useState(0);
|
||||
export function Settings(props: SettingsProps) {
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [settings, setSettings] = createSignal<SettingItem[]>(DEFAULT_SETTINGS);
|
||||
const [animPhase, setAnimPhase] = createSignal(0);
|
||||
|
||||
const isCompact = cols < 60;
|
||||
const contentWidth = Math.max(1, Math.min(cols - 4, 60));
|
||||
const cols = () => props.cols ?? 80;
|
||||
const isCompact = () => cols() < 60;
|
||||
const contentWidth = () => Math.max(1, Math.min(cols() - 4, 60));
|
||||
|
||||
useEffect(() => {
|
||||
if (animPhase >= 2) return;
|
||||
createEffect(() => {
|
||||
if (animPhase() >= 2) return;
|
||||
const timer = setTimeout(() => setAnimPhase(p => p + 1), 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, [animPhase]);
|
||||
onCleanup(() => clearTimeout(timer));
|
||||
});
|
||||
|
||||
const handleKeyNav = useCallback((delta: number) => {
|
||||
setSelectedIndex(prev => Math.max(0, Math.min(prev + delta, settings.length - 1)));
|
||||
}, [settings.length]);
|
||||
const handleKeyNav = (delta: number) => {
|
||||
setSelectedIndex(prev => Math.max(0, Math.min(prev + delta, settings().length - 1)));
|
||||
};
|
||||
|
||||
const handleToggle = useCallback(() => {
|
||||
const setting = settings[selectedIndex];
|
||||
const handleToggle = () => {
|
||||
const setting = settings()[selectedIndex()];
|
||||
if (setting?.type === 'toggle') {
|
||||
setSettings(prev => prev.map((s, i) =>
|
||||
i === selectedIndex ? { ...s, value: s.value === 'enabled' ? 'disabled' : 'enabled' } : s
|
||||
i === selectedIndex() ? { ...s, value: s.value === 'enabled' ? 'disabled' : 'enabled' } : s
|
||||
));
|
||||
}
|
||||
}, [selectedIndex, settings]);
|
||||
};
|
||||
|
||||
const handleReset = useCallback(() => {
|
||||
const handleReset = () => {
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
}, []);
|
||||
};
|
||||
|
||||
const handleKeyboard = useCallback((key: { name?: string }) => {
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'return') handleToggle();
|
||||
else if (key.name === 'r') handleReset();
|
||||
else if (key.name === 'escape') onNavigate('home');
|
||||
}, [handleKeyNav, handleToggle, handleReset, onNavigate]);
|
||||
else if (key.name === 'escape') props.onNavigate('home');
|
||||
});
|
||||
|
||||
useKeyboard(handleKeyboard);
|
||||
|
||||
const divider = useMemo(() =>
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth)}</text>,
|
||||
[contentWidth]
|
||||
const divider = createMemo(() =>
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth())}</text>
|
||||
);
|
||||
|
||||
const shortcuts = isCompact
|
||||
const shortcuts = () => isCompact()
|
||||
? 'j/k nav enter toggle r reset esc back'
|
||||
: 'j/k navigate enter toggle r reset defaults esc back';
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
{/* Header */}
|
||||
{animPhase >= 1 && (
|
||||
<Show when={animPhase() >= 1}>
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth}>
|
||||
<text fg={terminalColors.text}>⚙ Settings</text>
|
||||
<text fg={terminalColors.textMuted}>{settings.length} options</text>
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth()}>
|
||||
<text fg={terminalColors.text}>Settings</text>
|
||||
<text fg={terminalColors.textMuted}>{settings().length} options</text>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}>configure skillkit</text>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Settings list */}
|
||||
{animPhase >= 2 && (
|
||||
<Show when={animPhase() >= 2}>
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
{divider()}
|
||||
<text> </text>
|
||||
<text fg={terminalColors.text}>Configuration</text>
|
||||
<text> </text>
|
||||
|
||||
{settings.map((setting, idx) => {
|
||||
const selected = idx === selectedIndex;
|
||||
const indicator = selected ? '▸' : ' ';
|
||||
const valueColor = setting.type === 'toggle'
|
||||
? (setting.value === 'enabled' ? terminalColors.success : terminalColors.textMuted)
|
||||
: terminalColors.textMuted;
|
||||
const toggleIcon = setting.type === 'toggle'
|
||||
? (setting.value === 'enabled' ? '● ' : '○ ')
|
||||
: '';
|
||||
return (
|
||||
<box key={setting.key} flexDirection="row">
|
||||
<text fg={terminalColors.text}>{indicator}</text>
|
||||
<text fg={selected ? terminalColors.accent : terminalColors.text} width={18}>
|
||||
{setting.label}
|
||||
</text>
|
||||
<text fg={valueColor}>{toggleIcon}{setting.value}</text>
|
||||
</box>
|
||||
);
|
||||
})}
|
||||
<For each={settings()}>
|
||||
{(setting, idx) => {
|
||||
const selected = () => idx() === selectedIndex();
|
||||
const indicator = () => selected() ? '>' : ' ';
|
||||
const valueColor = () => setting.type === 'toggle'
|
||||
? (setting.value === 'enabled' ? terminalColors.success : terminalColors.textMuted)
|
||||
: terminalColors.textMuted;
|
||||
const toggleIcon = () => setting.type === 'toggle'
|
||||
? (setting.value === 'enabled' ? '* ' : 'o ')
|
||||
: '';
|
||||
return (
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.text}>{indicator()}</text>
|
||||
<text fg={selected() ? terminalColors.accent : terminalColors.text} width={18}>
|
||||
{setting.label}
|
||||
</text>
|
||||
<text fg={valueColor()}>{toggleIcon()}{setting.value}</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Config location */}
|
||||
{animPhase >= 2 && !isCompact && (
|
||||
<Show when={animPhase() >= 2 && !isCompact()}>
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
{divider()}
|
||||
<text fg={terminalColors.textMuted}>config: ~/.config/skillkit/config.json</text>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Footer */}
|
||||
{animPhase >= 2 && (
|
||||
<Show when={animPhase() >= 2}>
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text fg={terminalColors.textMuted}>{shortcuts}</text>
|
||||
{divider()}
|
||||
<text fg={terminalColors.textMuted}>{shortcuts()}</text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
+245
-142
@@ -1,12 +1,15 @@
|
||||
/**
|
||||
* Sync Screen - Cross-Agent Synchronization
|
||||
* Clean monochromatic design
|
||||
*/
|
||||
import { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
||||
import { useKeyboard } from '@opentui/react';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { createSignal, createEffect, createMemo, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen, loadSkills } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { AGENT_LOGOS } from '../theme/symbols.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
import { getSupportedAgents } from '../services/translator.service.js';
|
||||
import { getAgentAvailability } from '../services/executor.service.js';
|
||||
import type { AgentType } from '@skillkit/core';
|
||||
|
||||
interface SyncProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -14,172 +17,272 @@ interface SyncProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
const SPINNER = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
||||
interface AgentSyncInfo {
|
||||
type: AgentType;
|
||||
name: string;
|
||||
icon: string;
|
||||
available: boolean;
|
||||
synced: boolean;
|
||||
skillCount: number;
|
||||
}
|
||||
|
||||
export function Sync({ onNavigate, cols = 80, rows = 24 }: SyncProps) {
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const [syncStatus, setSyncStatus] = useState<'idle' | 'syncing' | 'done'>('idle');
|
||||
const [spinnerFrame, setSpinnerFrame] = useState(0);
|
||||
const [animPhase, setAnimPhase] = useState(0);
|
||||
const syncTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
export function Sync(props: SyncProps) {
|
||||
const [agents, setAgents] = createSignal<AgentSyncInfo[]>([]);
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [syncStatus, setSyncStatus] = createSignal<'idle' | 'syncing' | 'done' | 'error'>('idle');
|
||||
const [syncMessage, setSyncMessage] = createSignal('');
|
||||
const [loading, setLoading] = createSignal(true);
|
||||
const [error, setError] = createSignal<string | null>(null);
|
||||
const [skillCount, setSkillCount] = createSignal(0);
|
||||
|
||||
const isCompact = cols < 60;
|
||||
const contentWidth = Math.max(1, Math.min(cols - 4, 60));
|
||||
const cols = () => props.cols ?? 80;
|
||||
const isCompact = () => cols() < 60;
|
||||
|
||||
// Cleanup timeout on unmount
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
if (syncTimeoutRef.current) {
|
||||
clearTimeout(syncTimeoutRef.current);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
// Entrance animation
|
||||
useEffect(() => {
|
||||
if (animPhase >= 2) return;
|
||||
const timer = setTimeout(() => setAnimPhase(p => p + 1), 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, [animPhase]);
|
||||
const loadData = async () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
// Spinner animation
|
||||
useEffect(() => {
|
||||
if (syncStatus !== 'syncing') return;
|
||||
const interval = setInterval(() => {
|
||||
setSpinnerFrame(f => (f + 1) % SPINNER.length);
|
||||
}, 80);
|
||||
return () => clearInterval(interval);
|
||||
}, [syncStatus]);
|
||||
try {
|
||||
const skillsData = loadSkills();
|
||||
setSkillCount(skillsData.skills.length);
|
||||
|
||||
// Agents with sync data
|
||||
const agents = useMemo(() => {
|
||||
const agentTypes = ['claude-code', 'cursor', 'github-copilot', 'codex', 'gemini-cli', 'windsurf'];
|
||||
return agentTypes.slice(0, isCompact ? 4 : 6).map((type) => ({
|
||||
type,
|
||||
...(AGENT_LOGOS[type] || { name: type, icon: '◇' }),
|
||||
synced: type === 'claude-code' || type === 'cursor',
|
||||
skillCount: type === 'claude-code' ? 12 : type === 'cursor' ? 8 : 0,
|
||||
}));
|
||||
}, [isCompact]);
|
||||
const supportedAgents = getSupportedAgents();
|
||||
const availability = await getAgentAvailability();
|
||||
|
||||
const syncedCount = agents.filter(a => a.synced).length;
|
||||
const totalSkills = agents.reduce((sum, a) => sum + a.skillCount, 0);
|
||||
const agentInfos: AgentSyncInfo[] = supportedAgents.slice(0, isCompact() ? 4 : 8).map((agent) => {
|
||||
const logo = AGENT_LOGOS[agent];
|
||||
const availInfo = availability.find((a) => a.agent === agent);
|
||||
|
||||
const handleKeyNav = useCallback((delta: number) => {
|
||||
setSelectedIndex(prev => Math.max(0, Math.min(prev + delta, agents.length - 1)));
|
||||
}, [agents.length]);
|
||||
return {
|
||||
type: agent,
|
||||
name: logo?.name || agent,
|
||||
icon: logo?.icon || '◇',
|
||||
available: availInfo?.available || false,
|
||||
synced: false,
|
||||
skillCount: 0,
|
||||
};
|
||||
});
|
||||
|
||||
setAgents(agentInfos);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to load agents');
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const handleSync = async () => {
|
||||
const agentList = agents();
|
||||
if (agentList.length === 0) return;
|
||||
|
||||
const idx = selectedIndex();
|
||||
const agent = agentList[idx];
|
||||
if (!agent || !agent.available) return;
|
||||
|
||||
const agentName = agent.name;
|
||||
const currentSkillCount = skillCount();
|
||||
|
||||
const handleSync = useCallback(() => {
|
||||
if (syncStatus === 'syncing') return;
|
||||
if (syncTimeoutRef.current) clearTimeout(syncTimeoutRef.current);
|
||||
setSyncStatus('syncing');
|
||||
syncTimeoutRef.current = setTimeout(() => setSyncStatus('done'), 1500);
|
||||
}, [syncStatus]);
|
||||
setSyncMessage(`Syncing to ${agentName}...`);
|
||||
|
||||
const handleSyncAll = useCallback(() => {
|
||||
if (syncStatus === 'syncing') return;
|
||||
if (syncTimeoutRef.current) clearTimeout(syncTimeoutRef.current);
|
||||
try {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
|
||||
setAgents((prev) =>
|
||||
prev.map((a, i) =>
|
||||
i === idx
|
||||
? { ...a, synced: true, skillCount: currentSkillCount }
|
||||
: a
|
||||
)
|
||||
);
|
||||
|
||||
setSyncStatus('done');
|
||||
setSyncMessage(`Synced ${currentSkillCount} skills to ${agentName}`);
|
||||
} catch {
|
||||
setSyncStatus('error');
|
||||
setSyncMessage('Sync failed');
|
||||
}
|
||||
};
|
||||
|
||||
const handleSyncAll = async () => {
|
||||
setSyncStatus('syncing');
|
||||
syncTimeoutRef.current = setTimeout(() => setSyncStatus('done'), 2000);
|
||||
}, [syncStatus]);
|
||||
setSyncMessage('Syncing to all available agents...');
|
||||
|
||||
// Clamp selectedIndex when agents list shrinks
|
||||
useEffect(() => {
|
||||
setSelectedIndex(prev => Math.max(0, Math.min(prev, agents.length - 1)));
|
||||
}, [agents.length]);
|
||||
try {
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
|
||||
setAgents((prev) =>
|
||||
prev.map((a) =>
|
||||
a.available ? { ...a, synced: true, skillCount: skillCount() } : a
|
||||
)
|
||||
);
|
||||
|
||||
const syncedCount = agents().filter((a) => a.available).length;
|
||||
setSyncStatus('done');
|
||||
setSyncMessage(`Synced to ${syncedCount} agents`);
|
||||
} catch {
|
||||
setSyncStatus('error');
|
||||
setSyncMessage('Sync failed');
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
const max = agents().length - 1;
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'return') handleSync();
|
||||
else if (key.name === 'a') handleSyncAll();
|
||||
else if (key.name === 'escape') onNavigate('home');
|
||||
else if (key.name === 'r') loadData();
|
||||
else if (key.name === 'escape') props.onNavigate('home');
|
||||
});
|
||||
|
||||
const divider = useMemo(() =>
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth)}</text>,
|
||||
[contentWidth]
|
||||
const syncedCount = createMemo(() => agents().filter((a) => a.synced).length);
|
||||
const availableCount = createMemo(() => agents().filter((a) => a.available).length);
|
||||
const totalSkillsSynced = createMemo(() =>
|
||||
agents().reduce((sum, a) => sum + a.skillCount, 0)
|
||||
);
|
||||
|
||||
const shortcuts = isCompact
|
||||
? 'j/k nav enter sync a sync all esc back'
|
||||
: 'j/k navigate enter sync selected a sync all esc back';
|
||||
const selectedAgent = () => {
|
||||
const agentList = agents();
|
||||
if (agentList.length === 0) return null;
|
||||
return agentList[selectedIndex()];
|
||||
};
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
{/* Header */}
|
||||
{animPhase >= 1 && (
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth}>
|
||||
<text fg={terminalColors.sync}>⇄ Sync</text>
|
||||
<text fg={terminalColors.textMuted}>{syncedCount}/{agents.length} synced</text>
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Sync"
|
||||
subtitle="Share skills across agents"
|
||||
icon="⟳"
|
||||
count={agents().length}
|
||||
/>
|
||||
|
||||
<Show when={error()}>
|
||||
<ErrorState
|
||||
message={error()!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={loading()}>
|
||||
<Spinner label="Loading agents..." />
|
||||
</Show>
|
||||
|
||||
<Show when={!loading() && !error()}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.success}>● {syncedCount()} synced</text>
|
||||
<text fg={terminalColors.textMuted}> | </text>
|
||||
<text fg={terminalColors.accent}>◎ {availableCount()} available</text>
|
||||
<text fg={terminalColors.textMuted}> | </text>
|
||||
<text fg={terminalColors.text}>{skillCount()} skills to sync</text>
|
||||
</box>
|
||||
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<Show when={syncStatus() === 'syncing'}>
|
||||
<StatusIndicator status="loading" label={syncMessage()} />
|
||||
<text> </text>
|
||||
</Show>
|
||||
|
||||
<Show when={syncStatus() === 'done'}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.success}>✓ </text>
|
||||
<text fg={terminalColors.text}>{syncMessage()}</text>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}>share skills across agents</text>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
</Show>
|
||||
|
||||
{/* Status */}
|
||||
{animPhase >= 2 && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text> </text>
|
||||
{syncStatus === 'syncing' ? (
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.accent}>{SPINNER[spinnerFrame]} </text>
|
||||
<text fg={terminalColors.text}>Syncing skills...</text>
|
||||
</box>
|
||||
) : syncStatus === 'done' ? (
|
||||
<box flexDirection="row">
|
||||
<text fg={terminalColors.success}>✓ </text>
|
||||
<text fg={terminalColors.text}>Sync complete</text>
|
||||
<text fg={terminalColors.textMuted}> · {totalSkills} skills synced</text>
|
||||
</box>
|
||||
) : (
|
||||
<box flexDirection="row" gap={3}>
|
||||
<text fg={terminalColors.success}>● {syncedCount} synced</text>
|
||||
<text fg={terminalColors.textMuted}>○ {agents.length - syncedCount} pending</text>
|
||||
</box>
|
||||
)}
|
||||
<text> </text>
|
||||
{divider}
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
<Show when={syncStatus() === 'error'}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.error}>✗ </text>
|
||||
<text fg={terminalColors.text}>{syncMessage()}</text>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
{/* Agents list */}
|
||||
{animPhase >= 2 && (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>Agents</text>
|
||||
<Show
|
||||
when={agents().length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
icon="⟳"
|
||||
title="No agents found"
|
||||
description="Install AI coding agents to sync skills"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Agents</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
{agents.map((agent, idx) => {
|
||||
const selected = idx === selectedIndex;
|
||||
const indicator = selected ? '▸' : ' ';
|
||||
const statusIcon = agent.synced ? '●' : '○';
|
||||
const statusColor = agent.synced ? terminalColors.success : terminalColors.textMuted;
|
||||
return (
|
||||
<box key={agent.type} flexDirection="row">
|
||||
<text fg={terminalColors.text}>{indicator}</text>
|
||||
<text fg={selected ? terminalColors.accent : terminalColors.text}>
|
||||
{agent.icon} {agent.name}
|
||||
</text>
|
||||
<text fg={statusColor}> {statusIcon}</text>
|
||||
<text fg={terminalColors.textMuted}> {agent.skillCount} skills</text>
|
||||
</box>
|
||||
);
|
||||
})}
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
<For each={agents()}>
|
||||
{(agent, idx) => {
|
||||
const selected = () => idx() === selectedIndex();
|
||||
return (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{selected() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={
|
||||
selected()
|
||||
? terminalColors.accent
|
||||
: agent.available
|
||||
? terminalColors.text
|
||||
: terminalColors.textMuted
|
||||
}
|
||||
width={20}
|
||||
>
|
||||
{agent.icon} {agent.name}
|
||||
</text>
|
||||
<text
|
||||
fg={
|
||||
agent.synced
|
||||
? terminalColors.success
|
||||
: agent.available
|
||||
? terminalColors.accent
|
||||
: terminalColors.textMuted
|
||||
}
|
||||
width={3}
|
||||
>
|
||||
{agent.synced ? '✓' : agent.available ? '○' : '✗'}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={12}>
|
||||
{agent.skillCount > 0 ? `${agent.skillCount} skills` : ''}
|
||||
</text>
|
||||
<Show when={!agent.available}>
|
||||
<text fg={terminalColors.textMuted}>(unavailable)</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</Show>
|
||||
|
||||
{/* Footer */}
|
||||
{animPhase >= 2 && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text fg={terminalColors.textMuted}>{shortcuts}</text>
|
||||
</box>
|
||||
)}
|
||||
<Show when={selectedAgent() && !selectedAgent()!.available}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.warning}>
|
||||
⚠ {selectedAgent()!.name} is not installed or available
|
||||
</text>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
j/k navigate Enter sync selected a sync all r refresh Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
/**
|
||||
* Team Screen
|
||||
* Team collaboration
|
||||
*/
|
||||
import { createSignal, createEffect, createMemo, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { DetailPane } from '../components/DetailPane.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
import {
|
||||
loadTeamConfig,
|
||||
initializeTeam,
|
||||
shareSkill,
|
||||
type TeamServiceState,
|
||||
type TeamMemberDisplay,
|
||||
type SharedSkillDisplay,
|
||||
} from '../services/team.service.js';
|
||||
|
||||
interface TeamProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -12,48 +22,355 @@ interface TeamProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Team({ onNavigate, cols = 80, rows = 24 }: TeamProps) {
|
||||
const members = [
|
||||
{ name: 'You', role: 'Owner', status: 'online', skills: 12 },
|
||||
{ name: 'Alice', role: 'Admin', status: 'online', skills: 8 },
|
||||
{ name: 'Bob', role: 'Member', status: 'offline', skills: 5 },
|
||||
];
|
||||
type FocusedPane = 'members' | 'skills';
|
||||
|
||||
export function Team(props: TeamProps) {
|
||||
const [state, setState] = createSignal<TeamServiceState>({
|
||||
config: null,
|
||||
members: [],
|
||||
sharedSkills: [],
|
||||
loading: true,
|
||||
error: null,
|
||||
});
|
||||
const [focusedPane, setFocusedPane] = createSignal<FocusedPane>('members');
|
||||
const [selectedMemberIndex, setSelectedMemberIndex] = createSignal(0);
|
||||
const [selectedSkillIndex, setSelectedSkillIndex] = createSignal(0);
|
||||
const [showDetail, setShowDetail] = createSignal(false);
|
||||
const [initializing, setInitializing] = createSignal(false);
|
||||
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
const loadData = async () => {
|
||||
setState((s) => ({ ...s, loading: true, error: null }));
|
||||
try {
|
||||
const result = await loadTeamConfig();
|
||||
setState(result);
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
loading: false,
|
||||
error: err instanceof Error ? err.message : 'Failed to load team',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleInitialize = async () => {
|
||||
if (initializing()) return;
|
||||
setInitializing(true);
|
||||
try {
|
||||
const success = await initializeTeam('My Team');
|
||||
if (success) {
|
||||
await loadData();
|
||||
}
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Failed to initialize team',
|
||||
}));
|
||||
} finally {
|
||||
setInitializing(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
if (focusedPane() === 'members') {
|
||||
const max = state().members.length - 1;
|
||||
setSelectedMemberIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
} else {
|
||||
const max = state().sharedSkills.length - 1;
|
||||
setSelectedSkillIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
}
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (showDetail()) {
|
||||
if (key.name === 'escape') {
|
||||
setShowDetail(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'tab' || key.name === 'l' || key.name === 'right') {
|
||||
setFocusedPane((p) => (p === 'members' ? 'skills' : 'members'));
|
||||
} else if (key.name === 'h' || key.name === 'left') {
|
||||
setFocusedPane((p) => (p === 'skills' ? 'members' : 'skills'));
|
||||
} else if (key.name === 'return') setShowDetail(true);
|
||||
else if (key.name === 'i') handleInitialize();
|
||||
else if (key.name === 'r') loadData();
|
||||
else if (key.name === 'escape') props.onNavigate('home');
|
||||
});
|
||||
|
||||
const getStatusIcon = (status: TeamMemberDisplay['status']): string => {
|
||||
switch (status) {
|
||||
case 'active':
|
||||
return '●';
|
||||
case 'inactive':
|
||||
return '○';
|
||||
case 'pending':
|
||||
return '◐';
|
||||
default:
|
||||
return '○';
|
||||
}
|
||||
};
|
||||
|
||||
const getStatusColor = (status: TeamMemberDisplay['status']): string => {
|
||||
switch (status) {
|
||||
case 'active':
|
||||
return terminalColors.success;
|
||||
case 'inactive':
|
||||
return terminalColors.textMuted;
|
||||
case 'pending':
|
||||
return terminalColors.warning;
|
||||
default:
|
||||
return terminalColors.textMuted;
|
||||
}
|
||||
};
|
||||
|
||||
const selectedMember = () => {
|
||||
const members = state().members;
|
||||
if (members.length === 0) return null;
|
||||
return members[selectedMemberIndex()];
|
||||
};
|
||||
|
||||
const selectedSharedSkill = () => {
|
||||
const skills = state().sharedSkills;
|
||||
if (skills.length === 0) return null;
|
||||
return skills[selectedSkillIndex()];
|
||||
};
|
||||
|
||||
const memberDetailFields = () => {
|
||||
const member = selectedMember();
|
||||
if (!member) return [];
|
||||
|
||||
return [
|
||||
{ label: 'Name', value: member.name },
|
||||
{ label: 'Role', value: member.role },
|
||||
{ label: 'Skills', value: String(member.skills) },
|
||||
{ label: 'Status', value: member.status },
|
||||
{ label: 'Last Sync', value: member.lastSync || 'Never' },
|
||||
];
|
||||
};
|
||||
|
||||
const skillDetailFields = () => {
|
||||
const skill = selectedSharedSkill();
|
||||
if (!skill) return [];
|
||||
|
||||
return [
|
||||
{ label: 'Name', value: skill.name },
|
||||
{ label: 'Shared By', value: skill.sharedBy },
|
||||
{ label: 'Shared At', value: skill.sharedAt },
|
||||
{ label: 'Agents', value: skill.agents.join(', ') || 'All' },
|
||||
];
|
||||
};
|
||||
|
||||
const activeCount = createMemo(
|
||||
() => state().members.filter((m) => m.status === 'active').length
|
||||
);
|
||||
|
||||
return (
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Team"
|
||||
subtitle="Collaborate with your development team"
|
||||
count={members.length}
|
||||
icon="◉"
|
||||
count={state().members.length}
|
||||
icon="◉"
|
||||
/>
|
||||
|
||||
<text fg={terminalColors.text}><b>Team Members</b></text>
|
||||
<text> </text>
|
||||
<Show when={state().error}>
|
||||
<ErrorState
|
||||
message={state().error!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
{members.map((member, idx) => (
|
||||
<box key={member.name} flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={idx === 0 ? terminalColors.accent : terminalColors.text}
|
||||
width={15}
|
||||
>
|
||||
{idx === 0 ? '\u25B8 ' : ' '}{member.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={10}>{member.role}</text>
|
||||
<text
|
||||
fg={member.status === 'online' ? terminalColors.success : terminalColors.textMuted}
|
||||
width={10}
|
||||
>
|
||||
{member.status === 'online' ? '\u25CF online' : '\u25CB offline'}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>{member.skills} skills</text>
|
||||
</box>
|
||||
))}
|
||||
<Show when={state().loading}>
|
||||
<Spinner label="Loading team..." />
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Press 'i' to invite, 's' to share skills
|
||||
</text>
|
||||
<Show when={initializing()}>
|
||||
<StatusIndicator status="loading" label="Initializing team..." />
|
||||
</Show>
|
||||
|
||||
<Show when={!state().loading && !state().error && !initializing()}>
|
||||
<Show
|
||||
when={state().config}
|
||||
fallback={
|
||||
<EmptyState
|
||||
icon="◉"
|
||||
title="No team configured"
|
||||
description="Initialize a team to start collaborating"
|
||||
action={{ label: 'Initialize', key: 'i' }}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>Team: </text>
|
||||
<text fg={terminalColors.accent}>{state().config?.teamName || 'Unnamed'}</text>
|
||||
<text fg={terminalColors.textMuted}> • </text>
|
||||
<text fg={terminalColors.success}>{activeCount()} active</text>
|
||||
<text fg={terminalColors.textMuted}> • </text>
|
||||
<text fg={terminalColors.text}>{state().sharedSkills.length} shared skills</text>
|
||||
</box>
|
||||
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<box flexDirection="row">
|
||||
<box flexDirection="column" width={30}>
|
||||
<text
|
||||
fg={
|
||||
focusedPane() === 'members'
|
||||
? terminalColors.accent
|
||||
: terminalColors.text
|
||||
}
|
||||
>
|
||||
<b>Members</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<Show
|
||||
when={state().members.length > 0}
|
||||
fallback={
|
||||
<EmptyState title="No members" compact />
|
||||
}
|
||||
>
|
||||
<For each={state().members}>
|
||||
{(member, idx) => {
|
||||
const selected = () =>
|
||||
focusedPane() === 'members' && idx() === selectedMemberIndex();
|
||||
return (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{selected() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={15}
|
||||
>
|
||||
{member.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={8}>
|
||||
{member.role}
|
||||
</text>
|
||||
<text fg={getStatusColor(member.status)}>
|
||||
{getStatusIcon(member.status)}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<box width={2}>
|
||||
<text fg={terminalColors.border}>│</text>
|
||||
</box>
|
||||
|
||||
<box flexDirection="column" width={35}>
|
||||
<text
|
||||
fg={
|
||||
focusedPane() === 'skills'
|
||||
? terminalColors.accent
|
||||
: terminalColors.text
|
||||
}
|
||||
>
|
||||
<b>Shared Skills</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<Show
|
||||
when={state().sharedSkills.length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
title="No shared skills"
|
||||
description="Share skills with 's'"
|
||||
compact
|
||||
/>
|
||||
}
|
||||
>
|
||||
<For each={state().sharedSkills.slice(0, 8)}>
|
||||
{(skill, idx) => {
|
||||
const selected = () =>
|
||||
focusedPane() === 'skills' && idx() === selectedSkillIndex();
|
||||
return (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{selected() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={18}
|
||||
>
|
||||
{skill.name}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
by {skill.sharedBy}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
<Show when={state().sharedSkills.length > 8}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
+{state().sharedSkills.length - 8} more
|
||||
</text>
|
||||
</Show>
|
||||
</Show>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<Show when={showDetail()}>
|
||||
<Show when={focusedPane() === 'members' && selectedMember()}>
|
||||
<DetailPane
|
||||
title={selectedMember()!.name}
|
||||
subtitle={selectedMember()!.role}
|
||||
icon="◉"
|
||||
fields={memberDetailFields()}
|
||||
actions={[
|
||||
{ key: 's', label: 'Share Skill' },
|
||||
{ key: 'd', label: 'Remove' },
|
||||
{ key: 'Esc', label: 'Close' },
|
||||
]}
|
||||
width={30}
|
||||
visible={showDetail()}
|
||||
onClose={() => setShowDetail(false)}
|
||||
/>
|
||||
</Show>
|
||||
<Show when={focusedPane() === 'skills' && selectedSharedSkill()}>
|
||||
<DetailPane
|
||||
title={selectedSharedSkill()!.name}
|
||||
subtitle={`Shared by ${selectedSharedSkill()!.sharedBy}`}
|
||||
icon="◇"
|
||||
fields={skillDetailFields()}
|
||||
actions={[
|
||||
{ key: 'i', label: 'Install' },
|
||||
{ key: 'Esc', label: 'Close' },
|
||||
]}
|
||||
width={30}
|
||||
visible={showDetail()}
|
||||
onClose={() => setShowDetail(false)}
|
||||
/>
|
||||
</Show>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Tab/←/→ switch pane j/k navigate Enter details i init r refresh Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
/**
|
||||
* Translate Screen
|
||||
* Skill format conversion with diff view
|
||||
*/
|
||||
import { useState } from 'react';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { createSignal, createEffect, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen, loadSkillsWithDetails, type SkillWithDetails } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { AGENT_LOGOS } from '../theme/symbols.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
import {
|
||||
getSupportedAgents,
|
||||
checkCanTranslate,
|
||||
translate,
|
||||
previewTranslation,
|
||||
getAgentFormatInfo,
|
||||
} from '../services/translator.service.js';
|
||||
import type { AgentType } from '@skillkit/core';
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
interface TranslateProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -14,51 +24,387 @@ interface TranslateProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
export function Translate(_props: TranslateProps) {
|
||||
const [sourceAgent] = useState('claude-code');
|
||||
const [targetAgent] = useState('cursor');
|
||||
type FocusedPane = 'source' | 'target' | 'skills';
|
||||
|
||||
const sourceInfo = AGENT_LOGOS[sourceAgent];
|
||||
const targetInfo = AGENT_LOGOS[targetAgent];
|
||||
function readSkillContent(skillPath: string): string | undefined {
|
||||
const skillMdPath = join(skillPath, 'SKILL.md');
|
||||
if (existsSync(skillMdPath)) {
|
||||
return readFileSync(skillMdPath, 'utf-8');
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function Translate(props: TranslateProps) {
|
||||
const [supportedAgents, setSupportedAgents] = createSignal<AgentType[]>([]);
|
||||
const [skills, setSkills] = createSignal<SkillWithDetails[]>([]);
|
||||
const [sourceAgentIndex, setSourceAgentIndex] = createSignal(0);
|
||||
const [targetAgentIndex, setTargetAgentIndex] = createSignal(1);
|
||||
const [selectedSkillIndex, setSelectedSkillIndex] = createSignal(0);
|
||||
const [focusedPane, setFocusedPane] = createSignal<FocusedPane>('skills');
|
||||
const [translating, setTranslating] = createSignal(false);
|
||||
const [preview, setPreview] = createSignal<{
|
||||
preview: string;
|
||||
compatible: boolean;
|
||||
issues: string[];
|
||||
} | null>(null);
|
||||
const [result, setResult] = createSignal<{
|
||||
success: boolean;
|
||||
content: string;
|
||||
filename?: string;
|
||||
} | null>(null);
|
||||
const [loading, setLoading] = createSignal(true);
|
||||
const [error, setError] = createSignal<string | null>(null);
|
||||
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
const loadData = async () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
const agents = getSupportedAgents();
|
||||
setSupportedAgents(agents);
|
||||
|
||||
const skillsWithDetails = loadSkillsWithDetails();
|
||||
setSkills(skillsWithDetails);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to load data');
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const sourceAgent = () => {
|
||||
const agents = supportedAgents();
|
||||
if (agents.length === 0) return null;
|
||||
return agents[sourceAgentIndex()];
|
||||
};
|
||||
|
||||
const targetAgent = () => {
|
||||
const agents = supportedAgents();
|
||||
if (agents.length === 0) return null;
|
||||
return agents[targetAgentIndex()];
|
||||
};
|
||||
|
||||
const selectedSkill = () => {
|
||||
const skillList = skills();
|
||||
if (skillList.length === 0) return null;
|
||||
return skillList[selectedSkillIndex()];
|
||||
};
|
||||
|
||||
const canDoTranslation = () => {
|
||||
const source = sourceAgent();
|
||||
const target = targetAgent();
|
||||
if (!source || !target) return false;
|
||||
return checkCanTranslate(source, target);
|
||||
};
|
||||
|
||||
const handlePreview = () => {
|
||||
const skill = selectedSkill();
|
||||
const target = targetAgent();
|
||||
if (!skill || !target || !skill.path) {
|
||||
setError('No skill path available for preview');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const content = readSkillContent(skill.path);
|
||||
if (!content) {
|
||||
setError('Could not read skill content');
|
||||
return;
|
||||
}
|
||||
|
||||
const previewResult = previewTranslation(content, target);
|
||||
setPreview(previewResult);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Preview failed');
|
||||
}
|
||||
};
|
||||
|
||||
const handleTranslate = async () => {
|
||||
const skill = selectedSkill();
|
||||
const target = targetAgent();
|
||||
if (!skill || !target || !skill.path) {
|
||||
setError('No skill path available for translation');
|
||||
return;
|
||||
}
|
||||
|
||||
const content = readSkillContent(skill.path);
|
||||
if (!content) {
|
||||
setError('Could not read skill content');
|
||||
return;
|
||||
}
|
||||
|
||||
setTranslating(true);
|
||||
setResult(null);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
const translationResult = translate(content, target);
|
||||
setResult({
|
||||
success: translationResult.success,
|
||||
content: translationResult.content,
|
||||
filename: translationResult.filename,
|
||||
});
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Translation failed');
|
||||
} finally {
|
||||
setTranslating(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
if (focusedPane() === 'skills') {
|
||||
const max = skills().length - 1;
|
||||
setSelectedSkillIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
} else if (focusedPane() === 'source') {
|
||||
const max = supportedAgents().length - 1;
|
||||
setSourceAgentIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
} else {
|
||||
const max = supportedAgents().length - 1;
|
||||
setTargetAgentIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
}
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'tab') {
|
||||
setFocusedPane((p) => {
|
||||
if (p === 'skills') return 'source';
|
||||
if (p === 'source') return 'target';
|
||||
return 'skills';
|
||||
});
|
||||
} else if (key.name === 'p') handlePreview();
|
||||
else if (key.name === 'return' || key.name === 't') handleTranslate();
|
||||
else if (key.name === 'r') loadData();
|
||||
else if (key.name === 'escape') {
|
||||
if (result() || preview()) {
|
||||
setResult(null);
|
||||
setPreview(null);
|
||||
} else {
|
||||
props.onNavigate('home');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const visibleAgents = () => supportedAgents().slice(0, 6);
|
||||
|
||||
return (
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Translate Skills"
|
||||
subtitle="Convert skills between agent formats"
|
||||
icon="⇄"
|
||||
icon="⇄"
|
||||
/>
|
||||
|
||||
<box flexDirection="row" marginTop={1} marginBottom={1}>
|
||||
<box flexDirection="column" width={25}>
|
||||
<text fg={terminalColors.textMuted}>Source Agent</text>
|
||||
<text fg={terminalColors.accent}>
|
||||
<b>{sourceInfo?.icon} {sourceInfo?.name}</b>
|
||||
</text>
|
||||
<Show when={error()}>
|
||||
<ErrorState
|
||||
message={error()!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={loading()}>
|
||||
<Spinner label="Loading agents and skills..." />
|
||||
</Show>
|
||||
|
||||
<Show when={!loading() && !error()}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<box flexDirection="column" width={25}>
|
||||
<text
|
||||
fg={
|
||||
focusedPane() === 'source'
|
||||
? terminalColors.accent
|
||||
: terminalColors.textMuted
|
||||
}
|
||||
>
|
||||
Source Agent
|
||||
</text>
|
||||
<Show when={sourceAgent()}>
|
||||
<text fg={terminalColors.accent}>
|
||||
<b>
|
||||
{AGENT_LOGOS[sourceAgent()!]?.icon || '◇'}{' '}
|
||||
{AGENT_LOGOS[sourceAgent()!]?.name || sourceAgent()}
|
||||
</b>
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{getAgentFormatInfo(sourceAgent()!).formatName}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<box flexDirection="column" width={5} justifyContent="center">
|
||||
<text fg={terminalColors.textMuted}> → </text>
|
||||
</box>
|
||||
|
||||
<box flexDirection="column" width={25}>
|
||||
<text
|
||||
fg={
|
||||
focusedPane() === 'target'
|
||||
? terminalColors.accent
|
||||
: terminalColors.textMuted
|
||||
}
|
||||
>
|
||||
Target Agent
|
||||
</text>
|
||||
<Show when={targetAgent()}>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>
|
||||
{AGENT_LOGOS[targetAgent()!]?.icon || '◇'}{' '}
|
||||
{AGENT_LOGOS[targetAgent()!]?.name || targetAgent()}
|
||||
</b>
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{getAgentFormatInfo(targetAgent()!).formatName}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<Show when={!canDoTranslation()}>
|
||||
<text fg={terminalColors.warning}> ⚠ Incompatible</text>
|
||||
</Show>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}> → </text>
|
||||
<box flexDirection="column" width={25}>
|
||||
<text fg={terminalColors.textMuted}>Target Agent</text>
|
||||
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text> </text>
|
||||
|
||||
<box flexDirection="row">
|
||||
<box flexDirection="column" width={30}>
|
||||
<text
|
||||
fg={
|
||||
focusedPane() === 'skills'
|
||||
? terminalColors.accent
|
||||
: terminalColors.text
|
||||
}
|
||||
>
|
||||
<b>Select Skill</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<Show
|
||||
when={skills().length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
title="No skills installed"
|
||||
description="Install skills first"
|
||||
action={{ label: 'Browse', key: 'b' }}
|
||||
compact
|
||||
/>
|
||||
}
|
||||
>
|
||||
<For each={skills().slice(0, 6)}>
|
||||
{(skill, idx) => {
|
||||
const selected = () =>
|
||||
focusedPane() === 'skills' && idx() === selectedSkillIndex();
|
||||
return (
|
||||
<box marginBottom={1}>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
>
|
||||
{selected() ? '▸ ' : ' '}
|
||||
{skill.name}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
<Show when={skills().length > 6}>
|
||||
<text fg={terminalColors.textMuted}>+{skills().length - 6} more</text>
|
||||
</Show>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<box width={2}>
|
||||
<text fg={terminalColors.border}>│</text>
|
||||
</box>
|
||||
|
||||
<box flexDirection="column" width={35}>
|
||||
<Show when={focusedPane() !== 'skills'}>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>{focusedPane() === 'source' ? 'Source' : 'Target'} Agents</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
<For each={visibleAgents()}>
|
||||
{(agent, idx) => {
|
||||
const isSource = focusedPane() === 'source';
|
||||
const selectedIdx = isSource ? sourceAgentIndex() : targetAgentIndex();
|
||||
const selected = () => idx() === selectedIdx;
|
||||
return (
|
||||
<box marginBottom={1}>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.textSecondary}
|
||||
>
|
||||
{selected() ? '▸ ' : ' '}
|
||||
{AGENT_LOGOS[agent]?.icon || '◇'} {AGENT_LOGOS[agent]?.name || agent}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</Show>
|
||||
|
||||
<Show when={focusedPane() === 'skills' && selectedSkill()}>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Skill Info</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>Name: {selectedSkill()!.name}</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Path: {selectedSkill()!.path ? 'Available' : 'Unknown'}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<Show when={translating()}>
|
||||
<text> </text>
|
||||
<StatusIndicator status="loading" label="Translating skill..." />
|
||||
</Show>
|
||||
|
||||
<Show when={preview() && !translating()}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>{targetInfo?.icon} {targetInfo?.name}</b>
|
||||
<b>Preview</b>
|
||||
</text>
|
||||
</box>
|
||||
</box>
|
||||
<text
|
||||
fg={
|
||||
preview()!.compatible ? terminalColors.success : terminalColors.warning
|
||||
}
|
||||
>
|
||||
{preview()!.compatible ? '✓ Compatible' : '⚠ Has issues'}
|
||||
</text>
|
||||
<Show when={preview()!.issues.length > 0}>
|
||||
<For each={preview()!.issues.slice(0, 2)}>
|
||||
{(issue) => <text fg={terminalColors.warning}>• {issue}</text>}
|
||||
</For>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{'\u2500'.repeat(50)}
|
||||
</text>
|
||||
<text> </text>
|
||||
<Show when={result() && !translating()}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text
|
||||
fg={result()!.success ? terminalColors.success : terminalColors.error}
|
||||
>
|
||||
{result()!.success ? '✓ Translation complete' : '✗ Translation failed'}
|
||||
</text>
|
||||
<Show when={result()!.filename}>
|
||||
<text fg={terminalColors.textMuted}>Output: {result()!.filename}</text>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<text fg={terminalColors.text}><b>Select a skill to translate:</b></text>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
No skills selected. Press 'i' to view installed skills.
|
||||
</text>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Use Tab to switch agents, Enter to translate
|
||||
</text>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>─────────────────────────────────────────────</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Tab switch pane j/k navigate p preview Enter translate Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
/**
|
||||
* Workflow Screen - Automation Builder
|
||||
* Clean monochromatic design
|
||||
*/
|
||||
import { useState, useEffect, useMemo, useCallback } from 'react';
|
||||
import { useKeyboard } from '@opentui/react';
|
||||
import { createSignal, createEffect, createMemo, Show, For } from 'solid-js';
|
||||
import { useKeyboard } from '@opentui/solid';
|
||||
import { type Screen } from '../state/index.js';
|
||||
import { terminalColors } from '../theme/colors.js';
|
||||
import { Header } from '../components/Header.js';
|
||||
import { Spinner } from '../components/Spinner.js';
|
||||
import { EmptyState, ErrorState } from '../components/EmptyState.js';
|
||||
import { DetailPane } from '../components/DetailPane.js';
|
||||
import { StatusIndicator } from '../components/StatusIndicator.js';
|
||||
import {
|
||||
loadWorkflowsList,
|
||||
loadWorkflow,
|
||||
executeWorkflow,
|
||||
type WorkflowServiceState,
|
||||
type WorkflowListItem,
|
||||
} from '../services/workflow.service.js';
|
||||
|
||||
interface WorkflowProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
@@ -13,121 +21,264 @@ interface WorkflowProps {
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
const WORKFLOWS = [
|
||||
{ name: 'test-and-commit', steps: 3, lastRun: '1 hour ago', status: 'success' as const },
|
||||
{ name: 'deploy-preview', steps: 5, lastRun: '2 hours ago', status: 'success' as const },
|
||||
{ name: 'full-ci', steps: 8, lastRun: '1 day ago', status: 'failed' as const },
|
||||
{ name: 'quick-fix', steps: 2, lastRun: '3 days ago', status: 'pending' as const },
|
||||
];
|
||||
export function Workflow(props: WorkflowProps) {
|
||||
const [state, setState] = createSignal<WorkflowServiceState>({
|
||||
workflows: [],
|
||||
current: null,
|
||||
progress: null,
|
||||
loading: true,
|
||||
error: null,
|
||||
});
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [showDetail, setShowDetail] = createSignal(false);
|
||||
const [executing, setExecuting] = createSignal(false);
|
||||
|
||||
export function Workflow({ onNavigate, cols = 80, rows = 24 }: WorkflowProps) {
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const [animPhase, setAnimPhase] = useState(0);
|
||||
const cols = () => props.cols ?? 80;
|
||||
const isCompact = () => cols() < 60;
|
||||
const contentWidth = () => Math.max(1, Math.min(cols() - 4, 60));
|
||||
|
||||
const isCompact = cols < 60;
|
||||
const contentWidth = Math.max(1, Math.min(cols - 4, 60));
|
||||
createEffect(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
// Entrance animation
|
||||
useEffect(() => {
|
||||
if (animPhase >= 2) return;
|
||||
const timer = setTimeout(() => setAnimPhase(p => p + 1), 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, [animPhase]);
|
||||
const loadData = async () => {
|
||||
setState((s) => ({ ...s, loading: true, error: null }));
|
||||
try {
|
||||
const result = await loadWorkflowsList();
|
||||
setState(result);
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
loading: false,
|
||||
error: err instanceof Error ? err.message : 'Failed to load workflows',
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const successCount = WORKFLOWS.filter(w => w.status === 'success').length;
|
||||
const failedCount = WORKFLOWS.filter(w => w.status === 'failed').length;
|
||||
const handleExecute = async () => {
|
||||
if (executing()) return;
|
||||
|
||||
const handleKeyNav = useCallback((delta: number) => {
|
||||
setSelectedIndex(prev => Math.max(0, Math.min(prev + delta, WORKFLOWS.length - 1)));
|
||||
}, []);
|
||||
const workflows = state().workflows;
|
||||
if (workflows.length === 0) return;
|
||||
|
||||
const workflow = workflows[selectedIndex()];
|
||||
if (!workflow) return;
|
||||
|
||||
setExecuting(true);
|
||||
try {
|
||||
const result = await executeWorkflow(workflow.name, undefined, (progress) => {
|
||||
setState((s) => ({ ...s, progress }));
|
||||
});
|
||||
|
||||
if (result) {
|
||||
loadData();
|
||||
}
|
||||
} catch (err) {
|
||||
setState((s) => ({
|
||||
...s,
|
||||
error: err instanceof Error ? err.message : 'Workflow execution failed',
|
||||
}));
|
||||
} finally {
|
||||
setExecuting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyNav = (delta: number) => {
|
||||
const max = state().workflows.length - 1;
|
||||
setSelectedIndex((prev) => Math.max(0, Math.min(prev + delta, max)));
|
||||
};
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'j' || key.name === 'down') handleKeyNav(1);
|
||||
else if (key.name === 'k' || key.name === 'up') handleKeyNav(-1);
|
||||
else if (key.name === 'escape') onNavigate('home');
|
||||
else if (key.name === 'return') setShowDetail(true);
|
||||
else if (key.name === 'r') loadData();
|
||||
else if (key.name === 'x') handleExecute();
|
||||
else if (key.name === 'escape') {
|
||||
if (showDetail()) setShowDetail(false);
|
||||
else props.onNavigate('home');
|
||||
}
|
||||
});
|
||||
|
||||
const divider = useMemo(() =>
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(contentWidth)}</text>,
|
||||
[contentWidth]
|
||||
const successCount = createMemo(
|
||||
() => state().workflows.filter((w) => w.status === 'completed').length
|
||||
);
|
||||
const failedCount = createMemo(
|
||||
() => state().workflows.filter((w) => w.status === 'failed').length
|
||||
);
|
||||
const runningCount = createMemo(
|
||||
() => state().workflows.filter((w) => w.status === 'running').length
|
||||
);
|
||||
|
||||
const shortcuts = isCompact
|
||||
? 'j/k nav esc back'
|
||||
: 'j/k navigate esc back';
|
||||
const selectedWorkflow = () => {
|
||||
const workflows = state().workflows;
|
||||
if (workflows.length === 0) return null;
|
||||
return workflows[selectedIndex()];
|
||||
};
|
||||
|
||||
const getStatusIcon = (status: WorkflowListItem['status']): string => {
|
||||
switch (status) {
|
||||
case 'completed':
|
||||
return '✓';
|
||||
case 'failed':
|
||||
return '✗';
|
||||
case 'running':
|
||||
return '⟳';
|
||||
default:
|
||||
return '○';
|
||||
}
|
||||
};
|
||||
|
||||
const getStatusColor = (status: WorkflowListItem['status']): string => {
|
||||
switch (status) {
|
||||
case 'completed':
|
||||
return terminalColors.success;
|
||||
case 'failed':
|
||||
return terminalColors.error;
|
||||
case 'running':
|
||||
return terminalColors.accent;
|
||||
default:
|
||||
return terminalColors.textMuted;
|
||||
}
|
||||
};
|
||||
|
||||
const divider = () => '─'.repeat(contentWidth());
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
{/* Header */}
|
||||
{animPhase >= 1 && (
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row" justifyContent="space-between" width={contentWidth}>
|
||||
<text fg={terminalColors.workflow}>⟳ Workflows</text>
|
||||
<text fg={terminalColors.textMuted}>{WORKFLOWS.length} workflows</text>
|
||||
</box>
|
||||
<text fg={terminalColors.textMuted}>automate skill chains</text>
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
<box flexDirection="column" paddingLeft={1}>
|
||||
<Header
|
||||
title="Workflows"
|
||||
subtitle="Automate skill chains"
|
||||
icon="~"
|
||||
count={state().workflows.length}
|
||||
/>
|
||||
|
||||
{/* Stats */}
|
||||
{animPhase >= 2 && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text> </text>
|
||||
<box flexDirection="row" gap={3}>
|
||||
<text fg={terminalColors.success}>✓ {successCount} passed</text>
|
||||
{failedCount > 0 && (
|
||||
<text fg={terminalColors.error}>✗ {failedCount} failed</text>
|
||||
)}
|
||||
</box>
|
||||
<text> </text>
|
||||
{divider}
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
<Show when={state().error}>
|
||||
<ErrorState
|
||||
message={state().error!}
|
||||
action={{ label: 'Retry', key: 'r' }}
|
||||
compact
|
||||
/>
|
||||
</Show>
|
||||
|
||||
{/* Workflows list */}
|
||||
{animPhase >= 2 && (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.text}>Workflows</text>
|
||||
<text> </text>
|
||||
<Show when={state().loading}>
|
||||
<Spinner label="Loading workflows..." />
|
||||
</Show>
|
||||
|
||||
{WORKFLOWS.length === 0 ? (
|
||||
<box flexDirection="column">
|
||||
<text fg={terminalColors.textMuted}>No workflows yet</text>
|
||||
<Show when={!state().loading && !state().error}>
|
||||
<box flexDirection="row">
|
||||
<box flexDirection="column" flexGrow={1}>
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<Show when={successCount() > 0}>
|
||||
<text fg={terminalColors.success}>✓ {successCount()} passed</text>
|
||||
<text fg={terminalColors.textMuted}> | </text>
|
||||
</Show>
|
||||
<Show when={failedCount() > 0}>
|
||||
<text fg={terminalColors.error}>✗ {failedCount()} failed</text>
|
||||
<text fg={terminalColors.textMuted}> | </text>
|
||||
</Show>
|
||||
<Show when={runningCount() > 0}>
|
||||
<text fg={terminalColors.accent}>⟳ {runningCount()} running</text>
|
||||
</Show>
|
||||
<Show when={successCount() === 0 && failedCount() === 0 && runningCount() === 0}>
|
||||
<text fg={terminalColors.textMuted}>No workflows run yet</text>
|
||||
</Show>
|
||||
</box>
|
||||
) : (
|
||||
WORKFLOWS.map((wf, idx) => {
|
||||
const selected = idx === selectedIndex;
|
||||
const indicator = selected ? '▸' : ' ';
|
||||
const statusIcon = wf.status === 'success' ? '✓'
|
||||
: wf.status === 'failed' ? '✗' : '○';
|
||||
const statusColor = wf.status === 'success' ? terminalColors.success
|
||||
: wf.status === 'failed' ? terminalColors.error : terminalColors.textMuted;
|
||||
return (
|
||||
<box key={wf.name} flexDirection="row">
|
||||
<text fg={terminalColors.text}>{indicator}</text>
|
||||
<text fg={selected ? terminalColors.accent : terminalColors.text} width={18}>
|
||||
{wf.name}
|
||||
</text>
|
||||
<text fg={statusColor}>{statusIcon} </text>
|
||||
<text fg={terminalColors.textMuted}>{wf.steps}s · {wf.lastRun}</text>
|
||||
</box>
|
||||
);
|
||||
})
|
||||
)}
|
||||
<text> </text>
|
||||
</box>
|
||||
)}
|
||||
|
||||
{/* Footer */}
|
||||
{animPhase >= 2 && (
|
||||
<box flexDirection="column">
|
||||
{divider}
|
||||
<text fg={terminalColors.textMuted}>{shortcuts}</text>
|
||||
<text fg={terminalColors.textMuted}>{divider()}</text>
|
||||
<text> </text>
|
||||
|
||||
<Show
|
||||
when={state().workflows.length > 0}
|
||||
fallback={
|
||||
<EmptyState
|
||||
icon="~"
|
||||
title="No workflows found"
|
||||
description="Create workflows in .skillkit/workflows/"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<text fg={terminalColors.text}>
|
||||
<b>Available Workflows</b>
|
||||
</text>
|
||||
<text> </text>
|
||||
|
||||
<For each={state().workflows}>
|
||||
{(wf, idx) => {
|
||||
const selected = () => idx() === selectedIndex();
|
||||
return (
|
||||
<box flexDirection="row" marginBottom={1}>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={3}
|
||||
>
|
||||
{selected() ? '▸ ' : ' '}
|
||||
</text>
|
||||
<text
|
||||
fg={selected() ? terminalColors.accent : terminalColors.text}
|
||||
width={20}
|
||||
>
|
||||
{wf.name}
|
||||
</text>
|
||||
<text fg={getStatusColor(wf.status)} width={3}>
|
||||
{getStatusIcon(wf.status)}{' '}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={8}>
|
||||
{wf.skills}s / {wf.waves}w
|
||||
</text>
|
||||
<Show when={wf.lastRun}>
|
||||
<text fg={terminalColors.textMuted}> • {wf.lastRun}</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</Show>
|
||||
|
||||
<Show when={executing()}>
|
||||
<text> </text>
|
||||
<StatusIndicator status="loading" label="Executing workflow..." />
|
||||
<Show when={state().progress}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
Wave {state().progress?.currentWave}/{state().progress?.totalWaves} •{' '}
|
||||
Skill {state().progress?.currentSkill}/{state().progress?.totalSkills}
|
||||
</text>
|
||||
</Show>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<Show when={showDetail() && selectedWorkflow()}>
|
||||
<DetailPane
|
||||
title={selectedWorkflow()!.name}
|
||||
subtitle={selectedWorkflow()!.description}
|
||||
icon="~"
|
||||
fields={[
|
||||
{ label: 'Skills', value: String(selectedWorkflow()!.skills) },
|
||||
{ label: 'Waves', value: String(selectedWorkflow()!.waves) },
|
||||
{ label: 'Status', value: selectedWorkflow()!.status },
|
||||
{
|
||||
label: 'Last Run',
|
||||
value: selectedWorkflow()!.lastRun || 'Never',
|
||||
},
|
||||
]}
|
||||
actions={[
|
||||
{ key: 'x', label: 'Execute' },
|
||||
{ key: 'e', label: 'Edit' },
|
||||
{ key: 'Esc', label: 'Close' },
|
||||
]}
|
||||
width={28}
|
||||
visible={showDetail()}
|
||||
onClose={() => setShowDetail(false)}
|
||||
/>
|
||||
</Show>
|
||||
</box>
|
||||
)}
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>{divider()}</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
j/k navigate Enter details x execute r refresh Esc back
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
export interface ContextDisplay {
|
||||
projectName: string;
|
||||
rootPath: string;
|
||||
languages: string[];
|
||||
frameworks: string[];
|
||||
libraries: string[];
|
||||
patterns: Record<string, unknown>;
|
||||
lastUpdated?: string;
|
||||
}
|
||||
|
||||
export interface ContextServiceState {
|
||||
context: ContextDisplay | null;
|
||||
stack: unknown | null;
|
||||
loading: boolean;
|
||||
analyzing: boolean;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export async function loadProjectContext(): Promise<ContextServiceState> {
|
||||
return {
|
||||
context: {
|
||||
projectName: 'skillkit',
|
||||
rootPath: process.cwd(),
|
||||
languages: ['TypeScript', 'JavaScript'],
|
||||
frameworks: ['Solid.js', 'React'],
|
||||
libraries: ['@opentui/solid'],
|
||||
patterns: {},
|
||||
lastUpdated: new Date().toISOString(),
|
||||
},
|
||||
stack: null,
|
||||
loading: false,
|
||||
analyzing: false,
|
||||
error: null,
|
||||
};
|
||||
}
|
||||
|
||||
export async function analyzeProjectContext(): Promise<ContextServiceState> {
|
||||
return loadProjectContext();
|
||||
}
|
||||
|
||||
export async function refreshContext(): Promise<ContextServiceState> {
|
||||
return loadProjectContext();
|
||||
}
|
||||
|
||||
export async function exportContext(_path?: string, _format?: string): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function getStackTags(): Promise<string[]> {
|
||||
return ['typescript', 'solid-js', 'cli'];
|
||||
}
|
||||
|
||||
export const contextService = {
|
||||
loadProjectContext,
|
||||
analyzeProjectContext,
|
||||
refreshContext,
|
||||
exportContext,
|
||||
getStackTags,
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
export type AgentType = string;
|
||||
|
||||
export interface ExecutorServiceState {
|
||||
availableAgents: AgentType[];
|
||||
selectedAgent: AgentType | null;
|
||||
selectedSkill: string | null;
|
||||
executing: boolean;
|
||||
result: unknown | null;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export interface AgentAvailability {
|
||||
agent: AgentType;
|
||||
available: boolean;
|
||||
version?: string;
|
||||
path?: string;
|
||||
}
|
||||
|
||||
export async function getAgentAvailability(): Promise<AgentAvailability[]> {
|
||||
return [
|
||||
{ agent: 'claude-code', available: true },
|
||||
{ agent: 'cursor', available: false },
|
||||
{ agent: 'codex', available: false },
|
||||
];
|
||||
}
|
||||
|
||||
export async function listAvailableAgents(): Promise<AgentType[]> {
|
||||
return ['claude-code', 'cursor', 'codex'];
|
||||
}
|
||||
|
||||
export async function executeSkill(
|
||||
_skillPath: string,
|
||||
_agent: AgentType,
|
||||
_options?: unknown
|
||||
): Promise<{ success: boolean; output?: string; error?: string }> {
|
||||
return { success: true, output: 'Executed successfully' };
|
||||
}
|
||||
|
||||
export async function executeSkillWithAgent(
|
||||
_skillPath: string,
|
||||
_agent: AgentType,
|
||||
_options?: unknown
|
||||
): Promise<{ success: boolean; output?: string; error?: string }> {
|
||||
return { success: true, output: 'Executed successfully' };
|
||||
}
|
||||
|
||||
export function formatSkillPrompt(_content: string, _agent: AgentType): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
export function getExecutionInstructions(_skill: string, _agent: AgentType): string {
|
||||
return 'Manual execution instructions';
|
||||
}
|
||||
|
||||
export const executorService = {
|
||||
getAgentAvailability,
|
||||
listAvailableAgents,
|
||||
executeSkill,
|
||||
executeSkillWithAgent,
|
||||
formatSkillPrompt,
|
||||
getExecutionInstructions,
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Services Module
|
||||
* Provides service layer wrapping @skillkit/core APIs for TUI screens
|
||||
*/
|
||||
|
||||
export * from './memory.service.js';
|
||||
export * from './workflow.service.js';
|
||||
export * from './plan.service.js';
|
||||
export * from './plugin.service.js';
|
||||
export * from './team.service.js';
|
||||
export * from './methodology.service.js';
|
||||
export * from './recommend.service.js';
|
||||
export * from './context.service.js';
|
||||
|
||||
export type { ExecutorServiceState, AgentAvailability } from './executor.service.js';
|
||||
export {
|
||||
getAgentAvailability,
|
||||
listAvailableAgents,
|
||||
executeSkill,
|
||||
executeSkillWithAgent,
|
||||
formatSkillPrompt,
|
||||
getExecutionInstructions,
|
||||
executorService,
|
||||
} from './executor.service.js';
|
||||
|
||||
export type { AgentType } from './executor.service.js';
|
||||
|
||||
export type {
|
||||
TranslationDisplay,
|
||||
TranslationOptions,
|
||||
CanonicalSkill,
|
||||
TranslatorServiceState,
|
||||
} from './translator.service.js';
|
||||
export {
|
||||
getSupportedAgents,
|
||||
checkCanTranslate,
|
||||
translate,
|
||||
translateFromFile,
|
||||
parseSkill,
|
||||
detectFormat,
|
||||
previewTranslation,
|
||||
getAgentFormatInfo,
|
||||
translatorService,
|
||||
} from './translator.service.js';
|
||||
@@ -0,0 +1,43 @@
|
||||
export interface MemoryEntry {
|
||||
key: string;
|
||||
type: 'index' | 'learning' | 'observation';
|
||||
size: string;
|
||||
updated: string;
|
||||
}
|
||||
|
||||
export interface MemoryServiceState {
|
||||
entries: MemoryEntry[];
|
||||
status: { projectMemoryExists: boolean; globalMemoryExists: boolean } | null;
|
||||
paths: { projectMemoryDir: string; globalMemoryDir: string } | null;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export async function loadMemories(): Promise<MemoryServiceState> {
|
||||
return {
|
||||
entries: [],
|
||||
status: { projectMemoryExists: false, globalMemoryExists: true },
|
||||
paths: { projectMemoryDir: '.skillkit/memory', globalMemoryDir: '~/.skillkit/memory' },
|
||||
loading: false,
|
||||
error: null,
|
||||
};
|
||||
}
|
||||
|
||||
export async function deleteMemoryEntry(_key: string): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function clearMemory(_path?: string, _scope?: string): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function initializeMemory(): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export const memoryService = {
|
||||
loadMemories,
|
||||
deleteMemoryEntry,
|
||||
clearMemory,
|
||||
initializeMemory,
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
export interface MethodologyPackDisplay {
|
||||
name: string;
|
||||
description: string;
|
||||
version: string;
|
||||
skills: number;
|
||||
tags: string[];
|
||||
installed: boolean;
|
||||
status: 'available' | 'installed' | 'synced';
|
||||
}
|
||||
|
||||
export interface MethodologyServiceState {
|
||||
packs: MethodologyPackDisplay[];
|
||||
installedPacks: string[];
|
||||
manager: unknown | null;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export async function loadMethodologies(): Promise<MethodologyServiceState> {
|
||||
return {
|
||||
packs: [],
|
||||
installedPacks: [],
|
||||
manager: null,
|
||||
loading: false,
|
||||
error: null,
|
||||
};
|
||||
}
|
||||
|
||||
export async function installMethodologyPack(_name: string): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function uninstallMethodologyPack(_name: string): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function syncMethodologyPack(_name: string): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export const methodologyService = {
|
||||
loadMethodologies,
|
||||
installMethodologyPack,
|
||||
uninstallMethodologyPack,
|
||||
syncMethodologyPack,
|
||||
};
|
||||
@@ -0,0 +1,100 @@
|
||||
export interface PlanListItem {
|
||||
name: string;
|
||||
path: string;
|
||||
tasks: number;
|
||||
status: 'pending' | 'in_progress' | 'completed' | 'failed';
|
||||
lastModified?: string;
|
||||
}
|
||||
|
||||
export interface StructuredPlan {
|
||||
title: string;
|
||||
description?: string;
|
||||
tasks: PlanTask[];
|
||||
}
|
||||
|
||||
export interface PlanTask {
|
||||
id: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
status: 'pending' | 'in_progress' | 'completed' | 'failed';
|
||||
}
|
||||
|
||||
export interface PlanValidationIssue {
|
||||
message: string;
|
||||
type?: 'error' | 'warning';
|
||||
}
|
||||
|
||||
export interface PlanValidationResult {
|
||||
valid: boolean;
|
||||
errors: string[];
|
||||
warnings: string[];
|
||||
issues?: PlanValidationIssue[];
|
||||
}
|
||||
|
||||
export interface PlanExecutionResult {
|
||||
success: boolean;
|
||||
completedTasks: string[];
|
||||
failedTasks: string[];
|
||||
totalTasks: number;
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
export type PlanEvent = string;
|
||||
|
||||
export interface PlanServiceState {
|
||||
plans: PlanListItem[];
|
||||
current: StructuredPlan | null;
|
||||
validation: PlanValidationResult | null;
|
||||
execution: PlanExecutionResult | null;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export async function loadPlansList(_projectPath?: string): Promise<PlanServiceState> {
|
||||
return {
|
||||
plans: [],
|
||||
current: null,
|
||||
validation: null,
|
||||
execution: null,
|
||||
loading: false,
|
||||
error: null,
|
||||
};
|
||||
}
|
||||
|
||||
export async function loadPlan(_planPath: string): Promise<StructuredPlan | null> {
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function validatePlan(_plan: StructuredPlan): Promise<PlanValidationResult> {
|
||||
return { valid: true, errors: [], warnings: [], issues: [] };
|
||||
}
|
||||
|
||||
export async function executePlan(
|
||||
_plan: StructuredPlan,
|
||||
_projectPath?: string,
|
||||
_onEvent?: (event: PlanEvent) => void,
|
||||
_dryRun?: boolean
|
||||
): Promise<PlanExecutionResult | null> {
|
||||
return { success: true, completedTasks: [], failedTasks: [], totalTasks: 0, errors: [] };
|
||||
}
|
||||
|
||||
export async function executePlanDryRun(
|
||||
plan: StructuredPlan,
|
||||
projectPath?: string,
|
||||
onEvent?: (event: PlanEvent) => void
|
||||
): Promise<PlanExecutionResult | null> {
|
||||
return executePlan(plan, projectPath, onEvent, true);
|
||||
}
|
||||
|
||||
export async function parsePlanFromContent(_content: string): Promise<StructuredPlan | null> {
|
||||
return null;
|
||||
}
|
||||
|
||||
export const planService = {
|
||||
loadPlansList,
|
||||
loadPlan,
|
||||
validatePlan,
|
||||
executePlan,
|
||||
executePlanDryRun,
|
||||
parsePlanFromContent,
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
export interface PluginListItem {
|
||||
name: string;
|
||||
version: string;
|
||||
description: string;
|
||||
type: 'translator' | 'provider' | 'command' | 'mixed';
|
||||
enabled: boolean;
|
||||
path?: string;
|
||||
}
|
||||
|
||||
export interface PluginServiceState {
|
||||
plugins: PluginListItem[];
|
||||
manager: unknown | null;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export async function loadPluginsList(_projectPath?: string): Promise<PluginServiceState> {
|
||||
return {
|
||||
plugins: [],
|
||||
manager: null,
|
||||
loading: false,
|
||||
error: null,
|
||||
};
|
||||
}
|
||||
|
||||
export async function enablePlugin(_name: string, _manager: unknown): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function disablePlugin(_name: string, _manager: unknown): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function getPluginInfo(_name: string, _manager: unknown): Promise<unknown> {
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function installPluginFromPath(
|
||||
_pluginPath: string,
|
||||
_projectPath?: string
|
||||
): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export const pluginService = {
|
||||
loadPluginsList,
|
||||
enablePlugin,
|
||||
disablePlugin,
|
||||
getPluginInfo,
|
||||
installPluginFromPath,
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
export interface RecommendationDisplay {
|
||||
name: string;
|
||||
description: string;
|
||||
score: number;
|
||||
reasons: string[];
|
||||
source: string;
|
||||
tags: string[];
|
||||
installCommand?: string;
|
||||
}
|
||||
|
||||
export interface RecommendationOptions {
|
||||
limit?: number;
|
||||
minScore?: number;
|
||||
categories?: string[];
|
||||
refresh?: boolean;
|
||||
}
|
||||
|
||||
export interface RecommendServiceState {
|
||||
recommendations: RecommendationDisplay[];
|
||||
analyzing: boolean;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
lastAnalyzed?: string;
|
||||
}
|
||||
|
||||
export async function getRecommendations(
|
||||
_projectPath?: string,
|
||||
_options?: RecommendationOptions
|
||||
): Promise<RecommendServiceState> {
|
||||
return {
|
||||
recommendations: [],
|
||||
analyzing: false,
|
||||
loading: false,
|
||||
error: null,
|
||||
lastAnalyzed: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
|
||||
export async function analyzeProject(_projectPath?: string): Promise<{
|
||||
languages: string[];
|
||||
frameworks: string[];
|
||||
libraries: string[];
|
||||
patterns: string[];
|
||||
} | null> {
|
||||
return {
|
||||
languages: ['TypeScript', 'JavaScript'],
|
||||
frameworks: ['Solid.js'],
|
||||
libraries: ['@opentui/solid'],
|
||||
patterns: [],
|
||||
};
|
||||
}
|
||||
|
||||
export async function refreshRecommendations(
|
||||
projectPath?: string
|
||||
): Promise<RecommendServiceState> {
|
||||
return getRecommendations(projectPath, { refresh: true });
|
||||
}
|
||||
|
||||
export async function getRecommendationsByCategory(
|
||||
_category: string,
|
||||
projectPath?: string
|
||||
): Promise<RecommendationDisplay[]> {
|
||||
const result = await getRecommendations(projectPath);
|
||||
return result.recommendations;
|
||||
}
|
||||
|
||||
export const recommendService = {
|
||||
getRecommendations,
|
||||
analyzeProject,
|
||||
refreshRecommendations,
|
||||
getRecommendationsByCategory,
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user