mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-19 02:13:58 +00:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b63b37ee6 | ||
|
|
57b29014ec | ||
|
|
39b94534ec | ||
|
|
aeb2b05f15 | ||
|
|
5991fead9b | ||
|
|
1d3a779c2e | ||
|
|
2fe4702bd6 | ||
|
|
28ed83deb0 | ||
|
|
7c4ee9cfef | ||
|
|
64cafc76a1 | ||
|
|
7e3b31b43b | ||
|
|
ff089429ae | ||
|
|
6c3cecec4d | ||
|
|
8ed4ada674 | ||
|
|
514de86727 |
@@ -35,7 +35,7 @@ assignees: rohitg00
|
||||
- [ ] Repository is public
|
||||
- [ ] Repository contains valid SKILL.md files
|
||||
- [ ] Repository has a clear license
|
||||
- [ ] Skills follow the [Agent Skills specification](https://agenstskills.com)
|
||||
- [ ] Skills follow the [Agent Skills specification](https://skillkit.sh)
|
||||
|
||||
## Additional Context
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ body:
|
||||
options:
|
||||
- label: Repository is public
|
||||
required: true
|
||||
- label: SKILL.md follows the agenstskills.com standard format
|
||||
- label: SKILL.md follows the skillkit.sh standard format
|
||||
required: true
|
||||
- label: Skill has been tested with at least one AI agent
|
||||
required: false
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ To add support for a new AI coding agent:
|
||||
|
||||
If you want to contribute skills to the ecosystem:
|
||||
|
||||
1. Follow the [Agent Skills specification](https://agenstskills.com)
|
||||
1. Follow the [Agent Skills specification](https://skillkit.sh)
|
||||
2. Include a `SKILL.md` with proper frontmatter
|
||||
3. Test with multiple agents using `skillkit translate`
|
||||
4. Submit to the appropriate skill repository
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
**SkillKit** is the open source package manager for AI agent skills. Write a skill once, deploy it to **44 agents** — Claude, Cursor, Copilot, Windsurf, Devin, Codex, and 38 more. No rewrites. 15,000+ skills in the marketplace.
|
||||
|
||||
[Website](https://agenstskills.com) · [Docs](https://agenstskills.com/docs) · [API Explorer](https://agenstskills.com/api) · [Chrome Extension](https://github.com/rohitg00/skillkit/tree/main/packages/extension#readme) · [npm](https://www.npmjs.com/package/skillkit)
|
||||
[Website](https://skillkit.sh) · [Docs](https://skillkit.sh/docs) · [API Explorer](https://skillkit.sh/api) · [Chrome Extension](https://github.com/rohitg00/skillkit/tree/main/packages/extension#readme) · [npm](https://www.npmjs.com/package/skillkit)
|
||||
|
||||
</div>
|
||||
|
||||
@@ -125,7 +125,7 @@ async with SkillKitClient() as client:
|
||||
results = await client.search("react performance", limit=5)
|
||||
```
|
||||
|
||||
[REST API docs](https://agenstskills.com/docs/rest-api) · [MCP Server docs](https://agenstskills.com/docs/mcp-server) · [Python Client docs](https://agenstskills.com/docs/python-client) · [Interactive API explorer](https://agenstskills.com/api)
|
||||
[REST API docs](https://skillkit.sh/docs/rest-api) · [MCP Server docs](https://skillkit.sh/docs/mcp-server) · [Python Client docs](https://skillkit.sh/docs/python-client) · [Interactive API explorer](https://skillkit.sh/api)
|
||||
|
||||
### Auto-generate agent instructions
|
||||
|
||||
@@ -183,15 +183,15 @@ Team members run `skillkit manifest install` and they're in sync.
|
||||
|
||||
### Chrome Extension
|
||||
|
||||
Save any webpage as a skill directly from your browser. No server needed.
|
||||
Save any webpage as a skill directly from your browser.
|
||||
|
||||
1. Build: `pnpm --filter @skillkit/extension build`
|
||||
2. Chrome → `chrome://extensions` → Load unpacked → `packages/extension/dist/`
|
||||
3. Click the extension icon or right-click → "Save page as Skill"
|
||||
|
||||
The extension extracts page content as markdown, generates SKILL.md with auto-detected tags, and downloads it. Then run `skillkit install ~/Downloads/skillkit-skills/my-skill` to deploy to all agents.
|
||||
The extension sends the page URL to the SkillKit API for server-side extraction with Turndown, 5-source weighted tag detection, and GitHub URL support. The resulting SKILL.md downloads automatically. Then run `skillkit install ~/Downloads/skillkit-skills/my-skill` to deploy to all agents.
|
||||
|
||||
[Extension docs](https://agenstskills.com/docs/chrome-extension)
|
||||
[Extension docs](https://skillkit.sh/docs/chrome-extension)
|
||||
|
||||
### Interactive TUI
|
||||
|
||||
@@ -221,7 +221,7 @@ skillkit ui
|
||||
|
||||
Plus 33 more: Amp, Antigravity, Augment Code, Bolt, Clawdbot, Cline, CodeBuddy, CodeGPT, CommandCode, Continue, Crush, Droid, Factory, Goose, Kilo Code, Kiro CLI, Lovable, MCPJam, Mux, Neovate, OpenHands, Pi, PlayCode, Qoder, Qwen, Replit Agent, Roo Code, Tabby, Tabnine, Trae, Vercel, Zencoder, Universal
|
||||
|
||||
[Full agent details](https://agenstskills.com/docs/agents)
|
||||
[Full agent details](https://skillkit.sh/docs/agents)
|
||||
|
||||
## Commands
|
||||
|
||||
@@ -254,6 +254,16 @@ skillkit issue plan owner/repo#42 # Cross-repo plan
|
||||
skillkit issue list # List open issues
|
||||
```
|
||||
|
||||
### Session Intelligence
|
||||
|
||||
```bash
|
||||
skillkit timeline # Unified event stream
|
||||
skillkit session handoff # Agent-to-agent context
|
||||
skillkit lineage # Skill impact graph
|
||||
skillkit session explain # Human-readable summary
|
||||
skillkit activity # Skill activity log
|
||||
```
|
||||
|
||||
### Advanced
|
||||
|
||||
```bash
|
||||
@@ -266,7 +276,7 @@ skillkit test # Test skills
|
||||
skillkit cicd init # CI/CD templates
|
||||
```
|
||||
|
||||
[Full command reference](https://agenstskills.com/docs/commands)
|
||||
[Full command reference](https://skillkit.sh/docs/commands)
|
||||
|
||||
## Creating Skills
|
||||
|
||||
@@ -357,4 +367,4 @@ Apache License 2.0 — see [LICENSE](LICENSE).
|
||||
|
||||
## Links
|
||||
|
||||
[Documentation](https://agenstskills.com/docs) · [Website](https://agenstskills.com) · [API Explorer](https://agenstskills.com/api) · [npm](https://www.npmjs.com/package/skillkit) · [GitHub](https://github.com/rohitg00/skillkit)
|
||||
[Documentation](https://skillkit.sh/docs) · [Website](https://skillkit.sh) · [API Explorer](https://skillkit.sh/api) · [npm](https://www.npmjs.com/package/skillkit) · [GitHub](https://github.com/rohitg00/skillkit)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "skillkit",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "Supercharge AI coding agents with portable skills. Install, translate, and share skills across Claude Code, Cursor, Codex, Copilot & 13 more",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -118,6 +118,9 @@ import {
|
||||
AgentsMdShowCommand,
|
||||
IssuePlanCommand,
|
||||
IssueListCommand,
|
||||
TimelineCommand,
|
||||
SessionHandoffCommand,
|
||||
LineageCommand,
|
||||
} from '@skillkit/cli';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
@@ -263,4 +266,8 @@ cli.register(AgentsMdShowCommand);
|
||||
cli.register(IssuePlanCommand);
|
||||
cli.register(IssueListCommand);
|
||||
|
||||
cli.register(TimelineCommand);
|
||||
cli.register(SessionHandoffCommand);
|
||||
cli.register(LineageCommand);
|
||||
|
||||
cli.runExit(process.argv.slice(2));
|
||||
|
||||
@@ -38,5 +38,5 @@ dev = [
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/rohitg00/skillkit"
|
||||
Documentation = "https://agenstskills.com"
|
||||
Documentation = "https://skillkit.sh"
|
||||
Repository = "https://github.com/rohitg00/skillkit"
|
||||
|
||||
@@ -5,7 +5,7 @@ description: Save any webpage as an AI agent skill from your browser
|
||||
|
||||
# Chrome Extension
|
||||
|
||||
Save any webpage as a SKILL.md directly from your browser. No server needed.
|
||||
Save any webpage as a SKILL.md directly from your browser.
|
||||
|
||||
## Install
|
||||
|
||||
@@ -33,14 +33,14 @@ Then load `packages/extension/dist/` as an unpacked extension.
|
||||
3. Optionally enter a custom skill name
|
||||
4. Click **Save as Skill**
|
||||
|
||||
The extension extracts the page content as markdown, generates a SKILL.md with YAML frontmatter and auto-detected tags, and downloads it to your `Downloads/skillkit-skills/` folder.
|
||||
The extension sends the page URL to the SkillKit API, which extracts the content as markdown, generates tags using weighted 5-source analysis, and returns a complete SKILL.md. The file downloads to your `Downloads/skillkit-skills/` folder.
|
||||
|
||||
### Context Menu
|
||||
|
||||
Right-click on any page:
|
||||
|
||||
- **Save page as Skill** — saves the entire page
|
||||
- **Save selection as Skill** — saves only the selected text
|
||||
- **Save page as Skill** — sends the URL to the API, downloads the result
|
||||
- **Save selection as Skill** — builds the skill locally from selected text (no network request)
|
||||
|
||||
### Making Skills Available to Agents
|
||||
|
||||
@@ -59,28 +59,31 @@ skillkit sync
|
||||
|
||||
## How It Works
|
||||
|
||||
The extension runs entirely in the browser:
|
||||
```
|
||||
Extension → POST /api/save-skill { url } → Server pipeline → Download
|
||||
```
|
||||
|
||||
1. **Content script** extracts page content using [Turndown](https://github.com/mixmark-io/turndown) to convert HTML to clean markdown. It targets `<article>`, `<main>`, or `<body>` and strips scripts, nav, footer, and iframes.
|
||||
1. **Popup** reads the current tab's URL and title via `activeTab` permission. No content script injection needed.
|
||||
|
||||
2. **Background service worker** generates the SKILL.md:
|
||||
- Slugifies the page title into a skill name
|
||||
- Builds YAML frontmatter (name, description, source URL, timestamp)
|
||||
- Auto-detects tags from 40+ tech keywords (react, typescript, docker, kubernetes, etc.)
|
||||
- Downloads via `chrome.downloads` API
|
||||
2. **Background service worker** sends the URL to `skillkit.sh/api/save-skill` (or `agenstskills.com/api/save-skill`):
|
||||
- Server fetches the page and converts HTML to markdown via Turndown
|
||||
- GitHub URLs are auto-converted to raw content
|
||||
- Tags are detected from 5 weighted sources (URL segments, headings, code blocks, keywords, language)
|
||||
- Returns a complete SKILL.md with YAML frontmatter
|
||||
|
||||
3. **No server required** — the `POST /save` API endpoint exists for CLI users (`skillkit save`), but the extension works independently.
|
||||
3. **Download** — the service worker creates a blob and saves via `chrome.downloads` API.
|
||||
|
||||
4. **Selection saves** work entirely offline — Chrome natively provides `selectionText` via the context menu API, so the skill is built locally with no server round-trip.
|
||||
|
||||
## Permissions
|
||||
|
||||
| Permission | Why |
|
||||
|-----------|-----|
|
||||
| `contextMenus` | Right-click "Save as Skill" menu items |
|
||||
| `activeTab` | Access current page URL and title |
|
||||
| `storage` | Persist extension preferences |
|
||||
| `activeTab` | Access current page URL and title on click |
|
||||
| `downloads` | Save SKILL.md files to disk |
|
||||
|
||||
No `host_permissions` needed. The extension never sends data to any server.
|
||||
No `host_permissions` or `scripting` permissions needed. Only the page URL is sent to the server — no page content, browsing history, or personal data.
|
||||
|
||||
## Generated SKILL.md Format
|
||||
|
||||
@@ -94,7 +97,7 @@ tags:
|
||||
- testing
|
||||
metadata:
|
||||
source: https://example.com/react-performance
|
||||
savedAt: 2026-02-10T09:00:00.000Z
|
||||
savedAt: 2026-02-14T09:00:00.000Z
|
||||
---
|
||||
|
||||
# React Performance Tips
|
||||
@@ -111,9 +114,8 @@ pnpm --filter @skillkit/extension build
|
||||
```
|
||||
|
||||
Output goes to `packages/extension/dist/` with:
|
||||
- `background.global.js` — Service worker (5KB)
|
||||
- `content.global.js` — Content script with Turndown (23KB)
|
||||
- `popup.global.js` — Popup UI logic (3KB)
|
||||
- `background.global.js` — Service worker (~4KB)
|
||||
- `popup.global.js` — Popup UI logic (~2KB)
|
||||
- `popup.html` + `popup.css` — Monochromatic UI
|
||||
- `manifest.json` — Chrome Manifest V3
|
||||
- `icons/` — 16/48/128px PNG icons
|
||||
|
||||
@@ -378,6 +378,66 @@ skillkit issue list --json # JSON output
|
||||
|
||||
The planner extracts task lists (checkboxes) from the issue body, infers file mentions from backtick-quoted paths, and maps labels to tags (e.g., `bug` → `fix`, `enhancement` → `feature`). Generated plans work with `skillkit plan validate` and `skillkit plan execute`.
|
||||
|
||||
## Session Intelligence
|
||||
|
||||
Track skill executions, generate handoff documents, and analyze skill impact.
|
||||
|
||||
### Timeline
|
||||
|
||||
View a unified chronological event stream of all session activity.
|
||||
|
||||
```bash
|
||||
skillkit timeline # Last 50 events
|
||||
skillkit timeline --type git_commit # Filter by event type
|
||||
skillkit timeline --skill code-simplifier # Filter by skill
|
||||
skillkit timeline --since 2026-02-10 # Date filter
|
||||
skillkit timeline --limit 20 --json # JSON output
|
||||
```
|
||||
|
||||
| Option | Short | Purpose |
|
||||
|--------|-------|---------|
|
||||
| `--type` | `-t` | Filter: skill_start, skill_complete, task_progress, git_commit, observation, decision, snapshot |
|
||||
| `--skill` | `-s` | Filter events by skill name |
|
||||
| `--since` | — | Show events since date (YYYY-MM-DD) |
|
||||
| `--limit` | `-l` | Max events (default: 50) |
|
||||
| `--json` | `-j` | JSON output |
|
||||
|
||||
### Session Handoff
|
||||
|
||||
Generate a structured context document for agent switching.
|
||||
|
||||
```bash
|
||||
skillkit session handoff # Print markdown to stdout
|
||||
skillkit session handoff --to cursor # Target agent recommendations
|
||||
skillkit session handoff --out handoff.md # Save to file
|
||||
skillkit session handoff --json # JSON output
|
||||
```
|
||||
|
||||
| Option | Short | Purpose |
|
||||
|--------|-------|---------|
|
||||
| `--to` | — | Target agent for recommendations |
|
||||
| `--out` | `-o` | Save to file path |
|
||||
| `--json` | `-j` | JSON output |
|
||||
|
||||
### Lineage
|
||||
|
||||
Show which skills produced which code changes with aggregate impact stats.
|
||||
|
||||
```bash
|
||||
skillkit lineage # Full overview
|
||||
skillkit lineage --skill code-simplifier # Single skill
|
||||
skillkit lineage --file src/index.ts # Single file
|
||||
skillkit lineage --since 2026-02-01 --json # Date filter + JSON
|
||||
```
|
||||
|
||||
| Option | Short | Purpose |
|
||||
|--------|-------|---------|
|
||||
| `--skill` | `-s` | Filter by skill name |
|
||||
| `--file` | `-f` | Filter by file path |
|
||||
| `--since` | — | Show lineage since date |
|
||||
| `--limit` | `-l` | Max entries |
|
||||
| `--json` | `-j` | JSON output |
|
||||
|
||||
## Utility Commands
|
||||
|
||||
```bash
|
||||
|
||||
@@ -29,7 +29,7 @@ skillkit/
|
||||
│ ├── core/ # Business logic
|
||||
│ ├── cli/ # CLI
|
||||
│ ├── tui/ # Terminal UI
|
||||
│ └── agents/ # 32 adapters
|
||||
│ └── agents/ # 44 adapters
|
||||
├── marketplace/ # Skills data
|
||||
│ ├── skills.json
|
||||
│ └── sources.json
|
||||
|
||||
@@ -124,6 +124,16 @@ skillkit memory search "auth patterns"
|
||||
skillkit memory export auth-patterns
|
||||
```
|
||||
|
||||
### Session Intelligence
|
||||
|
||||
Track skill executions, generate handoff documents for agent switching, and view skill impact lineage:
|
||||
|
||||
```bash
|
||||
skillkit timeline # Unified event stream
|
||||
skillkit session handoff # Agent-to-agent context
|
||||
skillkit lineage # Skill impact graph
|
||||
```
|
||||
|
||||
### Primer
|
||||
|
||||
Auto-generate CLAUDE.md, .cursorrules, and agent instructions by analyzing your codebase:
|
||||
@@ -163,4 +173,4 @@ Team members run `skillkit manifest install` and they're in sync.
|
||||
- [MCP Server](/docs/mcp-server) — Agent-native discovery
|
||||
- [Python Client](/docs/python-client) — Python SDK
|
||||
|
||||
**Current version:** v1.12.0 | [npm](https://www.npmjs.com/package/skillkit) | [GitHub](https://github.com/rohitg00/skillkit) | Apache-2.0
|
||||
**Current version:** v1.18.0 | [npm](https://www.npmjs.com/package/skillkit) | [GitHub](https://github.com/rohitg00/skillkit) | Apache-2.0
|
||||
|
||||
@@ -5,7 +5,7 @@ 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.
|
||||
Primer analyzes your codebase and automatically generates optimized instructions for all 44 AI agents. No more manual configuration—let SkillKit detect your tech stack, coding patterns, and project structure.
|
||||
|
||||
## Quick Start
|
||||
|
||||
@@ -65,7 +65,7 @@ Primer creates agent-specific instructions for:
|
||||
└── copilot-instructions.md
|
||||
```
|
||||
|
||||
### All 32 Agents
|
||||
### All 44 Agents
|
||||
Each agent gets optimized instructions in their native format.
|
||||
|
||||
## Example Output
|
||||
@@ -86,7 +86,7 @@ Detected:
|
||||
- Claude Code (.claude/CLAUDE.md)
|
||||
- Cursor (.cursor/.cursorrules)
|
||||
- Codex (.codex/instructions.md)
|
||||
+ 29 more agents
|
||||
+ 41 more agents
|
||||
|
||||
💡 Tip: Run `skillkit sync` to apply changes
|
||||
```
|
||||
|
||||
@@ -188,7 +188,7 @@ const { app, cache } = createApp({
|
||||
|
||||
The server includes built-in Swagger UI at `/docs` and an OpenAPI 3.1 spec at `/openapi.json`. Open `http://localhost:3737/docs` in your browser to try endpoints interactively.
|
||||
|
||||
The hosted version is available at [agenstskills.com/api](https://agenstskills.com/api).
|
||||
The hosted version is available at [skillkit.sh/api](https://skillkit.sh/api) and [agenstskills.com/api](https://agenstskills.com/api).
|
||||
|
||||
## All endpoints
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ description: Convert skills between AI agent formats
|
||||
|
||||
# Translation
|
||||
|
||||
SkillKit automatically converts between all 32 agent formats using an adapter pattern.
|
||||
SkillKit automatically converts between all 44 agent formats using an adapter pattern.
|
||||
|
||||
## Basic Translation
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "skillkit-docs",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "next build",
|
||||
@@ -21,7 +21,8 @@
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "^19.2.3",
|
||||
"react-dom": "^19.2.3",
|
||||
"tailwind-merge": "^3.4.0"
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"turndown": "^7.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4.1.18",
|
||||
@@ -29,6 +30,7 @@
|
||||
"@types/node": "^24.10.2",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@types/turndown": "^5.0.6",
|
||||
"postcss": "^8.5.6",
|
||||
"tailwindcss": "^4.1.18",
|
||||
"typescript": "^5.9.3"
|
||||
|
||||
@@ -18,7 +18,7 @@ export default function HomePage() {
|
||||
|
||||
<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.
|
||||
Windsurf, Copilot, and 40 more agents. 15,000+ skills ready to use.
|
||||
</p>
|
||||
|
||||
<div className="flex flex-wrap justify-center gap-4 mb-12">
|
||||
@@ -39,8 +39,8 @@ export default function HomePage() {
|
||||
{/* 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>
|
||||
<h3 className="text-lg font-bold text-white mb-2 font-mono">44 Agents</h3>
|
||||
<p className="text-zinc-500 text-sm">Claude, Cursor, Codex, Windsurf, Copilot, and 39 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>
|
||||
|
||||
@@ -0,0 +1,291 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import TurndownService from 'turndown';
|
||||
|
||||
const rateLimitMap = new Map<string, { count: number; resetTime: number }>();
|
||||
const RATE_LIMIT_WINDOW_MS = 60 * 1000;
|
||||
const RATE_LIMIT_MAX_REQUESTS = 10;
|
||||
|
||||
function checkRateLimit(key: string): { allowed: boolean; remaining: number } {
|
||||
const now = Date.now();
|
||||
const entry = rateLimitMap.get(key);
|
||||
|
||||
if (!entry || now > entry.resetTime) {
|
||||
rateLimitMap.set(key, { count: 1, resetTime: now + RATE_LIMIT_WINDOW_MS });
|
||||
return { allowed: true, remaining: RATE_LIMIT_MAX_REQUESTS - 1 };
|
||||
}
|
||||
|
||||
if (entry.count >= RATE_LIMIT_MAX_REQUESTS) {
|
||||
return { allowed: false, remaining: 0 };
|
||||
}
|
||||
|
||||
entry.count++;
|
||||
return { allowed: true, remaining: RATE_LIMIT_MAX_REQUESTS - entry.count };
|
||||
}
|
||||
|
||||
const BLOCKED_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]', '::1', '0.0.0.0']);
|
||||
|
||||
function isAllowedUrl(url: string): boolean {
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return false;
|
||||
|
||||
const hostname = parsed.hostname.toLowerCase();
|
||||
const bare = hostname.replace(/^\[|\]$/g, '');
|
||||
|
||||
if (BLOCKED_HOSTS.has(hostname) || BLOCKED_HOSTS.has(bare)) return false;
|
||||
if (bare.startsWith('::ffff:')) return isAllowedUrl(`http://${bare.slice(7)}`);
|
||||
if (/^127\./.test(bare) || /^0\./.test(bare)) return false;
|
||||
if (bare.startsWith('10.') || bare.startsWith('192.168.')) return false;
|
||||
if (/^172\.(1[6-9]|2\d|3[01])\./.test(bare)) return false;
|
||||
if (bare.startsWith('169.254.')) return false;
|
||||
if (bare.startsWith('fe80:') || bare.startsWith('fc00:') || bare.startsWith('fd')) return false;
|
||||
if (/^(22[4-9]|23\d|24\d|25[0-5])\./.test(bare)) return false;
|
||||
if (/^ff[0-9a-f]{2}:/.test(bare)) return false;
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const GITHUB_URL_PATTERN = /^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/blob\/([^/]+)\/(.+)$/;
|
||||
const GITHUB_RAW_PATTERN = /^https?:\/\/raw\.githubusercontent\.com\//;
|
||||
const FETCH_TIMEOUT = 30_000;
|
||||
|
||||
const TECH_KEYWORDS = new Set([
|
||||
'react', 'vue', 'angular', 'svelte', 'nextjs', 'nuxt', 'remix',
|
||||
'typescript', 'javascript', 'python', 'rust', 'go', 'java', 'ruby',
|
||||
'node', 'deno', 'bun', 'docker', 'kubernetes', 'terraform',
|
||||
'aws', 'gcp', 'azure', 'vercel', 'netlify', 'cloudflare',
|
||||
'graphql', 'rest', 'grpc', 'websocket', 'redis', 'postgres',
|
||||
'mongodb', 'sqlite', 'mysql', 'prisma', 'drizzle',
|
||||
'tailwind', 'css', 'html', 'sass', 'webpack', 'vite', 'esbuild',
|
||||
'git', 'ci', 'cd', 'testing', 'security', 'authentication',
|
||||
'api', 'cli', 'sdk', 'mcp', 'llm', 'ai', 'ml', 'openai', 'anthropic',
|
||||
]);
|
||||
|
||||
const TAG_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
||||
|
||||
const turndown = new TurndownService({ headingStyle: 'atx', codeBlockStyle: 'fenced' });
|
||||
|
||||
interface ExtractedContent {
|
||||
title: string;
|
||||
content: string;
|
||||
sourceUrl: string;
|
||||
contentType: string;
|
||||
language?: string;
|
||||
}
|
||||
|
||||
async function extractFromUrl(url: string): Promise<ExtractedContent> {
|
||||
if (GITHUB_URL_PATTERN.test(url) || GITHUB_RAW_PATTERN.test(url)) {
|
||||
return fetchGitHubContent(url);
|
||||
}
|
||||
|
||||
const MAX_BODY_SIZE = 5 * 1024 * 1024;
|
||||
const response = await fetch(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT) });
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
|
||||
const contentLength = Number(response.headers.get('content-length') || '0');
|
||||
if (contentLength > MAX_BODY_SIZE) {
|
||||
throw new Error('Response too large');
|
||||
}
|
||||
|
||||
const contentType = response.headers.get('content-type') ?? '';
|
||||
const body = await response.text();
|
||||
if (body.length > MAX_BODY_SIZE) {
|
||||
throw new Error('Response too large');
|
||||
}
|
||||
|
||||
if (contentType.includes('text/html')) {
|
||||
const titleMatch = body.match(/<title[^>]*>([^<]+)<\/title>/i);
|
||||
const title = titleMatch?.[1]?.trim() ?? new URL(url).hostname;
|
||||
const bodyMatch = body.match(/<body[^>]*>([\s\S]*)<\/body>/i);
|
||||
const content = turndown.turndown(bodyMatch?.[1] ?? body);
|
||||
return { title, content, sourceUrl: url, contentType: 'webpage' };
|
||||
}
|
||||
|
||||
const title = new URL(url).pathname.split('/').pop() ?? 'Untitled';
|
||||
return { title, content: body, sourceUrl: url, contentType: 'text' };
|
||||
}
|
||||
|
||||
const LANG_MAP: Record<string, string> = {
|
||||
'.ts': 'typescript', '.tsx': 'typescript', '.js': 'javascript', '.jsx': 'javascript',
|
||||
'.py': 'python', '.rb': 'ruby', '.go': 'go', '.rs': 'rust', '.java': 'java',
|
||||
'.kt': 'kotlin', '.swift': 'swift', '.sh': 'shell', '.yml': 'yaml', '.yaml': 'yaml',
|
||||
'.json': 'json', '.md': 'markdown', '.html': 'html', '.css': 'css', '.sql': 'sql',
|
||||
};
|
||||
|
||||
async function fetchGitHubContent(url: string): Promise<ExtractedContent> {
|
||||
let rawUrl = url;
|
||||
const match = url.match(GITHUB_URL_PATTERN);
|
||||
if (match) {
|
||||
const [, owner, repo, branch, path] = match;
|
||||
rawUrl = `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${path}`;
|
||||
}
|
||||
|
||||
const MAX_BODY_SIZE = 5 * 1024 * 1024;
|
||||
const response = await fetch(rawUrl, { signal: AbortSignal.timeout(FETCH_TIMEOUT) });
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch GitHub content: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
|
||||
const contentLength = Number(response.headers.get('content-length') || '0');
|
||||
if (contentLength > MAX_BODY_SIZE) {
|
||||
throw new Error('Response too large');
|
||||
}
|
||||
|
||||
const body = await response.text();
|
||||
if (body.length > MAX_BODY_SIZE) {
|
||||
throw new Error('Response too large');
|
||||
}
|
||||
const filename = rawUrl.split('/').pop() ?? 'file';
|
||||
const ext = filename.includes('.') ? '.' + filename.split('.').pop()!.toLowerCase() : '';
|
||||
const language = LANG_MAP[ext];
|
||||
const isCode = language !== undefined && language !== 'markdown';
|
||||
const content = isCode ? `\`\`\`${language}\n${body}\n\`\`\`` : body;
|
||||
|
||||
return { title: filename, content, sourceUrl: url, contentType: 'github', language };
|
||||
}
|
||||
|
||||
function addTag(counts: Map<string, number>, tag: string, weight: number): void {
|
||||
if (TAG_PATTERN.test(tag)) {
|
||||
counts.set(tag, (counts.get(tag) ?? 0) + weight);
|
||||
}
|
||||
}
|
||||
|
||||
function detectTags(extracted: ExtractedContent): string[] {
|
||||
const counts = new Map<string, number>();
|
||||
|
||||
try {
|
||||
const segments = new URL(extracted.sourceUrl).pathname
|
||||
.split('/').filter(Boolean)
|
||||
.map((s) => s.toLowerCase().replace(/[^a-z0-9-]/g, ''));
|
||||
for (const seg of segments) {
|
||||
if (seg.length >= 2 && seg.length <= 30) {
|
||||
addTag(counts, seg, 2);
|
||||
}
|
||||
}
|
||||
} catch { /* skip */ }
|
||||
|
||||
const headingRe = /^#{1,2}\s+(.+)$/gm;
|
||||
let m: RegExpExecArray | null;
|
||||
while ((m = headingRe.exec(extracted.content)) !== null) {
|
||||
for (const word of m[1].toLowerCase().split(/\s+/)) {
|
||||
const cleaned = word.replace(/[^a-z0-9-]/g, '');
|
||||
if (cleaned.length >= 2) {
|
||||
addTag(counts, cleaned, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const codeBlockRe = /^```(\w+)/gm;
|
||||
while ((m = codeBlockRe.exec(extracted.content)) !== null) {
|
||||
const lang = m[1].toLowerCase();
|
||||
if (lang.length >= 2) {
|
||||
addTag(counts, lang, 3);
|
||||
}
|
||||
}
|
||||
|
||||
const lower = extracted.content.toLowerCase();
|
||||
for (const keyword of TECH_KEYWORDS) {
|
||||
if (new RegExp(`\\b${keyword}\\b`, 'i').test(lower)) {
|
||||
addTag(counts, keyword, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (extracted.language) {
|
||||
addTag(counts, extracted.language.toLowerCase(), 3);
|
||||
}
|
||||
|
||||
return Array.from(counts.entries())
|
||||
.sort((a, b) => b[1] - a[1])
|
||||
.slice(0, 10)
|
||||
.map(([tag]) => tag);
|
||||
}
|
||||
|
||||
function slugify(input: string): string {
|
||||
const slug = input
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '')
|
||||
.replace(/-{2,}/g, '-');
|
||||
return slug.slice(0, 64).replace(/-+$/, '') || 'untitled-skill';
|
||||
}
|
||||
|
||||
function yamlEscape(value: string): string {
|
||||
const singleLine = value.replace(/\r?\n/g, ' ').trim();
|
||||
if (/[:#{}[\],&*?|>!%@`]/.test(singleLine) || singleLine.startsWith("'") || singleLine.startsWith('"')) {
|
||||
return `"${singleLine.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
||||
}
|
||||
return singleLine;
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const ip = request.headers.get('x-forwarded-for')?.split(',')[0]?.trim() ?? 'unknown';
|
||||
const { allowed, remaining } = checkRateLimit(ip);
|
||||
|
||||
if (!allowed) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Too many requests. Try again in a minute.' },
|
||||
{ status: 429, headers: { 'X-RateLimit-Remaining': '0', 'Retry-After': '60' } },
|
||||
);
|
||||
}
|
||||
|
||||
let body: { url?: string; name?: string };
|
||||
try {
|
||||
body = await request.json();
|
||||
} catch {
|
||||
return NextResponse.json({ error: 'Invalid JSON body' }, { status: 400 });
|
||||
}
|
||||
|
||||
const { url, name } = body;
|
||||
if (!url || typeof url !== 'string') {
|
||||
return NextResponse.json({ error: 'Missing required field: url' }, { status: 400 });
|
||||
}
|
||||
|
||||
if (name !== undefined && typeof name !== 'string') {
|
||||
return NextResponse.json({ error: 'Field "name" must be a string' }, { status: 400 });
|
||||
}
|
||||
|
||||
if (!isAllowedUrl(url)) {
|
||||
return NextResponse.json({ error: 'URL not allowed' }, { status: 403 });
|
||||
}
|
||||
|
||||
try {
|
||||
const extracted = await extractFromUrl(url);
|
||||
const tags = detectTags(extracted);
|
||||
|
||||
const skillName = slugify(name || extracted.title || 'untitled');
|
||||
const description = extracted.content
|
||||
.split('\n')
|
||||
.find((l) => l.trim().length > 0)
|
||||
?.replace(/^#+\s*/, '')
|
||||
.trim()
|
||||
.slice(0, 200) || 'Saved skill';
|
||||
const savedAt = new Date().toISOString();
|
||||
|
||||
const yamlTags = tags.length > 0
|
||||
? `tags:\n${tags.map((t) => ` - ${t}`).join('\n')}\n`
|
||||
: '';
|
||||
|
||||
const skillMd =
|
||||
`---\n` +
|
||||
`name: ${skillName}\n` +
|
||||
`description: ${yamlEscape(description)}\n` +
|
||||
yamlTags +
|
||||
`metadata:\n` +
|
||||
` source: ${yamlEscape(url)}\n` +
|
||||
` savedAt: ${savedAt}\n` +
|
||||
`---\n\n` +
|
||||
extracted.content + '\n';
|
||||
|
||||
return NextResponse.json(
|
||||
{ name: skillName, skillMd, tags, description },
|
||||
{ headers: { 'X-RateLimit-Remaining': String(remaining) } },
|
||||
);
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : 'Failed to extract content';
|
||||
return NextResponse.json({ error: message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export const metadata: Metadata = {
|
||||
openGraph: {
|
||||
title: 'SkillKit - Universal Skills for AI Coding Agents',
|
||||
description: 'One CLI to install, sync, and manage skills across Claude Code, Cursor, Windsurf, Copilot, and 28 more agents.',
|
||||
url: 'https://agenstskills.com',
|
||||
url: 'https://skillkit.sh',
|
||||
siteName: 'SkillKit',
|
||||
images: [{ url: '/og-image.png', width: 1200, height: 630 }],
|
||||
type: 'website',
|
||||
|
||||
@@ -44,12 +44,12 @@ const sections: DocSection[] = [
|
||||
content: (
|
||||
<div className="space-y-4">
|
||||
<p className="text-zinc-300">
|
||||
SkillKit is a universal command-line interface (CLI) and programmatic toolkit for managing AI agent skills across 32 AI coding platforms. It solves the fragmentation problem where each AI agent uses different skill formats and directory structures.
|
||||
SkillKit is a universal command-line interface (CLI) and programmatic toolkit for managing AI agent skills across 44 AI coding platforms. It solves the fragmentation problem where each AI agent uses different skill formats and directory structures.
|
||||
</p>
|
||||
<h3 className="text-lg font-semibold text-white mt-6">Core Capabilities</h3>
|
||||
<ul className="list-disc list-inside space-y-2 text-zinc-400">
|
||||
<li><span className="text-white">Skill Discovery</span> - Browse 15,000+ skills from marketplace with AI-powered recommendations</li>
|
||||
<li><span className="text-white">Cross-Agent Translation</span> - Automatically convert skills between 32 agent-specific formats</li>
|
||||
<li><span className="text-white">Cross-Agent Translation</span> - Automatically convert skills between 44 agent-specific formats</li>
|
||||
<li><span className="text-white">Team Collaboration</span> - Share skills via .skills manifest files and publish to marketplace</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -102,7 +102,7 @@ skillkit install anthropics/skills`}</CodeBlock>
|
||||
<ul className="list-disc list-inside space-y-2 text-zinc-400">
|
||||
<li><span className="text-white">UI Tier</span> - CLI commands, Terminal UI (OpenTUI-based), and documentation website</li>
|
||||
<li><span className="text-white">Core Logic Tier</span> - @skillkit/core for business logic; @skillkit/agents for adapter implementations</li>
|
||||
<li><span className="text-white">Integration Tier</span> - File systems, Git repositories, marketplace APIs, and 32 AI agents</li>
|
||||
<li><span className="text-white">Integration Tier</span> - File systems, Git repositories, marketplace APIs, and 44 AI agents</li>
|
||||
</ul>
|
||||
|
||||
<h3 className="text-lg font-semibold text-white mt-6">Monorepo Structure</h3>
|
||||
@@ -130,7 +130,7 @@ skillkit install anthropics/skills`}</CodeBlock>
|
||||
content: (
|
||||
<div className="space-y-4">
|
||||
<p className="text-zinc-300">
|
||||
SkillKit supports 32 AI coding agents with automatic format translation:
|
||||
SkillKit supports 44 AI coding agents with automatic format translation:
|
||||
</p>
|
||||
|
||||
<Table
|
||||
@@ -167,6 +167,18 @@ skillkit install anthropics/skills`}</CodeBlock>
|
||||
['Trae', '.trae/skills/', 'SKILL.md'],
|
||||
['Vercel', '.vercel/skills/', 'SKILL.md'],
|
||||
['Zencoder', '.zencoder/skills/', 'SKILL.md'],
|
||||
['Devin', '.devin/skills/', 'SKILL.md'],
|
||||
['Aider', '.aider/skills/', 'SKILL.md'],
|
||||
['Sourcegraph Cody', '.cody/skills/', 'SKILL.md'],
|
||||
['Amazon Q', '.amazonq/skills/', 'SKILL.md'],
|
||||
['Augment Code', '.augment/skills/', 'SKILL.md'],
|
||||
['Replit Agent', '.replit/skills/', 'SKILL.md'],
|
||||
['Bolt', '.bolt/skills/', 'SKILL.md'],
|
||||
['Lovable', '.lovable/skills/', 'SKILL.md'],
|
||||
['Tabby', '.tabby/skills/', 'SKILL.md'],
|
||||
['Tabnine', '.tabnine/skills/', 'SKILL.md'],
|
||||
['CodeGPT', '.codegpt/skills/', 'SKILL.md'],
|
||||
['PlayCode Agent', '.playcode/skills/', 'SKILL.md'],
|
||||
['Universal', 'skills/', 'SKILL.md'],
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -9,7 +9,7 @@ interface Feature {
|
||||
const FEATURES: Feature[] = [
|
||||
{
|
||||
title: 'Multi-Agent',
|
||||
description: 'Deploy to 32 AI coding agents with one command.',
|
||||
description: 'Deploy to 44 AI coding agents with one command.',
|
||||
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" />
|
||||
@@ -64,7 +64,7 @@ const FEATURES: Feature[] = [
|
||||
];
|
||||
|
||||
const COMPARISONS = [
|
||||
['Agents', '1', '32'],
|
||||
['Agents', '1', '44'],
|
||||
['Translation', 'Manual', 'Auto'],
|
||||
['Sharing', 'Copy/paste', '.skills manifest'],
|
||||
['Discovery', 'Forums', 'CLI + AI'],
|
||||
@@ -83,7 +83,7 @@ export function Features(): React.ReactElement {
|
||||
</p>
|
||||
<div className="flex gap-6 sm:gap-8">
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">32</div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">44</div>
|
||||
<div className="text-zinc-600 text-[10px] sm:text-xs font-mono">Agents</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -18,7 +18,7 @@ export function Footer(): React.ReactElement {
|
||||
</p>
|
||||
<span className="hidden sm:inline text-zinc-700">•</span>
|
||||
<a
|
||||
href="https://agenstskills.com"
|
||||
href="https://skillkit.sh"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-600 hover:text-zinc-400 text-xs font-mono transition-colors"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"$schema": "https://openapi.vercel.sh/vercel.json",
|
||||
"ignoreCommand": "git diff --quiet HEAD^ HEAD -- .",
|
||||
"buildCommand": "next build",
|
||||
"installCommand": "npm install",
|
||||
"outputDirectory": ".next",
|
||||
|
||||
+44
-70
@@ -5,14 +5,10 @@ import { Agents } from './components/Agents';
|
||||
import { Footer } from './components/Footer';
|
||||
import { SkillGenerator } from './components/SkillGenerator';
|
||||
import { SkillSubmitForm } from './components/SkillSubmitForm';
|
||||
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';
|
||||
import { BadgeGenerator } from './components/BadgeGenerator';
|
||||
import { CompatibilityMatrix } from './components/CompatibilityMatrix';
|
||||
import { useStats } from './hooks/useStats';
|
||||
|
||||
@@ -56,13 +52,6 @@ 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="#matrix"
|
||||
onClick={(e) => scrollToSection(e, 'matrix')}
|
||||
@@ -70,13 +59,6 @@ export default function App(): React.ReactElement {
|
||||
>
|
||||
Matrix
|
||||
</a>
|
||||
<a
|
||||
href="#badge"
|
||||
onClick={(e) => scrollToSection(e, 'badge')}
|
||||
className="text-zinc-500 hover:text-white transition-colors"
|
||||
>
|
||||
Badge
|
||||
</a>
|
||||
<a
|
||||
href="#advanced"
|
||||
onClick={(e) => scrollToSection(e, 'advanced')}
|
||||
@@ -98,28 +80,20 @@ export default function App(): React.ReactElement {
|
||||
>
|
||||
Generator
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/rohitg00/skillkit/tree/main/packages/extension#readme"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-500 hover:text-white transition-colors"
|
||||
>
|
||||
Extension
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex items-center gap-3 sm:gap-4">
|
||||
<a
|
||||
href="/docs"
|
||||
className="text-zinc-400 hover:text-white transition-colors text-xs sm:text-sm font-mono"
|
||||
>
|
||||
Docs
|
||||
</a>
|
||||
<a
|
||||
href="/api"
|
||||
className="text-zinc-400 hover:text-white transition-colors text-xs sm:text-sm font-mono"
|
||||
>
|
||||
API
|
||||
</a>
|
||||
<a
|
||||
href="https://agenstskills.com/docs"
|
||||
className="text-zinc-400 hover:text-white transition-colors text-xs sm:text-sm font-mono"
|
||||
>
|
||||
Docs
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/rohitg00/skillkit"
|
||||
target="_blank"
|
||||
@@ -187,44 +161,6 @@ export default function App(): React.ReactElement {
|
||||
{/* Core Features & Comparison - Value prop at a glance */}
|
||||
<Features />
|
||||
|
||||
{/* 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>
|
||||
|
||||
{/* Compatibility Matrix */}
|
||||
<section id="matrix" style={{ scrollMarginTop: '4rem' }}>
|
||||
<CompatibilityMatrix />
|
||||
</section>
|
||||
|
||||
{/* Badge Generator */}
|
||||
<section id="badge" style={{ scrollMarginTop: '4rem' }}>
|
||||
<BadgeGenerator />
|
||||
</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 />
|
||||
@@ -243,6 +179,44 @@ export default function App(): React.ReactElement {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Trending Skills - Social proof, what's popular */}
|
||||
<section id="trending" style={{ scrollMarginTop: '4rem' }}>
|
||||
<TrendingSkills />
|
||||
</section>
|
||||
|
||||
{/* Compatibility Matrix */}
|
||||
<section id="matrix" style={{ scrollMarginTop: '4rem' }}>
|
||||
<CompatibilityMatrix />
|
||||
</section>
|
||||
|
||||
{/* Advanced Capabilities: Memory, Primer, Mesh, Messaging */}
|
||||
<section id="advanced" style={{ scrollMarginTop: '4rem' }}>
|
||||
<AdvancedFeatures />
|
||||
</section>
|
||||
|
||||
{/* Docs CTA */}
|
||||
<section className="py-8 border-b border-zinc-800">
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8 text-center">
|
||||
<p className="text-sm font-mono text-zinc-400">
|
||||
Explore all 50+ commands, team workflows, and integrations in the{' '}
|
||||
<a
|
||||
href="/docs"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-white underline underline-offset-4 hover:text-zinc-300 transition-colors"
|
||||
>
|
||||
documentation
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Real-World Use Cases */}
|
||||
<section id="use-cases" style={{ scrollMarginTop: '4rem' }}>
|
||||
<UseCases />
|
||||
</section>
|
||||
|
||||
{/* Attribution & Sources */}
|
||||
<section id="sources" style={{ scrollMarginTop: '4rem' }}>
|
||||
<Attribution />
|
||||
|
||||
@@ -47,6 +47,24 @@ const ADVANCED_FEATURES: AdvancedFeature[] = [
|
||||
{ cmd: 'memory --global', desc: 'Share across all projects' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'session',
|
||||
title: 'Session Intelligence',
|
||||
subtitle: 'Skill Lineage & Agent Handoffs',
|
||||
description: 'Track which skills produced which code changes. Generate handoff documents when switching agents. View unified timelines of all session events — skill executions, git commits, observations, and decisions in one stream.',
|
||||
highlight: 'Timeline, handoff, and lineage in one place',
|
||||
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="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
),
|
||||
commands: [
|
||||
{ cmd: 'timeline', desc: 'Unified event stream' },
|
||||
{ cmd: 'session handoff', desc: 'Agent-to-agent context' },
|
||||
{ cmd: 'lineage', desc: 'Skill impact graph' },
|
||||
{ cmd: 'lineage --skill code-simplifier', desc: 'Per-skill impact' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'primer',
|
||||
title: 'Primer',
|
||||
|
||||
@@ -35,8 +35,8 @@ export function BadgeGenerator(): React.ReactElement {
|
||||
|
||||
const badgeUrl = useMemo(() => buildBadgeUrl(skills), [skills]);
|
||||
|
||||
const markdown = `[](https://agenstskills.com)`;
|
||||
const html = `<a href="https://agenstskills.com"><img src="${badgeUrl}" alt="SkillKit Stack" /></a>`;
|
||||
const markdown = `[](https://skillkit.sh)`;
|
||||
const html = `<a href="https://skillkit.sh"><img src="${badgeUrl}" alt="SkillKit Stack" /></a>`;
|
||||
|
||||
function addSkill(skill: string): void {
|
||||
const trimmed = skill.trim().toLowerCase();
|
||||
|
||||
@@ -104,6 +104,17 @@ const COMMAND_GROUPS: CommandGroup[] = [
|
||||
{ cmd: 'issue list --label bug', desc: 'Filter by label' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Session',
|
||||
commands: [
|
||||
{ cmd: 'timeline', desc: 'Unified event stream' },
|
||||
{ cmd: 'session handoff', desc: 'Agent handoff doc' },
|
||||
{ cmd: 'lineage', desc: 'Skill impact graph' },
|
||||
{ cmd: 'session explain', desc: 'Session summary' },
|
||||
{ cmd: 'activity', desc: 'Skill activity log' },
|
||||
{ cmd: 'session snapshot save', desc: 'Save state' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Advanced',
|
||||
commands: [
|
||||
|
||||
@@ -24,14 +24,42 @@ const AGENTS: AgentDef[] = [
|
||||
{ id: 'windsurf', name: 'Windsurf', icon: '\u25C7', group: 'Tier 1' },
|
||||
{ id: 'github-copilot', name: 'Copilot', icon: '\u2318', group: 'Tier 1' },
|
||||
{ id: 'cline', name: 'Cline', icon: '\u25CF', group: 'Tier 1' },
|
||||
{ id: 'devin', name: 'Devin', icon: '\u25C9', group: 'Tier 1' },
|
||||
{ id: 'roo', name: 'Roo', icon: '\u25C6', group: 'Tier 2' },
|
||||
{ id: 'kilo', name: 'Kilo', icon: '\u25B3', group: 'Tier 2' },
|
||||
{ id: 'kiro-cli', name: 'Kiro CLI', icon: '\u25BD', group: 'Tier 2' },
|
||||
{ id: 'goose', name: 'Goose', icon: '\u25CA', group: 'Tier 2' },
|
||||
{ id: 'trae', name: 'Trae', icon: '\u25A0', group: 'Tier 2' },
|
||||
{ id: 'amp', name: 'AMP', icon: '\u26A1', group: 'Tier 2' },
|
||||
{ id: 'aider', name: 'Aider', icon: '\u25E6', group: 'Tier 2' },
|
||||
{ id: 'cody', name: 'Cody', icon: '\u25D0', group: 'Tier 2' },
|
||||
{ id: 'amazon-q', name: 'Amazon Q', icon: '\u25A3', group: 'Tier 2' },
|
||||
{ id: 'antigravity', name: 'Antigrav', icon: '\u2191', group: 'Tier 3' },
|
||||
{ id: 'continue', name: 'Continue', icon: '\u25B6', group: 'Tier 3' },
|
||||
{ id: 'augment', name: 'Augment', icon: '\u25C8', group: 'Tier 3' },
|
||||
{ id: 'replit', name: 'Replit', icon: '\u25B7', group: 'Tier 3' },
|
||||
{ id: 'bolt', name: 'Bolt', icon: '\u2605', group: 'Tier 3' },
|
||||
{ id: 'lovable', name: 'Lovable', icon: '\u2665', group: 'Tier 3' },
|
||||
{ id: 'tabby', name: 'Tabby', icon: '\u25AB', group: 'Tier 3' },
|
||||
{ id: 'tabnine', name: 'Tabnine', icon: '\u25AA', group: 'Tier 3' },
|
||||
{ id: 'codegpt', name: 'CodeGPT', icon: '\u25E7', group: 'Tier 3' },
|
||||
{ id: 'playcode', name: 'PlayCode', icon: '\u25B9', group: 'Tier 3' },
|
||||
{ id: 'clawdbot', name: 'Clawdbot', icon: '\u25D1', group: 'Tier 3' },
|
||||
{ id: 'droid', name: 'Droid', icon: '\u25D2', group: 'Tier 3' },
|
||||
{ id: 'codebuddy', name: 'CodeBuddy', icon: '\u25D3', group: 'Tier 3' },
|
||||
{ id: 'commandcode', name: 'CmdCode', icon: '\u25D4', group: 'Tier 3' },
|
||||
{ id: 'crush', name: 'Crush', icon: '\u25D5', group: 'Tier 3' },
|
||||
{ id: 'factory', name: 'Factory', icon: '\u25D6', group: 'Tier 3' },
|
||||
{ id: 'mcpjam', name: 'MCPJam', icon: '\u25D7', group: 'Tier 3' },
|
||||
{ id: 'mux', name: 'Mux', icon: '\u25E0', group: 'Tier 3' },
|
||||
{ id: 'neovate', name: 'Neovate', icon: '\u25E1', group: 'Tier 3' },
|
||||
{ id: 'openhands', name: 'OpenHands', icon: '\u25E2', group: 'Tier 3' },
|
||||
{ id: 'pi', name: 'Pi', icon: '\u25E3', group: 'Tier 3' },
|
||||
{ id: 'qoder', name: 'Qoder', icon: '\u25E4', group: 'Tier 3' },
|
||||
{ id: 'qwen', name: 'Qwen', icon: '\u25E5', group: 'Tier 3' },
|
||||
{ id: 'vercel', name: 'Vercel', icon: '\u25B2', group: 'Tier 3' },
|
||||
{ id: 'zencoder', name: 'Zencoder', icon: '\u25E8', group: 'Tier 3' },
|
||||
{ id: 'universal', name: 'Universal', icon: '\u25CB', group: 'Tier 3' },
|
||||
];
|
||||
|
||||
const CATEGORIES: CategoryDef[] = [
|
||||
@@ -56,66 +84,87 @@ const CATEGORIES: CategoryDef[] = [
|
||||
// - windsurf: 32K context, no MCP/tools, workflow YAML format
|
||||
// - kilo, kiro-cli: XML block format, multi-mode support, no MCP
|
||||
// - goose, amp, antigravity, trae, continue: varies, mostly universal adapter
|
||||
const T3_FULL: Record<string, Support> = {
|
||||
'augment': 'full', 'replit': 'full', 'bolt': 'full', 'lovable': 'full',
|
||||
'tabby': 'full', 'tabnine': 'full', 'codegpt': 'full', 'playcode': 'full',
|
||||
'clawdbot': 'full', 'droid': 'full', 'codebuddy': 'full', 'commandcode': 'full',
|
||||
'crush': 'full', 'factory': 'full', 'mcpjam': 'full', 'mux': 'full',
|
||||
'neovate': 'full', 'openhands': 'full', 'pi': 'full', 'qoder': 'full',
|
||||
'qwen': 'full', 'vercel': 'full', 'zencoder': 'full', 'universal': 'full',
|
||||
};
|
||||
const T3_PARTIAL: Record<string, Support> = Object.fromEntries(Object.keys(T3_FULL).map(k => [k, 'partial']));
|
||||
const T3_NONE: Record<string, Support> = Object.fromEntries(Object.keys(T3_FULL).map(k => [k, 'none']));
|
||||
|
||||
const MATRIX: Record<string, Record<string, Support>> = {
|
||||
'translation': {
|
||||
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
|
||||
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'full', 'cline': 'full',
|
||||
'roo': 'full', 'kilo': 'full', 'kiro-cli': 'partial', 'goose': 'full',
|
||||
'trae': 'full', 'amp': 'full', 'antigravity': 'full', 'continue': 'full',
|
||||
'devin': 'full', 'roo': 'full', 'kilo': 'full', 'kiro-cli': 'partial', 'goose': 'full',
|
||||
'trae': 'full', 'amp': 'full', 'aider': 'full', 'cody': 'full', 'amazon-q': 'full',
|
||||
'antigravity': 'full', 'continue': 'full', ...T3_FULL,
|
||||
},
|
||||
'hooks': {
|
||||
'claude-code': 'full', 'cursor': 'partial', 'codex': 'partial', 'gemini-cli': 'partial',
|
||||
'opencode': 'partial', 'windsurf': 'none', 'github-copilot': 'none', 'cline': 'full',
|
||||
'roo': 'full', 'kilo': 'partial', 'kiro-cli': 'partial', 'goose': 'partial',
|
||||
'trae': 'partial', 'amp': 'partial', 'antigravity': 'none', 'continue': 'none',
|
||||
'devin': 'partial', 'roo': 'full', 'kilo': 'partial', 'kiro-cli': 'partial', 'goose': 'partial',
|
||||
'trae': 'partial', 'amp': 'partial', 'aider': 'none', 'cody': 'none', 'amazon-q': 'none',
|
||||
'antigravity': 'none', 'continue': 'none', ...T3_NONE,
|
||||
},
|
||||
'mcp-tools': {
|
||||
'claude-code': 'full', 'cursor': 'none', 'codex': 'none', 'gemini-cli': 'none',
|
||||
'opencode': 'none', 'windsurf': 'none', 'github-copilot': 'none', 'cline': 'full',
|
||||
'roo': 'full', 'kilo': 'none', 'kiro-cli': 'none', 'goose': 'none',
|
||||
'trae': 'none', 'amp': 'none', 'antigravity': 'none', 'continue': 'none',
|
||||
'devin': 'partial', 'roo': 'full', 'kilo': 'none', 'kiro-cli': 'none', 'goose': 'none',
|
||||
'trae': 'none', 'amp': 'none', 'aider': 'none', 'cody': 'none', 'amazon-q': 'none',
|
||||
'antigravity': 'none', 'continue': 'none', ...T3_NONE,
|
||||
},
|
||||
'context': {
|
||||
'claude-code': 'full', 'cursor': 'partial', 'codex': 'partial', 'gemini-cli': 'full',
|
||||
'opencode': 'full', 'windsurf': 'partial', 'github-copilot': 'partial', 'cline': 'full',
|
||||
'roo': 'full', 'kilo': 'full', 'kiro-cli': 'full', 'goose': 'full',
|
||||
'trae': 'partial', 'amp': 'full', 'antigravity': 'partial', 'continue': 'partial',
|
||||
'devin': 'full', 'roo': 'full', 'kilo': 'full', 'kiro-cli': 'full', 'goose': 'full',
|
||||
'trae': 'partial', 'amp': 'full', 'aider': 'full', 'cody': 'full', 'amazon-q': 'partial',
|
||||
'antigravity': 'partial', 'continue': 'partial', ...T3_PARTIAL,
|
||||
},
|
||||
'security': {
|
||||
'claude-code': 'full', 'cursor': 'full', 'codex': 'partial', 'gemini-cli': 'full',
|
||||
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'partial', 'cline': 'full',
|
||||
'roo': 'full', 'kilo': 'full', 'kiro-cli': 'full', 'goose': 'full',
|
||||
'trae': 'full', 'amp': 'full', 'antigravity': 'partial', 'continue': 'partial',
|
||||
'devin': 'full', 'roo': 'full', 'kilo': 'full', 'kiro-cli': 'full', 'goose': 'full',
|
||||
'trae': 'full', 'amp': 'full', 'aider': 'full', 'cody': 'full', 'amazon-q': 'full',
|
||||
'antigravity': 'partial', 'continue': 'partial', ...T3_PARTIAL,
|
||||
},
|
||||
'testing': {
|
||||
'claude-code': 'full', 'cursor': 'full', 'codex': 'partial', 'gemini-cli': 'full',
|
||||
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'partial', 'cline': 'full',
|
||||
'roo': 'full', 'kilo': 'full', 'kiro-cli': 'full', 'goose': 'full',
|
||||
'trae': 'full', 'amp': 'full', 'antigravity': 'partial', 'continue': 'partial',
|
||||
'devin': 'full', 'roo': 'full', 'kilo': 'full', 'kiro-cli': 'full', 'goose': 'full',
|
||||
'trae': 'full', 'amp': 'full', 'aider': 'full', 'cody': 'full', 'amazon-q': 'partial',
|
||||
'antigravity': 'partial', 'continue': 'partial', ...T3_PARTIAL,
|
||||
},
|
||||
'frontend': {
|
||||
'claude-code': 'full', 'cursor': 'full', 'codex': 'partial', 'gemini-cli': 'full',
|
||||
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'partial', 'cline': 'full',
|
||||
'roo': 'full', 'kilo': 'partial', 'kiro-cli': 'partial', 'goose': 'partial',
|
||||
'trae': 'full', 'amp': 'full', 'antigravity': 'partial', 'continue': 'partial',
|
||||
'devin': 'full', 'roo': 'full', 'kilo': 'partial', 'kiro-cli': 'partial', 'goose': 'partial',
|
||||
'trae': 'full', 'amp': 'full', 'aider': 'partial', 'cody': 'partial', 'amazon-q': 'partial',
|
||||
'antigravity': 'partial', 'continue': 'partial', ...T3_PARTIAL,
|
||||
},
|
||||
'backend': {
|
||||
'claude-code': 'full', 'cursor': 'full', 'codex': 'partial', 'gemini-cli': 'full',
|
||||
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'partial', 'cline': 'full',
|
||||
'roo': 'full', 'kilo': 'full', 'kiro-cli': 'full', 'goose': 'full',
|
||||
'trae': 'full', 'amp': 'full', 'antigravity': 'partial', 'continue': 'partial',
|
||||
'devin': 'full', 'roo': 'full', 'kilo': 'full', 'kiro-cli': 'full', 'goose': 'full',
|
||||
'trae': 'full', 'amp': 'full', 'aider': 'full', 'cody': 'full', 'amazon-q': 'partial',
|
||||
'antigravity': 'partial', 'continue': 'partial', ...T3_PARTIAL,
|
||||
},
|
||||
'devops': {
|
||||
'claude-code': 'full', 'cursor': 'full', 'codex': 'partial', 'gemini-cli': 'full',
|
||||
'opencode': 'full', 'windsurf': 'partial', 'github-copilot': 'partial', 'cline': 'full',
|
||||
'roo': 'full', 'kilo': 'partial', 'kiro-cli': 'partial', 'goose': 'partial',
|
||||
'trae': 'partial', 'amp': 'partial', 'antigravity': 'partial', 'continue': 'partial',
|
||||
'devin': 'full', 'roo': 'full', 'kilo': 'partial', 'kiro-cli': 'partial', 'goose': 'partial',
|
||||
'trae': 'partial', 'amp': 'partial', 'aider': 'partial', 'cody': 'partial', 'amazon-q': 'partial',
|
||||
'antigravity': 'partial', 'continue': 'partial', ...T3_PARTIAL,
|
||||
},
|
||||
'docs': {
|
||||
'claude-code': 'full', 'cursor': 'full', 'codex': 'partial', 'gemini-cli': 'full',
|
||||
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'full', 'cline': 'full',
|
||||
'roo': 'full', 'kilo': 'full', 'kiro-cli': 'full', 'goose': 'full',
|
||||
'trae': 'full', 'amp': 'full', 'antigravity': 'full', 'continue': 'full',
|
||||
'devin': 'full', 'roo': 'full', 'kilo': 'full', 'kiro-cli': 'full', 'goose': 'full',
|
||||
'trae': 'full', 'amp': 'full', 'aider': 'full', 'cody': 'full', 'amazon-q': 'full',
|
||||
'antigravity': 'full', 'continue': 'full', ...T3_FULL,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -197,7 +246,7 @@ export function CompatibilityMatrix(): React.ReactElement {
|
||||
<div>
|
||||
<h2 className="text-lg sm:text-xl font-bold text-white mb-1 font-mono">Compatibility Matrix</h2>
|
||||
<p className="text-zinc-500 font-mono text-[10px] sm:text-xs">
|
||||
Skill support across {AGENTS.length} agents and {CATEGORIES.length} categories.
|
||||
Skill support across all 44 agents and {CATEGORIES.length} categories.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -213,6 +213,13 @@ skillkit primer --dry-run # Preview without writing files
|
||||
skillkit primer --json # Output analysis as JSON
|
||||
skillkit primer --output ./dir # Custom output directory`}</CodeBlock>
|
||||
|
||||
<h3 className="text-lg font-semibold text-white mt-6">Session Intelligence</h3>
|
||||
<CodeBlock>{`skillkit timeline # Unified event stream
|
||||
skillkit session handoff # Agent-to-agent context
|
||||
skillkit lineage # Skill impact graph
|
||||
skillkit session explain # Session summary
|
||||
skillkit activity # Skill activity log`}</CodeBlock>
|
||||
|
||||
<h3 className="text-lg font-semibold text-white mt-6">Advanced</h3>
|
||||
<CodeBlock>{`skillkit ui # Launch Terminal UI
|
||||
skillkit workflow # Manage workflows
|
||||
|
||||
@@ -109,34 +109,34 @@ const FEATURES: Feature[] = [
|
||||
];
|
||||
|
||||
const COMPARISONS = [
|
||||
['Agent Support', '1 agent', '44 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'],
|
||||
['Security', 'Manual review', 'Auto-scan on install'],
|
||||
['Agent Support', '1-17 agents', '44 agents'],
|
||||
['Sources', 'Single registry', '31+ aggregated'],
|
||||
['Translation', 'None or limited', 'All 44 formats'],
|
||||
['Memory', 'None', 'Persistent learning'],
|
||||
['Security', 'None', '46-rule scanner'],
|
||||
['Team Sync', 'None', '.skills manifest'],
|
||||
['Telemetry', 'Varies', 'Zero. Ever.'],
|
||||
['API Access', 'None', 'REST + MCP + Python'],
|
||||
] as const;
|
||||
|
||||
export function Features(): React.ReactElement {
|
||||
return (
|
||||
<section id="features" className="py-12 border-b border-zinc-800 bg-surface">
|
||||
<section id="features" className="py-8 border-b border-zinc-800 bg-surface">
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="grid grid-cols-1 lg:grid-cols-5 gap-6 lg:gap-8 mb-10">
|
||||
<div className="grid grid-cols-1 lg:grid-cols-5 gap-6 lg:gap-8 mb-6">
|
||||
<div className="lg:col-span-2">
|
||||
<h2 className="text-xl font-bold text-white mb-2 font-mono">Why SkillKit?</h2>
|
||||
<h2 className="text-xl font-bold text-white mb-2 font-mono">At a Glance</h2>
|
||||
<p className="text-zinc-500 font-mono text-sm mb-6">
|
||||
Universal bridge for AI coding agents.
|
||||
What you get vs. a simple installer.
|
||||
</p>
|
||||
<div className="flex gap-6 sm:gap-8">
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">32</div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">44</div>
|
||||
<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">50+</div>
|
||||
<div className="text-zinc-600 text-[10px] sm:text-xs font-mono">Commands</div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">31+</div>
|
||||
<div className="text-zinc-600 text-[10px] sm:text-xs font-mono">Sources</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">15K+</div>
|
||||
@@ -147,8 +147,8 @@ export function Features(): React.ReactElement {
|
||||
|
||||
<div className="lg:col-span-3 border border-zinc-800 bg-black/50 p-4 font-mono text-xs backdrop-blur-sm">
|
||||
<div className="grid grid-cols-3 gap-2 border-b border-zinc-800 pb-2 mb-3 text-zinc-500 uppercase tracking-wider text-[10px]">
|
||||
<div>Feature</div>
|
||||
<div className="text-center">Without</div>
|
||||
<div>Capability</div>
|
||||
<div className="text-center">Simple Installers</div>
|
||||
<div className="text-right">SkillKit</div>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
@@ -167,20 +167,20 @@ export function Features(): React.ReactElement {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3">
|
||||
<div className="grid grid-cols-3 sm:grid-cols-4 gap-2">
|
||||
{FEATURES.map((feature, index) => (
|
||||
<div
|
||||
key={feature.title}
|
||||
className="group relative p-4 border border-zinc-800 bg-zinc-900/30 hover:bg-zinc-900/80 hover:border-zinc-700 transition-all duration-300 cursor-default"
|
||||
className="group relative p-2.5 border border-zinc-800 bg-zinc-900/30 hover:bg-zinc-900/80 hover:border-zinc-700 transition-all duration-300 cursor-default"
|
||||
style={{ animationDelay: `${index * 50}ms` }}
|
||||
>
|
||||
<div className="absolute inset-0 bg-gradient-to-b from-zinc-800/0 to-zinc-800/20 opacity-0 group-hover:opacity-100 transition-opacity"></div>
|
||||
<div className="relative">
|
||||
<div className="text-zinc-500 group-hover:text-white transition-colors mb-2">
|
||||
<div className="text-zinc-500 group-hover:text-white transition-colors mb-1">
|
||||
{feature.icon}
|
||||
</div>
|
||||
<h4 className="text-xs font-bold text-white mb-1 font-mono">{feature.title}</h4>
|
||||
<p className="text-zinc-600 text-[10px] leading-relaxed font-mono group-hover:text-zinc-400 transition-colors">
|
||||
<h4 className="text-[11px] font-bold text-white mb-0.5 font-mono">{feature.title}</h4>
|
||||
<p className="text-zinc-600 text-[10px] leading-snug font-mono group-hover:text-zinc-400 transition-colors">
|
||||
{feature.description}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@ export function Footer(): React.ReactElement {
|
||||
</p>
|
||||
<span className="hidden sm:inline text-zinc-700">•</span>
|
||||
<a
|
||||
href="https://agenstskills.com"
|
||||
href="https://skillkit.sh"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-600 hover:text-zinc-400 text-xs font-mono transition-colors"
|
||||
|
||||
@@ -20,16 +20,18 @@ interface TerminalLine {
|
||||
}
|
||||
|
||||
const TERMINAL_LINES: TerminalLine[] = [
|
||||
{ type: 'cmd', text: 'skillkit install anthropics/skills --agent all' },
|
||||
{ type: 'out', text: '→ Installed to 44 agents' },
|
||||
{ type: 'cmd', text: 'skillkit install anthropics/skills' },
|
||||
{ type: 'out', text: '→ Fetched from github.com/anthropics/skills' },
|
||||
{ type: 'out', text: '→ Translated to 44 agent formats' },
|
||||
{ type: 'out', text: '→ Scanned: 0 issues found' },
|
||||
{ type: 'cmd', text: 'skillkit install vercel-labs/agent-skills' },
|
||||
{ type: 'out', text: '→ Installed 12 skills from Vercel' },
|
||||
{ type: 'cmd', text: 'skillkit translate --all --to cursor' },
|
||||
{ type: 'out', text: '→ 26 skills → .cursor/skills/' },
|
||||
{ type: 'cmd', text: 'skillkit recommend' },
|
||||
{ type: 'out', text: ' 92% vercel-react-best-practices' },
|
||||
{ type: 'out', text: ' 87% typescript-strict-mode' },
|
||||
{ type: 'cmd', text: 'skillkit serve' },
|
||||
{ type: 'out', text: '→ API server on http://0.0.0.0:3737' },
|
||||
{ type: 'out', text: ' GET /search · /trending · /categories' },
|
||||
{ type: 'cmd', text: 'curl localhost:3737/search?q=react' },
|
||||
{ type: 'out', text: ' {"skills":[...],"total":42}' },
|
||||
{ type: 'out', text: ' 92% react-best-practices (vercel)' },
|
||||
{ type: 'out', text: ' 87% strict-typescript (anthropic)' },
|
||||
{ type: 'out', text: ' 85% supabase-auth (supabase)' },
|
||||
];
|
||||
|
||||
const FADE_ANIMATION_STYLES = `
|
||||
@@ -141,14 +143,14 @@ export function Hero({ version, stars }: HeroProps): React.ReactElement {
|
||||
</div>
|
||||
|
||||
<h1 className="text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight text-white mb-3 font-mono">
|
||||
One Skill.<br />
|
||||
<span className="text-zinc-500">44 Agents. Zero Rewrites.</span>
|
||||
One CLI. Every Source.<br />
|
||||
<span className="text-zinc-500">Every Agent. Zero Telemetry.</span>
|
||||
</h1>
|
||||
|
||||
<p className="text-sm text-zinc-400 mb-5 max-w-lg font-mono leading-relaxed">
|
||||
The open source package manager for AI agent skills. Install from 15,000+ skills,
|
||||
auto-translate between formats, persist learnings with Memory.
|
||||
Works with Claude, Cursor, Windsurf, Copilot, Devin, Codex, and 38 more.
|
||||
The open source package manager that aggregates 31+ skill sources,
|
||||
auto-translates to 44 agent formats, and adds memory, security scanning,
|
||||
and team workflows. No account required. Everything runs locally.
|
||||
</p>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2 mb-4">
|
||||
|
||||
@@ -92,7 +92,7 @@ export function TeamEnterprise(): React.ReactElement {
|
||||
</p>
|
||||
</div>
|
||||
<a
|
||||
href="https://agenstskills.com/docs/api-reference"
|
||||
href="https://skillkit.sh/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"
|
||||
@@ -108,7 +108,7 @@ export function TeamEnterprise(): React.ReactElement {
|
||||
{/* Bottom CTA */}
|
||||
<div className="mt-6 sm:mt-8 text-center">
|
||||
<a
|
||||
href="https://agenstskills.com/docs"
|
||||
href="https://skillkit.sh/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"
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
import React from 'react';
|
||||
|
||||
interface Competitor {
|
||||
name: string;
|
||||
type: string;
|
||||
agents: string;
|
||||
translate: boolean;
|
||||
memory: boolean;
|
||||
security: boolean;
|
||||
team: boolean;
|
||||
tui: boolean;
|
||||
api: boolean;
|
||||
}
|
||||
|
||||
const COMPETITORS: Competitor[] = [
|
||||
{ name: 'Vercel skills', type: 'Installer', agents: '~17', translate: false, memory: false, security: false, team: false, tui: false, api: false },
|
||||
{ name: 'PRPM', type: 'Registry', agents: '~6', translate: true, memory: false, security: false, team: false, tui: false, api: false },
|
||||
{ name: 'Askill', type: 'Installer', agents: '~40', translate: false, memory: false, security: true, team: false, tui: false, api: false },
|
||||
{ name: 'Skild', type: 'Installer', agents: '~7', translate: false, memory: false, security: false, team: false, tui: false, api: false },
|
||||
{ name: 'Paks', type: 'Installer', agents: '~6', translate: false, memory: false, security: false, team: false, tui: false, api: false },
|
||||
{ name: 'SkillKit', type: 'Platform', agents: '44', translate: true, memory: true, security: true, team: true, tui: true, api: true },
|
||||
];
|
||||
|
||||
const SOURCES = [
|
||||
{ name: 'Anthropic', repo: 'anthropics/skills', official: true },
|
||||
{ name: 'Vercel', repo: 'vercel-labs/agent-skills', official: true },
|
||||
{ name: 'Expo', repo: 'expo/skills', official: true },
|
||||
{ name: 'Supabase', repo: 'supabase/agent-skills', official: true },
|
||||
{ name: 'Stripe', repo: 'stripe/ai', official: true },
|
||||
{ name: 'Remotion', repo: 'remotion-dev/skills', official: true },
|
||||
{ name: 'Trail of Bits', repo: 'trailofbits/skills', official: false },
|
||||
{ name: 'Better Auth', repo: 'better-auth/skills', official: false },
|
||||
{ name: 'ElysiaJS', repo: 'elysiajs/skills', official: false },
|
||||
{ name: 'Nuxt', repo: 'onmax/nuxt-skills', official: false },
|
||||
{ name: 'NestJS', repo: 'kadajett/agent-nestjs-skills', official: false },
|
||||
{ name: 'Three.js', repo: 'cloudai-x/threejs-skills', official: false },
|
||||
];
|
||||
|
||||
function Check(): React.ReactElement {
|
||||
return <span className="text-green-400 text-xs font-bold">✓</span>;
|
||||
}
|
||||
|
||||
function Cross(): React.ReactElement {
|
||||
return <span className="text-zinc-700 text-xs">—</span>;
|
||||
}
|
||||
|
||||
export function WhySkillKit(): React.ReactElement {
|
||||
return (
|
||||
<section id="why" className="py-12 sm:py-16 border-b border-zinc-800" style={{ scrollMarginTop: '4rem' }}>
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
<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-white rounded-full"></span>
|
||||
<span className="text-[10px] sm:text-xs font-mono text-zinc-300 uppercase tracking-wider">Not Another Installer</span>
|
||||
</div>
|
||||
<h2 className="text-2xl sm:text-3xl lg:text-4xl font-bold text-white mb-3 font-mono tracking-tight">
|
||||
Others Install. SkillKit Orchestrates.
|
||||
</h2>
|
||||
<p className="text-zinc-400 font-mono text-xs sm:text-sm max-w-2xl mx-auto">
|
||||
Most skill tools are simple installers with 3-5 commands.
|
||||
SkillKit is a full platform that aggregates every source, translates to every format,
|
||||
and adds memory, security, and team workflows on top.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0 mb-12">
|
||||
<div className="min-w-[640px]">
|
||||
<table className="w-full border-collapse font-mono text-[10px] sm:text-xs">
|
||||
<thead>
|
||||
<tr className="border-b border-zinc-800">
|
||||
<th className="text-left text-zinc-500 uppercase tracking-wider py-2 pr-3">Tool</th>
|
||||
<th className="px-2 py-2 text-center text-zinc-500 uppercase tracking-wider">Agents</th>
|
||||
<th className="px-2 py-2 text-center text-zinc-500 uppercase tracking-wider">Translate</th>
|
||||
<th className="px-2 py-2 text-center text-zinc-500 uppercase tracking-wider">Memory</th>
|
||||
<th className="px-2 py-2 text-center text-zinc-500 uppercase tracking-wider">Security</th>
|
||||
<th className="px-2 py-2 text-center text-zinc-500 uppercase tracking-wider">Team</th>
|
||||
<th className="px-2 py-2 text-center text-zinc-500 uppercase tracking-wider">TUI</th>
|
||||
<th className="px-2 py-2 text-center text-zinc-500 uppercase tracking-wider">API</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{COMPETITORS.map((c) => {
|
||||
const isSkillKit = c.name === 'SkillKit';
|
||||
const rowClass = isSkillKit
|
||||
? 'bg-white/[0.03] border-b border-zinc-700'
|
||||
: 'border-b border-zinc-800/50 hover:bg-zinc-900/50';
|
||||
const nameClass = isSkillKit ? 'text-white font-bold' : 'text-zinc-400';
|
||||
return (
|
||||
<tr key={c.name} className={rowClass}>
|
||||
<td className="py-2.5 pr-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className={nameClass}>{c.name}</span>
|
||||
<span className="text-zinc-700 text-[9px]">{c.type}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td className={`px-2 py-2.5 text-center ${isSkillKit ? 'text-white font-bold' : 'text-zinc-500'}`}>{c.agents}</td>
|
||||
<td className="px-2 py-2.5 text-center">{c.translate ? <Check /> : <Cross />}</td>
|
||||
<td className="px-2 py-2.5 text-center">{c.memory ? <Check /> : <Cross />}</td>
|
||||
<td className="px-2 py-2.5 text-center">{c.security ? <Check /> : <Cross />}</td>
|
||||
<td className="px-2 py-2.5 text-center">{c.team ? <Check /> : <Cross />}</td>
|
||||
<td className="px-2 py-2.5 text-center">{c.tui ? <Check /> : <Cross />}</td>
|
||||
<td className="px-2 py-2.5 text-center">{c.api ? <Check /> : <Cross />}</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mb-8">
|
||||
<h3 className="text-lg font-bold text-white mb-2 font-mono">
|
||||
One CLI. Every Source. Zero Telemetry.
|
||||
</h3>
|
||||
<p className="text-zinc-400 font-mono text-xs sm:text-sm mb-6">
|
||||
SkillKit doesn't compete with skill sources — it aggregates them.
|
||||
Install from 31+ curated repositories, any GitHub/GitLab repo, or local paths.
|
||||
Everything runs locally. No accounts, no tracking, no lock-in.
|
||||
</p>
|
||||
|
||||
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2">
|
||||
{SOURCES.map((s) => (
|
||||
<a
|
||||
key={s.repo}
|
||||
href={`https://github.com/${s.repo}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="group flex items-center gap-2 px-3 py-2 border border-zinc-800 bg-zinc-900/30 hover:border-zinc-600 hover:bg-zinc-900/80 transition-all"
|
||||
>
|
||||
<span className="text-zinc-400 group-hover:text-white text-xs font-mono transition-colors">{s.name}</span>
|
||||
{s.official && (
|
||||
<span className="text-[8px] text-zinc-600 border border-zinc-800 px-1 py-0.5 uppercase tracking-wider">official</span>
|
||||
)}
|
||||
</a>
|
||||
))}
|
||||
<div className="flex items-center gap-2 px-3 py-2 border border-dashed border-zinc-800 text-zinc-600 text-xs font-mono">
|
||||
+ 19 more community sources
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
|
||||
<div className="p-4 border border-zinc-800 bg-zinc-900/30">
|
||||
<div className="text-2xl font-bold text-white font-mono mb-1">0 bytes</div>
|
||||
<div className="text-zinc-500 text-xs font-mono">telemetry collected</div>
|
||||
</div>
|
||||
<div className="p-4 border border-zinc-800 bg-zinc-900/30">
|
||||
<div className="text-2xl font-bold text-white font-mono mb-1">Apache 2.0</div>
|
||||
<div className="text-zinc-500 text-xs font-mono">fully open source</div>
|
||||
</div>
|
||||
<div className="p-4 border border-zinc-800 bg-zinc-900/30">
|
||||
<div className="text-2xl font-bold text-white font-mono mb-1">No account</div>
|
||||
<div className="text-zinc-500 text-xs font-mono">required to use</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -8,20 +8,20 @@
|
||||
|
||||
<!-- Open Graph -->
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:url" content="https://agenstskills.com/">
|
||||
<meta property="og:url" content="https://skillkit.sh/">
|
||||
<meta property="og:title" content="SkillKit - Universal Skills for AI Coding Agents">
|
||||
<meta property="og:description" content="Write once, deploy to 44 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" content="https://skillkit.sh/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:url" content="https://skillkit.sh/">
|
||||
<meta name="twitter:title" content="SkillKit - Universal Skills for AI Coding Agents">
|
||||
<meta name="twitter:description" content="Write once, deploy to 44 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">
|
||||
<meta name="twitter:image" content="https://skillkit.sh/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": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -24,21 +24,30 @@
|
||||
<div class="container">
|
||||
<a href="/" class="back">← Back to SkillKit</a>
|
||||
<h1>Privacy Policy</h1>
|
||||
<p class="updated">Last updated: February 10, 2026</p>
|
||||
<p class="updated">Last updated: February 14, 2026</p>
|
||||
|
||||
<h2>Overview</h2>
|
||||
<p>SkillKit ("we", "our", "us") is an open-source CLI tool and Chrome extension for managing AI agent skills. We are committed to protecting your privacy. This policy explains what data we collect (or don't) across all SkillKit products.</p>
|
||||
|
||||
<h2>Chrome Extension — "SkillKit - Save as Skill"</h2>
|
||||
<p>The Chrome extension operates entirely within your browser. It does not collect, transmit, or store any personal data externally.</p>
|
||||
<p>The Chrome extension helps you save webpages as AI agent skill files.</p>
|
||||
<ul>
|
||||
<li><strong>No data collection:</strong> We do not collect browsing history, page content, personal information, or any other user data.</li>
|
||||
<li><strong>No external requests:</strong> The extension makes zero network requests. All processing (HTML to markdown conversion, SKILL.md generation) happens locally in your browser.</li>
|
||||
<li><strong>What data is sent:</strong> When you click "Save as Skill", the extension sends the URL of the current page to our server at <code>https://skillkit.sh/api/save-skill</code>. This is required to fetch and convert the webpage content into a skill file.</li>
|
||||
<li><strong>What data is NOT sent:</strong> We do not send page content, browsing history, personal information, cookies, authentication tokens, or any data beyond the single URL you choose to save.</li>
|
||||
<li><strong>No data stored on server:</strong> The URL is processed in real time to extract content, generate tags, and build the skill file. No URLs, page content, or user data are stored, logged, or retained on the server after the response is returned.</li>
|
||||
<li><strong>Selection saves are local:</strong> When you save selected text via the right-click menu, the skill file is built entirely in the browser with no network requests.</li>
|
||||
<li><strong>No analytics or tracking:</strong> We do not use any analytics, telemetry, or tracking services.</li>
|
||||
<li><strong>Local storage only:</strong> The Chrome storage API is used solely to store user preferences (e.g., default settings) on your device. This data never leaves your browser.</li>
|
||||
<li><strong>No user accounts:</strong> No login, API key, or account is required.</li>
|
||||
<li><strong>Downloads:</strong> Generated skill files are saved to your local filesystem via the Chrome Downloads API. No files are uploaded anywhere.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Permissions Used</h2>
|
||||
<ul>
|
||||
<li><strong>activeTab:</strong> Read the URL and title of the tab you are viewing when you click the extension. Only accessed when you actively use the extension.</li>
|
||||
<li><strong>contextMenus:</strong> Add "Save page as Skill" and "Save selection as Skill" to the right-click menu.</li>
|
||||
<li><strong>downloads:</strong> Save the generated SKILL.md file to your Downloads folder.</li>
|
||||
</ul>
|
||||
|
||||
<h2>CLI Tool</h2>
|
||||
<p>The SkillKit CLI runs entirely on your local machine. It does not phone home, collect telemetry, or transmit any data to external servers unless you explicitly use network features (e.g., <code>skillkit install</code> fetches public GitHub repositories).</p>
|
||||
|
||||
@@ -46,13 +55,13 @@
|
||||
<p>The SkillKit MCP server runs locally and provides skill discovery over the Model Context Protocol. It loads skill data from a bundled JSON file and does not make external network requests or collect user data.</p>
|
||||
|
||||
<h2>Website</h2>
|
||||
<p>The SkillKit website (<a href="https://agenstskills.com">agenstskills.com</a>) is a static site hosted on Vercel. We do not use cookies, analytics trackers, or collect personal information. Vercel may collect standard web server logs (IP address, user agent) as described in their <a href="https://vercel.com/legal/privacy-policy">privacy policy</a>.</p>
|
||||
<p>The SkillKit website is available at <a href="https://skillkit.sh">skillkit.sh</a> and <a href="https://agenstskills.com">agenstskills.com</a>. It is a static site hosted on Vercel. We do not use cookies, analytics trackers, or collect personal information. Vercel may collect standard web server logs (IP address, user agent) as described in their <a href="https://vercel.com/legal/privacy-policy">privacy policy</a>.</p>
|
||||
|
||||
<h2>Third-Party Services</h2>
|
||||
<p>SkillKit does not integrate with any third-party data processors, advertising networks, or analytics services.</p>
|
||||
<p>The Chrome extension communicates with <code>skillkit.sh</code> and <code>agenstskills.com</code> (both our own servers, hosted on Vercel) to process webpage URLs. No third-party data processors, advertising networks, or analytics services are used.</p>
|
||||
|
||||
<h2>Data Retention</h2>
|
||||
<p>We do not retain any user data because we do not collect any user data.</p>
|
||||
<p>We do not retain any user data. URLs sent to the API are processed in memory and discarded immediately after the response.</p>
|
||||
|
||||
<h2>Changes to This Policy</h2>
|
||||
<p>We may update this privacy policy from time to time. Changes will be posted on this page with an updated revision date.</p>
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"ignoreCommand": "git diff --quiet HEAD^ HEAD -- .",
|
||||
"buildCommand": "npm run build",
|
||||
"outputDirectory": "dist",
|
||||
"installCommand": "npm install",
|
||||
|
||||
@@ -536,28 +536,28 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "composioHQ/awesome-claude-code-skills/python-best-practices",
|
||||
"id": "composioHQ/awesome-claude-skills/python-best-practices",
|
||||
"name": "Python Best Practices",
|
||||
"description": "Python coding standards and patterns",
|
||||
"source": "composioHQ/awesome-claude-code-skills",
|
||||
"source": "composioHQ/awesome-claude-skills",
|
||||
"tags": [
|
||||
"python"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "composioHQ/awesome-claude-code-skills/rust-patterns",
|
||||
"id": "composioHQ/awesome-claude-skills/rust-patterns",
|
||||
"name": "Rust Patterns",
|
||||
"description": "Rust memory safety and performance patterns",
|
||||
"source": "composioHQ/awesome-claude-code-skills",
|
||||
"source": "composioHQ/awesome-claude-skills",
|
||||
"tags": [
|
||||
"rust"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "composioHQ/awesome-claude-code-skills/go-patterns",
|
||||
"id": "composioHQ/awesome-claude-skills/go-patterns",
|
||||
"name": "Go Patterns",
|
||||
"description": "Go concurrency and idiomatic patterns",
|
||||
"source": "composioHQ/awesome-claude-code-skills",
|
||||
"source": "composioHQ/awesome-claude-skills",
|
||||
"tags": [
|
||||
"golang",
|
||||
"go"
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
{ "source": "jimliu/baoyu-skills", "name": "Baoyu Tools" },
|
||||
{ "source": "giuseppe-trisciuoglio/developer-kit", "name": "Shadcn / Radix" },
|
||||
{ "source": "openrouterteam/agent-skills", "name": "OpenRouter SDK" },
|
||||
{ "source": "intellectronica/agent-skills", "name": "Context7" }
|
||||
{ "source": "intellectronica/agent-skills", "name": "Context7" },
|
||||
{ "source": "skills.sh", "name": "Skills.sh Leaderboard", "official": true, "registry": "skills-sh" }
|
||||
]
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "skillkit-monorepo",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"private": true,
|
||||
"description": "The package manager for AI agent skills — install, translate, share across 32 coding agents",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/agents",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "Agent adapters for SkillKit - supports 32 AI coding agents",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/api",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "REST API server for SkillKit skill discovery",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/cli",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "CLI commands for SkillKit",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -16,8 +16,8 @@ export function generateBadge(skills: string[]): {
|
||||
const url = `https://img.shields.io/badge/SkillKit-No%20Skills-555555?style=flat-square&logo=data:image/svg+xml;base64,${SKILLKIT_LOGO_SVG_BASE64}`;
|
||||
return {
|
||||
url,
|
||||
markdown: `[](https://agenstskills.com)`,
|
||||
html: `<a href="https://agenstskills.com"><img src="${url}" alt="SkillKit Stack" /></a>`,
|
||||
markdown: `[](https://skillkit.sh)`,
|
||||
html: `<a href="https://skillkit.sh"><img src="${url}" alt="SkillKit Stack" /></a>`,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export function generateBadge(skills: string[]): {
|
||||
|
||||
return {
|
||||
url,
|
||||
markdown: `[](https://agenstskills.com)`,
|
||||
html: `<a href="https://agenstskills.com"><img src="${url}" alt="SkillKit Stack" /></a>`,
|
||||
markdown: `[](https://skillkit.sh)`,
|
||||
html: `<a href="https://skillkit.sh"><img src="${url}" alt="SkillKit Stack" /></a>`,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Command, Option } from 'clipanion';
|
||||
import { Command, Option } from "clipanion";
|
||||
import {
|
||||
colors,
|
||||
symbols,
|
||||
@@ -7,8 +7,13 @@ import {
|
||||
isCancel,
|
||||
select,
|
||||
header,
|
||||
} from '../onboarding/index.js';
|
||||
import { FederatedSearch, GitHubSkillRegistry, RateLimitError } from '@skillkit/core';
|
||||
} from "../onboarding/index.js";
|
||||
import {
|
||||
FederatedSearch,
|
||||
GitHubSkillRegistry,
|
||||
SkillsShRegistry,
|
||||
} from "@skillkit/core";
|
||||
import { formatCount } from "../helpers.js";
|
||||
|
||||
interface SkillResult {
|
||||
name: string;
|
||||
@@ -17,46 +22,46 @@ interface SkillResult {
|
||||
repoName: string;
|
||||
}
|
||||
|
||||
import skillsData from '../../../../marketplace/skills.json' with { type: 'json' };
|
||||
import sourcesData from '../../../../marketplace/sources.json' with { type: 'json' };
|
||||
import skillsData from "../../../../marketplace/skills.json" with { type: "json" };
|
||||
import sourcesData from "../../../../marketplace/sources.json" with { type: "json" };
|
||||
|
||||
export class FindCommand extends Command {
|
||||
static override paths = [['find'], ['search']];
|
||||
static override paths = [["find"], ["search"]];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Search for skills in the marketplace',
|
||||
description: "Search for skills in the marketplace",
|
||||
details: `
|
||||
Quickly find and install skills from the marketplace.
|
||||
Interactive mode lets you browse and install in one step.
|
||||
`,
|
||||
examples: [
|
||||
['Interactive search', '$0 find'],
|
||||
['Search for specific skill', '$0 find pdf'],
|
||||
['Search with keyword', '$0 find "nextjs"'],
|
||||
['List top skills', '$0 find --top'],
|
||||
["Interactive search", "$0 find"],
|
||||
["Search for specific skill", "$0 find pdf"],
|
||||
["Search with keyword", '$0 find "nextjs"'],
|
||||
["List top skills", "$0 find --top"],
|
||||
],
|
||||
});
|
||||
|
||||
query = Option.String({ required: false });
|
||||
|
||||
top = Option.Boolean('--top,-t', false, {
|
||||
description: 'Show top/featured skills',
|
||||
top = Option.Boolean("--top,-t", false, {
|
||||
description: "Show top/featured skills",
|
||||
});
|
||||
|
||||
limit = Option.String('--limit,-l', '10', {
|
||||
description: 'Maximum results to show',
|
||||
limit = Option.String("--limit,-l", "10", {
|
||||
description: "Maximum results to show",
|
||||
});
|
||||
|
||||
install = Option.Boolean('--install,-i', false, {
|
||||
description: 'Prompt to install after finding',
|
||||
install = Option.Boolean("--install,-i", false, {
|
||||
description: "Prompt to install after finding",
|
||||
});
|
||||
|
||||
quiet = Option.Boolean('--quiet,-q', false, {
|
||||
description: 'Minimal output (just list skills)',
|
||||
quiet = Option.Boolean("--quiet,-q", false, {
|
||||
description: "Minimal output (just list skills)",
|
||||
});
|
||||
|
||||
federated = Option.Boolean('--federated,-f', false, {
|
||||
description: 'Search external registries (GitHub SKILL.md files)',
|
||||
federated = Option.Boolean("--federated,-f", false, {
|
||||
description: "Search external registries (GitHub SKILL.md files)",
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
@@ -64,17 +69,25 @@ export class FindCommand extends Command {
|
||||
const limit = parseInt(this.limit, 10) || 10;
|
||||
|
||||
if (!this.quiet) {
|
||||
header('Find Skills');
|
||||
header("Find Skills");
|
||||
}
|
||||
|
||||
const allSkills: SkillResult[] = (skillsData.skills || []).map((skill: { name: string; description?: string; source?: string; repo?: string }) => ({
|
||||
name: skill.name,
|
||||
description: skill.description,
|
||||
source: skill.source || '',
|
||||
repoName: skill.repo || skill.source?.split('/').pop() || '',
|
||||
}));
|
||||
const allSkills: SkillResult[] = (skillsData.skills || []).map(
|
||||
(skill: {
|
||||
name: string;
|
||||
description?: string;
|
||||
source?: string;
|
||||
repo?: string;
|
||||
}) => ({
|
||||
name: skill.name,
|
||||
description: skill.description,
|
||||
source: skill.source || "",
|
||||
repoName: skill.repo || skill.source?.split("/").pop() || "",
|
||||
}),
|
||||
);
|
||||
|
||||
let results: SkillResult[];
|
||||
let searchTerm: string | undefined;
|
||||
|
||||
if (this.top) {
|
||||
const featured = sourcesData.sources
|
||||
@@ -82,35 +95,43 @@ export class FindCommand extends Command {
|
||||
.slice(0, 5);
|
||||
|
||||
results = allSkills
|
||||
.filter(skill => featured.some((f: { source: string }) => skill.source.includes(f.source)))
|
||||
.filter((skill) =>
|
||||
featured.some((f: { source: string }) =>
|
||||
skill.source.includes(f.source),
|
||||
),
|
||||
)
|
||||
.slice(0, limit);
|
||||
|
||||
if (!this.quiet) {
|
||||
step('Showing featured skills');
|
||||
step("Showing featured skills");
|
||||
}
|
||||
} else if (this.query) {
|
||||
const query = this.query.toLowerCase();
|
||||
searchTerm = this.query;
|
||||
|
||||
s.start('Searching...');
|
||||
s.start("Searching...");
|
||||
|
||||
results = allSkills.filter(skill =>
|
||||
skill.name.toLowerCase().includes(query) ||
|
||||
skill.description?.toLowerCase().includes(query) ||
|
||||
skill.source.toLowerCase().includes(query) ||
|
||||
skill.repoName.toLowerCase().includes(query)
|
||||
).slice(0, limit);
|
||||
results = allSkills
|
||||
.filter(
|
||||
(skill) =>
|
||||
skill.name.toLowerCase().includes(query) ||
|
||||
skill.description?.toLowerCase().includes(query) ||
|
||||
skill.source.toLowerCase().includes(query) ||
|
||||
skill.repoName.toLowerCase().includes(query),
|
||||
)
|
||||
.slice(0, limit);
|
||||
|
||||
s.stop(`Found ${results.length} skill(s)`);
|
||||
} else {
|
||||
if (!this.quiet) {
|
||||
step('Enter a search term or browse featured skills');
|
||||
step("Enter a search term or browse featured skills");
|
||||
}
|
||||
|
||||
const { text } = await import('../onboarding/prompts.js');
|
||||
const { text } = await import("../onboarding/prompts.js");
|
||||
|
||||
const searchResult = await text({
|
||||
message: 'Search skills',
|
||||
placeholder: 'e.g., pdf, nextjs, testing',
|
||||
message: "Search skills",
|
||||
placeholder: "e.g., pdf, nextjs, testing",
|
||||
});
|
||||
|
||||
if (isCancel(searchResult)) {
|
||||
@@ -118,101 +139,163 @@ export class FindCommand extends Command {
|
||||
}
|
||||
|
||||
const query = (searchResult as string).toLowerCase();
|
||||
searchTerm = searchResult as string;
|
||||
|
||||
if (query) {
|
||||
s.start('Searching...');
|
||||
results = allSkills.filter(skill =>
|
||||
skill.name.toLowerCase().includes(query) ||
|
||||
skill.description?.toLowerCase().includes(query) ||
|
||||
skill.source.toLowerCase().includes(query) ||
|
||||
skill.repoName.toLowerCase().includes(query)
|
||||
).slice(0, limit);
|
||||
s.start("Searching...");
|
||||
results = allSkills
|
||||
.filter(
|
||||
(skill) =>
|
||||
skill.name.toLowerCase().includes(query) ||
|
||||
skill.description?.toLowerCase().includes(query) ||
|
||||
skill.source.toLowerCase().includes(query) ||
|
||||
skill.repoName.toLowerCase().includes(query),
|
||||
)
|
||||
.slice(0, limit);
|
||||
s.stop(`Found ${results.length} skill(s)`);
|
||||
} else {
|
||||
results = allSkills.slice(0, limit);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.federated && this.query) {
|
||||
s.start('Searching external registries...');
|
||||
if (searchTerm) {
|
||||
s.start("Searching skills.sh + external registries...");
|
||||
const fedSearch = new FederatedSearch();
|
||||
fedSearch.addRegistry(new GitHubSkillRegistry());
|
||||
fedSearch.addRegistry(new SkillsShRegistry());
|
||||
if (this.federated) {
|
||||
fedSearch.addRegistry(new GitHubSkillRegistry());
|
||||
}
|
||||
try {
|
||||
const fedResult = await fedSearch.search(this.query, { limit: parseInt(this.limit, 10) || 10 });
|
||||
s.stop(`Found ${fedResult.total} external skill(s) from ${fedResult.registries.join(', ') || 'none'}`);
|
||||
const fedResult = await fedSearch.search(searchTerm, {
|
||||
limit: parseInt(this.limit, 10) || 10,
|
||||
});
|
||||
const sourceLabel = fedResult.registries.join(", ") || "none";
|
||||
s.stop(`Found ${fedResult.total} skill(s) from ${sourceLabel}`);
|
||||
|
||||
if (fedResult.skills.length > 0) {
|
||||
console.log('');
|
||||
console.log(colors.bold('External Skills (SKILL.md):'));
|
||||
for (const skill of fedResult.skills) {
|
||||
const stars = typeof skill.stars === 'number' ? colors.muted(` ★${skill.stars}`) : '';
|
||||
const desc = skill.description
|
||||
? colors.muted(` - ${skill.description.slice(0, 50)}${skill.description.length > 50 ? '...' : ''}`)
|
||||
: '';
|
||||
console.log(` ${colors.cyan(symbols.bullet)} ${colors.primary(skill.name)}${stars}${desc}`);
|
||||
if (!this.quiet) {
|
||||
console.log(` ${colors.muted(skill.source)}`);
|
||||
const skillsShResults = fedResult.skills.filter(
|
||||
(sk) => sk.registry === "skills.sh",
|
||||
);
|
||||
const githubResults = fedResult.skills.filter(
|
||||
(sk) => sk.registry !== "skills.sh",
|
||||
);
|
||||
|
||||
if (skillsShResults.length > 0) {
|
||||
console.log("");
|
||||
console.log(colors.bold("Skills.sh Registry:"));
|
||||
for (const skill of skillsShResults) {
|
||||
const installs =
|
||||
typeof skill.stars === "number" && skill.stars > 0
|
||||
? colors.muted(` ${formatCount(skill.stars)} installs`)
|
||||
: "";
|
||||
const desc = skill.description
|
||||
? colors.muted(
|
||||
` - ${skill.description.slice(0, 50)}${skill.description.length > 50 ? "..." : ""}`,
|
||||
)
|
||||
: "";
|
||||
console.log(
|
||||
` ${colors.cyan(symbols.bullet)} ${colors.primary(skill.name)}${installs}${desc}`,
|
||||
);
|
||||
if (!this.quiet) {
|
||||
const installSource = skill.source.replace(
|
||||
"https://github.com/",
|
||||
"",
|
||||
);
|
||||
console.log(
|
||||
` ${colors.muted(`skillkit install skills.sh/${installSource}/${skill.name}`)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('');
|
||||
}
|
||||
} catch (err) {
|
||||
if (err instanceof RateLimitError) {
|
||||
s.stop(colors.warning('Rate limited by GitHub API'));
|
||||
console.log(colors.muted('Set GITHUB_TOKEN env var or wait before retrying.'));
|
||||
} else {
|
||||
s.stop(colors.warning('Federated search failed'));
|
||||
|
||||
if (githubResults.length > 0) {
|
||||
console.log("");
|
||||
console.log(colors.bold("GitHub (SKILL.md):"));
|
||||
for (const skill of githubResults) {
|
||||
const stars =
|
||||
typeof skill.stars === "number"
|
||||
? colors.muted(` ★${skill.stars}`)
|
||||
: "";
|
||||
const desc = skill.description
|
||||
? colors.muted(
|
||||
` - ${skill.description.slice(0, 50)}${skill.description.length > 50 ? "..." : ""}`,
|
||||
)
|
||||
: "";
|
||||
console.log(
|
||||
` ${colors.cyan(symbols.bullet)} ${colors.primary(skill.name)}${stars}${desc}`,
|
||||
);
|
||||
if (!this.quiet) {
|
||||
console.log(` ${colors.muted(skill.source)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log("");
|
||||
}
|
||||
} catch {
|
||||
s.stop(colors.warning("External search unavailable"));
|
||||
}
|
||||
}
|
||||
|
||||
if (results.length === 0) {
|
||||
console.log(colors.muted('No skills found matching your search'));
|
||||
console.log('');
|
||||
console.log(colors.muted('Try:'));
|
||||
console.log(colors.muted(' skillkit find --top # Show featured skills'));
|
||||
console.log(colors.muted(' skillkit find -f <query> # Search external registries'));
|
||||
console.log(colors.muted(' skillkit ui # Browse in TUI'));
|
||||
console.log(colors.muted("No skills found matching your search"));
|
||||
console.log("");
|
||||
console.log(colors.muted("Try:"));
|
||||
console.log(
|
||||
colors.muted(" skillkit find --top # Show featured skills"),
|
||||
);
|
||||
console.log(
|
||||
colors.muted(
|
||||
" skillkit find -f <query> # Also search GitHub SKILL.md files",
|
||||
),
|
||||
);
|
||||
console.log(colors.muted(" skillkit ui # Browse in TUI"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log("");
|
||||
|
||||
for (const skill of results) {
|
||||
const desc = skill.description
|
||||
? colors.muted(` - ${skill.description.slice(0, 50)}${skill.description.length > 50 ? '...' : ''}`)
|
||||
: '';
|
||||
console.log(` ${colors.success(symbols.bullet)} ${colors.primary(skill.name)}${desc}`);
|
||||
? colors.muted(
|
||||
` - ${skill.description.slice(0, 50)}${skill.description.length > 50 ? "..." : ""}`,
|
||||
)
|
||||
: "";
|
||||
console.log(
|
||||
` ${colors.success(symbols.bullet)} ${colors.primary(skill.name)}${desc}`,
|
||||
);
|
||||
if (!this.quiet && skill.source) {
|
||||
console.log(` ${colors.muted(skill.source)}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log(colors.muted(`Showing ${results.length} of ${allSkills.length} skills`));
|
||||
console.log('');
|
||||
console.log("");
|
||||
console.log(
|
||||
colors.muted(`Showing ${results.length} of ${allSkills.length} skills`),
|
||||
);
|
||||
console.log("");
|
||||
|
||||
if (this.install || (!this.query && !this.top && process.stdin.isTTY)) {
|
||||
const installResult = await select({
|
||||
message: 'Install a skill?',
|
||||
message: "Install a skill?",
|
||||
options: [
|
||||
{ value: 'none', label: 'No, just browsing' },
|
||||
...results.slice(0, 5).map(skill => ({
|
||||
{ value: "none", label: "No, just browsing" },
|
||||
...results.slice(0, 5).map((skill) => ({
|
||||
value: skill.source,
|
||||
label: skill.name,
|
||||
hint: skill.repoName,
|
||||
})),
|
||||
],
|
||||
initialValue: 'none',
|
||||
initialValue: "none",
|
||||
});
|
||||
|
||||
if (!isCancel(installResult) && installResult !== 'none') {
|
||||
console.log('');
|
||||
console.log(colors.cyan('To install, run:'));
|
||||
if (!isCancel(installResult) && installResult !== "none") {
|
||||
console.log("");
|
||||
console.log(colors.cyan("To install, run:"));
|
||||
console.log(` ${colors.bold(`skillkit install ${installResult}`)}`);
|
||||
}
|
||||
} else {
|
||||
console.log(colors.muted('To install: skillkit install <source>'));
|
||||
console.log(colors.muted("To install: skillkit install <source>"));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import { Command, Option } from 'clipanion';
|
||||
import { writeFileSync } from 'node:fs';
|
||||
import chalk from 'chalk';
|
||||
import { SessionHandoff } from '@skillkit/core';
|
||||
|
||||
export class SessionHandoffCommand extends Command {
|
||||
static override paths = [['session', 'handoff']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Generate agent-to-agent session handoff document',
|
||||
examples: [
|
||||
['Print handoff to stdout', '$0 session handoff'],
|
||||
['Target agent recommendations', '$0 session handoff --to cursor'],
|
||||
['Save to file', '$0 session handoff --out handoff.md'],
|
||||
['JSON output', '$0 session handoff --json'],
|
||||
],
|
||||
});
|
||||
|
||||
to = Option.String('--to', {
|
||||
description: 'Target agent for recommendations',
|
||||
});
|
||||
|
||||
out = Option.String('--out,-o', {
|
||||
description: 'Save handoff to file',
|
||||
});
|
||||
|
||||
json = Option.Boolean('--json,-j', false, {
|
||||
description: 'Output as JSON',
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const projectPath = process.cwd();
|
||||
const handoff = new SessionHandoff(projectPath);
|
||||
|
||||
const doc = handoff.generate({
|
||||
targetAgent: this.to,
|
||||
});
|
||||
|
||||
const output = this.json ? handoff.toJson(doc) : handoff.toMarkdown(doc);
|
||||
|
||||
if (this.out) {
|
||||
try {
|
||||
writeFileSync(this.out, output, 'utf-8');
|
||||
console.log(chalk.green(`Handoff saved to ${this.out}`));
|
||||
} catch (error) {
|
||||
console.error(chalk.red(`Failed to write file: ${(error as Error).message}`));
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
console.log(output);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -127,6 +127,9 @@ export { ServeCommand } from './serve.js';
|
||||
export { ScanCommand } from './scan.js';
|
||||
export { IssuePlanCommand, IssueListCommand } from './issue.js';
|
||||
export { DoctorCommand } from './doctor.js';
|
||||
export { TimelineCommand } from './timeline.js';
|
||||
export { SessionHandoffCommand } from './handoff.js';
|
||||
export { LineageCommand } from './lineage.js';
|
||||
export { SaveCommand } from './save.js';
|
||||
export {
|
||||
AgentsMdCommand,
|
||||
|
||||
@@ -1,15 +1,36 @@
|
||||
import { existsSync, mkdirSync, cpSync, rmSync, symlinkSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { execFile } from 'node:child_process';
|
||||
import { promisify } from 'node:util';
|
||||
import {
|
||||
existsSync,
|
||||
mkdirSync,
|
||||
cpSync,
|
||||
rmSync,
|
||||
symlinkSync,
|
||||
readFileSync,
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { execFile } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
import { Command, Option } from 'clipanion';
|
||||
import { detectProvider, isLocalPath, getProvider, evaluateSkillDirectory, SkillScanner, formatSummary, Severity, WellKnownProvider, AgentsMdParser, AgentsMdGenerator } from '@skillkit/core';
|
||||
import type { SkillMetadata, GitProvider, AgentType } from '@skillkit/core';
|
||||
import { isPathInside } from '@skillkit/core';
|
||||
import { getAdapter, detectAgent, getAllAdapters } from '@skillkit/agents';
|
||||
import { getInstallDir, saveSkillMetadata } from '../helpers.js';
|
||||
import { Command, Option } from "clipanion";
|
||||
import {
|
||||
detectProvider,
|
||||
isLocalPath,
|
||||
getProvider,
|
||||
evaluateSkillDirectory,
|
||||
SkillScanner,
|
||||
formatSummary,
|
||||
Severity,
|
||||
WellKnownProvider,
|
||||
AgentsMdParser,
|
||||
AgentsMdGenerator,
|
||||
SkillsShRegistry,
|
||||
} from "@skillkit/core";
|
||||
import type { SkillsShStats } from "@skillkit/core";
|
||||
import type { SkillMetadata, GitProvider, AgentType } from "@skillkit/core";
|
||||
import { isPathInside } from "@skillkit/core";
|
||||
import { getAdapter, detectAgent, getAllAdapters } from "@skillkit/agents";
|
||||
import { getInstallDir, saveSkillMetadata, formatCount } from "../helpers.js";
|
||||
import {
|
||||
welcome,
|
||||
colors,
|
||||
@@ -35,71 +56,80 @@ import {
|
||||
formatQualityBadge,
|
||||
getQualityGradeFromScore,
|
||||
type InstallResult,
|
||||
} from '../onboarding/index.js';
|
||||
} from "../onboarding/index.js";
|
||||
|
||||
export class InstallCommand extends Command {
|
||||
static override paths = [['install'], ['i'], ['add']];
|
||||
static override paths = [["install"], ["i"], ["add"]];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Install skills from GitHub, GitLab, Bitbucket, or local path',
|
||||
description:
|
||||
"Install skills from GitHub, GitLab, Bitbucket, skills.sh, or local path",
|
||||
examples: [
|
||||
['Install from GitHub', '$0 install owner/repo'],
|
||||
['Install from GitLab', '$0 install gitlab:owner/repo'],
|
||||
['Install from Bitbucket', '$0 install bitbucket:owner/repo'],
|
||||
['Install specific skill', '$0 install owner/repo --skill=pdf'],
|
||||
['Install multiple skills (CI/CD)', '$0 install owner/repo --skills=pdf,xlsx'],
|
||||
['Install all skills non-interactively', '$0 install owner/repo --all'],
|
||||
['Install from local path', '$0 install ./my-skills'],
|
||||
['Install globally', '$0 install owner/repo --global'],
|
||||
['List available skills', '$0 install owner/repo --list'],
|
||||
['Install to specific agents', '$0 install owner/repo --agent claude-code --agent cursor'],
|
||||
["Install from GitHub", "$0 install owner/repo"],
|
||||
["Install from skills.sh", "$0 install skills.sh/owner/repo/skill-name"],
|
||||
["Install from GitLab", "$0 install gitlab:owner/repo"],
|
||||
["Install from Bitbucket", "$0 install bitbucket:owner/repo"],
|
||||
["Install specific skill", "$0 install owner/repo --skill=pdf"],
|
||||
[
|
||||
"Install multiple skills (CI/CD)",
|
||||
"$0 install owner/repo --skills=pdf,xlsx",
|
||||
],
|
||||
["Install all skills non-interactively", "$0 install owner/repo --all"],
|
||||
["Install from local path", "$0 install ./my-skills"],
|
||||
["Install globally", "$0 install owner/repo --global"],
|
||||
["List available skills", "$0 install owner/repo --list"],
|
||||
[
|
||||
"Install to specific agents",
|
||||
"$0 install owner/repo --agent claude-code --agent cursor",
|
||||
],
|
||||
],
|
||||
});
|
||||
|
||||
source = Option.String({ required: true });
|
||||
|
||||
skills = Option.String('--skills,--skill,-s', {
|
||||
description: 'Comma-separated list of skills to install (non-interactive)',
|
||||
skills = Option.String("--skills,--skill,-s", {
|
||||
description: "Comma-separated list of skills to install (non-interactive)",
|
||||
});
|
||||
|
||||
all = Option.Boolean('--all,-a', false, {
|
||||
description: 'Install all discovered skills (non-interactive)',
|
||||
all = Option.Boolean("--all,-a", false, {
|
||||
description: "Install all discovered skills (non-interactive)",
|
||||
});
|
||||
|
||||
yes = Option.Boolean('--yes,-y', false, {
|
||||
description: 'Skip confirmation prompts',
|
||||
yes = Option.Boolean("--yes,-y", false, {
|
||||
description: "Skip confirmation prompts",
|
||||
});
|
||||
|
||||
global = Option.Boolean('--global,-g', false, {
|
||||
description: 'Install to global skills directory',
|
||||
global = Option.Boolean("--global,-g", false, {
|
||||
description: "Install to global skills directory",
|
||||
});
|
||||
|
||||
force = Option.Boolean('--force,-f', false, {
|
||||
description: 'Overwrite existing skills',
|
||||
force = Option.Boolean("--force,-f", false, {
|
||||
description: "Overwrite existing skills",
|
||||
});
|
||||
|
||||
provider = Option.String('--provider,-p', {
|
||||
description: 'Force specific provider (github, gitlab, bitbucket)',
|
||||
provider = Option.String("--provider,-p", {
|
||||
description: "Force specific provider (github, gitlab, bitbucket)",
|
||||
});
|
||||
|
||||
list = Option.Boolean('--list,-l', false, {
|
||||
description: 'List available skills without installing',
|
||||
list = Option.Boolean("--list,-l", false, {
|
||||
description: "List available skills without installing",
|
||||
});
|
||||
|
||||
agent = Option.Array('--agent', {
|
||||
description: 'Target specific agents (can specify multiple)',
|
||||
agent = Option.Array("--agent", {
|
||||
description: "Target specific agents (can specify multiple)",
|
||||
});
|
||||
|
||||
quiet = Option.Boolean('--quiet,-q', false, {
|
||||
description: 'Minimal output (no logo)',
|
||||
quiet = Option.Boolean("--quiet,-q", false, {
|
||||
description: "Minimal output (no logo)",
|
||||
});
|
||||
|
||||
scan = Option.Boolean('--scan', true, {
|
||||
description: 'Run security scan before installing (default: true)',
|
||||
scan = Option.Boolean("--scan", true, {
|
||||
description: "Run security scan before installing (default: true)",
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const isInteractive = process.stdin.isTTY && !this.skills && !this.all && !this.yes;
|
||||
const isInteractive =
|
||||
process.stdin.isTTY && !this.skills && !this.all && !this.yes;
|
||||
const s = spinner();
|
||||
|
||||
try {
|
||||
@@ -109,21 +139,37 @@ export class InstallCommand extends Command {
|
||||
}
|
||||
|
||||
let providerAdapter = detectProvider(this.source);
|
||||
let result: { success: boolean; path?: string; tempRoot?: string; error?: string; skills?: string[]; discoveredSkills?: Array<{ name: string; dirName: string; path: string }> } | null = null;
|
||||
let result: {
|
||||
success: boolean;
|
||||
path?: string;
|
||||
tempRoot?: string;
|
||||
error?: string;
|
||||
skills?: string[];
|
||||
discoveredSkills?: Array<{
|
||||
name: string;
|
||||
dirName: string;
|
||||
path: string;
|
||||
}>;
|
||||
} | null = null;
|
||||
|
||||
const isUrl = this.source.startsWith('http://') || this.source.startsWith('https://');
|
||||
const isUrl =
|
||||
this.source.startsWith("http://") || this.source.startsWith("https://");
|
||||
if (isUrl && !this.provider && !providerAdapter) {
|
||||
s.start('Checking for well-known skills...');
|
||||
s.start("Checking for well-known skills...");
|
||||
const wellKnown = new WellKnownProvider();
|
||||
const discovery = await wellKnown.discoverFromUrl(this.source);
|
||||
if (discovery.success) {
|
||||
s.stop(`Found ${discovery.skills?.length || 0} skill(s) via well-known discovery`);
|
||||
s.stop(
|
||||
`Found ${discovery.skills?.length || 0} skill(s) via well-known discovery`,
|
||||
);
|
||||
providerAdapter = wellKnown;
|
||||
result = discovery;
|
||||
} else {
|
||||
s.stop('No well-known skills found');
|
||||
s.stop("No well-known skills found");
|
||||
warn(`No well-known skills found at ${this.source}`);
|
||||
console.log(colors.muted('You can save this URL as a skill instead:'));
|
||||
console.log(
|
||||
colors.muted("You can save this URL as a skill instead:"),
|
||||
);
|
||||
console.log(colors.muted(` skillkit save ${this.source}`));
|
||||
return 1;
|
||||
}
|
||||
@@ -135,20 +181,31 @@ export class InstallCommand extends Command {
|
||||
|
||||
if (!providerAdapter) {
|
||||
error(`Could not detect provider for: ${this.source}`);
|
||||
console.log(colors.muted('Use --provider flag or specify source as:'));
|
||||
console.log(colors.muted(' GitHub: owner/repo or https://github.com/owner/repo'));
|
||||
console.log(colors.muted(' GitLab: gitlab:owner/repo or https://gitlab.com/owner/repo'));
|
||||
console.log(colors.muted(' Bitbucket: bitbucket:owner/repo'));
|
||||
console.log(colors.muted(' Local: ./path or ~/path'));
|
||||
console.log(colors.muted("Use --provider flag or specify source as:"));
|
||||
console.log(
|
||||
colors.muted(
|
||||
" GitHub: owner/repo or https://github.com/owner/repo",
|
||||
),
|
||||
);
|
||||
console.log(
|
||||
colors.muted(" Skills.sh: skills.sh/owner/repo/skill-name"),
|
||||
);
|
||||
console.log(
|
||||
colors.muted(
|
||||
" GitLab: gitlab:owner/repo or https://gitlab.com/owner/repo",
|
||||
),
|
||||
);
|
||||
console.log(colors.muted(" Bitbucket: bitbucket:owner/repo"));
|
||||
console.log(colors.muted(" Local: ./path or ~/path"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
s.start(`Fetching from ${providerAdapter.name}...`);
|
||||
result = await providerAdapter.clone(this.source, '', { depth: 1 });
|
||||
result = await providerAdapter.clone(this.source, "", { depth: 1 });
|
||||
|
||||
if (!result.success || !result.path) {
|
||||
s.stop(colors.error(result.error || 'Failed to fetch source'));
|
||||
s.stop(colors.error(result.error || "Failed to fetch source"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -161,23 +218,35 @@ export class InstallCommand extends Command {
|
||||
// List mode - just show skills and exit
|
||||
if (this.list) {
|
||||
if (discoveredSkills.length === 0) {
|
||||
warn('No skills found in this repository');
|
||||
warn("No skills found in this repository");
|
||||
} else {
|
||||
console.log('');
|
||||
console.log(colors.bold('Available skills:'));
|
||||
console.log('');
|
||||
console.log("");
|
||||
console.log(colors.bold("Available skills:"));
|
||||
console.log("");
|
||||
for (const skill of discoveredSkills) {
|
||||
const quality = evaluateSkillDirectory(skill.path);
|
||||
const qualityBadge = quality ? ` ${formatQualityBadge(quality.overall)}` : '';
|
||||
console.log(` ${colors.success(symbols.stepActive)} ${colors.primary(skill.name)}${qualityBadge}`);
|
||||
const qualityBadge = quality
|
||||
? ` ${formatQualityBadge(quality.overall)}`
|
||||
: "";
|
||||
console.log(
|
||||
` ${colors.success(symbols.stepActive)} ${colors.primary(skill.name)}${qualityBadge}`,
|
||||
);
|
||||
}
|
||||
console.log('');
|
||||
console.log(colors.muted(`Total: ${discoveredSkills.length} skill(s)`));
|
||||
console.log(colors.muted('To install: skillkit install <source> --skill=name'));
|
||||
console.log("");
|
||||
console.log(
|
||||
colors.muted(`Total: ${discoveredSkills.length} skill(s)`),
|
||||
);
|
||||
console.log(
|
||||
colors.muted("To install: skillkit install <source> --skill=name"),
|
||||
);
|
||||
}
|
||||
|
||||
const cleanupPath = cloneResult.tempRoot || cloneResult.path;
|
||||
if (!isLocalPath(this.source) && cleanupPath && existsSync(cleanupPath)) {
|
||||
if (
|
||||
!isLocalPath(this.source) &&
|
||||
cleanupPath &&
|
||||
existsSync(cleanupPath)
|
||||
) {
|
||||
rmSync(cleanupPath, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
@@ -188,17 +257,19 @@ export class InstallCommand extends Command {
|
||||
|
||||
// Non-interactive: use --skills filter
|
||||
if (this.skills) {
|
||||
const requestedSkills = this.skills.split(',').map(s => s.trim());
|
||||
const available = discoveredSkills.map(s => s.name);
|
||||
const notFound = requestedSkills.filter(s => !available.includes(s));
|
||||
const requestedSkills = this.skills.split(",").map((s) => s.trim());
|
||||
const available = discoveredSkills.map((s) => s.name);
|
||||
const notFound = requestedSkills.filter((s) => !available.includes(s));
|
||||
|
||||
if (notFound.length > 0) {
|
||||
error(`Skills not found: ${notFound.join(', ')}`);
|
||||
console.log(colors.muted(`Available: ${available.join(', ')}`));
|
||||
error(`Skills not found: ${notFound.join(", ")}`);
|
||||
console.log(colors.muted(`Available: ${available.join(", ")}`));
|
||||
return 1;
|
||||
}
|
||||
|
||||
skillsToInstall = discoveredSkills.filter(s => requestedSkills.includes(s.name));
|
||||
skillsToInstall = discoveredSkills.filter((s) =>
|
||||
requestedSkills.includes(s.name),
|
||||
);
|
||||
} else if (this.all || this.yes) {
|
||||
skillsToInstall = discoveredSkills;
|
||||
} else if (isInteractive && discoveredSkills.length > 1) {
|
||||
@@ -206,21 +277,23 @@ export class InstallCommand extends Command {
|
||||
step(`Source: ${colors.cyan(this.source)}`);
|
||||
|
||||
const skillResult = await skillMultiselect({
|
||||
message: 'Select skills to install',
|
||||
skills: discoveredSkills.map(s => ({ name: s.name })),
|
||||
initialValues: discoveredSkills.map(s => s.name),
|
||||
message: "Select skills to install",
|
||||
skills: discoveredSkills.map((s) => ({ name: s.name })),
|
||||
initialValues: discoveredSkills.map((s) => s.name),
|
||||
});
|
||||
|
||||
if (isCancel(skillResult)) {
|
||||
cancel('Installation cancelled');
|
||||
cancel("Installation cancelled");
|
||||
return 0;
|
||||
}
|
||||
|
||||
skillsToInstall = discoveredSkills.filter(s => (skillResult as string[]).includes(s.name));
|
||||
skillsToInstall = discoveredSkills.filter((s) =>
|
||||
(skillResult as string[]).includes(s.name),
|
||||
);
|
||||
}
|
||||
|
||||
if (skillsToInstall.length === 0) {
|
||||
warn('No skills to install');
|
||||
warn("No skills to install");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -228,26 +301,35 @@ export class InstallCommand extends Command {
|
||||
let targetAgents: AgentType[];
|
||||
|
||||
if (this.agent && this.agent.length > 0) {
|
||||
// Explicitly specified agents
|
||||
const allValid = getAllAdapters().map((a) => a.type);
|
||||
const invalid = this.agent.filter(
|
||||
(a) => !allValid.includes(a as AgentType),
|
||||
);
|
||||
if (invalid.length > 0) {
|
||||
error(`Unknown agent(s): ${invalid.join(", ")}`);
|
||||
console.log(colors.muted(`Available: ${allValid.join(", ")}`));
|
||||
return 1;
|
||||
}
|
||||
targetAgents = this.agent as AgentType[];
|
||||
} else if (isInteractive) {
|
||||
const allAgentTypes = getAllAdapters().map(a => a.type);
|
||||
const allAgentTypes = getAllAdapters().map((a) => a.type);
|
||||
const lastAgents = getLastAgents();
|
||||
|
||||
step(`Detected ${allAgentTypes.length} agents`);
|
||||
|
||||
const agentResult = await quickAgentSelect({
|
||||
message: 'Install to',
|
||||
message: "Install to",
|
||||
agents: allAgentTypes,
|
||||
lastSelected: lastAgents,
|
||||
});
|
||||
|
||||
if (isCancel(agentResult)) {
|
||||
cancel('Installation cancelled');
|
||||
cancel("Installation cancelled");
|
||||
return 0;
|
||||
}
|
||||
|
||||
targetAgents = (agentResult as { agents: string[] }).agents as AgentType[];
|
||||
targetAgents = (agentResult as { agents: string[] })
|
||||
.agents as AgentType[];
|
||||
|
||||
// Save selection for next time
|
||||
saveLastAgents(targetAgents);
|
||||
@@ -258,21 +340,25 @@ export class InstallCommand extends Command {
|
||||
}
|
||||
|
||||
// Interactive: select installation method
|
||||
let installMethod: 'symlink' | 'copy' = 'copy';
|
||||
let installMethod: "symlink" | "copy" = "copy";
|
||||
|
||||
if (isInteractive && targetAgents.length > 1) {
|
||||
const methodResult = await selectInstallMethod({});
|
||||
|
||||
if (isCancel(methodResult)) {
|
||||
cancel('Installation cancelled');
|
||||
cancel("Installation cancelled");
|
||||
return 0;
|
||||
}
|
||||
|
||||
installMethod = methodResult as 'symlink' | 'copy';
|
||||
installMethod = methodResult as "symlink" | "copy";
|
||||
}
|
||||
|
||||
// Check for low-quality skills and warn
|
||||
const lowQualitySkills: Array<{ name: string; score: number; warnings: string[] }> = [];
|
||||
const lowQualitySkills: Array<{
|
||||
name: string;
|
||||
score: number;
|
||||
warnings: string[];
|
||||
}> = [];
|
||||
for (const skill of skillsToInstall) {
|
||||
const quality = evaluateSkillDirectory(skill.path);
|
||||
if (quality && quality.overall < 60) {
|
||||
@@ -289,42 +375,60 @@ export class InstallCommand extends Command {
|
||||
for (const skill of skillsToInstall) {
|
||||
const scanResult = await scanner.scan(skill.path);
|
||||
|
||||
if (scanResult.verdict === 'fail' && !this.force) {
|
||||
if (scanResult.verdict === "fail" && !this.force) {
|
||||
error(`Security scan FAILED for "${skill.name}"`);
|
||||
console.log(formatSummary(scanResult));
|
||||
console.log(colors.muted('Use --force to install anyway, or --no-scan to skip scanning'));
|
||||
console.log(
|
||||
colors.muted(
|
||||
"Use --force to install anyway, or --no-scan to skip scanning",
|
||||
),
|
||||
);
|
||||
|
||||
const cleanupPath = cloneResult.tempRoot || cloneResult.path;
|
||||
if (!isLocalPath(this.source) && cleanupPath && existsSync(cleanupPath)) {
|
||||
if (
|
||||
!isLocalPath(this.source) &&
|
||||
cleanupPath &&
|
||||
existsSync(cleanupPath)
|
||||
) {
|
||||
rmSync(cleanupPath, { recursive: true, force: true });
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (scanResult.verdict === 'warn' && !this.quiet) {
|
||||
warn(`Security warnings for "${skill.name}" (${scanResult.stats.medium} medium, ${scanResult.stats.low} low)`);
|
||||
if (scanResult.verdict === "warn" && !this.quiet) {
|
||||
warn(
|
||||
`Security warnings for "${skill.name}" (${scanResult.stats.medium} medium, ${scanResult.stats.low} low)`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Confirm installation
|
||||
if (isInteractive && !this.yes) {
|
||||
console.log('');
|
||||
console.log("");
|
||||
|
||||
// Show low-quality warning if any
|
||||
if (lowQualitySkills.length > 0) {
|
||||
console.log(colors.warning(`${symbols.warning} Warning: ${lowQualitySkills.length} skill(s) have low quality scores (< 60)`));
|
||||
console.log(
|
||||
colors.warning(
|
||||
`${symbols.warning} Warning: ${lowQualitySkills.length} skill(s) have low quality scores (< 60)`,
|
||||
),
|
||||
);
|
||||
for (const lq of lowQualitySkills) {
|
||||
const grade = getQualityGradeFromScore(lq.score);
|
||||
const warningText = lq.warnings.length > 0 ? ` - ${lq.warnings.join(', ')}` : '';
|
||||
console.log(colors.muted(` - ${lq.name} [${grade}]${warningText}`));
|
||||
const warningText =
|
||||
lq.warnings.length > 0 ? ` - ${lq.warnings.join(", ")}` : "";
|
||||
console.log(
|
||||
colors.muted(` - ${lq.name} [${grade}]${warningText}`),
|
||||
);
|
||||
}
|
||||
console.log('');
|
||||
console.log("");
|
||||
}
|
||||
|
||||
const agentDisplay = targetAgents.length <= 3
|
||||
? targetAgents.map(formatAgent).join(', ')
|
||||
: `${targetAgents.slice(0, 2).map(formatAgent).join(', ')} +${targetAgents.length - 2} more`;
|
||||
const agentDisplay =
|
||||
targetAgents.length <= 3
|
||||
? targetAgents.map(formatAgent).join(", ")
|
||||
: `${targetAgents.slice(0, 2).map(formatAgent).join(", ")} +${targetAgents.length - 2} more`;
|
||||
|
||||
const confirmResult = await confirm({
|
||||
message: `Install ${skillsToInstall.length} skill(s) to ${agentDisplay}?`,
|
||||
@@ -332,7 +436,7 @@ export class InstallCommand extends Command {
|
||||
});
|
||||
|
||||
if (isCancel(confirmResult) || !confirmResult) {
|
||||
cancel('Installation cancelled');
|
||||
cancel("Installation cancelled");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -359,21 +463,26 @@ export class InstallCommand extends Command {
|
||||
|
||||
if (existsSync(targetPath) && !this.force) {
|
||||
if (!this.quiet) {
|
||||
warn(`Skipping ${skillName} for ${adapter.name} (already exists, use --force)`);
|
||||
warn(
|
||||
`Skipping ${skillName} for ${adapter.name} (already exists, use --force)`,
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const securityRoot = cloneResult.tempRoot || cloneResult.path || '';
|
||||
const securityRoot = cloneResult.tempRoot || cloneResult.path || "";
|
||||
if (!securityRoot || !isPathInside(sourcePath, securityRoot)) {
|
||||
error(`Skipping ${skillName} (path traversal detected)`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const isSymlinkMode = installMethod === 'symlink' && targetAgents.length > 1;
|
||||
const isSymlinkMode =
|
||||
installMethod === "symlink" && targetAgents.length > 1;
|
||||
const useSymlink = isSymlinkMode && primaryPath !== null;
|
||||
|
||||
s.start(`Installing ${skillName} to ${adapter.name}${useSymlink ? ' (symlink)' : ''}...`);
|
||||
s.start(
|
||||
`Installing ${skillName} to ${adapter.name}${useSymlink ? " (symlink)" : ""}...`,
|
||||
);
|
||||
|
||||
try {
|
||||
if (existsSync(targetPath)) {
|
||||
@@ -381,24 +490,33 @@ export class InstallCommand extends Command {
|
||||
}
|
||||
|
||||
if (useSymlink && primaryPath) {
|
||||
symlinkSync(primaryPath, targetPath, 'dir');
|
||||
symlinkSync(primaryPath, targetPath, "dir");
|
||||
} else {
|
||||
cpSync(sourcePath, targetPath, { recursive: true, dereference: true });
|
||||
cpSync(sourcePath, targetPath, {
|
||||
recursive: true,
|
||||
dereference: true,
|
||||
});
|
||||
if (isSymlinkMode && primaryPath === null) {
|
||||
primaryPath = targetPath;
|
||||
}
|
||||
|
||||
// Auto-install npm dependencies if package.json exists
|
||||
const packageJsonPath = join(targetPath, 'package.json');
|
||||
const packageJsonPath = join(targetPath, "package.json");
|
||||
if (existsSync(packageJsonPath)) {
|
||||
s.stop(`Installed ${skillName} to ${adapter.name}`);
|
||||
s.start(`Installing npm dependencies for ${skillName}...`);
|
||||
try {
|
||||
await execFileAsync('npm', ['install', '--production'], { cwd: targetPath });
|
||||
await execFileAsync("npm", ["install", "--omit=dev"], {
|
||||
cwd: targetPath,
|
||||
});
|
||||
s.stop(`Installed dependencies for ${skillName}`);
|
||||
} catch (npmErr) {
|
||||
s.stop(colors.warning(`Dependencies failed for ${skillName}`));
|
||||
console.log(colors.muted('Run manually: npm install in ' + targetPath));
|
||||
s.stop(
|
||||
colors.warning(`Dependencies failed for ${skillName}`),
|
||||
);
|
||||
console.log(
|
||||
colors.muted("Run manually: npm install in " + targetPath),
|
||||
);
|
||||
}
|
||||
s.start(`Finishing ${skillName} installation...`);
|
||||
}
|
||||
@@ -406,7 +524,7 @@ export class InstallCommand extends Command {
|
||||
|
||||
const metadata: SkillMetadata = {
|
||||
name: skillName,
|
||||
description: '',
|
||||
description: "",
|
||||
source: this.source,
|
||||
sourceType: providerAdapter.type,
|
||||
subpath: skillName,
|
||||
@@ -416,10 +534,16 @@ export class InstallCommand extends Command {
|
||||
saveSkillMetadata(targetPath, metadata);
|
||||
|
||||
installedAgents.push(agentType);
|
||||
s.stop(`Installed ${skillName} to ${adapter.name}${useSymlink ? ' (symlink)' : ''}`);
|
||||
s.stop(
|
||||
`Installed ${skillName} to ${adapter.name}${useSymlink ? " (symlink)" : ""}`,
|
||||
);
|
||||
} catch (err) {
|
||||
s.stop(colors.error(`Failed to install ${skillName} to ${adapter.name}`));
|
||||
console.log(colors.muted(err instanceof Error ? err.message : String(err)));
|
||||
s.stop(
|
||||
colors.error(`Failed to install ${skillName} to ${adapter.name}`),
|
||||
);
|
||||
console.log(
|
||||
colors.muted(err instanceof Error ? err.message : String(err)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +553,10 @@ export class InstallCommand extends Command {
|
||||
skillName,
|
||||
method: installMethod,
|
||||
agents: installedAgents,
|
||||
path: join(getInstallDir(this.global, installedAgents[0] as AgentType), skillName),
|
||||
path: join(
|
||||
getInstallDir(this.global, installedAgents[0] as AgentType),
|
||||
skillName,
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -442,19 +569,22 @@ export class InstallCommand extends Command {
|
||||
|
||||
if (totalInstalled > 0) {
|
||||
try {
|
||||
const agentsMdPath = join(process.cwd(), 'AGENTS.md');
|
||||
const agentsMdPath = join(process.cwd(), "AGENTS.md");
|
||||
if (existsSync(agentsMdPath)) {
|
||||
const parser = new AgentsMdParser();
|
||||
const existing = readFileSync(agentsMdPath, 'utf-8');
|
||||
const existing = readFileSync(agentsMdPath, "utf-8");
|
||||
if (parser.hasManagedSections(existing)) {
|
||||
const gen = new AgentsMdGenerator({ projectPath: process.cwd() });
|
||||
const genResult = gen.generate();
|
||||
const updated = parser.updateManagedSections(existing, genResult.sections.filter(s => s.managed));
|
||||
writeFileSync(agentsMdPath, updated, 'utf-8');
|
||||
const updated = parser.updateManagedSections(
|
||||
existing,
|
||||
genResult.sections.filter((s) => s.managed),
|
||||
);
|
||||
writeFileSync(agentsMdPath, updated, "utf-8");
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
warn('Failed to update AGENTS.md');
|
||||
warn("Failed to update AGENTS.md");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,32 +598,105 @@ export class InstallCommand extends Command {
|
||||
source: this.source,
|
||||
});
|
||||
|
||||
outro('Installation complete!');
|
||||
await this.showSkillsShStats(
|
||||
installResults.map((r) => r.skillName),
|
||||
providerAdapter,
|
||||
);
|
||||
|
||||
outro("Installation complete!");
|
||||
|
||||
if (!this.yes) {
|
||||
showNextSteps({
|
||||
skillNames: installResults.map(r => r.skillName),
|
||||
skillNames: installResults.map((r) => r.skillName),
|
||||
agentTypes: targetAgents,
|
||||
syncNeeded: true,
|
||||
});
|
||||
|
||||
this.showProTips(installResults.map((r) => r.skillName));
|
||||
}
|
||||
} else {
|
||||
success(`Installed ${totalInstalled} skill(s) to ${targetAgents.length} agent(s)`);
|
||||
success(
|
||||
`Installed ${totalInstalled} skill(s) to ${targetAgents.length} agent(s)`,
|
||||
);
|
||||
for (const r of installResults) {
|
||||
console.log(colors.muted(` ${symbols.success} ${r.skillName} ${symbols.arrowRight} ${r.agents.map(getAgentIcon).join(' ')}`));
|
||||
console.log(
|
||||
colors.muted(
|
||||
` ${symbols.success} ${r.skillName} ${symbols.arrowRight} ${r.agents.map(getAgentIcon).join(" ")}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
console.log('');
|
||||
console.log(colors.muted('Run `skillkit sync` to update agent configs'));
|
||||
console.log("");
|
||||
console.log(
|
||||
colors.muted("Run `skillkit sync` to update agent configs"),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
warn('No skills were installed');
|
||||
warn("No skills were installed");
|
||||
}
|
||||
|
||||
return 0;
|
||||
} catch (err) {
|
||||
s.stop(colors.error('Installation failed'));
|
||||
console.log(colors.muted(err instanceof Error ? err.message : String(err)));
|
||||
s.stop(colors.error("Installation failed"));
|
||||
console.log(
|
||||
colors.muted(err instanceof Error ? err.message : String(err)),
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private async showSkillsShStats(
|
||||
skillNames: string[],
|
||||
provider: {
|
||||
type: string;
|
||||
parseSource: (s: string) => { owner: string; repo: string } | null;
|
||||
},
|
||||
): Promise<void> {
|
||||
try {
|
||||
if (provider.type === "local") return;
|
||||
const parsed = provider.parseSource(this.source);
|
||||
if (!parsed) return;
|
||||
|
||||
const registry = new SkillsShRegistry();
|
||||
const statsResults: SkillsShStats[] = [];
|
||||
|
||||
for (const name of skillNames) {
|
||||
const stats = await registry.getSkillStats(
|
||||
parsed.owner,
|
||||
parsed.repo,
|
||||
name,
|
||||
);
|
||||
if (stats) statsResults.push(stats);
|
||||
}
|
||||
|
||||
if (statsResults.length > 0) {
|
||||
console.log("");
|
||||
console.log(colors.bold("Skills.sh Popularity:"));
|
||||
for (const s of statsResults) {
|
||||
const rank =
|
||||
s.rank <= 10
|
||||
? colors.success(`#${s.rank}`)
|
||||
: colors.muted(`#${s.rank}`);
|
||||
const installs = s.installs > 0 ? formatCount(s.installs) : "n/a";
|
||||
console.log(
|
||||
` ${rank} ${colors.primary(s.skillName)} ${colors.muted(`(${installs} installs)`)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Non-critical, silently skip
|
||||
}
|
||||
}
|
||||
|
||||
private showProTips(skillNames: string[]): void {
|
||||
const tips = [
|
||||
`Translate to any agent format: ${colors.bold(`skillkit translate ${skillNames[0] || "skill-name"} --to cursor`)}`,
|
||||
`Get AI recommendations: ${colors.bold("skillkit recommend")}`,
|
||||
`Score quality: ${colors.bold(`skillkit evaluate ${skillNames[0] || "skill-name"}`)}`,
|
||||
`Browse all skills: ${colors.bold("skillkit find --top")}`,
|
||||
];
|
||||
|
||||
const tip = tips[Math.floor(Math.random() * tips.length)];
|
||||
console.log("");
|
||||
console.log(colors.muted(`Pro tip: ${tip}`));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import { Command, Option } from 'clipanion';
|
||||
import chalk from 'chalk';
|
||||
import { SkillLineage } from '@skillkit/core';
|
||||
|
||||
export class LineageCommand extends Command {
|
||||
static override paths = [['lineage']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Show skill impact lineage — which skills produced which changes',
|
||||
examples: [
|
||||
['Full overview', '$0 lineage'],
|
||||
['Single skill', '$0 lineage --skill code-simplifier'],
|
||||
['Single file', '$0 lineage --file src/index.ts'],
|
||||
['Date filter + JSON', '$0 lineage --since 2026-02-01 --json'],
|
||||
],
|
||||
});
|
||||
|
||||
skill = Option.String('--skill,-s', {
|
||||
description: 'Filter by skill name',
|
||||
});
|
||||
|
||||
file = Option.String('--file,-f', {
|
||||
description: 'Filter by file path',
|
||||
});
|
||||
|
||||
since = Option.String('--since', {
|
||||
description: 'Show lineage since date (YYYY-MM-DD)',
|
||||
});
|
||||
|
||||
limit = Option.String('--limit,-l', {
|
||||
description: 'Max entries to show',
|
||||
});
|
||||
|
||||
json = Option.Boolean('--json,-j', false, {
|
||||
description: 'Output as JSON',
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const projectPath = process.cwd();
|
||||
const lineage = new SkillLineage(projectPath);
|
||||
|
||||
const parsed = this.limit ? parseInt(this.limit, 10) : undefined;
|
||||
const limit = parsed && Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
|
||||
|
||||
const data = lineage.build({
|
||||
skill: this.skill,
|
||||
file: this.file,
|
||||
since: this.since,
|
||||
limit,
|
||||
});
|
||||
|
||||
if (this.json) {
|
||||
console.log(lineage.formatJson(data));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (data.skills.length === 0) {
|
||||
console.log(chalk.yellow('No skill lineage found.'));
|
||||
console.log(chalk.dim('Lineage is built from skill execution history and activity logs.'));
|
||||
return 0;
|
||||
}
|
||||
|
||||
console.log(lineage.formatText(data));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ export class MarketplaceCommand extends Command {
|
||||
from curated repositories.
|
||||
|
||||
Skills are aggregated from multiple sources including:
|
||||
- composioHQ/awesome-claude-code-skills
|
||||
- composioHQ/awesome-claude-skills
|
||||
- anthropics/courses
|
||||
- User-added custom sources
|
||||
`,
|
||||
|
||||
@@ -351,7 +351,7 @@ export class QuickCommand extends Command {
|
||||
console.log('');
|
||||
const badgeUrl = `https://img.shields.io/badge/SkillKit-${encodeURIComponent(matchedSkill.name)}-black?style=flat-square`;
|
||||
console.log(colors.dim('Add to your README:'));
|
||||
console.log(colors.muted(` [](https://agenstskills.com)`));
|
||||
console.log(colors.muted(` [](https://skillkit.sh)`));
|
||||
|
||||
outro('Quick setup complete!');
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
import { Command, Option } from 'clipanion';
|
||||
import chalk from 'chalk';
|
||||
import { SessionTimeline } from '@skillkit/core';
|
||||
import type { TimelineEventType } from '@skillkit/core';
|
||||
|
||||
export class TimelineCommand extends Command {
|
||||
static override paths = [['timeline']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Show unified session event timeline',
|
||||
examples: [
|
||||
['Show last 50 events', '$0 timeline'],
|
||||
['Filter by type', '$0 timeline --type git_commit'],
|
||||
['Filter by skill', '$0 timeline --skill code-simplifier'],
|
||||
['Date filter', '$0 timeline --since 2026-02-10'],
|
||||
['JSON output with limit', '$0 timeline --limit 20 --json'],
|
||||
],
|
||||
});
|
||||
|
||||
type = Option.String('--type,-t', {
|
||||
description: 'Filter by event type (skill_start, skill_complete, task_progress, git_commit, observation, decision, snapshot)',
|
||||
});
|
||||
|
||||
skill = Option.String('--skill,-s', {
|
||||
description: 'Filter by skill name',
|
||||
});
|
||||
|
||||
since = Option.String('--since', {
|
||||
description: 'Show events since date (YYYY-MM-DD)',
|
||||
});
|
||||
|
||||
limit = Option.String('--limit,-l', {
|
||||
description: 'Max events to show (default: 50)',
|
||||
});
|
||||
|
||||
json = Option.Boolean('--json,-j', false, {
|
||||
description: 'Output as JSON',
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const projectPath = process.cwd();
|
||||
const timeline = new SessionTimeline(projectPath);
|
||||
|
||||
const parsed = this.limit ? parseInt(this.limit, 10) : 50;
|
||||
const limit = Number.isFinite(parsed) && parsed > 0 ? parsed : 50;
|
||||
|
||||
const validTypes: TimelineEventType[] = [
|
||||
'skill_start', 'skill_complete', 'task_progress',
|
||||
'git_commit', 'observation', 'decision', 'snapshot',
|
||||
];
|
||||
|
||||
let types: TimelineEventType[] | undefined;
|
||||
if (this.type) {
|
||||
if (!validTypes.includes(this.type as TimelineEventType)) {
|
||||
console.log(chalk.red(`Invalid event type: ${this.type}`));
|
||||
console.log(chalk.dim(`Valid types: ${validTypes.join(', ')}`));
|
||||
return 1;
|
||||
}
|
||||
types = [this.type as TimelineEventType];
|
||||
}
|
||||
|
||||
const data = timeline.build({
|
||||
since: this.since,
|
||||
types,
|
||||
limit,
|
||||
skillFilter: this.skill,
|
||||
});
|
||||
|
||||
if (this.json) {
|
||||
console.log(timeline.formatJson(data));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (data.events.length === 0) {
|
||||
console.log(chalk.yellow('No timeline events found.'));
|
||||
console.log(chalk.dim('Events are recorded during skill execution, git commits, and observations.'));
|
||||
return 0;
|
||||
}
|
||||
|
||||
console.log(timeline.formatText(data));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,9 @@ import {
|
||||
initProject as coreInitProject,
|
||||
loadSkillMetadata as coreLoadSkillMetadata,
|
||||
saveSkillMetadata as coreSaveSkillMetadata,
|
||||
} from '@skillkit/core';
|
||||
import { getAdapter, detectAgent } from '@skillkit/agents';
|
||||
import type { AgentType, AgentAdapterInfo } from '@skillkit/core';
|
||||
} from "@skillkit/core";
|
||||
import { getAdapter, detectAgent } from "@skillkit/agents";
|
||||
import type { AgentType, AgentAdapterInfo } from "@skillkit/core";
|
||||
|
||||
// Re-export metadata functions directly (they don't need adapter bridging)
|
||||
export const loadSkillMetadata = coreLoadSkillMetadata;
|
||||
@@ -62,3 +62,9 @@ export async function initProject(agentType?: AgentType): Promise<void> {
|
||||
};
|
||||
return coreInitProject(type, adapterInfo);
|
||||
}
|
||||
|
||||
export function formatCount(count: number): string {
|
||||
if (count >= 1_000_000) return `${(count / 1_000_000).toFixed(1)}M`;
|
||||
if (count >= 1_000) return `${(count / 1_000).toFixed(1)}K`;
|
||||
return String(count);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/core",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "Core functionality for SkillKit - skill discovery, parsing, and translation",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
import type { GitProviderAdapter } from './base.js';
|
||||
import type { GitProvider } from '../types.js';
|
||||
import { GitHubProvider } from './github.js';
|
||||
import { GitLabProvider } from './gitlab.js';
|
||||
import { BitbucketProvider } from './bitbucket.js';
|
||||
import { LocalProvider } from './local.js';
|
||||
import { WellKnownProvider } from './wellknown.js';
|
||||
import type { GitProviderAdapter } from "./base.js";
|
||||
import type { GitProvider } from "../types.js";
|
||||
import { GitHubProvider } from "./github.js";
|
||||
import { GitLabProvider } from "./gitlab.js";
|
||||
import { BitbucketProvider } from "./bitbucket.js";
|
||||
import { LocalProvider } from "./local.js";
|
||||
import { WellKnownProvider } from "./wellknown.js";
|
||||
import { SkillsShProvider } from "./skills-sh.js";
|
||||
|
||||
export * from './base.js';
|
||||
export * from './github.js';
|
||||
export * from './gitlab.js';
|
||||
export * from './bitbucket.js';
|
||||
export * from './local.js';
|
||||
export * from './wellknown.js';
|
||||
export * from "./base.js";
|
||||
export * from "./github.js";
|
||||
export * from "./gitlab.js";
|
||||
export * from "./bitbucket.js";
|
||||
export * from "./local.js";
|
||||
export * from "./wellknown.js";
|
||||
export * from "./skills-sh.js";
|
||||
|
||||
const providers: GitProviderAdapter[] = [
|
||||
new LocalProvider(),
|
||||
new SkillsShProvider(),
|
||||
new GitLabProvider(),
|
||||
new BitbucketProvider(),
|
||||
new WellKnownProvider(),
|
||||
@@ -22,7 +25,7 @@ const providers: GitProviderAdapter[] = [
|
||||
];
|
||||
|
||||
export function getProvider(type: GitProvider): GitProviderAdapter | undefined {
|
||||
return providers.find(p => p.type === type);
|
||||
return providers.find((p) => p.type === type);
|
||||
}
|
||||
|
||||
export function getAllProviders(): GitProviderAdapter[] {
|
||||
@@ -30,7 +33,7 @@ export function getAllProviders(): GitProviderAdapter[] {
|
||||
}
|
||||
|
||||
export function detectProvider(source: string): GitProviderAdapter | undefined {
|
||||
return providers.find(p => p.matches(source));
|
||||
return providers.find((p) => p.matches(source));
|
||||
}
|
||||
|
||||
export function parseSource(source: string): {
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { existsSync, rmSync } from "node:fs";
|
||||
import { join, basename, resolve } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import type { GitProviderAdapter, CloneOptions } from "./base.js";
|
||||
import type { GitProvider, CloneResult } from "../types.js";
|
||||
import { discoverSkills } from "../skills.js";
|
||||
|
||||
/**
|
||||
* Resolves `skills.sh/owner/repo/skill` references to their underlying
|
||||
* GitHub repos and clones them the same way the GitHubProvider does.
|
||||
*/
|
||||
export class SkillsShProvider implements GitProviderAdapter {
|
||||
readonly type: GitProvider = "skills-sh";
|
||||
readonly name = "Skills.sh";
|
||||
readonly baseUrl = "https://skills.sh";
|
||||
|
||||
parseSource(
|
||||
source: string,
|
||||
): { owner: string; repo: string; subpath?: string } | null {
|
||||
const cleaned = source
|
||||
.replace(/^https?:\/\//, "")
|
||||
.replace(/^skills\.sh\//, "");
|
||||
|
||||
if (!this.isSkillsShSource(source)) return null;
|
||||
|
||||
const parts = cleaned.split("/").filter(Boolean);
|
||||
if (parts.length < 2) return null;
|
||||
|
||||
return {
|
||||
owner: parts[0],
|
||||
repo: parts[1],
|
||||
subpath: parts.length > 2 ? parts.slice(2).join("/") : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
matches(source: string): boolean {
|
||||
return this.isSkillsShSource(source);
|
||||
}
|
||||
|
||||
getCloneUrl(owner: string, repo: string): string {
|
||||
return `https://github.com/${owner}/${repo}.git`;
|
||||
}
|
||||
|
||||
getSshUrl(owner: string, repo: string): string {
|
||||
return `git@github.com:${owner}/${repo}.git`;
|
||||
}
|
||||
|
||||
async clone(
|
||||
source: string,
|
||||
_targetDir: string,
|
||||
options: CloneOptions = {},
|
||||
): Promise<CloneResult> {
|
||||
const parsed = this.parseSource(source);
|
||||
if (!parsed) {
|
||||
return { success: false, error: `Invalid skills.sh source: ${source}` };
|
||||
}
|
||||
|
||||
const { owner, repo, subpath } = parsed;
|
||||
const cloneUrl = options.ssh
|
||||
? this.getSshUrl(owner, repo)
|
||||
: this.getCloneUrl(owner, repo);
|
||||
|
||||
const tempDir = join(tmpdir(), `skillkit-skillssh-${randomUUID()}`);
|
||||
|
||||
try {
|
||||
const args = ["clone"];
|
||||
if (options.depth) {
|
||||
args.push("--depth", String(options.depth));
|
||||
}
|
||||
if (options.branch) {
|
||||
args.push("--branch", options.branch);
|
||||
}
|
||||
args.push(cloneUrl, tempDir);
|
||||
|
||||
execFileSync("git", args, {
|
||||
stdio: ["pipe", "pipe", "pipe"],
|
||||
encoding: "utf-8",
|
||||
});
|
||||
|
||||
const searchDir = subpath ? join(tempDir, subpath) : tempDir;
|
||||
|
||||
if (!resolve(searchDir).startsWith(resolve(tempDir))) {
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
return {
|
||||
success: false,
|
||||
error: `Invalid subpath in source: ${source}`,
|
||||
};
|
||||
}
|
||||
|
||||
const skills = discoverSkills(searchDir);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
path: searchDir,
|
||||
tempRoot: tempDir,
|
||||
skills: skills.map((s) => s.name),
|
||||
discoveredSkills: skills.map((s) => ({
|
||||
name: s.name,
|
||||
dirName: basename(s.path),
|
||||
path: s.path,
|
||||
})),
|
||||
};
|
||||
} catch (error) {
|
||||
if (existsSync(tempDir)) {
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return { success: false, error: `Failed to clone: ${message}` };
|
||||
}
|
||||
}
|
||||
|
||||
private isSkillsShSource(source: string): boolean {
|
||||
return (
|
||||
source.startsWith("skills.sh/") ||
|
||||
source.startsWith("https://skills.sh/") ||
|
||||
source.startsWith("http://skills.sh/")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import { discoverSkills, extractFrontmatter } from '../skills.js';
|
||||
export const KNOWN_SKILL_REPOS = [
|
||||
{ owner: 'anthropics', repo: 'courses', description: 'Anthropic official courses and skills' },
|
||||
{ owner: 'vercel-labs', repo: 'ai-sdk-preview-internal-knowledge-base', description: 'Vercel AI SDK skills' },
|
||||
{ owner: 'composioHQ', repo: 'awesome-claude-code-skills', description: 'Curated Claude Code skills' },
|
||||
{ owner: 'composioHQ', repo: 'awesome-claude-skills', description: 'Curated Claude Code skills' },
|
||||
] as const;
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,10 @@ export interface ExternalSkill {
|
||||
|
||||
export interface ExternalRegistry {
|
||||
name: string;
|
||||
search(query: string, options?: { limit?: number; timeoutMs?: number }): Promise<ExternalSkill[]>;
|
||||
search(
|
||||
query: string,
|
||||
options?: { limit?: number; timeoutMs?: number },
|
||||
): Promise<ExternalSkill[]>;
|
||||
}
|
||||
|
||||
export interface FederatedResult {
|
||||
@@ -22,16 +25,21 @@ export interface FederatedResult {
|
||||
|
||||
export class RateLimitError extends Error {
|
||||
constructor(registry: string) {
|
||||
super(`Rate limited by ${registry} API. Authenticate with a token or wait before retrying.`);
|
||||
this.name = 'RateLimitError';
|
||||
super(
|
||||
`Rate limited by ${registry} API. Authenticate with a token or wait before retrying.`,
|
||||
);
|
||||
this.name = "RateLimitError";
|
||||
}
|
||||
}
|
||||
|
||||
export class GitHubSkillRegistry implements ExternalRegistry {
|
||||
name = 'github';
|
||||
private baseUrl = 'https://api.github.com';
|
||||
name = "github";
|
||||
private baseUrl = "https://api.github.com";
|
||||
|
||||
async search(query: string, options?: { limit?: number; timeoutMs?: number }): Promise<ExternalSkill[]> {
|
||||
async search(
|
||||
query: string,
|
||||
options?: { limit?: number; timeoutMs?: number },
|
||||
): Promise<ExternalSkill[]> {
|
||||
const limit = options?.limit ?? 20;
|
||||
const timeoutMs = options?.timeoutMs ?? 10_000;
|
||||
const searchQuery = `SKILL.md ${query} in:path,file`;
|
||||
@@ -41,8 +49,8 @@ export class GitHubSkillRegistry implements ExternalRegistry {
|
||||
|
||||
try {
|
||||
const headers: Record<string, string> = {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
'User-Agent': 'skillkit-cli',
|
||||
Accept: "application/vnd.github.v3+json",
|
||||
"User-Agent": "skillkit-cli",
|
||||
};
|
||||
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
||||
if (token) {
|
||||
@@ -89,15 +97,15 @@ export class GitHubSkillRegistry implements ExternalRegistry {
|
||||
if (seen.has(repo)) continue;
|
||||
seen.add(repo);
|
||||
|
||||
const pathParts = item.path.split('/');
|
||||
const pathParts = item.path.split("/");
|
||||
const skillName =
|
||||
pathParts.length > 1
|
||||
? pathParts[pathParts.length - 2]
|
||||
: repo.split('/').pop() || repo;
|
||||
: repo.split("/").pop() || repo;
|
||||
|
||||
skills.push({
|
||||
name: skillName,
|
||||
description: item.repository.description || '',
|
||||
description: item.repository.description || "",
|
||||
source: item.repository.html_url,
|
||||
registry: this.name,
|
||||
path: item.path,
|
||||
@@ -115,7 +123,9 @@ export class GitHubSkillRegistry implements ExternalRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
export { CommunityRegistry } from './community.js';
|
||||
export { CommunityRegistry } from "./community.js";
|
||||
export { SkillsShRegistry, resolveSkillsShUrl } from "./skills-sh.js";
|
||||
export type { SkillsShStats } from "./skills-sh.js";
|
||||
|
||||
export class FederatedSearch {
|
||||
private registries: ExternalRegistry[] = [];
|
||||
@@ -124,10 +134,15 @@ export class FederatedSearch {
|
||||
this.registries.push(registry);
|
||||
}
|
||||
|
||||
async search(query: string, options?: { limit?: number }): Promise<FederatedResult> {
|
||||
async search(
|
||||
query: string,
|
||||
options?: { limit?: number; timeoutMs?: number },
|
||||
): Promise<FederatedResult> {
|
||||
const limit = options?.limit ?? 20;
|
||||
const results = await Promise.allSettled(
|
||||
this.registries.map((r) => r.search(query, { limit })),
|
||||
this.registries.map((r) =>
|
||||
r.search(query, { limit, timeoutMs: options?.timeoutMs }),
|
||||
),
|
||||
);
|
||||
|
||||
const allSkills: ExternalSkill[] = [];
|
||||
@@ -135,11 +150,9 @@ export class FederatedSearch {
|
||||
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
const result = results[i];
|
||||
if (result.status === 'fulfilled' && result.value.length > 0) {
|
||||
if (result.status === "fulfilled" && result.value.length > 0) {
|
||||
allSkills.push(...result.value);
|
||||
activeRegistries.push(this.registries[i].name);
|
||||
} else if (result.status === 'rejected' && result.reason instanceof RateLimitError) {
|
||||
throw result.reason;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
import type { ExternalRegistry, ExternalSkill } from "./index.js";
|
||||
|
||||
const SKILLS_SH_BASE = "https://skills.sh";
|
||||
const SKILLS_SH_CACHE_TTL = 10 * 60 * 1000; // 10 minutes
|
||||
|
||||
export interface SkillsShStats {
|
||||
rank: number;
|
||||
installs: number;
|
||||
name: string;
|
||||
source: string;
|
||||
skillName: string;
|
||||
}
|
||||
|
||||
interface CachedLeaderboard {
|
||||
skills: ExternalSkill[];
|
||||
fetchedAt: number;
|
||||
}
|
||||
|
||||
export class SkillsShRegistry implements ExternalRegistry {
|
||||
name = "skills.sh";
|
||||
private cache: CachedLeaderboard | null = null;
|
||||
|
||||
async search(
|
||||
query: string,
|
||||
options?: { limit?: number; timeoutMs?: number },
|
||||
): Promise<ExternalSkill[]> {
|
||||
const limit = options?.limit ?? 20;
|
||||
const skills = await this.fetchLeaderboard(options?.timeoutMs);
|
||||
const q = query.toLowerCase();
|
||||
|
||||
return skills
|
||||
.filter(
|
||||
(s) =>
|
||||
s.name.toLowerCase().includes(q) ||
|
||||
s.description.toLowerCase().includes(q) ||
|
||||
s.source.toLowerCase().includes(q),
|
||||
)
|
||||
.slice(0, limit);
|
||||
}
|
||||
|
||||
async getLeaderboard(
|
||||
limit = 50,
|
||||
timeoutMs?: number,
|
||||
): Promise<ExternalSkill[]> {
|
||||
const skills = await this.fetchLeaderboard(timeoutMs);
|
||||
return skills.slice(0, limit);
|
||||
}
|
||||
|
||||
async getSkillStats(
|
||||
owner: string,
|
||||
repo: string,
|
||||
skillName: string,
|
||||
): Promise<SkillsShStats | null> {
|
||||
const skills = await this.fetchLeaderboard();
|
||||
const source = `${owner}/${repo}`;
|
||||
|
||||
for (let i = 0; i < skills.length; i++) {
|
||||
const skill = skills[i];
|
||||
if (skill.name === skillName && skill.source.endsWith(`/${source}`)) {
|
||||
return {
|
||||
rank: i + 1,
|
||||
installs: skill.stars ?? 0,
|
||||
name: skill.name,
|
||||
source: skill.source,
|
||||
skillName,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private async fetchLeaderboard(timeoutMs = 15_000): Promise<ExternalSkill[]> {
|
||||
if (this.cache && Date.now() - this.cache.fetchedAt < SKILLS_SH_CACHE_TTL) {
|
||||
return this.cache.skills;
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
||||
|
||||
try {
|
||||
const response = await fetch(SKILLS_SH_BASE, {
|
||||
headers: {
|
||||
Accept: "text/html",
|
||||
"User-Agent": "skillkit-cli",
|
||||
},
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
if (!response.ok) return this.cache?.skills ?? [];
|
||||
|
||||
const html = await response.text();
|
||||
const skills = this.parseLeaderboard(html);
|
||||
|
||||
this.cache = { skills, fetchedAt: Date.now() };
|
||||
return skills;
|
||||
} catch {
|
||||
return this.cache?.skills ?? [];
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
|
||||
private parseLeaderboard(html: string): ExternalSkill[] {
|
||||
const skills: ExternalSkill[] = [];
|
||||
|
||||
const lines = html.split("\n");
|
||||
for (const line of lines) {
|
||||
// Match patterns like: [1vercel-labs/skills290.0K] from the page links
|
||||
const hrefMatch = line.match(
|
||||
/href="\/([^/]+)\/([^/]+)\/([^"]+)".*?(\d[\d,.]*[KMB]?)\s*<\/a>/,
|
||||
);
|
||||
if (hrefMatch) {
|
||||
const [, owner, repo, skillName, installStr] = hrefMatch;
|
||||
const installs = this.parseInstallCount(installStr);
|
||||
|
||||
skills.push({
|
||||
name: skillName,
|
||||
description: `${owner}/${repo}`,
|
||||
source: `https://github.com/${owner}/${repo}`,
|
||||
registry: this.name,
|
||||
path: skillName,
|
||||
stars: installs,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: try simpler pattern matching if structured parsing found nothing
|
||||
if (skills.length === 0) {
|
||||
const simplePattern = /skills\.sh\/([^/]+)\/([^/]+)\/([^/"]+)/g;
|
||||
let match;
|
||||
while ((match = simplePattern.exec(html)) !== null) {
|
||||
const [, owner, repo, skillName] = match;
|
||||
skills.push({
|
||||
name: skillName,
|
||||
description: `${owner}/${repo}`,
|
||||
source: `https://github.com/${owner}/${repo}`,
|
||||
registry: this.name,
|
||||
path: skillName,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return skills;
|
||||
}
|
||||
|
||||
private parseInstallCount(str: string): number {
|
||||
if (!str) return 0;
|
||||
const cleaned = str.replace(/,/g, "");
|
||||
const multiplier = cleaned.endsWith("K")
|
||||
? 1_000
|
||||
: cleaned.endsWith("M")
|
||||
? 1_000_000
|
||||
: cleaned.endsWith("B")
|
||||
? 1_000_000_000
|
||||
: 1;
|
||||
const num = parseFloat(cleaned.replace(/[KMB]$/, ""));
|
||||
return Math.round(num * multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
function parseSkillsShParts(
|
||||
source: string,
|
||||
): { owner: string; repo: string; rest?: string } | null {
|
||||
const cleaned = source
|
||||
.replace(/^https?:\/\//, "")
|
||||
.replace(/^skills\.sh\//, "");
|
||||
|
||||
const parts = cleaned.split("/").filter(Boolean);
|
||||
if (parts.length < 2) return null;
|
||||
|
||||
return {
|
||||
owner: parts[0],
|
||||
repo: parts[1],
|
||||
rest: parts.length > 2 ? parts.slice(2).join("/") : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export function resolveSkillsShUrl(
|
||||
source: string,
|
||||
): { owner: string; repo: string; skillName?: string } | null {
|
||||
const parsed = parseSkillsShParts(source);
|
||||
if (!parsed) return null;
|
||||
|
||||
return {
|
||||
owner: parsed.owner,
|
||||
repo: parsed.repo,
|
||||
skillName: parsed.rest,
|
||||
};
|
||||
}
|
||||
@@ -125,13 +125,13 @@ export function formatSarif(result: ScanResult): string {
|
||||
driver: {
|
||||
name: 'skillkit-scanner',
|
||||
version: SCANNER_VERSION,
|
||||
informationUri: 'https://agenstskills.com',
|
||||
informationUri: 'https://skillkit.sh',
|
||||
rules: [...rules.values()].map((r) => ({
|
||||
id: r.ruleId,
|
||||
name: r.ruleId,
|
||||
shortDescription: { text: r.title },
|
||||
fullDescription: { text: r.description },
|
||||
helpUri: 'https://agenstskills.com/docs/security',
|
||||
helpUri: 'https://skillkit.sh/docs/security',
|
||||
defaultConfiguration: {
|
||||
level: severityToSarif[r.severity] ?? 'warning',
|
||||
},
|
||||
|
||||
@@ -0,0 +1,361 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import { mkdirSync, writeFileSync, rmSync, existsSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { stringify } from 'yaml';
|
||||
import { SessionHandoff } from '../handoff.js';
|
||||
import type { SessionState } from '../types.js';
|
||||
|
||||
const TEST_DIR = join(process.cwd(), '.test-handoff-' + process.pid);
|
||||
const SKILLKIT_DIR = join(TEST_DIR, '.skillkit');
|
||||
|
||||
function writeSessionState(state: SessionState): void {
|
||||
mkdirSync(SKILLKIT_DIR, { recursive: true });
|
||||
writeFileSync(join(SKILLKIT_DIR, 'session.yaml'), stringify(state));
|
||||
}
|
||||
|
||||
function writeObservations(observations: Array<Record<string, unknown>>): void {
|
||||
const dir = join(SKILLKIT_DIR, 'memory');
|
||||
mkdirSync(dir, { recursive: true });
|
||||
writeFileSync(
|
||||
join(dir, 'observations.yaml'),
|
||||
stringify({ version: 1, sessionId: 'test', observations })
|
||||
);
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
mkdirSync(TEST_DIR, { recursive: true });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (existsSync(TEST_DIR)) {
|
||||
rmSync(TEST_DIR, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
describe('SessionHandoff', () => {
|
||||
it('should create handoff instance', () => {
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
expect(handoff).toBeDefined();
|
||||
});
|
||||
|
||||
it('should generate empty handoff when no data', () => {
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false });
|
||||
|
||||
expect(doc.generatedAt).toBeTruthy();
|
||||
expect(doc.projectPath).toBe(TEST_DIR);
|
||||
expect(doc.accomplished.tasks).toEqual([]);
|
||||
expect(doc.pending.tasks).toEqual([]);
|
||||
expect(doc.keyFiles).toEqual([]);
|
||||
});
|
||||
|
||||
it('should collect accomplished tasks', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
currentExecution: {
|
||||
skillName: 'test-skill',
|
||||
skillSource: 'test',
|
||||
currentStep: 2,
|
||||
totalSteps: 3,
|
||||
status: 'running',
|
||||
startedAt: '2026-02-12T10:00:00.000Z',
|
||||
tasks: [
|
||||
{
|
||||
id: 't1',
|
||||
name: 'Setup project',
|
||||
type: 'auto',
|
||||
status: 'completed',
|
||||
startedAt: '2026-02-12T10:00:00.000Z',
|
||||
completedAt: '2026-02-12T10:03:00.000Z',
|
||||
commitSha: 'abc1234',
|
||||
},
|
||||
{
|
||||
id: 't2',
|
||||
name: 'Write tests',
|
||||
type: 'auto',
|
||||
status: 'completed',
|
||||
startedAt: '2026-02-12T10:03:00.000Z',
|
||||
completedAt: '2026-02-12T10:08:00.000Z',
|
||||
},
|
||||
{
|
||||
id: 't3',
|
||||
name: 'Update docs',
|
||||
type: 'auto',
|
||||
status: 'pending',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false });
|
||||
|
||||
expect(doc.accomplished.tasks.length).toBe(2);
|
||||
expect(doc.accomplished.tasks[0].name).toBe('Setup project');
|
||||
expect(doc.accomplished.tasks[0].duration).toBe('3m');
|
||||
expect(doc.accomplished.tasks[0].commitSha).toBe('abc1234');
|
||||
});
|
||||
|
||||
it('should collect pending tasks', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
currentExecution: {
|
||||
skillName: 'test-skill',
|
||||
skillSource: 'test',
|
||||
currentStep: 0,
|
||||
totalSteps: 2,
|
||||
status: 'running',
|
||||
startedAt: '2026-02-12T10:00:00.000Z',
|
||||
tasks: [
|
||||
{ id: 't1', name: 'Pending task', type: 'auto', status: 'pending' },
|
||||
{ id: 't2', name: 'In progress task', type: 'auto', status: 'in_progress', startedAt: '2026-02-12T10:00:00.000Z' },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false });
|
||||
|
||||
expect(doc.pending.tasks.length).toBe(2);
|
||||
expect(doc.pending.tasks[0].name).toBe('Pending task');
|
||||
expect(doc.pending.tasks[1].name).toBe('In progress task');
|
||||
});
|
||||
|
||||
it('should collect key files from tasks and history', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'old-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-11T15:00:00.000Z',
|
||||
durationMs: 120000,
|
||||
status: 'completed',
|
||||
commits: [],
|
||||
filesModified: ['src/old.ts', 'src/shared.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
currentExecution: {
|
||||
skillName: 'test-skill',
|
||||
skillSource: 'test',
|
||||
currentStep: 1,
|
||||
totalSteps: 1,
|
||||
status: 'running',
|
||||
startedAt: '2026-02-12T10:00:00.000Z',
|
||||
tasks: [
|
||||
{
|
||||
id: 't1',
|
||||
name: 'Task 1',
|
||||
type: 'auto',
|
||||
status: 'completed',
|
||||
filesModified: ['src/new.ts', 'src/shared.ts'],
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false });
|
||||
|
||||
expect(doc.keyFiles.length).toBe(3);
|
||||
const paths = doc.keyFiles.map((f) => f.path);
|
||||
expect(paths).toContain('src/new.ts');
|
||||
expect(paths).toContain('src/old.ts');
|
||||
expect(paths).toContain('src/shared.ts');
|
||||
});
|
||||
|
||||
it('should collect observations by type', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
writeObservations([
|
||||
{
|
||||
id: 'o1',
|
||||
timestamp: '2026-02-12T10:00:00.000Z',
|
||||
sessionId: 'test',
|
||||
agent: 'claude-code',
|
||||
type: 'error',
|
||||
content: { action: 'build', context: 'src', error: 'missing import' },
|
||||
relevance: 90,
|
||||
},
|
||||
{
|
||||
id: 'o2',
|
||||
timestamp: '2026-02-12T10:01:00.000Z',
|
||||
sessionId: 'test',
|
||||
agent: 'claude-code',
|
||||
type: 'solution',
|
||||
content: { action: 'fix', context: 'src', solution: 'added import' },
|
||||
relevance: 85,
|
||||
},
|
||||
{
|
||||
id: 'o3',
|
||||
timestamp: '2026-02-12T10:02:00.000Z',
|
||||
sessionId: 'test',
|
||||
agent: 'claude-code',
|
||||
type: 'pattern',
|
||||
content: { action: 'review', context: 'always check imports' },
|
||||
relevance: 70,
|
||||
},
|
||||
]);
|
||||
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false });
|
||||
|
||||
expect(doc.observations.errors.length).toBe(1);
|
||||
expect(doc.observations.errors[0].error).toBe('missing import');
|
||||
expect(doc.observations.solutions.length).toBe(1);
|
||||
expect(doc.observations.solutions[0].solution).toBe('added import');
|
||||
expect(doc.observations.patterns.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should generate recommendations from pending tasks', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
currentExecution: {
|
||||
skillName: 'test-skill',
|
||||
skillSource: 'test',
|
||||
currentStep: 0,
|
||||
totalSteps: 1,
|
||||
status: 'running',
|
||||
startedAt: '2026-02-12T10:00:00.000Z',
|
||||
tasks: [
|
||||
{ id: 't1', name: 'Write documentation', type: 'auto', status: 'pending' },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false });
|
||||
|
||||
expect(doc.recommendations.length).toBeGreaterThan(0);
|
||||
expect(doc.recommendations[0]).toContain('Write documentation');
|
||||
});
|
||||
|
||||
it('should format markdown output', () => {
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false });
|
||||
const md = handoff.toMarkdown(doc);
|
||||
|
||||
expect(md).toContain('# Session Handoff');
|
||||
expect(md).toContain('## Accomplished');
|
||||
expect(md).toContain('## Pending');
|
||||
});
|
||||
|
||||
it('should format JSON output', () => {
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false });
|
||||
const json = handoff.toJson(doc);
|
||||
|
||||
const parsed = JSON.parse(json);
|
||||
expect(parsed.projectPath).toBe(TEST_DIR);
|
||||
expect(parsed.accomplished).toBeDefined();
|
||||
expect(parsed.pending).toBeDefined();
|
||||
});
|
||||
|
||||
it('should include history in accomplished', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'completed-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T09:00:00.000Z',
|
||||
durationMs: 300000,
|
||||
status: 'completed',
|
||||
commits: ['def5678'],
|
||||
filesModified: ['src/foo.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false });
|
||||
|
||||
expect(doc.accomplished.tasks.length).toBe(1);
|
||||
expect(doc.accomplished.tasks[0].name).toBe('completed-skill');
|
||||
expect(doc.accomplished.tasks[0].duration).toBe('5m');
|
||||
});
|
||||
|
||||
it('should respect maxObservations option', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
writeObservations(
|
||||
Array.from({ length: 10 }, (_, i) => ({
|
||||
id: `o${i}`,
|
||||
timestamp: `2026-02-12T10:${String(i).padStart(2, '0')}:00.000Z`,
|
||||
sessionId: 'test',
|
||||
agent: 'claude-code',
|
||||
type: 'error',
|
||||
content: { action: `action-${i}`, context: 'src', error: `error-${i}` },
|
||||
relevance: 90 - i,
|
||||
}))
|
||||
);
|
||||
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false, maxObservations: 3 });
|
||||
|
||||
const totalObs =
|
||||
doc.observations.errors.length +
|
||||
doc.observations.solutions.length +
|
||||
doc.observations.patterns.length;
|
||||
expect(totalObs).toBeLessThanOrEqual(3);
|
||||
});
|
||||
|
||||
it('should skip observations when disabled', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
writeObservations([
|
||||
{
|
||||
id: 'o1',
|
||||
timestamp: '2026-02-12T10:00:00.000Z',
|
||||
sessionId: 'test',
|
||||
agent: 'claude-code',
|
||||
type: 'error',
|
||||
content: { action: 'build', context: 'src', error: 'fail' },
|
||||
relevance: 90,
|
||||
},
|
||||
]);
|
||||
|
||||
const handoff = new SessionHandoff(TEST_DIR);
|
||||
const doc = handoff.generate({ includeGit: false, includeObservations: false });
|
||||
|
||||
expect(doc.observations.errors).toEqual([]);
|
||||
expect(doc.observations.solutions).toEqual([]);
|
||||
expect(doc.observations.patterns).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,554 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import { mkdirSync, writeFileSync, rmSync, existsSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { stringify } from 'yaml';
|
||||
import { SkillLineage } from '../lineage.js';
|
||||
import type { SessionState } from '../types.js';
|
||||
|
||||
const TEST_DIR = join(process.cwd(), '.test-lineage-' + process.pid);
|
||||
const SKILLKIT_DIR = join(TEST_DIR, '.skillkit');
|
||||
|
||||
function writeSessionState(state: SessionState): void {
|
||||
mkdirSync(SKILLKIT_DIR, { recursive: true });
|
||||
writeFileSync(join(SKILLKIT_DIR, 'session.yaml'), stringify(state));
|
||||
}
|
||||
|
||||
function writeActivityLog(activities: Array<Record<string, unknown>>): void {
|
||||
mkdirSync(SKILLKIT_DIR, { recursive: true });
|
||||
writeFileSync(
|
||||
join(SKILLKIT_DIR, 'activity.yaml'),
|
||||
stringify({ version: 1, activities })
|
||||
);
|
||||
}
|
||||
|
||||
function writeObservations(observations: Array<Record<string, unknown>>): void {
|
||||
const dir = join(SKILLKIT_DIR, 'memory');
|
||||
mkdirSync(dir, { recursive: true });
|
||||
writeFileSync(
|
||||
join(dir, 'observations.yaml'),
|
||||
stringify({ version: 1, sessionId: 'test', observations })
|
||||
);
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
mkdirSync(TEST_DIR, { recursive: true });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (existsSync(TEST_DIR)) {
|
||||
rmSync(TEST_DIR, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
describe('SkillLineage', () => {
|
||||
it('should create lineage instance', () => {
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
expect(lineage).toBeDefined();
|
||||
});
|
||||
|
||||
it('should return empty lineage when no data', () => {
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build();
|
||||
|
||||
expect(data.skills).toEqual([]);
|
||||
expect(data.files).toEqual([]);
|
||||
expect(data.stats.totalSkillExecutions).toBe(0);
|
||||
expect(data.stats.mostImpactfulSkill).toBeNull();
|
||||
});
|
||||
|
||||
it('should build lineage from execution history', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'code-simplifier',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 120000,
|
||||
status: 'completed',
|
||||
commits: ['abc1234', 'def5678'],
|
||||
filesModified: ['src/index.ts', 'src/utils.ts'],
|
||||
},
|
||||
{
|
||||
skillName: 'code-simplifier',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T11:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['ghi9012'],
|
||||
filesModified: ['src/index.ts'],
|
||||
},
|
||||
{
|
||||
skillName: 'pro-workflow',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T12:00:00.000Z',
|
||||
durationMs: 180000,
|
||||
status: 'completed',
|
||||
commits: ['jkl3456'],
|
||||
filesModified: ['src/index.ts', 'README.md'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build();
|
||||
|
||||
expect(data.skills.length).toBe(2);
|
||||
|
||||
const cs = data.skills.find((s) => s.skillName === 'code-simplifier');
|
||||
expect(cs).toBeDefined();
|
||||
expect(cs!.executions).toBe(2);
|
||||
expect(cs!.totalDurationMs).toBe(180000);
|
||||
expect(cs!.commits.length).toBe(3);
|
||||
expect(cs!.filesModified).toContain('src/index.ts');
|
||||
expect(cs!.filesModified).toContain('src/utils.ts');
|
||||
|
||||
const pw = data.skills.find((s) => s.skillName === 'pro-workflow');
|
||||
expect(pw).toBeDefined();
|
||||
expect(pw!.executions).toBe(1);
|
||||
});
|
||||
|
||||
it('should build file lineage', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'skill-a',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['abc'],
|
||||
filesModified: ['src/shared.ts'],
|
||||
},
|
||||
{
|
||||
skillName: 'skill-b',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T11:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['def'],
|
||||
filesModified: ['src/shared.ts', 'src/only-b.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build();
|
||||
|
||||
const shared = data.files.find((f) => f.path === 'src/shared.ts');
|
||||
expect(shared).toBeDefined();
|
||||
expect(shared!.skills.length).toBe(2);
|
||||
expect(shared!.skills).toContain('skill-a');
|
||||
expect(shared!.skills).toContain('skill-b');
|
||||
});
|
||||
|
||||
it('should compute stats', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'big-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['a', 'b'],
|
||||
filesModified: ['f1.ts', 'f2.ts', 'f3.ts'],
|
||||
},
|
||||
{
|
||||
skillName: 'small-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T11:00:00.000Z',
|
||||
durationMs: 30000,
|
||||
status: 'completed',
|
||||
commits: ['c'],
|
||||
filesModified: ['f1.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build();
|
||||
|
||||
expect(data.stats.totalSkillExecutions).toBe(2);
|
||||
expect(data.stats.totalCommits).toBe(3);
|
||||
expect(data.stats.totalFilesChanged).toBe(3);
|
||||
expect(data.stats.mostImpactfulSkill).toBe('big-skill');
|
||||
});
|
||||
|
||||
it('should filter by skill name', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'target',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['a'],
|
||||
filesModified: ['src/a.ts'],
|
||||
},
|
||||
{
|
||||
skillName: 'other',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T11:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['b'],
|
||||
filesModified: ['src/b.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build({ skill: 'target' });
|
||||
|
||||
expect(data.skills.length).toBe(1);
|
||||
expect(data.skills[0].skillName).toBe('target');
|
||||
expect(data.files.every((f) => f.skills.includes('target'))).toBe(true);
|
||||
});
|
||||
|
||||
it('should filter by file path', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'skill-a',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['a'],
|
||||
filesModified: ['src/target.ts', 'src/other.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build({ file: 'target.ts' });
|
||||
|
||||
expect(data.files.length).toBe(1);
|
||||
expect(data.files[0].path).toBe('src/target.ts');
|
||||
});
|
||||
|
||||
it('should filter by since date', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'old',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-01-01T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['a'],
|
||||
filesModified: ['old.ts'],
|
||||
},
|
||||
{
|
||||
skillName: 'recent',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['b'],
|
||||
filesModified: ['recent.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build({ since: '2026-02-01' });
|
||||
|
||||
expect(data.skills.length).toBe(1);
|
||||
expect(data.skills[0].skillName).toBe('recent');
|
||||
});
|
||||
|
||||
it('should include current execution in lineage', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
currentExecution: {
|
||||
skillName: 'active-skill',
|
||||
skillSource: 'test',
|
||||
currentStep: 1,
|
||||
totalSteps: 2,
|
||||
status: 'running',
|
||||
startedAt: '2026-02-12T10:00:00.000Z',
|
||||
tasks: [
|
||||
{
|
||||
id: 't1',
|
||||
name: 'Task 1',
|
||||
type: 'auto',
|
||||
status: 'completed',
|
||||
commitSha: 'abc',
|
||||
filesModified: ['src/active.ts'],
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build();
|
||||
|
||||
expect(data.skills.length).toBe(1);
|
||||
expect(data.skills[0].skillName).toBe('active-skill');
|
||||
expect(data.skills[0].commits).toContain('abc');
|
||||
expect(data.skills[0].filesModified).toContain('src/active.ts');
|
||||
});
|
||||
|
||||
it('should merge activity log data', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'my-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['abc'],
|
||||
filesModified: ['src/a.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
writeActivityLog([
|
||||
{
|
||||
commitSha: 'xyz',
|
||||
committedAt: '2026-02-12T11:00:00.000Z',
|
||||
activeSkills: ['my-skill'],
|
||||
filesChanged: ['src/b.ts'],
|
||||
message: 'extra commit',
|
||||
},
|
||||
]);
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build();
|
||||
|
||||
const skill = data.skills.find((s) => s.skillName === 'my-skill');
|
||||
expect(skill).toBeDefined();
|
||||
expect(skill!.commits).toContain('xyz');
|
||||
});
|
||||
|
||||
it('should match observations by timestamp overlap', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'test-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T11:00:00.000Z',
|
||||
durationMs: 3600000,
|
||||
status: 'completed',
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
writeObservations([
|
||||
{
|
||||
id: 'obs1',
|
||||
timestamp: '2026-02-12T10:30:00.000Z',
|
||||
sessionId: 'test',
|
||||
agent: 'claude-code',
|
||||
type: 'error',
|
||||
content: { action: 'build', context: 'src', files: ['src/buggy.ts'] },
|
||||
relevance: 80,
|
||||
},
|
||||
]);
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build();
|
||||
|
||||
expect(data.stats.errorProneFiles).toContain('src/buggy.ts');
|
||||
});
|
||||
|
||||
it('should getSkillLineage for a specific skill', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'target-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['abc'],
|
||||
filesModified: ['src/foo.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const entry = lineage.getSkillLineage('target-skill');
|
||||
|
||||
expect(entry).toBeDefined();
|
||||
expect(entry!.skillName).toBe('target-skill');
|
||||
expect(entry!.executions).toBe(1);
|
||||
});
|
||||
|
||||
it('should getFileLineage for a specific file', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'skill-a',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['abc'],
|
||||
filesModified: ['src/target.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const fl = lineage.getFileLineage('src/target.ts');
|
||||
|
||||
expect(fl).toBeDefined();
|
||||
expect(fl!.path).toBe('src/target.ts');
|
||||
expect(fl!.skills).toContain('skill-a');
|
||||
});
|
||||
|
||||
it('should format text output', () => {
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = {
|
||||
projectPath: TEST_DIR,
|
||||
skills: [
|
||||
{
|
||||
skillName: 'test-skill',
|
||||
executions: 3,
|
||||
totalDurationMs: 180000,
|
||||
commits: ['a', 'b'],
|
||||
filesModified: ['f1.ts', 'f2.ts'],
|
||||
observationIds: [],
|
||||
firstSeen: '2026-02-12T08:00:00.000Z',
|
||||
lastSeen: '2026-02-12T12:00:00.000Z',
|
||||
},
|
||||
],
|
||||
files: [
|
||||
{ path: 'f1.ts', skills: ['test-skill', 'other'], commitCount: 5, lastModified: '2026-02-12T12:00:00.000Z' },
|
||||
],
|
||||
stats: {
|
||||
totalSkillExecutions: 3,
|
||||
totalCommits: 2,
|
||||
totalFilesChanged: 2,
|
||||
mostImpactfulSkill: 'test-skill',
|
||||
mostChangedFile: 'f1.ts',
|
||||
errorProneFiles: ['f1.ts'],
|
||||
},
|
||||
};
|
||||
|
||||
const text = lineage.formatText(data);
|
||||
expect(text).toContain('Skill Lineage');
|
||||
expect(text).toContain('test-skill');
|
||||
expect(text).toContain('3 runs');
|
||||
expect(text).toContain('File Hotspots');
|
||||
expect(text).toContain('Stats');
|
||||
});
|
||||
|
||||
it('should format JSON output', () => {
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = {
|
||||
projectPath: TEST_DIR,
|
||||
skills: [],
|
||||
files: [],
|
||||
stats: {
|
||||
totalSkillExecutions: 0,
|
||||
totalCommits: 0,
|
||||
totalFilesChanged: 0,
|
||||
mostImpactfulSkill: null,
|
||||
mostChangedFile: null,
|
||||
errorProneFiles: [],
|
||||
},
|
||||
};
|
||||
|
||||
const json = lineage.formatJson(data);
|
||||
const parsed = JSON.parse(json);
|
||||
expect(parsed.projectPath).toBe(TEST_DIR);
|
||||
});
|
||||
|
||||
it('should handle empty lineage in text format', () => {
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = {
|
||||
projectPath: TEST_DIR,
|
||||
skills: [],
|
||||
files: [],
|
||||
stats: {
|
||||
totalSkillExecutions: 0,
|
||||
totalCommits: 0,
|
||||
totalFilesChanged: 0,
|
||||
mostImpactfulSkill: null,
|
||||
mostChangedFile: null,
|
||||
errorProneFiles: [],
|
||||
},
|
||||
};
|
||||
|
||||
const text = lineage.formatText(data);
|
||||
expect(text).toContain('No skill executions found');
|
||||
});
|
||||
|
||||
it('should deduplicate commits and files', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'dup-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: ['abc', 'abc'],
|
||||
filesModified: ['src/a.ts', 'src/a.ts', 'src/b.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const lineage = new SkillLineage(TEST_DIR);
|
||||
const data = lineage.build();
|
||||
|
||||
const skill = data.skills.find((s) => s.skillName === 'dup-skill');
|
||||
expect(skill!.commits.length).toBe(1);
|
||||
expect(skill!.filesModified.length).toBe(2);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,423 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import { mkdirSync, writeFileSync, rmSync, existsSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { stringify } from 'yaml';
|
||||
import { SessionTimeline } from '../timeline.js';
|
||||
import type { SessionState, TimelineOptions } from '../types.js';
|
||||
|
||||
const TEST_DIR = join(process.cwd(), '.test-timeline-' + process.pid);
|
||||
const SKILLKIT_DIR = join(TEST_DIR, '.skillkit');
|
||||
|
||||
function writeSessionState(state: SessionState): void {
|
||||
mkdirSync(SKILLKIT_DIR, { recursive: true });
|
||||
writeFileSync(join(SKILLKIT_DIR, 'session.yaml'), stringify(state));
|
||||
}
|
||||
|
||||
function writeObservations(observations: Array<Record<string, unknown>>): void {
|
||||
const dir = join(SKILLKIT_DIR, 'memory');
|
||||
mkdirSync(dir, { recursive: true });
|
||||
writeFileSync(
|
||||
join(dir, 'observations.yaml'),
|
||||
stringify({ version: 1, sessionId: 'test', observations })
|
||||
);
|
||||
}
|
||||
|
||||
function writeSnapshots(snapshots: Array<Record<string, unknown>>): void {
|
||||
const dir = join(SKILLKIT_DIR, 'snapshots');
|
||||
mkdirSync(dir, { recursive: true });
|
||||
for (const snap of snapshots) {
|
||||
writeFileSync(join(dir, `${snap.name}.yaml`), stringify(snap));
|
||||
}
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
mkdirSync(TEST_DIR, { recursive: true });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (existsSync(TEST_DIR)) {
|
||||
rmSync(TEST_DIR, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
describe('SessionTimeline', () => {
|
||||
it('should create timeline instance', () => {
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
expect(timeline).toBeDefined();
|
||||
});
|
||||
|
||||
it('should return empty timeline when no data', () => {
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build();
|
||||
expect(data.events).toEqual([]);
|
||||
expect(data.totalCount).toBe(0);
|
||||
expect(data.projectPath).toBe(TEST_DIR);
|
||||
});
|
||||
|
||||
it('should collect events from current execution', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
currentExecution: {
|
||||
skillName: 'test-skill',
|
||||
skillSource: 'test',
|
||||
currentStep: 1,
|
||||
totalSteps: 2,
|
||||
status: 'running',
|
||||
startedAt: '2026-02-12T10:00:00.000Z',
|
||||
tasks: [
|
||||
{
|
||||
id: 't1',
|
||||
name: 'Task 1',
|
||||
type: 'auto',
|
||||
status: 'completed',
|
||||
startedAt: '2026-02-12T10:00:00.000Z',
|
||||
completedAt: '2026-02-12T10:01:00.000Z',
|
||||
},
|
||||
{
|
||||
id: 't2',
|
||||
name: 'Task 2',
|
||||
type: 'auto',
|
||||
status: 'in_progress',
|
||||
startedAt: '2026-02-12T10:01:00.000Z',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build({ includeGit: false });
|
||||
|
||||
const skillStarts = data.events.filter((e) => e.type === 'skill_start');
|
||||
expect(skillStarts.length).toBe(1);
|
||||
expect(skillStarts[0].source).toBe('test-skill');
|
||||
|
||||
const taskEvents = data.events.filter((e) => e.type === 'task_progress');
|
||||
expect(taskEvents.length).toBe(2);
|
||||
});
|
||||
|
||||
it('should collect events from execution history', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'old-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-11T15:00:00.000Z',
|
||||
durationMs: 120000,
|
||||
status: 'completed',
|
||||
commits: ['abc1234'],
|
||||
filesModified: ['src/index.ts'],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build({ includeGit: false });
|
||||
|
||||
const completes = data.events.filter((e) => e.type === 'skill_complete');
|
||||
expect(completes.length).toBe(1);
|
||||
expect(completes[0].summary).toContain('old-skill');
|
||||
expect(completes[0].summary).toContain('2m');
|
||||
});
|
||||
|
||||
it('should collect decision events', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [
|
||||
{
|
||||
key: 'api-style',
|
||||
value: 'REST',
|
||||
madeAt: '2026-02-12T11:00:00.000Z',
|
||||
skillName: 'architect',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build({ includeGit: false });
|
||||
|
||||
const decisions = data.events.filter((e) => e.type === 'decision');
|
||||
expect(decisions.length).toBe(1);
|
||||
expect(decisions[0].summary).toContain('REST');
|
||||
});
|
||||
|
||||
it('should collect observation events', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
writeObservations([
|
||||
{
|
||||
id: 'obs1',
|
||||
timestamp: '2026-02-12T10:30:00.000Z',
|
||||
sessionId: 'test',
|
||||
agent: 'claude-code',
|
||||
type: 'error',
|
||||
content: { action: 'build', context: 'src', error: 'missing import' },
|
||||
relevance: 80,
|
||||
},
|
||||
]);
|
||||
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build({ includeGit: false });
|
||||
|
||||
const obs = data.events.filter((e) => e.type === 'observation');
|
||||
expect(obs.length).toBe(1);
|
||||
expect(obs[0].summary).toContain('error');
|
||||
});
|
||||
|
||||
it('should collect snapshot events', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
writeSnapshots([
|
||||
{
|
||||
version: 1,
|
||||
name: 'pre-refactor',
|
||||
createdAt: '2026-02-12T09:00:00.000Z',
|
||||
description: 'Before big refactor',
|
||||
sessionState: {
|
||||
version: 1,
|
||||
lastActivity: '2026-02-12T09:00:00.000Z',
|
||||
projectPath: TEST_DIR,
|
||||
history: [],
|
||||
decisions: [],
|
||||
},
|
||||
observations: [],
|
||||
},
|
||||
]);
|
||||
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build({ includeGit: false });
|
||||
|
||||
const snaps = data.events.filter((e) => e.type === 'snapshot');
|
||||
expect(snaps.length).toBe(1);
|
||||
expect(snaps[0].summary).toContain('pre-refactor');
|
||||
});
|
||||
|
||||
it('should filter by event type', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'skill-a',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
},
|
||||
],
|
||||
decisions: [
|
||||
{ key: 'k', value: 'v', madeAt: '2026-02-12T10:01:00.000Z' },
|
||||
],
|
||||
});
|
||||
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build({ types: ['decision'], includeGit: false });
|
||||
|
||||
expect(data.events.every((e) => e.type === 'decision')).toBe(true);
|
||||
expect(data.events.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should filter by since date', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'old',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-01T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
},
|
||||
{
|
||||
skillName: 'recent',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build({ since: '2026-02-10', includeGit: false });
|
||||
|
||||
expect(data.events.length).toBe(1);
|
||||
expect(data.events[0].source).toBe('recent');
|
||||
});
|
||||
|
||||
it('should respect limit', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: Array.from({ length: 10 }, (_, i) => ({
|
||||
skillName: `skill-${i}`,
|
||||
skillSource: 'test',
|
||||
completedAt: `2026-02-12T${String(i).padStart(2, '0')}:00:00.000Z`,
|
||||
durationMs: 60000,
|
||||
status: 'completed' as const,
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
})),
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build({ limit: 3, includeGit: false });
|
||||
|
||||
expect(data.events.length).toBe(3);
|
||||
expect(data.totalCount).toBe(10);
|
||||
});
|
||||
|
||||
it('should sort events chronologically', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'later',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T12:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
},
|
||||
{
|
||||
skillName: 'earlier',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T08:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build({ includeGit: false });
|
||||
|
||||
expect(data.events[0].source).toBe('earlier');
|
||||
expect(data.events[1].source).toBe('later');
|
||||
});
|
||||
|
||||
it('should format text output', () => {
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = {
|
||||
projectPath: TEST_DIR,
|
||||
sessionDate: '2026-02-12',
|
||||
events: [
|
||||
{
|
||||
timestamp: '2026-02-12T10:30:00.000Z',
|
||||
type: 'skill_start' as const,
|
||||
source: 'test-skill',
|
||||
summary: 'test-skill started',
|
||||
},
|
||||
],
|
||||
totalCount: 1,
|
||||
};
|
||||
|
||||
const text = timeline.formatText(data);
|
||||
expect(text).toContain('Session Timeline');
|
||||
expect(text).toContain('test-skill started');
|
||||
expect(text).toContain('1 event total');
|
||||
});
|
||||
|
||||
it('should format JSON output', () => {
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = {
|
||||
projectPath: TEST_DIR,
|
||||
sessionDate: '2026-02-12',
|
||||
events: [],
|
||||
totalCount: 0,
|
||||
};
|
||||
|
||||
const json = timeline.formatJson(data);
|
||||
const parsed = JSON.parse(json);
|
||||
expect(parsed.projectPath).toBe(TEST_DIR);
|
||||
expect(parsed.events).toEqual([]);
|
||||
});
|
||||
|
||||
it('should filter by skill name', () => {
|
||||
writeSessionState({
|
||||
version: 1,
|
||||
lastActivity: new Date().toISOString(),
|
||||
projectPath: TEST_DIR,
|
||||
history: [
|
||||
{
|
||||
skillName: 'target-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T10:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
},
|
||||
{
|
||||
skillName: 'other-skill',
|
||||
skillSource: 'test',
|
||||
completedAt: '2026-02-12T11:00:00.000Z',
|
||||
durationMs: 60000,
|
||||
status: 'completed',
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
},
|
||||
],
|
||||
decisions: [],
|
||||
});
|
||||
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = timeline.build({ skillFilter: 'target-skill', includeGit: false });
|
||||
|
||||
expect(data.events.length).toBe(1);
|
||||
expect(data.events[0].source).toBe('target-skill');
|
||||
});
|
||||
|
||||
it('should handle empty events in text format', () => {
|
||||
const timeline = new SessionTimeline(TEST_DIR);
|
||||
const data = {
|
||||
projectPath: TEST_DIR,
|
||||
sessionDate: '2026-02-12',
|
||||
events: [],
|
||||
totalCount: 0,
|
||||
};
|
||||
|
||||
const text = timeline.formatText(data);
|
||||
expect(text).toContain('No events found');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,314 @@
|
||||
import { SessionManager } from './manager.js';
|
||||
import { ActivityLog } from './activity-log.js';
|
||||
import { ObservationStore } from '../memory/observation-store.js';
|
||||
import { getGitCommits } from '../learning/git-analyzer.js';
|
||||
import { loadConfig } from '../config.js';
|
||||
import type {
|
||||
HandoffDocument,
|
||||
HandoffSection,
|
||||
HandoffOptions,
|
||||
SessionTask,
|
||||
ExecutionHistory,
|
||||
} from './types.js';
|
||||
|
||||
function formatDuration(ms: number): string {
|
||||
const seconds = Math.floor(ms / 1000);
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
const hours = Math.floor(minutes / 60);
|
||||
if (hours > 0) return `${hours}h ${minutes % 60}m`;
|
||||
if (minutes > 0) return `${minutes}m`;
|
||||
return `${seconds}s`;
|
||||
}
|
||||
|
||||
export class SessionHandoff {
|
||||
private readonly projectPath: string;
|
||||
private readonly sessionManager: SessionManager;
|
||||
private readonly activityLog: ActivityLog;
|
||||
|
||||
constructor(projectPath: string) {
|
||||
this.projectPath = projectPath;
|
||||
this.sessionManager = new SessionManager(projectPath);
|
||||
this.activityLog = new ActivityLog(projectPath);
|
||||
}
|
||||
|
||||
generate(options?: HandoffOptions): HandoffDocument {
|
||||
const state = this.sessionManager.get();
|
||||
const includeGit = options?.includeGit !== false;
|
||||
const includeObservations = options?.includeObservations !== false;
|
||||
const maxObservations = options?.maxObservations ?? 20;
|
||||
|
||||
let agent = 'unknown';
|
||||
try {
|
||||
const configAgent = loadConfig().agent;
|
||||
if (configAgent && configAgent !== 'universal') {
|
||||
agent = configAgent;
|
||||
}
|
||||
} catch {
|
||||
// use default
|
||||
}
|
||||
|
||||
if (agent === 'unknown' && state?.currentExecution?.skillSource) {
|
||||
agent = state.currentExecution.skillSource;
|
||||
}
|
||||
|
||||
const accomplished = this.buildAccomplished(state?.currentExecution?.tasks, state?.history ?? [], includeGit);
|
||||
const pending = this.buildPending(state?.currentExecution?.tasks);
|
||||
const keyFiles = this.buildKeyFiles(state?.currentExecution?.tasks, state?.history ?? []);
|
||||
const observations = includeObservations
|
||||
? this.buildObservations(maxObservations)
|
||||
: { errors: [], solutions: [], patterns: [] };
|
||||
const recommendations = this.buildRecommendations(pending, observations, includeGit);
|
||||
|
||||
return {
|
||||
generatedAt: new Date().toISOString(),
|
||||
fromAgent: agent,
|
||||
projectPath: this.projectPath,
|
||||
accomplished,
|
||||
pending,
|
||||
keyFiles,
|
||||
observations,
|
||||
recommendations,
|
||||
};
|
||||
}
|
||||
|
||||
private buildAccomplished(
|
||||
tasks: SessionTask[] | undefined,
|
||||
history: ExecutionHistory[],
|
||||
includeGit: boolean
|
||||
): HandoffSection {
|
||||
const section: HandoffSection = { tasks: [], commits: [] };
|
||||
|
||||
for (const task of tasks ?? []) {
|
||||
if (task.status === 'completed') {
|
||||
let duration: string | undefined;
|
||||
if (task.startedAt && task.completedAt) {
|
||||
duration = formatDuration(
|
||||
new Date(task.completedAt).getTime() - new Date(task.startedAt).getTime()
|
||||
);
|
||||
}
|
||||
section.tasks.push({
|
||||
name: task.name,
|
||||
duration,
|
||||
commitSha: task.commitSha,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const hist of history) {
|
||||
if (hist.status === 'completed') {
|
||||
section.tasks.push({
|
||||
name: hist.skillName,
|
||||
duration: Number.isFinite(hist.durationMs) ? formatDuration(hist.durationMs) : undefined,
|
||||
commitSha: hist.commits?.[0],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (includeGit) {
|
||||
try {
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
const commits = getGitCommits(this.projectPath, { commits: 50 });
|
||||
for (const commit of commits) {
|
||||
if (commit.date.startsWith(today)) {
|
||||
section.commits.push({
|
||||
sha: commit.shortHash,
|
||||
message: commit.message,
|
||||
filesCount: commit.files.length,
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// git not available
|
||||
}
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
private buildPending(tasks: SessionTask[] | undefined): HandoffSection {
|
||||
const section: HandoffSection = { tasks: [], commits: [] };
|
||||
|
||||
const pendingStatuses = new Set(['pending', 'in_progress', 'paused']);
|
||||
for (const task of tasks ?? []) {
|
||||
if (pendingStatuses.has(task.status)) {
|
||||
section.tasks.push({ name: task.name });
|
||||
}
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
private buildKeyFiles(
|
||||
tasks: SessionTask[] | undefined,
|
||||
history: ExecutionHistory[]
|
||||
): Array<{ path: string; changeType: string }> {
|
||||
const fileMap = new Map<string, string>();
|
||||
|
||||
for (const task of tasks ?? []) {
|
||||
for (const f of task.filesModified ?? []) {
|
||||
fileMap.set(f, task.status === 'completed' ? 'modified' : 'in-progress');
|
||||
}
|
||||
}
|
||||
|
||||
for (const hist of history) {
|
||||
for (const f of hist.filesModified ?? []) {
|
||||
if (!fileMap.has(f)) {
|
||||
fileMap.set(f, 'modified');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(fileMap.entries())
|
||||
.map(([path, changeType]) => ({ path, changeType }))
|
||||
.sort((a, b) => a.path.localeCompare(b.path));
|
||||
}
|
||||
|
||||
private buildObservations(max: number): HandoffDocument['observations'] {
|
||||
const result: HandoffDocument['observations'] = {
|
||||
errors: [],
|
||||
solutions: [],
|
||||
patterns: [],
|
||||
};
|
||||
|
||||
try {
|
||||
const observations = ObservationStore.readAll(this.projectPath);
|
||||
const sorted = [...observations].sort((a, b) => b.relevance - a.relevance);
|
||||
let count = 0;
|
||||
|
||||
for (const obs of sorted) {
|
||||
if (count >= max) break;
|
||||
if (obs.type === 'error' && obs.content.error) {
|
||||
result.errors.push({ action: obs.content.action, error: obs.content.error });
|
||||
count++;
|
||||
} else if (obs.type === 'solution' && obs.content.solution) {
|
||||
result.solutions.push({ action: obs.content.action, solution: obs.content.solution });
|
||||
count++;
|
||||
} else if (obs.type === 'pattern' && obs.content.context) {
|
||||
result.patterns.push({ action: obs.content.action, context: obs.content.context });
|
||||
count++;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// no observations
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private buildRecommendations(
|
||||
pending: HandoffSection,
|
||||
observations: HandoffDocument['observations'],
|
||||
includeGit: boolean
|
||||
): string[] {
|
||||
const recs: string[] = [];
|
||||
|
||||
if (pending.tasks.length > 0) {
|
||||
recs.push(`Complete pending tasks: ${pending.tasks.map((t) => t.name).join(', ')}`);
|
||||
}
|
||||
|
||||
if (observations.errors.length > 0) {
|
||||
const unresolved = observations.errors.filter(
|
||||
(e) => !observations.solutions.some((s) => s.action === e.action)
|
||||
);
|
||||
if (unresolved.length > 0) {
|
||||
recs.push(`Resolve ${unresolved.length} unresolved error(s)`);
|
||||
}
|
||||
}
|
||||
|
||||
if (includeGit) {
|
||||
try {
|
||||
const activities = this.activityLog.getRecent(50);
|
||||
const fileCounts = new Map<string, number>();
|
||||
for (const activity of activities) {
|
||||
for (const f of activity.filesChanged) {
|
||||
fileCounts.set(f, (fileCounts.get(f) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
const highChurn = Array.from(fileCounts.entries())
|
||||
.filter(([, count]) => count >= 3)
|
||||
.sort((a, b) => b[1] - a[1])
|
||||
.slice(0, 3);
|
||||
|
||||
for (const [file, count] of highChurn) {
|
||||
recs.push(`Review high-churn file: ${file} (${count} changes)`);
|
||||
}
|
||||
} catch {
|
||||
// activity log not available
|
||||
}
|
||||
}
|
||||
|
||||
return recs;
|
||||
}
|
||||
|
||||
toMarkdown(doc: HandoffDocument): string {
|
||||
const lines: string[] = [];
|
||||
lines.push(`# Session Handoff`);
|
||||
lines.push(`Agent: ${doc.fromAgent} | ${doc.generatedAt.split('T')[0]}\n`);
|
||||
|
||||
lines.push(`## Accomplished`);
|
||||
if (doc.accomplished.tasks.length === 0 && doc.accomplished.commits.length === 0) {
|
||||
lines.push('No completed tasks.\n');
|
||||
} else {
|
||||
for (const task of doc.accomplished.tasks) {
|
||||
const dur = task.duration ? ` (${task.duration})` : '';
|
||||
const sha = task.commitSha ? ` [${task.commitSha.slice(0, 7)}]` : '';
|
||||
lines.push(`- ${task.name}${dur}${sha}`);
|
||||
}
|
||||
for (const commit of doc.accomplished.commits) {
|
||||
lines.push(`- ${commit.sha} — ${commit.message} (${commit.filesCount} files)`);
|
||||
}
|
||||
lines.push('');
|
||||
}
|
||||
|
||||
lines.push(`## Pending`);
|
||||
if (doc.pending.tasks.length === 0) {
|
||||
lines.push('No pending tasks.\n');
|
||||
} else {
|
||||
for (const task of doc.pending.tasks) {
|
||||
lines.push(`- ${task.name}`);
|
||||
}
|
||||
lines.push('');
|
||||
}
|
||||
|
||||
if (doc.keyFiles.length > 0) {
|
||||
lines.push(`## Key Files`);
|
||||
for (const f of doc.keyFiles) {
|
||||
lines.push(`- \`${f.path}\` (${f.changeType})`);
|
||||
}
|
||||
lines.push('');
|
||||
}
|
||||
|
||||
const hasObs =
|
||||
doc.observations.errors.length > 0 ||
|
||||
doc.observations.solutions.length > 0 ||
|
||||
doc.observations.patterns.length > 0;
|
||||
|
||||
if (hasObs) {
|
||||
lines.push(`## Observations`);
|
||||
for (const e of doc.observations.errors) {
|
||||
lines.push(`- Error: ${e.error} (${e.action})`);
|
||||
}
|
||||
for (const s of doc.observations.solutions) {
|
||||
lines.push(`- Solution: ${s.solution} (${s.action})`);
|
||||
}
|
||||
for (const p of doc.observations.patterns) {
|
||||
lines.push(`- Pattern: ${p.action} — ${p.context}`);
|
||||
}
|
||||
lines.push('');
|
||||
}
|
||||
|
||||
if (doc.recommendations.length > 0) {
|
||||
lines.push(`## Recommendations`);
|
||||
doc.recommendations.forEach((r, i) => {
|
||||
lines.push(`${i + 1}. ${r}`);
|
||||
});
|
||||
lines.push('');
|
||||
}
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
toJson(doc: HandoffDocument): string {
|
||||
return JSON.stringify(doc, null, 2);
|
||||
}
|
||||
}
|
||||
@@ -11,3 +11,6 @@ export { SessionManager, createSessionManager } from './manager.js';
|
||||
export { ActivityLog } from './activity-log.js';
|
||||
export { SnapshotManager } from './snapshot-manager.js';
|
||||
export { SessionExplainer } from './session-explainer.js';
|
||||
export { SessionTimeline } from './timeline.js';
|
||||
export { SessionHandoff } from './handoff.js';
|
||||
export { SkillLineage } from './lineage.js';
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
import { SessionManager } from './manager.js';
|
||||
import { ActivityLog } from './activity-log.js';
|
||||
import { ObservationStore } from '../memory/observation-store.js';
|
||||
import type {
|
||||
SkillLineageEntry,
|
||||
FileLineage,
|
||||
LineageData,
|
||||
LineageOptions,
|
||||
} from './types.js';
|
||||
|
||||
function formatDurationMs(ms: number): string {
|
||||
const seconds = Math.floor(ms / 1000);
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
const hours = Math.floor(minutes / 60);
|
||||
if (hours > 0) return `${hours}h ${minutes % 60}m`;
|
||||
if (minutes > 0) return `${minutes}m`;
|
||||
return `${seconds}s`;
|
||||
}
|
||||
|
||||
export class SkillLineage {
|
||||
private readonly projectPath: string;
|
||||
private readonly sessionManager: SessionManager;
|
||||
private readonly activityLog: ActivityLog;
|
||||
|
||||
constructor(projectPath: string) {
|
||||
this.projectPath = projectPath;
|
||||
this.sessionManager = new SessionManager(projectPath);
|
||||
this.activityLog = new ActivityLog(projectPath);
|
||||
}
|
||||
|
||||
build(options?: LineageOptions): LineageData {
|
||||
const state = this.sessionManager.get();
|
||||
const sinceDate = options?.since ? new Date(options.since) : undefined;
|
||||
|
||||
const skillMap = new Map<string, SkillLineageEntry>();
|
||||
const fileSkillMap = new Map<string, Set<string>>();
|
||||
const fileCommitCount = new Map<string, number>();
|
||||
const fileLastModified = new Map<string, string>();
|
||||
|
||||
for (const hist of state?.history ?? []) {
|
||||
if (sinceDate && new Date(hist.completedAt) < sinceDate) continue;
|
||||
|
||||
const entry = skillMap.get(hist.skillName) ?? {
|
||||
skillName: hist.skillName,
|
||||
executions: 0,
|
||||
totalDurationMs: 0,
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
observationIds: [],
|
||||
firstSeen: hist.completedAt,
|
||||
lastSeen: hist.completedAt,
|
||||
};
|
||||
|
||||
entry.executions++;
|
||||
entry.totalDurationMs += hist.durationMs;
|
||||
entry.commits.push(...(hist.commits ?? []));
|
||||
entry.filesModified.push(...(hist.filesModified ?? []));
|
||||
|
||||
if (new Date(hist.completedAt) < new Date(entry.firstSeen)) {
|
||||
entry.firstSeen = hist.completedAt;
|
||||
}
|
||||
if (new Date(hist.completedAt) > new Date(entry.lastSeen)) {
|
||||
entry.lastSeen = hist.completedAt;
|
||||
}
|
||||
|
||||
skillMap.set(hist.skillName, entry);
|
||||
|
||||
for (const f of hist.filesModified ?? []) {
|
||||
const skills = fileSkillMap.get(f) ?? new Set();
|
||||
skills.add(hist.skillName);
|
||||
fileSkillMap.set(f, skills);
|
||||
|
||||
fileCommitCount.set(f, (fileCommitCount.get(f) ?? 0) + (hist.commits?.length ?? 0));
|
||||
const existing = fileLastModified.get(f);
|
||||
if (!existing || new Date(hist.completedAt) > new Date(existing)) {
|
||||
fileLastModified.set(f, hist.completedAt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state?.currentExecution) {
|
||||
const exec = state.currentExecution;
|
||||
const startTime = new Date(exec.startedAt);
|
||||
if (!sinceDate || startTime >= sinceDate) {
|
||||
const entry = skillMap.get(exec.skillName) ?? {
|
||||
skillName: exec.skillName,
|
||||
executions: 0,
|
||||
totalDurationMs: 0,
|
||||
commits: [],
|
||||
filesModified: [],
|
||||
observationIds: [],
|
||||
firstSeen: exec.startedAt,
|
||||
lastSeen: exec.startedAt,
|
||||
};
|
||||
|
||||
entry.executions++;
|
||||
entry.totalDurationMs += Date.now() - startTime.getTime();
|
||||
|
||||
for (const task of exec.tasks) {
|
||||
if (task.commitSha) entry.commits.push(task.commitSha);
|
||||
entry.filesModified.push(...(task.filesModified ?? []));
|
||||
for (const f of task.filesModified ?? []) {
|
||||
const skills = fileSkillMap.get(f) ?? new Set();
|
||||
skills.add(exec.skillName);
|
||||
fileSkillMap.set(f, skills);
|
||||
|
||||
if (task.commitSha) {
|
||||
fileCommitCount.set(f, (fileCommitCount.get(f) ?? 0) + 1);
|
||||
}
|
||||
const existing = fileLastModified.get(f);
|
||||
if (!existing || new Date(exec.startedAt) > new Date(existing)) {
|
||||
fileLastModified.set(f, exec.startedAt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new Date(exec.startedAt) < new Date(entry.firstSeen)) {
|
||||
entry.firstSeen = exec.startedAt;
|
||||
}
|
||||
entry.lastSeen = new Date().toISOString();
|
||||
|
||||
skillMap.set(exec.skillName, entry);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const activities = this.activityLog.getRecent(500);
|
||||
for (const activity of activities) {
|
||||
if (sinceDate && new Date(activity.committedAt) < sinceDate) continue;
|
||||
const countedFiles = new Set<string>();
|
||||
for (const skill of activity.activeSkills) {
|
||||
const entry = skillMap.get(skill);
|
||||
if (entry && !entry.commits.includes(activity.commitSha)) {
|
||||
entry.commits.push(activity.commitSha);
|
||||
}
|
||||
for (const f of activity.filesChanged) {
|
||||
const skills = fileSkillMap.get(f) ?? new Set();
|
||||
skills.add(skill);
|
||||
fileSkillMap.set(f, skills);
|
||||
if (!countedFiles.has(f)) {
|
||||
fileCommitCount.set(f, (fileCommitCount.get(f) ?? 0) + 1);
|
||||
countedFiles.add(f);
|
||||
}
|
||||
const existing = fileLastModified.get(f);
|
||||
if (!existing || new Date(activity.committedAt) > new Date(existing)) {
|
||||
fileLastModified.set(f, activity.committedAt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// activity log not available
|
||||
}
|
||||
|
||||
const errorProneFiles: string[] = [];
|
||||
try {
|
||||
const observations = ObservationStore.readAll(this.projectPath);
|
||||
for (const obs of observations) {
|
||||
if (sinceDate && new Date(obs.timestamp) < sinceDate) continue;
|
||||
|
||||
for (const [, entry] of skillMap) {
|
||||
const execStart = new Date(entry.firstSeen).getTime();
|
||||
const execEnd = new Date(entry.lastSeen).getTime();
|
||||
const obsTime = new Date(obs.timestamp).getTime();
|
||||
if (obsTime >= execStart && obsTime <= execEnd) {
|
||||
if (!entry.observationIds.includes(obs.id)) {
|
||||
entry.observationIds.push(obs.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (obs.type === 'error' && Array.isArray(obs.content?.files)) {
|
||||
errorProneFiles.push(...obs.content.files);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// no observations
|
||||
}
|
||||
|
||||
for (const entry of skillMap.values()) {
|
||||
entry.commits = [...new Set(entry.commits)];
|
||||
entry.filesModified = [...new Set(entry.filesModified)];
|
||||
}
|
||||
|
||||
let skills = Array.from(skillMap.values());
|
||||
let files: FileLineage[] = Array.from(fileSkillMap.entries()).map(([path, skillSet]) => ({
|
||||
path,
|
||||
skills: Array.from(skillSet),
|
||||
commitCount: fileCommitCount.get(path) ?? 0,
|
||||
lastModified: fileLastModified.get(path) ?? '',
|
||||
}));
|
||||
|
||||
if (options?.skill) {
|
||||
skills = skills.filter((s) => s.skillName === options.skill);
|
||||
const skillFiles = new Set(skills.flatMap((s) => s.filesModified));
|
||||
files = files.filter((f) => skillFiles.has(f.path));
|
||||
}
|
||||
|
||||
if (options?.file) {
|
||||
files = files.filter((f) => f.path === options.file || f.path.includes(options.file!));
|
||||
const fileSkills = new Set(files.flatMap((f) => f.skills));
|
||||
skills = skills.filter((s) => fileSkills.has(s.skillName));
|
||||
}
|
||||
|
||||
skills.sort((a, b) => b.filesModified.length - a.filesModified.length);
|
||||
files.sort((a, b) => b.skills.length - a.skills.length || b.commitCount - a.commitCount);
|
||||
|
||||
if (options?.limit) {
|
||||
skills = skills.slice(0, options.limit);
|
||||
files = files.slice(0, options.limit);
|
||||
}
|
||||
|
||||
const uniqueErrorFiles = [...new Set(errorProneFiles)];
|
||||
const allCommits = new Set(skills.flatMap((s) => s.commits));
|
||||
const allFiles = new Set(skills.flatMap((s) => s.filesModified));
|
||||
|
||||
const mostImpactful = skills.length > 0 ? skills[0].skillName : null;
|
||||
const mostChanged = files.length > 0 ? files[0].path : null;
|
||||
|
||||
return {
|
||||
projectPath: this.projectPath,
|
||||
skills,
|
||||
files,
|
||||
stats: {
|
||||
totalSkillExecutions: skills.reduce((sum, s) => sum + s.executions, 0),
|
||||
totalCommits: allCommits.size,
|
||||
totalFilesChanged: allFiles.size,
|
||||
mostImpactfulSkill: mostImpactful,
|
||||
mostChangedFile: mostChanged,
|
||||
errorProneFiles: uniqueErrorFiles.slice(0, 5),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
getSkillLineage(skillName: string): SkillLineageEntry | undefined {
|
||||
const data = this.build({ skill: skillName });
|
||||
return data.skills.find((s) => s.skillName === skillName);
|
||||
}
|
||||
|
||||
getFileLineage(filePath: string): FileLineage | undefined {
|
||||
const data = this.build({ file: filePath });
|
||||
return data.files.find((f) => f.path === filePath || f.path.includes(filePath));
|
||||
}
|
||||
|
||||
formatText(data: LineageData): string {
|
||||
const lines: string[] = [];
|
||||
lines.push(' Skill Lineage\n');
|
||||
|
||||
if (data.skills.length === 0) {
|
||||
lines.push(' No skill executions found.\n');
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
lines.push(' Skills');
|
||||
for (const skill of data.skills) {
|
||||
const duration = formatDurationMs(skill.totalDurationMs);
|
||||
lines.push(
|
||||
` ${skill.skillName.padEnd(24)} ${skill.executions} runs ${skill.commits.length} commits ${skill.filesModified.length} files ${duration} total`
|
||||
);
|
||||
}
|
||||
lines.push('');
|
||||
|
||||
const hotspots = data.files.filter((f) => f.skills.length >= 2);
|
||||
if (hotspots.length > 0) {
|
||||
lines.push(' File Hotspots (touched by 2+ skills)');
|
||||
for (const f of hotspots.slice(0, 10)) {
|
||||
lines.push(` ${f.path.padEnd(40)} ${f.skills.join(', ')}`);
|
||||
}
|
||||
lines.push('');
|
||||
}
|
||||
|
||||
lines.push(' Stats');
|
||||
lines.push(` Total executions: ${data.stats.totalSkillExecutions} | Commits: ${data.stats.totalCommits}`);
|
||||
if (data.stats.mostImpactfulSkill) {
|
||||
const skill = data.skills.find((s) => s.skillName === data.stats.mostImpactfulSkill);
|
||||
lines.push(` Most impactful: ${data.stats.mostImpactfulSkill} (${skill?.filesModified.length ?? 0} files)`);
|
||||
}
|
||||
if (data.stats.errorProneFiles.length > 0) {
|
||||
lines.push(` Error-prone: ${data.stats.errorProneFiles.join(', ')}`);
|
||||
}
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
formatJson(data: LineageData): string {
|
||||
return JSON.stringify(data, null, 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
import { SessionManager } from './manager.js';
|
||||
import { ActivityLog } from './activity-log.js';
|
||||
import { SnapshotManager } from './snapshot-manager.js';
|
||||
import { ObservationStore } from '../memory/observation-store.js';
|
||||
import { getGitCommits } from '../learning/git-analyzer.js';
|
||||
import type {
|
||||
TimelineEvent,
|
||||
TimelineData,
|
||||
TimelineOptions,
|
||||
TimelineEventType,
|
||||
} from './types.js';
|
||||
|
||||
function formatDuration(ms: number): string {
|
||||
const seconds = Math.floor(ms / 1000);
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
const hours = Math.floor(minutes / 60);
|
||||
if (hours > 0) return `${hours}h ${minutes % 60}m`;
|
||||
if (minutes > 0) return `${minutes}m`;
|
||||
return `${seconds}s`;
|
||||
}
|
||||
|
||||
function formatTime(iso: string): string {
|
||||
const d = new Date(iso);
|
||||
if (isNaN(d.getTime())) return iso;
|
||||
return d.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true });
|
||||
}
|
||||
|
||||
export class SessionTimeline {
|
||||
private readonly projectPath: string;
|
||||
private readonly sessionManager: SessionManager;
|
||||
private readonly activityLog: ActivityLog;
|
||||
private readonly snapshotManager: SnapshotManager;
|
||||
|
||||
constructor(projectPath: string) {
|
||||
this.projectPath = projectPath;
|
||||
this.sessionManager = new SessionManager(projectPath);
|
||||
this.activityLog = new ActivityLog(projectPath);
|
||||
this.snapshotManager = new SnapshotManager(projectPath);
|
||||
}
|
||||
|
||||
build(options?: TimelineOptions): TimelineData {
|
||||
const events: TimelineEvent[] = [];
|
||||
const state = this.sessionManager.get();
|
||||
const limit = options?.limit ?? 50;
|
||||
const includeGit = options?.includeGit !== false;
|
||||
const sinceDate = options?.since ? new Date(options.since) : undefined;
|
||||
if (sinceDate && isNaN(sinceDate.getTime())) {
|
||||
return { projectPath: this.projectPath, sessionDate: new Date().toISOString().split('T')[0], events: [], totalCount: 0 };
|
||||
}
|
||||
|
||||
if (state?.currentExecution) {
|
||||
const exec = state.currentExecution;
|
||||
events.push({
|
||||
timestamp: exec.startedAt,
|
||||
type: 'skill_start',
|
||||
source: exec.skillName,
|
||||
summary: `${exec.skillName} started`,
|
||||
details: { status: exec.status, totalSteps: exec.totalSteps },
|
||||
});
|
||||
|
||||
const activeStatuses = new Set(['in_progress', 'completed', 'failed']);
|
||||
for (const task of exec.tasks) {
|
||||
if (task.startedAt && activeStatuses.has(task.status)) {
|
||||
events.push({
|
||||
timestamp: task.completedAt ?? task.startedAt,
|
||||
type: 'task_progress',
|
||||
source: exec.skillName,
|
||||
summary: `${task.name} (${task.status})`,
|
||||
details: { taskId: task.id, error: task.error },
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const hist of state?.history ?? []) {
|
||||
events.push({
|
||||
timestamp: hist.completedAt,
|
||||
type: 'skill_complete',
|
||||
source: hist.skillName,
|
||||
summary: `${hist.skillName} ${hist.status} (${formatDuration(hist.durationMs)})`,
|
||||
details: {
|
||||
durationMs: hist.durationMs,
|
||||
commits: hist.commits,
|
||||
filesModified: hist.filesModified,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (includeGit) {
|
||||
try {
|
||||
const commits = getGitCommits(this.projectPath, {
|
||||
commits: 50,
|
||||
since: options?.since,
|
||||
});
|
||||
for (const commit of commits) {
|
||||
const activity = this.activityLog.getByCommit(commit.shortHash);
|
||||
events.push({
|
||||
timestamp: commit.date,
|
||||
type: 'git_commit',
|
||||
source: activity?.activeSkills?.join(', ') ?? 'git',
|
||||
summary: `${commit.shortHash} — ${commit.message} (${commit.files.length} files)`,
|
||||
details: {
|
||||
sha: commit.hash,
|
||||
author: commit.author,
|
||||
skills: activity?.activeSkills,
|
||||
},
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// git not available
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const observations = ObservationStore.readAll(this.projectPath);
|
||||
for (const obs of observations) {
|
||||
events.push({
|
||||
timestamp: obs.timestamp,
|
||||
type: 'observation',
|
||||
source: String(obs.agent),
|
||||
summary: `${obs.type}: ${obs.content?.action ?? 'unknown'}`,
|
||||
details: { observationId: obs.id, ...obs.content },
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// no observations
|
||||
}
|
||||
|
||||
for (const decision of state?.decisions ?? []) {
|
||||
events.push({
|
||||
timestamp: decision.madeAt,
|
||||
type: 'decision',
|
||||
source: decision.skillName ?? 'user',
|
||||
summary: `${decision.key} → ${decision.value}`,
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const snapshots = this.snapshotManager.list();
|
||||
for (const snap of snapshots) {
|
||||
events.push({
|
||||
timestamp: snap.createdAt,
|
||||
type: 'snapshot',
|
||||
source: 'snapshot',
|
||||
summary: `snapshot: ${snap.name}${snap.description ? ` — ${snap.description}` : ''}`,
|
||||
details: { skillCount: snap.skillCount },
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// no snapshots
|
||||
}
|
||||
|
||||
let filtered = events;
|
||||
|
||||
if (sinceDate) {
|
||||
filtered = filtered.filter((e) => new Date(e.timestamp) >= sinceDate);
|
||||
}
|
||||
|
||||
if (options?.types && options.types.length > 0) {
|
||||
const typeSet = new Set<TimelineEventType>(options.types);
|
||||
filtered = filtered.filter((e) => typeSet.has(e.type));
|
||||
}
|
||||
|
||||
if (options?.skillFilter) {
|
||||
const skill = options.skillFilter;
|
||||
filtered = filtered.filter(
|
||||
(e) => e.source.includes(skill) || (e.details?.skills as string[] | undefined)?.includes(skill)
|
||||
);
|
||||
}
|
||||
|
||||
filtered.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
||||
|
||||
const totalCount = filtered.length;
|
||||
const limited = filtered.slice(-limit);
|
||||
|
||||
return {
|
||||
projectPath: this.projectPath,
|
||||
sessionDate: new Date().toISOString().split('T')[0],
|
||||
events: limited,
|
||||
totalCount,
|
||||
};
|
||||
}
|
||||
|
||||
formatText(data: TimelineData): string {
|
||||
const lines: string[] = [];
|
||||
lines.push(' Session Timeline\n');
|
||||
|
||||
if (data.events.length === 0) {
|
||||
lines.push(' No events found.\n');
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
const icons: Record<TimelineEventType, string> = {
|
||||
skill_start: '>',
|
||||
skill_complete: '\u2713',
|
||||
task_progress: '\u2022',
|
||||
git_commit: '*',
|
||||
observation: '!',
|
||||
decision: '?',
|
||||
snapshot: '\u25C9',
|
||||
};
|
||||
|
||||
let lastTimeBlock = '';
|
||||
|
||||
for (const event of data.events) {
|
||||
const time = formatTime(event.timestamp);
|
||||
|
||||
if (time !== lastTimeBlock) {
|
||||
if (lastTimeBlock) lines.push('');
|
||||
lines.push(` ${time}`);
|
||||
lastTimeBlock = time;
|
||||
}
|
||||
|
||||
const icon = icons[event.type] ?? '\u2022';
|
||||
lines.push(` ${icon} ${event.summary}`);
|
||||
}
|
||||
|
||||
lines.push('');
|
||||
if (data.totalCount > data.events.length) {
|
||||
lines.push(` Showing ${data.events.length} of ${data.totalCount} events`);
|
||||
} else {
|
||||
lines.push(` ${data.totalCount} ${data.totalCount === 1 ? 'event' : 'events'} total`);
|
||||
}
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
formatJson(data: TimelineData): string {
|
||||
return JSON.stringify(data, null, 2);
|
||||
}
|
||||
}
|
||||
@@ -146,6 +146,100 @@ export interface SessionSnapshot {
|
||||
}>;
|
||||
}
|
||||
|
||||
// Timeline types
|
||||
export type TimelineEventType = 'skill_start' | 'skill_complete' | 'task_progress' | 'git_commit' | 'observation' | 'decision' | 'snapshot';
|
||||
|
||||
export interface TimelineEvent {
|
||||
timestamp: string;
|
||||
type: TimelineEventType;
|
||||
source: string;
|
||||
summary: string;
|
||||
details?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface TimelineData {
|
||||
projectPath: string;
|
||||
sessionDate: string;
|
||||
events: TimelineEvent[];
|
||||
totalCount: number;
|
||||
}
|
||||
|
||||
export interface TimelineOptions {
|
||||
since?: string;
|
||||
types?: TimelineEventType[];
|
||||
limit?: number;
|
||||
skillFilter?: string;
|
||||
includeGit?: boolean;
|
||||
}
|
||||
|
||||
// Handoff types
|
||||
export interface HandoffDocument {
|
||||
generatedAt: string;
|
||||
fromAgent: string;
|
||||
projectPath: string;
|
||||
accomplished: HandoffSection;
|
||||
pending: HandoffSection;
|
||||
keyFiles: Array<{ path: string; changeType: string }>;
|
||||
observations: {
|
||||
errors: Array<{ action: string; error: string }>;
|
||||
solutions: Array<{ action: string; solution: string }>;
|
||||
patterns: Array<{ action: string; context: string }>;
|
||||
};
|
||||
recommendations: string[];
|
||||
}
|
||||
|
||||
export interface HandoffSection {
|
||||
tasks: Array<{ name: string; duration?: string; commitSha?: string }>;
|
||||
commits: Array<{ sha: string; message: string; filesCount: number }>;
|
||||
}
|
||||
|
||||
export interface HandoffOptions {
|
||||
targetAgent?: string;
|
||||
includeGit?: boolean;
|
||||
includeObservations?: boolean;
|
||||
maxObservations?: number;
|
||||
}
|
||||
|
||||
// Lineage types
|
||||
export interface SkillLineageEntry {
|
||||
skillName: string;
|
||||
executions: number;
|
||||
totalDurationMs: number;
|
||||
commits: string[];
|
||||
filesModified: string[];
|
||||
observationIds: string[];
|
||||
firstSeen: string;
|
||||
lastSeen: string;
|
||||
}
|
||||
|
||||
export interface FileLineage {
|
||||
path: string;
|
||||
skills: string[];
|
||||
commitCount: number;
|
||||
lastModified: string;
|
||||
}
|
||||
|
||||
export interface LineageData {
|
||||
projectPath: string;
|
||||
skills: SkillLineageEntry[];
|
||||
files: FileLineage[];
|
||||
stats: {
|
||||
totalSkillExecutions: number;
|
||||
totalCommits: number;
|
||||
totalFilesChanged: number;
|
||||
mostImpactfulSkill: string | null;
|
||||
mostChangedFile: string | null;
|
||||
errorProneFiles: string[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface LineageOptions {
|
||||
skill?: string;
|
||||
file?: string;
|
||||
limit?: number;
|
||||
since?: string;
|
||||
}
|
||||
|
||||
export interface SessionExplanation {
|
||||
date: string;
|
||||
agent: string;
|
||||
|
||||
+62
-51
@@ -1,66 +1,77 @@
|
||||
import { z } from 'zod';
|
||||
import { z } from "zod";
|
||||
|
||||
export const AgentType = z.enum([
|
||||
'claude-code',
|
||||
'codex',
|
||||
'cursor',
|
||||
'antigravity',
|
||||
'opencode',
|
||||
'gemini-cli',
|
||||
'amp',
|
||||
'clawdbot',
|
||||
'droid',
|
||||
'github-copilot',
|
||||
'goose',
|
||||
'kilo',
|
||||
'kiro-cli',
|
||||
'roo',
|
||||
'trae',
|
||||
'windsurf',
|
||||
'universal',
|
||||
'cline',
|
||||
'codebuddy',
|
||||
'commandcode',
|
||||
'continue',
|
||||
'crush',
|
||||
'factory',
|
||||
'mcpjam',
|
||||
'mux',
|
||||
'neovate',
|
||||
'openhands',
|
||||
'pi',
|
||||
'qoder',
|
||||
'qwen',
|
||||
'vercel',
|
||||
'zencoder',
|
||||
'devin',
|
||||
'aider',
|
||||
'sourcegraph-cody',
|
||||
'amazon-q',
|
||||
'augment-code',
|
||||
'replit-agent',
|
||||
'bolt',
|
||||
'lovable',
|
||||
'tabby',
|
||||
'tabnine',
|
||||
'codegpt',
|
||||
'playcode-agent',
|
||||
"claude-code",
|
||||
"codex",
|
||||
"cursor",
|
||||
"antigravity",
|
||||
"opencode",
|
||||
"gemini-cli",
|
||||
"amp",
|
||||
"clawdbot",
|
||||
"droid",
|
||||
"github-copilot",
|
||||
"goose",
|
||||
"kilo",
|
||||
"kiro-cli",
|
||||
"roo",
|
||||
"trae",
|
||||
"windsurf",
|
||||
"universal",
|
||||
"cline",
|
||||
"codebuddy",
|
||||
"commandcode",
|
||||
"continue",
|
||||
"crush",
|
||||
"factory",
|
||||
"mcpjam",
|
||||
"mux",
|
||||
"neovate",
|
||||
"openhands",
|
||||
"pi",
|
||||
"qoder",
|
||||
"qwen",
|
||||
"vercel",
|
||||
"zencoder",
|
||||
"devin",
|
||||
"aider",
|
||||
"sourcegraph-cody",
|
||||
"amazon-q",
|
||||
"augment-code",
|
||||
"replit-agent",
|
||||
"bolt",
|
||||
"lovable",
|
||||
"tabby",
|
||||
"tabnine",
|
||||
"codegpt",
|
||||
"playcode-agent",
|
||||
]);
|
||||
export type AgentType = z.infer<typeof AgentType>;
|
||||
|
||||
export const GitProvider = z.enum(['github', 'gitlab', 'bitbucket', 'local', 'wellknown']);
|
||||
export const GitProvider = z.enum([
|
||||
"github",
|
||||
"gitlab",
|
||||
"bitbucket",
|
||||
"local",
|
||||
"wellknown",
|
||||
"skills-sh",
|
||||
]);
|
||||
export type GitProvider = z.infer<typeof GitProvider>;
|
||||
|
||||
export const SkillFrontmatter = z.object({
|
||||
name: z.string()
|
||||
name: z
|
||||
.string()
|
||||
.min(1)
|
||||
.max(64)
|
||||
.regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'Skill name must be lowercase alphanumeric with hyphens, no leading/trailing/consecutive hyphens'),
|
||||
.regex(
|
||||
/^[a-z0-9]+(-[a-z0-9]+)*$/,
|
||||
"Skill name must be lowercase alphanumeric with hyphens, no leading/trailing/consecutive hyphens",
|
||||
),
|
||||
description: z.string().min(1).max(1024),
|
||||
license: z.string().optional(),
|
||||
compatibility: z.string().max(500).optional(),
|
||||
metadata: z.record(z.string()).optional(),
|
||||
'allowed-tools': z.string().optional(),
|
||||
"allowed-tools": z.string().optional(),
|
||||
version: z.string().optional(),
|
||||
author: z.string().optional(),
|
||||
tags: z.array(z.string()).optional(),
|
||||
@@ -82,7 +93,7 @@ export const SkillMetadata = z.object({
|
||||
});
|
||||
export type SkillMetadata = z.infer<typeof SkillMetadata>;
|
||||
|
||||
export const SkillLocation = z.enum(['project', 'global']);
|
||||
export const SkillLocation = z.enum(["project", "global"]);
|
||||
export type SkillLocation = z.infer<typeof SkillLocation>;
|
||||
|
||||
export const Skill = z.object({
|
||||
@@ -97,7 +108,7 @@ export type Skill = z.infer<typeof Skill>;
|
||||
|
||||
export const SkillkitConfig = z.object({
|
||||
version: z.literal(1),
|
||||
agent: AgentType.default('universal'),
|
||||
agent: AgentType.default("universal"),
|
||||
skillsDir: z.string().optional(),
|
||||
enabledSkills: z.array(z.string()).optional(),
|
||||
disabledSkills: z.array(z.string()).optional(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/extension",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"private": true,
|
||||
"description": "Chrome extension to save any webpage as an AI agent skill",
|
||||
"type": "module",
|
||||
@@ -9,12 +9,9 @@
|
||||
"dev": "tsup --watch",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"turndown": "^7.2.2"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/chrome": "^0.0.280",
|
||||
"@types/turndown": "^5.0.6",
|
||||
"tsup": "^8.3.5",
|
||||
"typescript": "^5.7.2"
|
||||
}
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import type { SaveResponse, ErrorResponse, ExtensionMessage } from './types';
|
||||
|
||||
const TECH_KEYWORDS = new Set([
|
||||
'react', 'vue', 'angular', 'svelte', 'next', 'nuxt', 'node', 'deno', 'bun',
|
||||
'typescript', 'javascript', 'python', 'rust', 'go', 'java', 'kotlin', 'swift',
|
||||
'docker', 'kubernetes', 'aws', 'gcp', 'azure', 'terraform', 'ansible',
|
||||
'graphql', 'rest', 'api', 'sql', 'nosql', 'redis', 'postgres', 'mongodb',
|
||||
'testing', 'ci', 'cd', 'git', 'webpack', 'vite', 'tailwind', 'css',
|
||||
'ai', 'ml', 'llm', 'mcp', 'agent', 'prompt', 'rag', 'embedding',
|
||||
]);
|
||||
const API_URL = 'https://skillkit.sh/api/save-skill';
|
||||
|
||||
chrome.runtime.onInstalled.addListener(() => {
|
||||
chrome.contextMenus.create({
|
||||
@@ -28,83 +21,107 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => {
|
||||
|
||||
try {
|
||||
if (info.menuItemId === 'save-page') {
|
||||
const pageInfo = await chrome.tabs.sendMessage(tab.id, { type: 'GET_PAGE_INFO' });
|
||||
if (pageInfo?.type === 'PAGE_INFO') {
|
||||
const { url, title, markdown } = pageInfo.payload;
|
||||
const result = generateAndDownload({ url, title, content: markdown });
|
||||
notifyTab(tab.id, result);
|
||||
const url = tab.url ?? '';
|
||||
if (!url || url.startsWith('chrome://') || url.startsWith('about:')) {
|
||||
notifyTab(tab.id, { error: 'Cannot save skills from this page' });
|
||||
return;
|
||||
}
|
||||
const result = await callSaveApi(url);
|
||||
if (!('error' in result)) {
|
||||
downloadSkill(result.name, result.skillMd);
|
||||
}
|
||||
notifyTab(tab.id, result);
|
||||
}
|
||||
|
||||
if (info.menuItemId === 'save-selection' && info.selectionText) {
|
||||
const url = tab.url ?? '';
|
||||
const result = generateAndDownload({ url, title: '', content: info.selectionText });
|
||||
const result = buildSelectionSkill(info.selectionText, url);
|
||||
downloadSkill(result.name, result.skillMd);
|
||||
notifyTab(tab.id, result);
|
||||
}
|
||||
} catch {
|
||||
notifyTab(tab.id, { error: 'Failed to extract page content' });
|
||||
notifyTab(tab.id, { error: 'Failed to save skill' });
|
||||
}
|
||||
});
|
||||
|
||||
chrome.runtime.onMessage.addListener(
|
||||
(message: ExtensionMessage, _sender, sendResponse) => {
|
||||
if (message.type === 'SAVE_PAGE') {
|
||||
const { url, title, markdown, name } = message.payload;
|
||||
sendResponse(generateAndDownload({ url, title, content: markdown, name }));
|
||||
} else if (message.type === 'SAVE_SELECTION') {
|
||||
const { text, url, name } = message.payload;
|
||||
sendResponse(generateAndDownload({ url, title: '', content: text, name }));
|
||||
const { url, name } = message.payload;
|
||||
callSaveApi(url, name).then((result) => {
|
||||
if (!('error' in result)) {
|
||||
downloadSkill(result.name, result.skillMd);
|
||||
}
|
||||
sendResponse(result);
|
||||
}).catch(() => {
|
||||
sendResponse({ error: 'Failed to save skill' });
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.type === 'SAVE_SELECTION') {
|
||||
const { text, url, name } = message.payload;
|
||||
const result = buildSelectionSkill(text, url, name);
|
||||
downloadSkill(result.name, result.skillMd);
|
||||
sendResponse(result);
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
);
|
||||
|
||||
interface GenerateInput {
|
||||
url: string;
|
||||
title: string;
|
||||
content: string;
|
||||
name?: string;
|
||||
async function callSaveApi(url: string, name?: string): Promise<SaveResponse | ErrorResponse> {
|
||||
const response = await fetch(API_URL, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ url, name }),
|
||||
});
|
||||
|
||||
let data: Record<string, unknown>;
|
||||
try {
|
||||
data = await response.json();
|
||||
} catch {
|
||||
return { error: `Server error: ${response.status}` };
|
||||
}
|
||||
if (!response.ok) {
|
||||
return { error: (data.error as string) ?? `Server error: ${response.status}` };
|
||||
}
|
||||
return {
|
||||
name: data.name as string,
|
||||
filename: `${data.name}/SKILL.md`,
|
||||
skillMd: data.skillMd as string,
|
||||
tags: (data.tags as string[]) ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
function generateAndDownload(input: GenerateInput): SaveResponse | ErrorResponse {
|
||||
try {
|
||||
const name = slugify(input.name || input.title || titleFromUrl(input.url));
|
||||
const tags = detectTags(input.url, input.content);
|
||||
const description = makeDescription(input.content);
|
||||
const savedAt = new Date().toISOString();
|
||||
function buildSelectionSkill(text: string, url: string, name?: string): SaveResponse {
|
||||
const skillName = slugify(name || 'selection');
|
||||
const savedAt = new Date().toISOString();
|
||||
|
||||
const yamlTags = tags.length > 0
|
||||
? `tags:\n${tags.map((t) => ` - ${t}`).join('\n')}\n`
|
||||
: '';
|
||||
const skillMd =
|
||||
`---\n` +
|
||||
`name: ${skillName}\n` +
|
||||
`description: Selected text saved as skill\n` +
|
||||
`metadata:\n` +
|
||||
(url ? ` source: ${yamlEscape(url)}\n` : '') +
|
||||
` savedAt: ${savedAt}\n` +
|
||||
`---\n\n` +
|
||||
text + '\n';
|
||||
|
||||
const skillMd =
|
||||
`---\n` +
|
||||
`name: ${name}\n` +
|
||||
`description: ${yamlEscape(description)}\n` +
|
||||
yamlTags +
|
||||
`metadata:\n` +
|
||||
(input.url ? ` source: ${input.url}\n` : '') +
|
||||
` savedAt: ${savedAt}\n` +
|
||||
`---\n\n` +
|
||||
input.content + '\n';
|
||||
return {
|
||||
name: skillName,
|
||||
filename: `${skillName}/SKILL.md`,
|
||||
skillMd,
|
||||
tags: [],
|
||||
};
|
||||
}
|
||||
|
||||
const filename = `${name}/SKILL.md`;
|
||||
|
||||
const blob = new Blob([skillMd], { type: 'text/markdown' });
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
chrome.downloads.download({
|
||||
url: blobUrl,
|
||||
filename: `skillkit-skills/${filename}`,
|
||||
saveAs: false,
|
||||
}, () => {
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
});
|
||||
|
||||
return { name, filename, skillMd, tags };
|
||||
} catch (err) {
|
||||
return { error: err instanceof Error ? err.message : 'Generation failed' };
|
||||
function yamlEscape(value: string): string {
|
||||
const singleLine = value.replace(/\r?\n/g, ' ').trim();
|
||||
if (/[:#{}[\],&*?|>!%@`]/.test(singleLine) || singleLine.startsWith("'") || singleLine.startsWith('"')) {
|
||||
return `"${singleLine.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
||||
}
|
||||
return singleLine;
|
||||
}
|
||||
|
||||
function slugify(input: string): string {
|
||||
@@ -116,39 +133,16 @@ function slugify(input: string): string {
|
||||
return slug.slice(0, 64).replace(/-+$/, '') || 'untitled-skill';
|
||||
}
|
||||
|
||||
function titleFromUrl(url: string): string {
|
||||
try {
|
||||
const pathname = new URL(url).pathname;
|
||||
const last = pathname.split('/').filter(Boolean).pop();
|
||||
return last ?? 'untitled';
|
||||
} catch {
|
||||
return 'untitled';
|
||||
}
|
||||
}
|
||||
|
||||
function makeDescription(content: string): string {
|
||||
const firstLine = content.split('\n').find((l) => l.trim().length > 0) ?? '';
|
||||
const cleaned = firstLine.replace(/^#+\s*/, '').trim();
|
||||
if (cleaned.length > 200) return cleaned.slice(0, 197) + '...';
|
||||
return cleaned || 'Saved skill';
|
||||
}
|
||||
|
||||
function yamlEscape(value: string): string {
|
||||
const singleLine = value.replace(/\r?\n/g, ' ').trim();
|
||||
if (/[:#{}[\],&*?|>!%@`]/.test(singleLine) || singleLine.startsWith("'") || singleLine.startsWith('"')) {
|
||||
return `"${singleLine.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
||||
}
|
||||
return singleLine;
|
||||
}
|
||||
|
||||
function detectTags(url: string, content: string): string[] {
|
||||
const text = `${url} ${content}`.toLowerCase();
|
||||
const found: string[] = [];
|
||||
for (const kw of TECH_KEYWORDS) {
|
||||
if (text.includes(kw)) found.push(kw);
|
||||
if (found.length >= 10) break;
|
||||
}
|
||||
return found;
|
||||
function downloadSkill(name: string, skillMd: string): void {
|
||||
const blob = new Blob([skillMd], { type: 'text/markdown' });
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
chrome.downloads.download({
|
||||
url: blobUrl,
|
||||
filename: `skillkit-skills/${name}/SKILL.md`,
|
||||
saveAs: false,
|
||||
}, () => {
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
});
|
||||
}
|
||||
|
||||
function notifyTab(tabId: number, result: SaveResponse | ErrorResponse): void {
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import TurndownService from 'turndown';
|
||||
import type { ExtensionMessage, PageContent } from './types';
|
||||
|
||||
const turndown = new TurndownService({
|
||||
headingStyle: 'atx',
|
||||
codeBlockStyle: 'fenced',
|
||||
});
|
||||
|
||||
turndown.remove(['script', 'style', 'nav', 'footer', 'iframe', 'noscript']);
|
||||
|
||||
function extractPageContent(): PageContent {
|
||||
const selection = window.getSelection()?.toString() ?? '';
|
||||
const description =
|
||||
document.querySelector('meta[name="description"]')?.getAttribute('content') ?? '';
|
||||
|
||||
const article = document.querySelector('article, main, [role="main"]');
|
||||
const source = article ?? document.body;
|
||||
const markdown = turndown.turndown(source.innerHTML);
|
||||
|
||||
return {
|
||||
url: window.location.href,
|
||||
title: document.title || description || window.location.hostname,
|
||||
markdown,
|
||||
selection,
|
||||
description,
|
||||
};
|
||||
}
|
||||
|
||||
chrome.runtime.onMessage.addListener(
|
||||
(message: ExtensionMessage, _sender, sendResponse) => {
|
||||
if (message.type === 'GET_PAGE_INFO') {
|
||||
const content = extractPageContent();
|
||||
const response: ExtensionMessage = { type: 'PAGE_INFO', payload: content };
|
||||
sendResponse(response);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
);
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "SkillKit - Save as Skill",
|
||||
"version": "1.17.0",
|
||||
"version": "1.19.0",
|
||||
"description": "Save any webpage as an AI agent skill — instantly available across 44 agents",
|
||||
"permissions": ["contextMenus", "activeTab", "storage", "downloads"],
|
||||
"permissions": ["contextMenus", "activeTab", "downloads"],
|
||||
"background": {
|
||||
"service_worker": "background.global.js"
|
||||
},
|
||||
@@ -15,12 +15,6 @@
|
||||
"128": "icons/icon128.png"
|
||||
}
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["content.global.js"]
|
||||
}
|
||||
],
|
||||
"icons": {
|
||||
"16": "icons/icon16.png",
|
||||
"48": "icons/icon48.png",
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
</div>
|
||||
|
||||
<button id="save-btn" class="primary">Save as Skill</button>
|
||||
<button id="save-selection-btn" class="secondary" style="display:none">Save Selection as Skill</button>
|
||||
|
||||
<div id="status" class="status" style="display:none">
|
||||
<span id="status-icon"></span>
|
||||
|
||||
@@ -4,7 +4,6 @@ const pageTitle = document.getElementById('page-title')!;
|
||||
const pageUrl = document.getElementById('page-url')!;
|
||||
const skillNameInput = document.getElementById('skill-name') as HTMLInputElement;
|
||||
const saveBtn = document.getElementById('save-btn')!;
|
||||
const saveSelectionBtn = document.getElementById('save-selection-btn')!;
|
||||
const statusEl = document.getElementById('status')!;
|
||||
const statusIcon = document.getElementById('status-icon')!;
|
||||
const statusText = document.getElementById('status-text')!;
|
||||
@@ -12,8 +11,6 @@ const resultEl = document.getElementById('result')!;
|
||||
const resultPath = document.getElementById('result-path')!;
|
||||
|
||||
let currentUrl = '';
|
||||
let currentSelection = '';
|
||||
let currentMarkdown = '';
|
||||
let currentTitle = '';
|
||||
|
||||
async function init() {
|
||||
@@ -25,63 +22,33 @@ async function init() {
|
||||
currentUrl = tab.url || '';
|
||||
currentTitle = tab.title || '';
|
||||
|
||||
try {
|
||||
const response = await chrome.tabs.sendMessage(
|
||||
tab.id,
|
||||
{ type: 'GET_PAGE_INFO' } satisfies ExtensionMessage,
|
||||
);
|
||||
if (response?.type === 'PAGE_INFO') {
|
||||
currentMarkdown = response.payload.markdown;
|
||||
currentSelection = response.payload.selection;
|
||||
currentTitle = response.payload.title || currentTitle;
|
||||
if (currentSelection) {
|
||||
saveSelectionBtn.style.display = 'block';
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Content script not loaded (chrome:// pages, etc.)
|
||||
const isRestricted = !currentUrl || currentUrl.startsWith('chrome://') || currentUrl.startsWith('chrome-extension://') || currentUrl.startsWith('about:');
|
||||
if (isRestricted) {
|
||||
saveBtn.setAttribute('disabled', '');
|
||||
setStatus('error', 'Cannot save skills from this page');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
saveBtn.addEventListener('click', async () => {
|
||||
if (!currentUrl) return;
|
||||
await save({
|
||||
|
||||
setStatus('saving', 'Saving...');
|
||||
saveBtn.setAttribute('disabled', '');
|
||||
|
||||
const message: ExtensionMessage = {
|
||||
type: 'SAVE_PAGE',
|
||||
payload: {
|
||||
url: currentUrl,
|
||||
title: currentTitle,
|
||||
markdown: currentMarkdown,
|
||||
name: skillNameInput.value.trim() || undefined,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
saveSelectionBtn.addEventListener('click', async () => {
|
||||
if (!currentSelection) return;
|
||||
await save({
|
||||
type: 'SAVE_SELECTION',
|
||||
payload: {
|
||||
text: currentSelection,
|
||||
url: currentUrl,
|
||||
name: skillNameInput.value.trim() || undefined,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
function setButtonsDisabled(disabled: boolean): void {
|
||||
const method = disabled ? 'setAttribute' : 'removeAttribute';
|
||||
saveBtn[method]('disabled', '');
|
||||
saveSelectionBtn[method]('disabled', '');
|
||||
}
|
||||
|
||||
async function save(message: ExtensionMessage) {
|
||||
setStatus('saving', 'Saving...');
|
||||
setButtonsDisabled(true);
|
||||
};
|
||||
|
||||
const response: SaveResponse | ErrorResponse | undefined =
|
||||
await chrome.runtime.sendMessage(message);
|
||||
|
||||
setButtonsDisabled(false);
|
||||
saveBtn.removeAttribute('disabled');
|
||||
|
||||
if (!response) {
|
||||
setStatus('error', 'No response from background script');
|
||||
@@ -98,7 +65,7 @@ async function save(message: ExtensionMessage) {
|
||||
setStatus('success', `Saved "${response.name}"`);
|
||||
resultPath.textContent = `Downloads/skillkit-skills/${response.filename}`;
|
||||
resultEl.style.display = 'block';
|
||||
}
|
||||
});
|
||||
|
||||
function setStatus(type: 'saving' | 'success' | 'error', text: string) {
|
||||
statusEl.style.display = 'flex';
|
||||
|
||||
@@ -9,16 +9,6 @@ export interface ErrorResponse {
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface PageContent {
|
||||
url: string;
|
||||
title: string;
|
||||
markdown: string;
|
||||
selection: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export type ExtensionMessage =
|
||||
| { type: 'SAVE_PAGE'; payload: { url: string; title: string; markdown: string; name?: string } }
|
||||
| { type: 'SAVE_SELECTION'; payload: { text: string; url: string; name?: string } }
|
||||
| { type: 'GET_PAGE_INFO' }
|
||||
| { type: 'PAGE_INFO'; payload: PageContent };
|
||||
| { type: 'SAVE_PAGE'; payload: { url: string; title: string; name?: string } }
|
||||
| { type: 'SAVE_SELECTION'; payload: { text: string; url: string; name?: string } };
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
SkillKit - Save as Skill
|
||||
|
||||
## Summary (132 chars max)
|
||||
Save any webpage as an AI agent skill. One click, works across 44 coding agents. No server needed.
|
||||
Save any webpage as an AI agent skill file. One click, works across 44 coding agents.
|
||||
|
||||
## Description
|
||||
SkillKit lets you save any webpage as a reusable AI agent skill with one click. The saved SKILL.md file works instantly across 44 coding agents including Claude Code, Cursor, Codex, Gemini CLI, Windsurf, and more.
|
||||
@@ -14,19 +14,22 @@ How it works:
|
||||
- Right-click any page and select "Save page as Skill"
|
||||
- Select text, right-click, and choose "Save selection as Skill"
|
||||
|
||||
Everything runs in the browser. No server, no API key, no account needed. Pages are converted to clean markdown with auto-generated YAML frontmatter and smart tags.
|
||||
When you save a page, the extension sends the page URL to our server (skillkit.sh / agenstskills.com) where it is converted to clean markdown with auto-generated tags and YAML frontmatter. The resulting skill file is downloaded to your computer. No page content, browsing history, or personal data is ever sent — only the URL of the page you choose to save.
|
||||
|
||||
Saving selected text works entirely offline with no network requests.
|
||||
|
||||
After saving, run `skillkit install <path>` to make the skill available to all your AI coding agents at once.
|
||||
|
||||
Features:
|
||||
- Converts HTML to clean markdown
|
||||
- Converts HTML to clean markdown via server-side processing
|
||||
- Auto-generates YAML frontmatter with metadata
|
||||
- Smart tag detection from 40+ tech keywords
|
||||
- Smart tag detection from 50+ tech keywords (weighted 5-source analysis)
|
||||
- GitHub URL support (auto-converts blob URLs to raw content)
|
||||
- Context menu integration for quick saves
|
||||
- Works on any webpage
|
||||
- Zero dependencies on external servers
|
||||
- No account or API key required
|
||||
|
||||
Part of the SkillKit ecosystem: https://agenstskills.com
|
||||
Part of the SkillKit ecosystem: https://skillkit.sh
|
||||
|
||||
## Category
|
||||
Developer Tools
|
||||
@@ -35,17 +38,34 @@ Developer Tools
|
||||
English
|
||||
|
||||
## Website
|
||||
https://agenstskills.com
|
||||
https://skillkit.sh
|
||||
|
||||
## Support URL
|
||||
https://github.com/rohitg00/skillkit/issues
|
||||
|
||||
## Privacy Policy
|
||||
This extension does not collect, transmit, or store any user data externally. All processing happens locally in the browser. Saved skills are downloaded to the local filesystem via the Chrome Downloads API.
|
||||
## Privacy Policy URL
|
||||
https://skillkit.sh/privacy.html
|
||||
|
||||
## Single Purpose
|
||||
Save webpages as AI agent skill files (SKILL.md) for use with coding AI agents.
|
||||
|
||||
## Permissions Justification
|
||||
- activeTab: Read the URL and title of the current tab when the user clicks the extension icon or context menu. Only accessed on explicit user action.
|
||||
- contextMenus: Add "Save page as Skill" and "Save selection as Skill" to the right-click context menu.
|
||||
- downloads: Save the generated SKILL.md file to the user's Downloads folder.
|
||||
|
||||
## Data Usage Disclosure (for Chrome Web Store Privacy tab)
|
||||
- Does the extension use remote code? No
|
||||
- Does it collect user data? No personal data. The page URL is sent to our server (skillkit.sh / agenstskills.com) when the user clicks save.
|
||||
- Data type: Website content (URL only, on user action)
|
||||
- Use: Required for core functionality (converting webpage to skill file)
|
||||
- Transfer: Sent to our server (skillkit.sh / agenstskills.com) over HTTPS
|
||||
- Not sold to third parties
|
||||
- Not used for creditworthiness or lending
|
||||
|
||||
## Host Permissions
|
||||
None. The extension uses activeTab which grants temporary access only when the user invokes the extension.
|
||||
|
||||
## Assets
|
||||
- promo-small-440x280.png — Small promo tile
|
||||
- screenshot-1-1280x800.png — Popup UI showing save flow
|
||||
|
||||
Binary file not shown.
@@ -3,7 +3,6 @@ import { defineConfig } from 'tsup';
|
||||
export default defineConfig({
|
||||
entry: {
|
||||
background: 'src/background.ts',
|
||||
content: 'src/content.ts',
|
||||
popup: 'src/popup.ts',
|
||||
},
|
||||
format: ['iife'],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/mcp-memory",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "MCP (Model Context Protocol) server for SkillKit persistent memory",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/mcp",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "MCP server for SkillKit skill discovery — agent-native skill search",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/memory",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "CozoDB-backed semantic memory with embeddings for SkillKit",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/mesh",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "Peer mesh network for multi-machine agent distribution",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/messaging",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "Inter-agent messaging system for SkillKit",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/resources",
|
||||
"version": "1.18.0",
|
||||
"version": "1.19.2",
|
||||
"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.18.0",
|
||||
"version": "1.19.2",
|
||||
"description": "Unified Terminal UI for SkillKit - Built on OpenTUI",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -9,9 +9,10 @@ import {
|
||||
Home, Browse, Installed, Marketplace, Settings, Recommend,
|
||||
Translate, Context, Memory, Team, Plugins, Methodology,
|
||||
Plan, Workflow, Execute, History, Sync, Help, Mesh, Message, Scan,
|
||||
Timeline, Lineage, Handoff,
|
||||
} from './screens/index.js';
|
||||
|
||||
const DOCS_URL = 'https://agenstskills.com/docs';
|
||||
const DOCS_URL = 'https://skillkit.sh/docs';
|
||||
|
||||
function openUrl(url: string): void {
|
||||
if (process.platform === 'win32') {
|
||||
@@ -138,6 +139,9 @@ export function App(props: AppProps) {
|
||||
<Match when={currentScreen() === 'mesh'}><Mesh {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'message'}><Message {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'scan'}><Scan {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'timeline'}><Timeline {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'lineage'}><Lineage {...screenProps()} /></Match>
|
||||
<Match when={currentScreen() === 'handoff'}><Handoff {...screenProps()} /></Match>
|
||||
</Switch>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
@@ -29,6 +29,9 @@ const SCREEN_LABELS: Record<Screen, string> = {
|
||||
mesh: 'Mesh',
|
||||
message: 'Message',
|
||||
scan: 'Security Scan',
|
||||
timeline: 'Timeline',
|
||||
lineage: 'Lineage',
|
||||
handoff: 'Handoff',
|
||||
};
|
||||
|
||||
export function BottomStatusBar(props: BottomStatusBarProps) {
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
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 } from '../components/EmptyState.js';
|
||||
import { execFile } from 'node:child_process';
|
||||
|
||||
function changeTypeLabel(changeType: string): string {
|
||||
switch (changeType) {
|
||||
case 'modified': return 'M';
|
||||
case 'created': return 'A';
|
||||
default: return 'D';
|
||||
}
|
||||
}
|
||||
|
||||
interface HandoffProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
cols?: number;
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
interface HandoffTask {
|
||||
name: string;
|
||||
duration?: string;
|
||||
commitSha?: string;
|
||||
}
|
||||
|
||||
interface HandoffCommit {
|
||||
sha: string;
|
||||
message: string;
|
||||
filesCount: number;
|
||||
}
|
||||
|
||||
interface HandoffResult {
|
||||
generatedAt: string;
|
||||
fromAgent: string;
|
||||
projectPath: string;
|
||||
accomplished: { tasks: HandoffTask[]; commits: HandoffCommit[] };
|
||||
pending: { tasks: HandoffTask[]; commits: HandoffCommit[] };
|
||||
keyFiles: Array<{ path: string; changeType: string }>;
|
||||
observations: {
|
||||
errors: Array<{ action: string; error: string }>;
|
||||
solutions: Array<{ action: string; solution: string }>;
|
||||
patterns: Array<{ action: string; context: string }>;
|
||||
};
|
||||
recommendations: string[];
|
||||
}
|
||||
|
||||
type SectionView = 'accomplished' | 'pending' | 'files' | 'recommendations';
|
||||
|
||||
export function Handoff(props: HandoffProps) {
|
||||
const [loading, setLoading] = createSignal(true);
|
||||
const [result, setResult] = createSignal<HandoffResult | null>(null);
|
||||
const [error, setError] = createSignal<string | null>(null);
|
||||
const [section, setSection] = createSignal<SectionView>('accomplished');
|
||||
|
||||
const loadHandoff = () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
execFile('npx', ['skillkit', 'session', 'handoff', '--json'], {
|
||||
timeout: 15000,
|
||||
maxBuffer: 1024 * 1024,
|
||||
}, (err, stdout, stderr) => {
|
||||
setLoading(false);
|
||||
if (err && !stdout) {
|
||||
setError(stderr || err.message || 'Failed to generate handoff');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(stdout) as HandoffResult;
|
||||
setResult(parsed);
|
||||
} catch {
|
||||
setError('Failed to parse handoff data');
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
setLoading(false);
|
||||
setError(err instanceof Error ? err.message : 'Failed to generate handoff');
|
||||
}
|
||||
};
|
||||
|
||||
createEffect(() => {
|
||||
loadHandoff();
|
||||
});
|
||||
|
||||
const sections: SectionView[] = ['accomplished', 'pending', 'files', 'recommendations'];
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'tab') {
|
||||
const idx = sections.indexOf(section());
|
||||
setSection(sections[(idx + 1) % sections.length]);
|
||||
} else if (key.name === 'r') {
|
||||
loadHandoff();
|
||||
} else if (key.name === 'escape') {
|
||||
props.onNavigate('home');
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
<Header
|
||||
title="Handoff"
|
||||
subtitle="agent-to-agent context transfer"
|
||||
icon="⇄"
|
||||
/>
|
||||
|
||||
<Show when={loading()}>
|
||||
<Spinner label="Generating handoff document..." />
|
||||
</Show>
|
||||
|
||||
<Show when={error()}>
|
||||
<box flexDirection="column">
|
||||
<text fg="#ff5555">Error: {error()}</text>
|
||||
<text fg={terminalColors.textMuted}>Press r to retry</text>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={!loading() && !error() && result()}>
|
||||
<box flexDirection="row" gap={1} marginBottom={1}>
|
||||
<text fg={terminalColors.textMuted}>from:</text>
|
||||
<text fg={terminalColors.text}>{result()!.fromAgent}</text>
|
||||
<text fg={terminalColors.textMuted}>|</text>
|
||||
<text fg={terminalColors.textMuted}>{result()!.generatedAt}</text>
|
||||
</box>
|
||||
|
||||
<box flexDirection="row" gap={2} marginBottom={1}>
|
||||
<For each={sections}>
|
||||
{(s) => (
|
||||
<text
|
||||
fg={section() === s ? terminalColors.accent : terminalColors.textMuted}
|
||||
bold={section() === s}
|
||||
>
|
||||
{s.charAt(0).toUpperCase() + s.slice(1)}
|
||||
</text>
|
||||
)}
|
||||
</For>
|
||||
<text fg={terminalColors.textMuted}>(Tab to switch)</text>
|
||||
</box>
|
||||
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(Math.min(60, (props.cols ?? 80) - 4))}</text>
|
||||
|
||||
<Show when={section() === 'accomplished'}>
|
||||
<text fg={terminalColors.text} bold>Accomplished Tasks</text>
|
||||
<text> </text>
|
||||
<Show when={result()!.accomplished.tasks.length === 0}>
|
||||
<EmptyState title="No accomplished tasks in this session" />
|
||||
</Show>
|
||||
<For each={result()!.accomplished.tasks}>
|
||||
{(task) => (
|
||||
<box flexDirection="row" gap={1}>
|
||||
<text fg="#22cc44">✓</text>
|
||||
<text fg={terminalColors.text}>{task.name}</text>
|
||||
<Show when={task.duration}>
|
||||
<text fg={terminalColors.textMuted}>({task.duration})</text>
|
||||
</Show>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
<Show when={result()!.accomplished.commits.length > 0}>
|
||||
<text> </text>
|
||||
<text fg={terminalColors.text} bold>Commits</text>
|
||||
<For each={result()!.accomplished.commits}>
|
||||
{(commit) => (
|
||||
<box flexDirection="row" gap={1}>
|
||||
<text fg="#fbbf24">●</text>
|
||||
<text fg={terminalColors.textMuted}>{commit.sha.slice(0, 7)}</text>
|
||||
<text fg={terminalColors.text}>{commit.message}</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<Show when={section() === 'pending'}>
|
||||
<text fg={terminalColors.text} bold>Pending Tasks</text>
|
||||
<text> </text>
|
||||
<Show when={result()!.pending.tasks.length === 0}>
|
||||
<EmptyState title="No pending tasks" />
|
||||
</Show>
|
||||
<For each={result()!.pending.tasks}>
|
||||
{(task) => (
|
||||
<box flexDirection="row" gap={1}>
|
||||
<text fg="#ffaa00">○</text>
|
||||
<text fg={terminalColors.text}>{task.name}</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
|
||||
<Show when={section() === 'files'}>
|
||||
<text fg={terminalColors.text} bold>Key Files</text>
|
||||
<text> </text>
|
||||
<Show when={result()!.keyFiles.length === 0}>
|
||||
<EmptyState title="No key files tracked" />
|
||||
</Show>
|
||||
<For each={result()!.keyFiles}>
|
||||
{(file) => (
|
||||
<box flexDirection="row" gap={1}>
|
||||
<text fg={terminalColors.textMuted}>{changeTypeLabel(file.changeType)}</text>
|
||||
<text fg={terminalColors.text}>{file.path}</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
|
||||
<Show when={section() === 'recommendations'}>
|
||||
<text fg={terminalColors.text} bold>Recommendations</text>
|
||||
<text> </text>
|
||||
<Show when={result()!.recommendations.length === 0}>
|
||||
<EmptyState title="No recommendations" />
|
||||
</Show>
|
||||
<For each={result()!.recommendations}>
|
||||
{(rec) => (
|
||||
<box flexDirection="row" gap={1}>
|
||||
<text fg={terminalColors.accent}>→</text>
|
||||
<text fg={terminalColors.text}>{rec}</text>
|
||||
</box>
|
||||
)}
|
||||
</For>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>Tab switch section r refresh esc back</text>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
import { createSignal, createEffect, Show, For, createMemo } 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 } from '../components/EmptyState.js';
|
||||
import { execFile } from 'node:child_process';
|
||||
|
||||
interface LineageProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
cols?: number;
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
interface SkillLineageEntry {
|
||||
skillName: string;
|
||||
executions: number;
|
||||
totalDurationMs: number;
|
||||
commits: string[];
|
||||
filesModified: string[];
|
||||
firstSeen: string;
|
||||
lastSeen: string;
|
||||
}
|
||||
|
||||
interface FileLineage {
|
||||
path: string;
|
||||
skills: string[];
|
||||
commitCount: number;
|
||||
lastModified: string;
|
||||
}
|
||||
|
||||
interface LineageResult {
|
||||
projectPath: string;
|
||||
skills: SkillLineageEntry[];
|
||||
files: FileLineage[];
|
||||
stats: {
|
||||
totalSkillExecutions: number;
|
||||
totalCommits: number;
|
||||
totalFilesChanged: number;
|
||||
mostImpactfulSkill: string | null;
|
||||
mostChangedFile: string | null;
|
||||
errorProneFiles: string[];
|
||||
};
|
||||
}
|
||||
|
||||
type ViewMode = 'skills' | 'files';
|
||||
|
||||
function formatDuration(ms: number): string {
|
||||
const seconds = Math.floor(ms / 1000);
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
if (minutes > 0) return `${minutes}m`;
|
||||
return `${seconds}s`;
|
||||
}
|
||||
|
||||
export function Lineage(props: LineageProps) {
|
||||
const [loading, setLoading] = createSignal(true);
|
||||
const [result, setResult] = createSignal<LineageResult | null>(null);
|
||||
const [error, setError] = createSignal<string | null>(null);
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
const [viewMode, setViewMode] = createSignal<ViewMode>('skills');
|
||||
|
||||
const rows = () => props.rows ?? 24;
|
||||
const visibleCount = () => Math.max(1, rows() - 14);
|
||||
|
||||
const loadLineage = () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
execFile('npx', ['skillkit', 'lineage', '--json'], {
|
||||
timeout: 15000,
|
||||
maxBuffer: 1024 * 1024,
|
||||
}, (err, stdout, stderr) => {
|
||||
setLoading(false);
|
||||
if (err && !stdout) {
|
||||
setError(stderr || err.message || 'Failed to load lineage');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(stdout) as LineageResult;
|
||||
setResult(parsed);
|
||||
} catch {
|
||||
setError('Failed to parse lineage data');
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
setLoading(false);
|
||||
setError(err instanceof Error ? err.message : 'Failed to load lineage');
|
||||
}
|
||||
};
|
||||
|
||||
createEffect(() => {
|
||||
loadLineage();
|
||||
});
|
||||
|
||||
const items = createMemo(() => {
|
||||
if (viewMode() === 'skills') return result()?.skills ?? [];
|
||||
return result()?.files ?? [];
|
||||
});
|
||||
|
||||
const windowStart = createMemo(() => Math.max(0, selectedIndex() - visibleCount() + 1));
|
||||
const visibleItems = createMemo(() =>
|
||||
items().slice(windowStart(), windowStart() + visibleCount())
|
||||
);
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'k' || key.name === 'up') {
|
||||
setSelectedIndex(i => Math.max(0, i - 1));
|
||||
} else if (key.name === 'j' || key.name === 'down') {
|
||||
setSelectedIndex(i => items().length > 0 ? Math.min(items().length - 1, i + 1) : 0);
|
||||
} else if (key.name === 'tab') {
|
||||
setViewMode(m => m === 'skills' ? 'files' : 'skills');
|
||||
setSelectedIndex(0);
|
||||
} else if (key.name === 'r') {
|
||||
loadLineage();
|
||||
} else if (key.name === 'escape') {
|
||||
props.onNavigate('home');
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
<Header
|
||||
title="Lineage"
|
||||
subtitle="skill impact graph"
|
||||
icon="◉"
|
||||
/>
|
||||
|
||||
<Show when={loading()}>
|
||||
<Spinner label="Loading lineage..." />
|
||||
</Show>
|
||||
|
||||
<Show when={error()}>
|
||||
<box flexDirection="column">
|
||||
<text fg="#ff5555">Error: {error()}</text>
|
||||
<text fg={terminalColors.textMuted}>Press r to retry</text>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={!loading() && !error() && result()}>
|
||||
<box flexDirection="row" gap={2} marginBottom={1}>
|
||||
<text fg={terminalColors.text}>{result()!.stats.totalSkillExecutions} executions</text>
|
||||
<text fg={terminalColors.textMuted}>|</text>
|
||||
<text fg={terminalColors.text}>{result()!.stats.totalCommits} commits</text>
|
||||
<text fg={terminalColors.textMuted}>|</text>
|
||||
<text fg={terminalColors.text}>{result()!.stats.totalFilesChanged} files</text>
|
||||
<Show when={result()!.stats.mostImpactfulSkill}>
|
||||
<text fg={terminalColors.textMuted}>|</text>
|
||||
<text fg="#22cc44">top: {result()!.stats.mostImpactfulSkill}</text>
|
||||
</Show>
|
||||
</box>
|
||||
|
||||
<box flexDirection="row" gap={2} marginBottom={1}>
|
||||
<text
|
||||
fg={viewMode() === 'skills' ? terminalColors.accent : terminalColors.textMuted}
|
||||
bold={viewMode() === 'skills'}
|
||||
>
|
||||
Skills ({result()?.skills?.length ?? 0})
|
||||
</text>
|
||||
<text
|
||||
fg={viewMode() === 'files' ? terminalColors.accent : terminalColors.textMuted}
|
||||
bold={viewMode() === 'files'}
|
||||
>
|
||||
Files ({result()?.files?.length ?? 0})
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>(Tab to switch)</text>
|
||||
</box>
|
||||
|
||||
<text fg={terminalColors.textMuted}>{'─'.repeat(Math.min(60, (props.cols ?? 80) - 4))}</text>
|
||||
|
||||
<Show when={items().length === 0}>
|
||||
<EmptyState
|
||||
title={viewMode() === 'skills' ? 'No skill lineage data' : 'No file lineage data'}
|
||||
description="Execute skills to build lineage history"
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={items().length > 0}>
|
||||
<For each={visibleItems()}>
|
||||
{(item, idx) => {
|
||||
const absoluteIdx = () => windowStart() + idx();
|
||||
const isSelected = () => absoluteIdx() === selectedIndex();
|
||||
|
||||
return (
|
||||
<box flexDirection="column">
|
||||
<Show when={viewMode() === 'skills'}>
|
||||
{(() => {
|
||||
const skill = item as SkillLineageEntry;
|
||||
return (
|
||||
<box flexDirection="row" gap={1}>
|
||||
<text fg={isSelected() ? terminalColors.accent : terminalColors.textMuted}>
|
||||
{isSelected() ? '>' : ' '}
|
||||
</text>
|
||||
<text fg={isSelected() ? terminalColors.text : terminalColors.textMuted} width={24}>
|
||||
{skill.skillName}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={8}>
|
||||
{skill.executions}x
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={8}>
|
||||
{formatDuration(skill.totalDurationMs)}
|
||||
</text>
|
||||
<text fg="#fbbf24" width={8}>
|
||||
{skill.commits.length} commits
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{skill.filesModified.length} files
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
})()}
|
||||
</Show>
|
||||
<Show when={viewMode() === 'files'}>
|
||||
{(() => {
|
||||
const file = item as FileLineage;
|
||||
return (
|
||||
<box flexDirection="row" gap={1}>
|
||||
<text fg={isSelected() ? terminalColors.accent : terminalColors.textMuted}>
|
||||
{isSelected() ? '>' : ' '}
|
||||
</text>
|
||||
<text fg={isSelected() ? terminalColors.text : terminalColors.textMuted} width={36}>
|
||||
{file.path}
|
||||
</text>
|
||||
<text fg="#fbbf24" width={10}>
|
||||
{file.commitCount} commits
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{file.skills.join(', ')}
|
||||
</text>
|
||||
</box>
|
||||
);
|
||||
})()}
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>j/k navigate Tab switch view r refresh esc back</text>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
import { createSignal, createEffect, Show, For, createMemo } 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 } from '../components/EmptyState.js';
|
||||
import { execFile } from 'node:child_process';
|
||||
|
||||
interface TimelineProps {
|
||||
onNavigate: (screen: Screen) => void;
|
||||
cols?: number;
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
interface TimelineEvent {
|
||||
timestamp: string;
|
||||
type: string;
|
||||
source: string;
|
||||
summary: string;
|
||||
details?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
interface TimelineResult {
|
||||
projectPath: string;
|
||||
sessionDate: string;
|
||||
events: TimelineEvent[];
|
||||
totalCount: number;
|
||||
}
|
||||
|
||||
function getTypeIcon(type: string): string {
|
||||
switch (type) {
|
||||
case 'skill_start': return '▶';
|
||||
case 'skill_complete': return '✓';
|
||||
case 'task_progress': return '◇';
|
||||
case 'git_commit': return '●';
|
||||
case 'observation': return '○';
|
||||
case 'decision': return '◆';
|
||||
case 'snapshot': return '◈';
|
||||
default: return '•';
|
||||
}
|
||||
}
|
||||
|
||||
function getTypeColor(type: string): string {
|
||||
switch (type) {
|
||||
case 'skill_start': return '#22cc44';
|
||||
case 'skill_complete': return '#22cc44';
|
||||
case 'git_commit': return '#fbbf24';
|
||||
case 'observation': return '#00bbcc';
|
||||
case 'decision': return '#aa88ff';
|
||||
case 'snapshot': return '#ff88aa';
|
||||
default: return terminalColors.textMuted;
|
||||
}
|
||||
}
|
||||
|
||||
function formatTimestamp(ts: string): string {
|
||||
try {
|
||||
const d = new Date(ts);
|
||||
if (isNaN(d.getTime())) return ts;
|
||||
return d.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true });
|
||||
} catch {
|
||||
return ts;
|
||||
}
|
||||
}
|
||||
|
||||
export function Timeline(props: TimelineProps) {
|
||||
const [loading, setLoading] = createSignal(true);
|
||||
const [result, setResult] = createSignal<TimelineResult | null>(null);
|
||||
const [error, setError] = createSignal<string | null>(null);
|
||||
const [selectedIndex, setSelectedIndex] = createSignal(0);
|
||||
|
||||
const rows = () => props.rows ?? 24;
|
||||
const visibleCount = () => Math.max(1, rows() - 10);
|
||||
|
||||
const loadTimeline = () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
execFile('npx', ['skillkit', 'timeline', '--json'], {
|
||||
timeout: 15000,
|
||||
maxBuffer: 1024 * 1024,
|
||||
}, (err, stdout, stderr) => {
|
||||
setLoading(false);
|
||||
if (err && !stdout) {
|
||||
setError(stderr || err.message || 'Failed to load timeline');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(stdout) as TimelineResult;
|
||||
setResult(parsed);
|
||||
} catch {
|
||||
setError('Failed to parse timeline data');
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
setLoading(false);
|
||||
setError(err instanceof Error ? err.message : 'Failed to load timeline');
|
||||
}
|
||||
};
|
||||
|
||||
createEffect(() => {
|
||||
loadTimeline();
|
||||
});
|
||||
|
||||
const events = createMemo(() => result()?.events ?? []);
|
||||
const windowStart = createMemo(() => Math.max(0, selectedIndex() - visibleCount() + 1));
|
||||
const visibleEvents = createMemo(() =>
|
||||
events().slice(windowStart(), windowStart() + visibleCount())
|
||||
);
|
||||
|
||||
useKeyboard((key: { name?: string }) => {
|
||||
if (key.name === 'k' || key.name === 'up') {
|
||||
setSelectedIndex(i => Math.max(0, i - 1));
|
||||
} else if (key.name === 'j' || key.name === 'down') {
|
||||
setSelectedIndex(i => events().length > 0 ? Math.min(events().length - 1, i + 1) : 0);
|
||||
} else if (key.name === 'r') {
|
||||
loadTimeline();
|
||||
} else if (key.name === 'escape') {
|
||||
props.onNavigate('home');
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<box flexDirection="column" padding={1}>
|
||||
<Header
|
||||
title="Timeline"
|
||||
subtitle="unified event stream"
|
||||
count={result()?.totalCount}
|
||||
icon="▸"
|
||||
/>
|
||||
|
||||
<Show when={loading()}>
|
||||
<Spinner label="Loading timeline..." />
|
||||
</Show>
|
||||
|
||||
<Show when={error()}>
|
||||
<box flexDirection="column">
|
||||
<text fg="#ff5555">Error: {error()}</text>
|
||||
<text fg={terminalColors.textMuted}>Press r to retry</text>
|
||||
</box>
|
||||
</Show>
|
||||
|
||||
<Show when={!loading() && !error()}>
|
||||
<Show when={events().length === 0}>
|
||||
<EmptyState
|
||||
title="No timeline events"
|
||||
description="Events appear as you execute skills and make commits"
|
||||
/>
|
||||
</Show>
|
||||
|
||||
<Show when={events().length > 0}>
|
||||
<For each={visibleEvents()}>
|
||||
{(event, idx) => {
|
||||
const absoluteIdx = () => windowStart() + idx();
|
||||
const isSelected = () => absoluteIdx() === selectedIndex();
|
||||
return (
|
||||
<box flexDirection="column">
|
||||
<box flexDirection="row" gap={1}>
|
||||
<text fg={isSelected() ? terminalColors.accent : terminalColors.textMuted}>
|
||||
{isSelected() ? '>' : ' '}
|
||||
</text>
|
||||
<text fg={terminalColors.textMuted} width={9}>
|
||||
{formatTimestamp(event.timestamp)}
|
||||
</text>
|
||||
<text fg={getTypeColor(event.type)}>
|
||||
{getTypeIcon(event.type)}
|
||||
</text>
|
||||
<text fg={isSelected() ? terminalColors.text : terminalColors.textMuted}>
|
||||
{event.summary}
|
||||
</text>
|
||||
</box>
|
||||
<Show when={isSelected() && event.source}>
|
||||
<text fg={terminalColors.textMuted}>
|
||||
{' '}source: {event.source}
|
||||
</text>
|
||||
</Show>
|
||||
</box>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
<text> </text>
|
||||
<text fg={terminalColors.textMuted}>j/k navigate r refresh esc back</text>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
@@ -23,3 +23,6 @@ export { Help } from './Help.js';
|
||||
export { Mesh } from './Mesh.js';
|
||||
export { Message } from './Message.js';
|
||||
export { Scan } from './Scan.js';
|
||||
export { Timeline } from './Timeline.js';
|
||||
export { Lineage } from './Lineage.js';
|
||||
export { Handoff } from './Handoff.js';
|
||||
|
||||
@@ -25,7 +25,8 @@ export type Screen =
|
||||
| 'home' | 'browse' | 'installed' | 'marketplace' | 'recommend'
|
||||
| 'translate' | 'context' | 'memory' | 'team' | 'plugins'
|
||||
| 'methodology' | 'plan' | 'workflow' | 'execute' | 'history'
|
||||
| 'sync' | 'settings' | 'help' | 'mesh' | 'message' | 'scan';
|
||||
| 'sync' | 'settings' | 'help' | 'mesh' | 'message' | 'scan'
|
||||
| 'timeline' | 'lineage' | 'handoff';
|
||||
|
||||
export const NAV_KEYS: Record<string, Screen> = {
|
||||
h: 'home', m: 'marketplace', b: 'browse', w: 'workflow',
|
||||
@@ -33,6 +34,7 @@ export const NAV_KEYS: Record<string, Screen> = {
|
||||
c: 'context', e: 'memory', i: 'installed', s: 'sync',
|
||||
a: 'team', p: 'plugins', o: 'methodology', n: 'plan',
|
||||
',': 'settings', '/': 'help', 'g': 'mesh', 'j': 'message', 'z': 'scan',
|
||||
l: 'timeline', v: 'lineage', f: 'handoff',
|
||||
} as const;
|
||||
|
||||
export const STATUS_BAR_SHORTCUTS = 'b browse m market i installed s sync / help q quit';
|
||||
@@ -85,6 +87,14 @@ export const SIDEBAR_NAV: SidebarSection[] = [
|
||||
{ key: 'j', label: 'Messages', screen: 'message' },
|
||||
],
|
||||
},
|
||||
{
|
||||
section: 'Session',
|
||||
items: [
|
||||
{ key: 'l', label: 'Timeline', screen: 'timeline' },
|
||||
{ key: 'v', label: 'Lineage', screen: 'lineage' },
|
||||
{ key: 'f', label: 'Handoff', screen: 'handoff' },
|
||||
],
|
||||
},
|
||||
{
|
||||
section: 'More',
|
||||
items: [
|
||||
|
||||
Generated
+3357
-65
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://skillkit.dev/schemas/skill.schema.json",
|
||||
"title": "Skill Frontmatter",
|
||||
"description": "Schema for SKILL.md frontmatter validation (follows Agent Skills spec: https://agenstskills.com)",
|
||||
"description": "Schema for SKILL.md frontmatter validation (follows Agent Skills spec: https://skillkit.sh)",
|
||||
"type": "object",
|
||||
"required": ["name", "description"],
|
||||
"properties": {
|
||||
|
||||
@@ -8,7 +8,7 @@ export class ValidateCommand extends Command {
|
||||
static override paths = [['validate'], ['v']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Validate skill(s) against the Agent Skills specification (agenstskills.com)',
|
||||
description: 'Validate skill(s) against the Agent Skills specification (skillkit.sh)',
|
||||
examples: [
|
||||
['Validate a skill directory', '$0 validate ./my-skill'],
|
||||
['Validate all skills in a directory', '$0 validate ./skills --all'],
|
||||
@@ -77,7 +77,7 @@ export class ValidateCommand extends Command {
|
||||
|
||||
if (hasErrors) {
|
||||
console.log(chalk.red('Validation failed'));
|
||||
console.log(chalk.dim('See https://agenstskills.com for the complete format'));
|
||||
console.log(chalk.dim('See https://skillkit.sh for the complete format'));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user