diff --git a/skills/code-review/SKILL.md b/skills/code-review/SKILL.md deleted file mode 100644 index fe0f3256..00000000 --- a/skills/code-review/SKILL.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -name: Code Review -description: Review code for bugs, security issues, and best practices -version: 1.0.0 -metadata: - emoji: "🔍" - tags: - - code-quality - - security - - review ---- - -## Instructions - -When the user asks you to review code, follow these guidelines: - -### Review Checklist - -1. **Correctness** - - Does the code do what it's supposed to do? - - Are there any logic errors? - - Are edge cases handled? - -2. **Security** - - Input validation and sanitization - - SQL injection vulnerabilities - - XSS vulnerabilities - - Command injection - - Path traversal - - Sensitive data exposure - - Authentication/authorization issues - -3. **Code Quality** - - Is the code readable and maintainable? - - Are variable/function names descriptive? - - Is there unnecessary complexity? - - Are there code duplications? - -4. **Performance** - - Are there obvious performance issues? - - N+1 queries - - Unnecessary loops or computations - - Memory leaks - -5. **Error Handling** - - Are errors properly caught and handled? - - Are error messages helpful? - - Is there proper logging? - -6. **Testing** - - Are there tests for the new code? - - Do the tests cover edge cases? - -### Review Format - -Structure your review as follows: - -``` -## Summary -[Brief overview of what the code does and overall assessment] - -## Critical Issues -[Must-fix issues: bugs, security vulnerabilities] - -## Suggestions -[Improvements and best practices recommendations] - -## Questions -[Clarifications needed about intent or design decisions] - -## Positive Aspects -[Good practices observed in the code] -``` - -### Guidelines - -- Be constructive, not critical -- Explain the "why" behind suggestions -- Provide concrete examples for improvements -- Prioritize issues by severity -- Acknowledge good practices diff --git a/skills/commit/SKILL.md b/skills/commit/SKILL.md deleted file mode 100644 index d9d38eac..00000000 --- a/skills/commit/SKILL.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -name: Git Commit Helper -description: Create well-formatted git commits following conventional commit standards -version: 1.0.0 -metadata: - emoji: "📝" - requiresBinaries: - - git - tags: - - git - - developer-tools ---- - -## Instructions - -When the user asks you to create a commit or commit their changes, follow these guidelines: - -### Step 1: Review Changes - -1. Run `git status` to see what files have changed -2. Run `git diff` to see the actual changes -3. If there are staged changes, also run `git diff --staged` - -### Step 2: Analyze and Group Changes - -Group related changes into logical commits: -- Feature additions -- Bug fixes -- Refactoring (no functional change) -- Documentation -- Tests -- Configuration/dependencies - -### Step 3: Create Atomic Commits - -For each logical group of changes: - -1. Stage only the relevant files: `git add ` -2. Create a commit with conventional message format - -### Commit Message Format - -Use conventional commits: -- `feat`: New feature -- `fix`: Bug fix -- `refactor`: Code refactoring (no functional change) -- `docs`: Documentation changes -- `test`: Adding or updating tests -- `chore`: Build, config, dependencies - -Format: `(): ` - -Example: `feat(auth): add user login endpoint` - -### Rules - -- Each commit should be independently meaningful and buildable -- Related test files should be committed with their implementation -- Never create empty commits -- Never combine unrelated changes in one commit -- Keep commit messages concise but descriptive -- If all changes are related to one logical unit, a single commit is fine - -### Example - -If the user modified: -- `src/api/user.ts` (added new endpoint) -- `src/api/user.test.ts` (tests for new endpoint) -- `src/utils/format.ts` (refactored helper) -- `README.md` (updated docs) - -Create three commits: -1. `git add src/api/user.ts src/api/user.test.ts && git commit -m "feat(api): add user profile endpoint"` -2. `git add src/utils/format.ts && git commit -m "refactor(utils): simplify date formatting logic"` -3. `git add README.md && git commit -m "docs: update API documentation"` diff --git a/src/agent/skills/loader.ts b/src/agent/skills/loader.ts index 9a3df530..ea8f3d46 100644 --- a/src/agent/skills/loader.ts +++ b/src/agent/skills/loader.ts @@ -6,7 +6,7 @@ * 2. profile - ~/.super-multica/agent-profiles//skills/ (profile-specific) */ -import { existsSync, readdirSync, statSync, mkdirSync, cpSync, rmSync } from "node:fs"; +import { existsSync, readdirSync, readFileSync, statSync, mkdirSync, cpSync, rmSync, writeFileSync } from "node:fs"; import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; import type { Skill, SkillSource, SkillManagerOptions } from "./types.js"; @@ -47,6 +47,31 @@ const BUNDLED_DIR = join(__dirname, "../../../skills"); /** Managed skills directory (global user skills) */ const MANAGED_DIR = join(DATA_DIR, "skills"); +/** Manifest file tracking which skills were synced from the bundle */ +const BUNDLED_MANIFEST = join(MANAGED_DIR, ".bundled-manifest.json"); + +/** + * Read the bundled skills manifest + * Returns a set of skill IDs that were last synced from the bundle + */ +function readBundledManifest(): Set { + try { + if (!existsSync(BUNDLED_MANIFEST)) return new Set(); + const data = JSON.parse(readFileSync(BUNDLED_MANIFEST, "utf-8")); + if (Array.isArray(data)) return new Set(data as string[]); + return new Set(); + } catch { + return new Set(); + } +} + +/** + * Write the bundled skills manifest + */ +function writeBundledManifest(skillIds: Set): void { + writeFileSync(BUNDLED_MANIFEST, JSON.stringify([...skillIds].sort(), null, 2) + "\n"); +} + /** * Discover skill directories in a given base path * A valid skill directory contains a SKILL.md file @@ -153,6 +178,9 @@ export function initializeManagedSkills(): void { return; } + const previouslyBundled = readBundledManifest(); + const currentlyBundled = new Set(); + // Sync each bundled skill to managed directory try { const entries = readdirSync(BUNDLED_DIR); @@ -166,6 +194,8 @@ export function initializeManagedSkills(): void { // Skip if not a directory if (!statSync(src).isDirectory()) continue; + currentlyBundled.add(skillName); + // Check if skill exists in managed if (!existsSync(dest)) { // Skill doesn't exist, copy it @@ -189,6 +219,19 @@ export function initializeManagedSkills(): void { cpSync(src, dest, { recursive: true }); } } + + // Remove managed skills that were previously bundled but no longer in the bundle + for (const skillName of previouslyBundled) { + if (!currentlyBundled.has(skillName)) { + const dest = join(MANAGED_DIR, skillName); + if (existsSync(dest)) { + rmSync(dest, { recursive: true }); + } + } + } + + // Persist updated manifest + writeBundledManifest(currentlyBundled); } catch { // Ignore errors during initialization }