mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-19 02:13:58 +00:00
fix: address CodeRabbit PR review issues
- Add noopener to rel="noreferrer" for tabnabbing protection - Fix standalone skill path handling in readSkillContent and validateSkill - Derive TOTAL_AGENTS from adapters instead of hardcoded value - Fix duplicate discovery path for droid/factory agents - Create dedicated FactoryAdapter instead of using UniversalAdapter
This commit is contained in:
@@ -20,7 +20,7 @@ export function Footer(): React.ReactElement {
|
||||
<a
|
||||
href="https://agenstskills.com"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-600 hover:text-zinc-400 text-xs font-mono transition-colors"
|
||||
>
|
||||
Agent Skills standard
|
||||
|
||||
@@ -469,7 +469,7 @@ ${skillContent.slice(0, 4000)}${skillContent.length > 4000 ? '\n...(truncated)'
|
||||
{selectedSkill.sourceUrl && (
|
||||
<>
|
||||
<span>•</span>
|
||||
<a href={selectedSkill.sourceUrl} target="_blank" rel="noreferrer" className="hover:text-white">
|
||||
<a href={selectedSkill.sourceUrl} target="_blank" rel="noopener noreferrer" className="hover:text-white">
|
||||
View on GitHub
|
||||
</a>
|
||||
</>
|
||||
@@ -503,7 +503,7 @@ ${skillContent.slice(0, 4000)}${skillContent.length > 4000 ? '\n...(truncated)'
|
||||
<a
|
||||
href={selectedSkill.sourceUrl}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-2 bg-zinc-800 text-white px-4 py-2 font-mono text-sm hover:bg-zinc-700 transition-colors"
|
||||
>
|
||||
View on GitHub
|
||||
|
||||
@@ -44,7 +44,7 @@ export default function App(): React.ReactElement {
|
||||
<a
|
||||
href="https://www.npmjs.com/package/skillkit"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-400 hover:text-red-500 transition-colors p-2"
|
||||
aria-label="npm"
|
||||
>
|
||||
@@ -53,7 +53,7 @@ export default function App(): React.ReactElement {
|
||||
<a
|
||||
href="https://github.com/rohitg00/skillkit"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-400 hover:text-white transition-colors p-2"
|
||||
aria-label="GitHub"
|
||||
>
|
||||
|
||||
@@ -451,7 +451,7 @@ export function Documentation(): React.ReactElement {
|
||||
<a
|
||||
href="https://deepwiki.com/rohitg00/skillkit"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-2 mt-2 text-xs text-zinc-500 hover:text-zinc-300 transition-colors"
|
||||
>
|
||||
<span>Powered by DeepWiki</span>
|
||||
|
||||
@@ -20,7 +20,7 @@ export function Footer(): React.ReactElement {
|
||||
<a
|
||||
href="https://agentskills.io"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-600 hover:text-zinc-400 text-xs font-mono transition-colors"
|
||||
>
|
||||
Agent Skills standard
|
||||
|
||||
@@ -441,7 +441,7 @@ ${skillContent.slice(0, 4000)}${skillContent.length > 4000 ? '\n...(truncated)'
|
||||
{selectedSkill.sourceUrl && (
|
||||
<>
|
||||
<span>•</span>
|
||||
<a href={selectedSkill.sourceUrl} target="_blank" rel="noreferrer" className="hover:text-white">
|
||||
<a href={selectedSkill.sourceUrl} target="_blank" rel="noopener noreferrer" className="hover:text-white">
|
||||
View on GitHub
|
||||
</a>
|
||||
</>
|
||||
@@ -475,7 +475,7 @@ ${skillContent.slice(0, 4000)}${skillContent.length > 4000 ? '\n...(truncated)'
|
||||
<a
|
||||
href={selectedSkill.sourceUrl}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-2 bg-zinc-800 text-white px-4 py-2 font-mono text-sm hover:bg-zinc-700 transition-colors"
|
||||
>
|
||||
View on GitHub
|
||||
@@ -634,7 +634,7 @@ ${skillContent.slice(0, 4000)}${skillContent.length > 4000 ? '\n...(truncated)'
|
||||
<a
|
||||
href={ref}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
className="text-zinc-400 hover:text-white font-mono text-sm transition-colors"
|
||||
>
|
||||
{ref}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import { existsSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { homedir } from 'node:os';
|
||||
import type { AgentAdapter } from './base.js';
|
||||
import { createSkillXml } from './base.js';
|
||||
import type { Skill, AgentType } from '@skillkit/core';
|
||||
import { AGENT_CONFIG } from '@skillkit/core';
|
||||
|
||||
const config = AGENT_CONFIG.factory;
|
||||
|
||||
export class FactoryAdapter implements AgentAdapter {
|
||||
readonly type: AgentType = 'factory';
|
||||
readonly name = 'Factory';
|
||||
readonly skillsDir = config.skillsDir;
|
||||
readonly configFile = config.configFile;
|
||||
|
||||
generateConfig(skills: Skill[]): string {
|
||||
const enabledSkills = skills.filter(s => s.enabled);
|
||||
|
||||
if (enabledSkills.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const skillsXml = enabledSkills.map(createSkillXml).join('\n\n');
|
||||
|
||||
return `<skills_system priority="1">
|
||||
|
||||
## Available Skills
|
||||
|
||||
<!-- SKILLS_TABLE_START -->
|
||||
<usage>
|
||||
When users ask you to perform tasks, check if any of the available skills below can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
|
||||
|
||||
How to use skills:
|
||||
- Invoke: \`skillkit read <skill-name>\` or \`npx skillkit read <skill-name>\`
|
||||
- The skill content will load with detailed instructions on how to complete the task
|
||||
- Base directory provided in output for resolving bundled resources (references/, scripts/, assets/)
|
||||
|
||||
Usage notes:
|
||||
- Only use skills listed in <available_skills> below
|
||||
- Do not invoke a skill that is already loaded in your context
|
||||
- Each skill invocation is stateless
|
||||
</usage>
|
||||
|
||||
<available_skills>
|
||||
|
||||
${skillsXml}
|
||||
|
||||
</available_skills>
|
||||
<!-- SKILLS_TABLE_END -->
|
||||
|
||||
</skills_system>`;
|
||||
}
|
||||
|
||||
parseConfig(content: string): string[] {
|
||||
const skillNames: string[] = [];
|
||||
const skillRegex = /<name>([^<]+)<\/name>/g;
|
||||
let match;
|
||||
|
||||
while ((match = skillRegex.exec(content)) !== null) {
|
||||
skillNames.push(match[1].trim());
|
||||
}
|
||||
|
||||
return skillNames;
|
||||
}
|
||||
|
||||
getInvokeCommand(skillName: string): string {
|
||||
return `skillkit read ${skillName}`;
|
||||
}
|
||||
|
||||
async isDetected(): Promise<boolean> {
|
||||
const projectFactory = join(process.cwd(), '.factory');
|
||||
const globalFactory = join(homedir(), '.factory');
|
||||
|
||||
return existsSync(projectFactory) || existsSync(globalFactory);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import { AntigravityAdapter } from './antigravity.js';
|
||||
import { AmpAdapter } from './amp.js';
|
||||
import { ClawdbotAdapter } from './clawdbot.js';
|
||||
import { DroidAdapter } from './droid.js';
|
||||
import { FactoryAdapter } from './factory.js';
|
||||
import { GitHubCopilotAdapter } from './github-copilot.js';
|
||||
import { GooseAdapter } from './goose.js';
|
||||
import { KiloAdapter } from './kilo.js';
|
||||
@@ -28,6 +29,7 @@ export * from './antigravity.js';
|
||||
export * from './amp.js';
|
||||
export * from './clawdbot.js';
|
||||
export * from './droid.js';
|
||||
export * from './factory.js';
|
||||
export * from './github-copilot.js';
|
||||
export * from './goose.js';
|
||||
export * from './kilo.js';
|
||||
@@ -63,7 +65,7 @@ const adapters: Record<AgentType, AgentAdapter> = {
|
||||
commandcode: new UniversalAdapter(),
|
||||
continue: new UniversalAdapter(),
|
||||
crush: new UniversalAdapter(),
|
||||
factory: new UniversalAdapter(),
|
||||
factory: new FactoryAdapter(),
|
||||
mcpjam: new UniversalAdapter(),
|
||||
mux: new UniversalAdapter(),
|
||||
neovate: new UniversalAdapter(),
|
||||
|
||||
@@ -222,7 +222,7 @@ export const AGENT_DISCOVERY_PATHS: Record<AgentType, string[]> = {
|
||||
'antigravity': ['.antigravity/agents'],
|
||||
'amp': ['.amp/agents'],
|
||||
'clawdbot': ['.clawdbot/agents', 'agents'],
|
||||
'droid': ['.factory/agents'],
|
||||
'droid': ['.droid/agents'],
|
||||
'github-copilot': ['.github/agents', '.github/instructions', '.github/custom-agents'],
|
||||
'goose': ['.goose/agents'],
|
||||
'kilo': ['.kilocode/agents', '.kilocode/modes'],
|
||||
@@ -266,6 +266,7 @@ export const ALL_AGENT_DISCOVERY_PATHS = [
|
||||
'.crush/agents',
|
||||
'.cursor/agents',
|
||||
'.cursor/commands',
|
||||
'.droid/agents',
|
||||
'.factory/agents',
|
||||
'.gemini/agents',
|
||||
'.github/agents',
|
||||
|
||||
@@ -292,7 +292,9 @@ export function loadMetadata(skillPath: string): SkillMetadata | null {
|
||||
}
|
||||
|
||||
export function readSkillContent(skillPath: string): string | null {
|
||||
const skillMdPath = join(skillPath, 'SKILL.md');
|
||||
const skillMdPath = skillPath.endsWith('.md')
|
||||
? skillPath
|
||||
: join(skillPath, 'SKILL.md');
|
||||
|
||||
if (!existsSync(skillMdPath)) {
|
||||
return null;
|
||||
@@ -343,9 +345,10 @@ export function findAllSkills(searchDirs: string[]): Skill[] {
|
||||
export function validateSkill(skillPath: string): { valid: boolean; errors: string[]; warnings?: string[] } {
|
||||
const errors: string[] = [];
|
||||
const warnings: string[] = [];
|
||||
const dirName = basename(skillPath);
|
||||
const isStandalone = skillPath.endsWith('.md');
|
||||
const dirName = isStandalone ? basename(skillPath, '.md') : basename(skillPath);
|
||||
const skillMdPath = isStandalone ? skillPath : join(skillPath, 'SKILL.md');
|
||||
|
||||
const skillMdPath = join(skillPath, 'SKILL.md');
|
||||
if (!existsSync(skillMdPath)) {
|
||||
errors.push('Missing SKILL.md file');
|
||||
return { valid: false, errors };
|
||||
|
||||
@@ -92,6 +92,6 @@ export function getAgentAdapter(type: AgentType) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of supported agents
|
||||
* Total number of supported agents (derived from adapters)
|
||||
*/
|
||||
export const TOTAL_AGENTS = 32;
|
||||
export const TOTAL_AGENTS = getAllAdapters().length;
|
||||
|
||||
Reference in New Issue
Block a user