You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@skillkit/agents

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@skillkit/agents - npm Package Compare versions

Comparing version
1.5.0
to
1.6.0
+599
-1
dist/index.d.ts

@@ -203,2 +203,600 @@ import { AgentType, Skill } from '@skillkit/core';

/**
* Agent Features Types
*
* Type definitions for enhanced agent-specific features.
*/
/**
* Permission level for agent actions
*/
type PermissionLevel = 'allow' | 'deny' | 'ask';
/**
* Permission pattern for file/resource access
*/
interface PermissionPattern {
/** Pattern to match (glob or regex) */
pattern: string;
/** Permission level */
level: PermissionLevel;
/** Description of why this permission is needed */
reason?: string;
}
/**
* Permission configuration for skills
*/
interface PermissionConfig {
/** File access permissions */
files?: PermissionPattern[];
/** Command execution permissions */
commands?: PermissionPattern[];
/** Network access permissions */
network?: PermissionPattern[];
/** Environment variable access */
env?: PermissionPattern[];
/** Default permission level */
default?: PermissionLevel;
}
/**
* Glob pattern configuration for file-scoped skills
*/
interface GlobConfig {
/** Patterns to include */
include: string[];
/** Patterns to exclude */
exclude?: string[];
/** Whether to match directories */
matchDirectories?: boolean;
/** Whether to match hidden files */
matchHidden?: boolean;
}
/**
* Bootstrap file types
*/
type BootstrapFileType = 'agents' | 'soul' | 'tools' | 'identity' | 'context' | 'brief' | 'history';
/**
* Bootstrap file configuration
*/
interface BootstrapFile {
/** File type */
type: BootstrapFileType;
/** File name */
name: string;
/** File content */
content: string;
/** Priority (higher = loaded first) */
priority?: number;
/** Whether file is required */
required?: boolean;
}
/**
* Agent mode types
*/
type AgentMode = 'code' | 'architect' | 'ask' | 'debug' | 'review' | 'test' | 'docs';
/**
* Mode configuration
*/
interface ModeConfig {
/** Mode name */
mode: AgentMode;
/** Mode description */
description: string;
/** Skills available in this mode */
skills: string[];
/** Tools available in this mode */
tools?: string[];
/** Default prompt prefix for this mode */
promptPrefix?: string;
/** Allowed file patterns in this mode */
allowedFiles?: string[];
}
/**
* Tool whitelist configuration
*/
interface ToolWhitelistConfig {
/** Allowed tools */
allowed: string[];
/** Denied tools */
denied?: string[];
/** Mode for handling unlisted tools */
unlisted?: 'allow' | 'deny' | 'ask';
}
/**
* Skill package configuration (for .skill bundles)
*/
interface SkillPackageConfig {
/** Package name */
name: string;
/** Package version */
version: string;
/** Package description */
description?: string;
/** Entry point skill */
entryPoint: string;
/** Included skill files */
files: string[];
/** Dependencies */
dependencies?: string[];
/** Metadata */
metadata?: Record<string, unknown>;
}
/**
* Agent feature capabilities
*/
interface AgentCapabilities {
/** Supports permission system */
permissions: boolean;
/** Supports glob patterns */
globs: boolean;
/** Supports bootstrap files */
bootstrapFiles: boolean;
/** Supports multi-mode */
multiMode: boolean;
/** Supports tool whitelisting */
toolWhitelist: boolean;
/** Supports .skill packages */
skillPackages: boolean;
/** Supports hooks */
hooks: boolean;
/** Supports subagents */
subagents: boolean;
}
/**
* Agent feature set
*/
interface AgentFeatures {
/** Agent type */
agent: AgentType;
/** Agent capabilities */
capabilities: AgentCapabilities;
/** Permission configuration */
permissions?: PermissionConfig;
/** Glob configuration */
globs?: GlobConfig;
/** Bootstrap files */
bootstrapFiles?: BootstrapFile[];
/** Mode configurations */
modes?: ModeConfig[];
/** Tool whitelist */
toolWhitelist?: ToolWhitelistConfig;
}
/**
* Feature generation options
*/
interface FeatureGenerationOptions {
/** Target agent */
agent: AgentType;
/** Output directory */
outputDir?: string;
/** Include optional files */
includeOptional?: boolean;
/** Dry run (don't write files) */
dryRun?: boolean;
}
/**
* Feature validation result
*/
interface FeatureValidationResult {
/** Whether features are valid */
valid: boolean;
/** Validation errors */
errors: string[];
/** Validation warnings */
warnings: string[];
/** Agent capabilities used */
usedCapabilities: (keyof AgentCapabilities)[];
}
/**
* Permissions System
*
* Implements permission patterns for agent skill access control.
*/
/**
* PermissionManager - Manage skill permissions
*/
declare class PermissionManager {
private config;
constructor(config?: PermissionConfig);
/**
* Set permission configuration
*/
setConfig(config: PermissionConfig): void;
/**
* Get permission configuration
*/
getConfig(): PermissionConfig;
/**
* Check file access permission
*/
checkFileAccess(path: string): PermissionLevel;
/**
* Check command execution permission
*/
checkCommandAccess(command: string): PermissionLevel;
/**
* Check network access permission
*/
checkNetworkAccess(url: string): PermissionLevel;
/**
* Check environment variable access
*/
checkEnvAccess(varName: string): PermissionLevel;
/**
* Add file permission pattern
*/
addFilePattern(pattern: PermissionPattern): void;
/**
* Add command permission pattern
*/
addCommandPattern(pattern: PermissionPattern): void;
/**
* Check pattern against permission list
*/
private checkPattern;
/**
* Match value against pattern (glob-style)
*
* Uses minimatch for safe glob matching, avoiding ReDoS vulnerabilities.
*/
private matchPattern;
/**
* Generate OpenCode-compatible permission config
*/
generateOpenCodeConfig(): string;
/**
* Generate SKILL.md metadata for permissions
*/
generateSkillMetadata(): Record<string, unknown>;
/**
* Parse permissions from SKILL.md metadata
*/
static fromMetadata(metadata: Record<string, unknown>): PermissionConfig;
/**
* Merge two permission configs
*/
static merge(base: PermissionConfig, override: PermissionConfig): PermissionConfig;
}
/**
* Create a PermissionManager instance
*/
declare function createPermissionManager(config?: PermissionConfig): PermissionManager;
/**
* Quick permission check helpers
*/
declare function isAllowed(level: PermissionLevel): boolean;
declare function isDenied(level: PermissionLevel): boolean;
declare function needsConfirmation(level: PermissionLevel): boolean;
/**
* Glob Pattern System
*
* Implements file pattern matching for file-scoped skills.
*/
/**
* GlobMatcher - Match files against glob patterns
*/
declare class GlobMatcher {
private config;
private includePatterns;
private excludePatterns;
constructor(config: GlobConfig);
/**
* Check if a file matches the glob patterns
*/
matches(filePath: string): boolean;
/**
* Filter a list of files
*/
filter(filePaths: string[]): string[];
/**
* Get all include patterns
*/
getIncludePatterns(): string[];
/**
* Get all exclude patterns
*/
getExcludePatterns(): string[];
/**
* Add an include pattern
*/
addInclude(pattern: string): void;
/**
* Add an exclude pattern
*/
addExclude(pattern: string): void;
/**
* Convert glob pattern to regex using minimatch
*
* Uses the battle-tested minimatch library to avoid ReDoS vulnerabilities
* and ensure consistent glob matching behavior.
*/
private patternToRegex;
/**
* Check if file is hidden (starts with .)
*/
private isHiddenFile;
/**
* Generate Cursor-compatible globs field
*/
generateCursorGlobs(): string[];
/**
* Generate MDC frontmatter
*/
generateMDCFrontmatter(): string;
}
/**
* Create a GlobMatcher instance
*/
declare function createGlobMatcher(config: GlobConfig): GlobMatcher;
/**
* Create a GlobMatcher from a single pattern
*/
declare function matchPattern(pattern: string): GlobMatcher;
/**
* Parse glob patterns from Cursor MDC format
*/
declare function parseGlobsFromMDC(content: string): GlobConfig | null;
/**
* Common glob patterns for different file types
*/
declare const COMMON_PATTERNS: {
/** All TypeScript files */
readonly typescript: readonly ["**/*.ts", "**/*.tsx"];
/** All JavaScript files */
readonly javascript: readonly ["**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"];
/** All test files */
readonly tests: readonly ["**/*.test.*", "**/*.spec.*", "**/__tests__/**"];
/** All config files */
readonly configs: readonly ["*.config.*", "*rc", "*rc.*", "*.json", "*.yaml", "*.yml"];
/** All source files */
readonly source: readonly ["src/**/*"];
/** All documentation */
readonly docs: readonly ["**/*.md", "docs/**/*", "README*"];
/** Node modules (usually excluded) */
readonly nodeModules: readonly ["**/node_modules/**"];
/** Build outputs (usually excluded) */
readonly buildOutputs: readonly ["**/dist/**", "**/build/**", "**/.next/**"];
/** All files */
readonly all: readonly ["**/*"];
};
/**
* Create glob config from common pattern names
*/
declare function fromCommonPatterns(includeNames: (keyof typeof COMMON_PATTERNS)[], excludeNames?: (keyof typeof COMMON_PATTERNS)[]): GlobConfig;
/**
* Bootstrap Files System
*
* Implements bootstrap file generation for agents that support them.
*/
/**
* BootstrapManager - Manage bootstrap files for agents
*/
declare class BootstrapManager {
private files;
/**
* Add a bootstrap file
*/
addFile(file: BootstrapFile): void;
/**
* Get a bootstrap file by type
*/
getFile(type: BootstrapFileType): BootstrapFile | undefined;
/**
* Get all bootstrap files
*/
getAllFiles(): BootstrapFile[];
/**
* Get files sorted by priority
*/
getFilesByPriority(): BootstrapFile[];
/**
* Remove a bootstrap file
*/
removeFile(type: BootstrapFileType): boolean;
/**
* Check if a file type exists
*/
hasFile(type: BootstrapFileType): boolean;
/**
* Create AGENTS.md file
*/
createAgentsFile(agents: AgentDefinition[]): void;
/**
* Create SOUL.md file
*/
createSoulFile(soul: SoulDefinition): void;
/**
* Create TOOLS.md file
*/
createToolsFile(tools: ToolDefinition[]): void;
/**
* Create IDENTITY.md file
*/
createIdentityFile(identity: IdentityDefinition): void;
/**
* Create CONTEXT.md file
*/
createContextFile(context: ContextDefinition): void;
/**
* Generate all files as a map
*/
generateFiles(): Map<string, string>;
/**
* Generate combined content for agents without file support
*/
generateCombinedContent(): string;
/**
* Get default file name for a type
*/
static getDefaultFileName(type: BootstrapFileType): string;
}
/**
* Agent definition for AGENTS.md
*/
interface AgentDefinition {
name: string;
description?: string;
capabilities?: string[];
constraints?: string[];
}
/**
* Soul definition for SOUL.md
*/
interface SoulDefinition {
personality?: string;
values?: string[];
communication?: string;
rules?: string[];
}
/**
* Tool definition for TOOLS.md
*/
interface ToolDefinition {
name: string;
description?: string;
usage?: string;
examples?: string[];
}
/**
* Identity definition for IDENTITY.md
*/
interface IdentityDefinition {
name?: string;
role?: string;
description?: string;
expertise?: string[];
}
/**
* Context definition for CONTEXT.md
*/
interface ContextDefinition {
project?: string;
techStack?: string[];
conventions?: string[];
currentTask?: string;
}
/**
* Create a BootstrapManager instance
*/
declare function createBootstrapManager(): BootstrapManager;
/**
* Create a complete bootstrap set from definitions
*/
declare function createBootstrapSet(options: {
agents?: AgentDefinition[];
soul?: SoulDefinition;
tools?: ToolDefinition[];
identity?: IdentityDefinition;
context?: ContextDefinition;
}): BootstrapManager;
/**
* Multi-Mode System
*
* Implements multi-mode support for agents that support different operating modes.
*/
/**
* ModeManager - Manage agent operating modes
*/
declare class ModeManager {
private modes;
private currentMode;
private modeListeners;
constructor(modes?: ModeConfig[]);
/**
* Add a mode configuration
*/
addMode(config: ModeConfig): void;
/**
* Get a mode configuration
*/
getMode(mode: AgentMode): ModeConfig | undefined;
/**
* Get all mode configurations
*/
getAllModes(): ModeConfig[];
/**
* Get available mode names
*/
getAvailableModes(): AgentMode[];
/**
* Set the current mode
*/
setMode(mode: AgentMode): void;
/**
* Get the current mode
*/
getCurrentMode(): AgentMode;
/**
* Get current mode configuration
*/
getCurrentModeConfig(): ModeConfig | undefined;
/**
* Get skills for current mode
*/
getCurrentSkills(): string[];
/**
* Get tools for current mode
*/
getCurrentTools(): string[];
/**
* Check if a skill is available in current mode
*/
isSkillAvailable(skillName: string): boolean;
/**
* Check if a file is allowed in current mode
*/
isFileAllowed(filePath: string): boolean;
/**
* Add mode change listener
*/
addModeListener(listener: ModeChangeListener): void;
/**
* Remove mode change listener
*/
removeModeListener(listener: ModeChangeListener): void;
/**
* Create a mode from default configuration
*/
addDefaultMode(mode: AgentMode, skills: string[]): void;
/**
* Generate mode-specific prompt prefix
*/
getPromptPrefix(): string;
/**
* Generate Roo-compatible mode configuration
*/
generateRooConfig(): Record<string, unknown>;
/**
* Generate mode documentation
*/
generateModeDocumentation(): string;
}
/**
* Mode change listener type
*/
type ModeChangeListener = (newMode: AgentMode, previousMode: AgentMode, config: ModeConfig) => void;
/**
* Create a ModeManager instance
*/
declare function createModeManager(modes?: ModeConfig[]): ModeManager;
/**
* Create a ModeManager with all default modes
*/
declare function createDefaultModeManager(skillsPerMode: Partial<Record<AgentMode, string[]>>): ModeManager;
/**
* Get default configuration for a mode
*/
declare function getDefaultModeConfig(mode: AgentMode): Omit<ModeConfig, 'skills'>;
/**
* All available agent modes
*/
declare const ALL_MODES: AgentMode[];
declare function getAdapter(type: AgentType): AgentAdapter;

@@ -210,2 +808,2 @@ declare function getAllAdapters(): AgentAdapter[];

export { type AgentAdapter, AmpAdapter, AntigravityAdapter, ClaudeCodeAdapter, ClawdbotAdapter, CodexAdapter, CursorAdapter, DroidAdapter, GeminiCliAdapter, GitHubCopilotAdapter, GooseAdapter, KiloAdapter, KiroCliAdapter, OpenCodeAdapter, RooAdapter, TraeAdapter, UniversalAdapter, WindsurfAdapter, createSkillXml, detectAgent, escapeXml, getAdapter, getAllAdapters, getConfigFile, getSkillsDir };
export { ALL_MODES, type AgentAdapter, type AgentCapabilities, type AgentDefinition, type AgentFeatures, type AgentMode, AmpAdapter, AntigravityAdapter, type BootstrapFile, type BootstrapFileType, BootstrapManager, COMMON_PATTERNS, ClaudeCodeAdapter, ClawdbotAdapter, CodexAdapter, type ContextDefinition, CursorAdapter, DroidAdapter, type FeatureGenerationOptions, type FeatureValidationResult, GeminiCliAdapter, GitHubCopilotAdapter, type GlobConfig, GlobMatcher, GooseAdapter, type IdentityDefinition, KiloAdapter, KiroCliAdapter, type ModeChangeListener, type ModeConfig, ModeManager, OpenCodeAdapter, type PermissionConfig, type PermissionLevel, PermissionManager, type PermissionPattern, RooAdapter, type SkillPackageConfig, type SoulDefinition, type ToolDefinition, type ToolWhitelistConfig, TraeAdapter, UniversalAdapter, WindsurfAdapter, createBootstrapManager, createBootstrapSet, createDefaultModeManager, createGlobMatcher, createModeManager, createPermissionManager, createSkillXml, detectAgent, escapeXml, fromCommonPatterns, getAdapter, getAllAdapters, getConfigFile, getDefaultModeConfig, getSkillsDir, isAllowed, isDenied, matchPattern, needsConfirmation, parseGlobsFromMDC };

@@ -1104,2 +1104,907 @@ // src/claude-code.ts

// src/features/permissions.ts
import { minimatch } from "minimatch";
var PermissionManager = class {
config;
constructor(config) {
this.config = config || { default: "ask" };
}
/**
* Set permission configuration
*/
setConfig(config) {
this.config = config;
}
/**
* Get permission configuration
*/
getConfig() {
return this.config;
}
/**
* Check file access permission
*/
checkFileAccess(path) {
return this.checkPattern(path, this.config.files);
}
/**
* Check command execution permission
*/
checkCommandAccess(command) {
return this.checkPattern(command, this.config.commands);
}
/**
* Check network access permission
*/
checkNetworkAccess(url) {
return this.checkPattern(url, this.config.network);
}
/**
* Check environment variable access
*/
checkEnvAccess(varName) {
return this.checkPattern(varName, this.config.env);
}
/**
* Add file permission pattern
*/
addFilePattern(pattern) {
if (!this.config.files) {
this.config.files = [];
}
this.config.files.push(pattern);
}
/**
* Add command permission pattern
*/
addCommandPattern(pattern) {
if (!this.config.commands) {
this.config.commands = [];
}
this.config.commands.push(pattern);
}
/**
* Check pattern against permission list
*/
checkPattern(value, patterns) {
if (!patterns || patterns.length === 0) {
return this.config.default || "ask";
}
for (const pattern of patterns) {
if (this.matchPattern(value, pattern.pattern)) {
return pattern.level;
}
}
return this.config.default || "ask";
}
/**
* Match value against pattern (glob-style)
*
* Uses minimatch for safe glob matching, avoiding ReDoS vulnerabilities.
*/
matchPattern(value, pattern) {
return minimatch(value, pattern, { nocase: true });
}
/**
* Generate OpenCode-compatible permission config
*/
generateOpenCodeConfig() {
const lines = [];
lines.push("# Permission Configuration");
lines.push("");
if (this.config.files && this.config.files.length > 0) {
lines.push("## File Access");
lines.push("");
for (const pattern of this.config.files) {
lines.push(`- ${pattern.level}: \`${pattern.pattern}\``);
if (pattern.reason) {
lines.push(` - Reason: ${pattern.reason}`);
}
}
lines.push("");
}
if (this.config.commands && this.config.commands.length > 0) {
lines.push("## Command Execution");
lines.push("");
for (const pattern of this.config.commands) {
lines.push(`- ${pattern.level}: \`${pattern.pattern}\``);
if (pattern.reason) {
lines.push(` - Reason: ${pattern.reason}`);
}
}
lines.push("");
}
if (this.config.network && this.config.network.length > 0) {
lines.push("## Network Access");
lines.push("");
for (const pattern of this.config.network) {
lines.push(`- ${pattern.level}: \`${pattern.pattern}\``);
if (pattern.reason) {
lines.push(` - Reason: ${pattern.reason}`);
}
}
lines.push("");
}
lines.push(`Default: ${this.config.default || "ask"}`);
lines.push("");
return lines.join("\n");
}
/**
* Generate SKILL.md metadata for permissions
*/
generateSkillMetadata() {
const metadata = {};
if (this.config.files) {
metadata.filePermissions = this.config.files.map((p) => ({
pattern: p.pattern,
level: p.level
}));
}
if (this.config.commands) {
metadata.commandPermissions = this.config.commands.map((p) => ({
pattern: p.pattern,
level: p.level
}));
}
if (this.config.network) {
metadata.networkPermissions = this.config.network.map((p) => ({
pattern: p.pattern,
level: p.level
}));
}
if (this.config.default) {
metadata.defaultPermission = this.config.default;
}
return metadata;
}
/**
* Parse permissions from SKILL.md metadata
*/
static fromMetadata(metadata) {
const config = {};
if (metadata.filePermissions && Array.isArray(metadata.filePermissions)) {
config.files = metadata.filePermissions;
}
if (metadata.commandPermissions && Array.isArray(metadata.commandPermissions)) {
config.commands = metadata.commandPermissions;
}
if (metadata.networkPermissions && Array.isArray(metadata.networkPermissions)) {
config.network = metadata.networkPermissions;
}
if (metadata.defaultPermission) {
config.default = metadata.defaultPermission;
}
return config;
}
/**
* Merge two permission configs
*/
static merge(base, override) {
return {
files: [...base.files || [], ...override.files || []],
commands: [...base.commands || [], ...override.commands || []],
network: [...base.network || [], ...override.network || []],
env: [...base.env || [], ...override.env || []],
default: override.default || base.default
};
}
};
function createPermissionManager(config) {
return new PermissionManager(config);
}
function isAllowed(level) {
return level === "allow";
}
function isDenied(level) {
return level === "deny";
}
function needsConfirmation(level) {
return level === "ask";
}
// src/features/globs.ts
import { minimatch as minimatch2 } from "minimatch";
var GlobMatcher = class {
config;
includePatterns;
excludePatterns;
constructor(config) {
this.config = config;
this.includePatterns = config.include.map((p) => this.patternToRegex(p));
this.excludePatterns = (config.exclude || []).map((p) => this.patternToRegex(p));
}
/**
* Check if a file matches the glob patterns
*/
matches(filePath) {
const normalizedPath = filePath.replace(/\\/g, "/");
if (!this.config.matchHidden && this.isHiddenFile(normalizedPath)) {
return false;
}
for (const pattern of this.excludePatterns) {
if (pattern.test(normalizedPath)) {
return false;
}
}
for (const pattern of this.includePatterns) {
if (pattern.test(normalizedPath)) {
return true;
}
}
return false;
}
/**
* Filter a list of files
*/
filter(filePaths) {
return filePaths.filter((p) => this.matches(p));
}
/**
* Get all include patterns
*/
getIncludePatterns() {
return [...this.config.include];
}
/**
* Get all exclude patterns
*/
getExcludePatterns() {
return [...this.config.exclude || []];
}
/**
* Add an include pattern
*/
addInclude(pattern) {
this.config.include.push(pattern);
this.includePatterns.push(this.patternToRegex(pattern));
}
/**
* Add an exclude pattern
*/
addExclude(pattern) {
if (!this.config.exclude) {
this.config.exclude = [];
}
this.config.exclude.push(pattern);
this.excludePatterns.push(this.patternToRegex(pattern));
}
/**
* Convert glob pattern to regex using minimatch
*
* Uses the battle-tested minimatch library to avoid ReDoS vulnerabilities
* and ensure consistent glob matching behavior.
*/
patternToRegex(pattern) {
const isNegated = pattern.startsWith("!");
const cleanPattern = isNegated ? pattern.slice(1) : pattern;
let adjustedPattern = cleanPattern;
if (this.config.matchDirectories && !cleanPattern.endsWith("/**")) {
adjustedPattern = cleanPattern.endsWith("/") ? `${cleanPattern}**` : `${cleanPattern}/**`;
}
const regex = minimatch2.makeRe(adjustedPattern, { dot: this.config.matchHidden });
return regex || /(?!)/;
}
/**
* Check if file is hidden (starts with .)
*/
isHiddenFile(path) {
const parts = path.split("/");
return parts.some((part) => part.startsWith(".") && part !== "." && part !== "..");
}
/**
* Generate Cursor-compatible globs field
*/
generateCursorGlobs() {
const globs = [...this.config.include];
if (this.config.exclude) {
for (const pattern of this.config.exclude) {
globs.push(`!${pattern}`);
}
}
return globs;
}
/**
* Generate MDC frontmatter
*/
generateMDCFrontmatter() {
const globs = this.generateCursorGlobs();
return `globs: ${JSON.stringify(globs)}`;
}
};
function createGlobMatcher(config) {
return new GlobMatcher(config);
}
function matchPattern(pattern) {
return new GlobMatcher({ include: [pattern] });
}
function parseGlobsFromMDC(content) {
const match = content.match(/globs:\s*(\[.*?\])/s);
if (!match) {
return null;
}
try {
const patterns = JSON.parse(match[1]);
const include = [];
const exclude = [];
for (const pattern of patterns) {
if (pattern.startsWith("!")) {
exclude.push(pattern.slice(1));
} else {
include.push(pattern);
}
}
return { include, exclude };
} catch {
return null;
}
}
var COMMON_PATTERNS = {
/** All TypeScript files */
typescript: ["**/*.ts", "**/*.tsx"],
/** All JavaScript files */
javascript: ["**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
/** All test files */
tests: ["**/*.test.*", "**/*.spec.*", "**/__tests__/**"],
/** All config files */
configs: ["*.config.*", "*rc", "*rc.*", "*.json", "*.yaml", "*.yml"],
/** All source files */
source: ["src/**/*"],
/** All documentation */
docs: ["**/*.md", "docs/**/*", "README*"],
/** Node modules (usually excluded) */
nodeModules: ["**/node_modules/**"],
/** Build outputs (usually excluded) */
buildOutputs: ["**/dist/**", "**/build/**", "**/.next/**"],
/** All files */
all: ["**/*"]
};
function fromCommonPatterns(includeNames, excludeNames) {
const include = [];
const exclude = [];
for (const name of includeNames) {
include.push(...COMMON_PATTERNS[name]);
}
if (excludeNames) {
for (const name of excludeNames) {
exclude.push(...COMMON_PATTERNS[name]);
}
}
return { include, exclude };
}
// src/features/bootstrap.ts
var DEFAULT_FILE_NAMES = {
agents: "AGENTS.md",
soul: "SOUL.md",
tools: "TOOLS.md",
identity: "IDENTITY.md",
context: "CONTEXT.md",
brief: "BRIEF.md",
history: "HISTORY.md"
};
var BootstrapManager = class {
files = /* @__PURE__ */ new Map();
/**
* Add a bootstrap file
*/
addFile(file) {
this.files.set(file.type, file);
}
/**
* Get a bootstrap file by type
*/
getFile(type) {
return this.files.get(type);
}
/**
* Get all bootstrap files
*/
getAllFiles() {
return Array.from(this.files.values());
}
/**
* Get files sorted by priority
*/
getFilesByPriority() {
return this.getAllFiles().sort((a, b) => (b.priority || 0) - (a.priority || 0));
}
/**
* Remove a bootstrap file
*/
removeFile(type) {
return this.files.delete(type);
}
/**
* Check if a file type exists
*/
hasFile(type) {
return this.files.has(type);
}
/**
* Create AGENTS.md file
*/
createAgentsFile(agents) {
const lines = [];
lines.push("# Agents");
lines.push("");
lines.push("This file defines the available agents and their capabilities.");
lines.push("");
for (const agent of agents) {
lines.push(`## ${agent.name}`);
lines.push("");
if (agent.description) {
lines.push(agent.description);
lines.push("");
}
if (agent.capabilities && agent.capabilities.length > 0) {
lines.push("### Capabilities");
lines.push("");
for (const cap of agent.capabilities) {
lines.push(`- ${cap}`);
}
lines.push("");
}
if (agent.constraints && agent.constraints.length > 0) {
lines.push("### Constraints");
lines.push("");
for (const constraint of agent.constraints) {
lines.push(`- ${constraint}`);
}
lines.push("");
}
}
this.addFile({
type: "agents",
name: "AGENTS.md",
content: lines.join("\n"),
priority: 100,
required: true
});
}
/**
* Create SOUL.md file
*/
createSoulFile(soul) {
const lines = [];
lines.push("# Soul");
lines.push("");
lines.push("This file defines the personality and behavior of the agent.");
lines.push("");
if (soul.personality) {
lines.push("## Personality");
lines.push("");
lines.push(soul.personality);
lines.push("");
}
if (soul.values && soul.values.length > 0) {
lines.push("## Values");
lines.push("");
for (const value of soul.values) {
lines.push(`- ${value}`);
}
lines.push("");
}
if (soul.communication) {
lines.push("## Communication Style");
lines.push("");
lines.push(soul.communication);
lines.push("");
}
if (soul.rules && soul.rules.length > 0) {
lines.push("## Rules");
lines.push("");
for (const rule of soul.rules) {
lines.push(`- ${rule}`);
}
lines.push("");
}
this.addFile({
type: "soul",
name: "SOUL.md",
content: lines.join("\n"),
priority: 90
});
}
/**
* Create TOOLS.md file
*/
createToolsFile(tools) {
const lines = [];
lines.push("# Tools");
lines.push("");
lines.push("This file defines the available tools and their usage.");
lines.push("");
for (const tool of tools) {
lines.push(`## ${tool.name}`);
lines.push("");
if (tool.description) {
lines.push(tool.description);
lines.push("");
}
if (tool.usage) {
lines.push("### Usage");
lines.push("");
lines.push("```");
lines.push(tool.usage);
lines.push("```");
lines.push("");
}
if (tool.examples && tool.examples.length > 0) {
lines.push("### Examples");
lines.push("");
for (const example of tool.examples) {
lines.push(`- ${example}`);
}
lines.push("");
}
}
this.addFile({
type: "tools",
name: "TOOLS.md",
content: lines.join("\n"),
priority: 80
});
}
/**
* Create IDENTITY.md file
*/
createIdentityFile(identity) {
const lines = [];
lines.push("# Identity");
lines.push("");
if (identity.name) {
lines.push(`**Name:** ${identity.name}`);
lines.push("");
}
if (identity.role) {
lines.push(`**Role:** ${identity.role}`);
lines.push("");
}
if (identity.description) {
lines.push("## Description");
lines.push("");
lines.push(identity.description);
lines.push("");
}
if (identity.expertise && identity.expertise.length > 0) {
lines.push("## Expertise");
lines.push("");
for (const exp of identity.expertise) {
lines.push(`- ${exp}`);
}
lines.push("");
}
this.addFile({
type: "identity",
name: "IDENTITY.md",
content: lines.join("\n"),
priority: 95
});
}
/**
* Create CONTEXT.md file
*/
createContextFile(context) {
const lines = [];
lines.push("# Context");
lines.push("");
if (context.project) {
lines.push("## Project");
lines.push("");
lines.push(context.project);
lines.push("");
}
if (context.techStack && context.techStack.length > 0) {
lines.push("## Tech Stack");
lines.push("");
for (const tech of context.techStack) {
lines.push(`- ${tech}`);
}
lines.push("");
}
if (context.conventions && context.conventions.length > 0) {
lines.push("## Conventions");
lines.push("");
for (const conv of context.conventions) {
lines.push(`- ${conv}`);
}
lines.push("");
}
if (context.currentTask) {
lines.push("## Current Task");
lines.push("");
lines.push(context.currentTask);
lines.push("");
}
this.addFile({
type: "context",
name: "CONTEXT.md",
content: lines.join("\n"),
priority: 70
});
}
/**
* Generate all files as a map
*/
generateFiles() {
const files = /* @__PURE__ */ new Map();
for (const file of this.getFilesByPriority()) {
files.set(file.name, file.content);
}
return files;
}
/**
* Generate combined content for agents without file support
*/
generateCombinedContent() {
const lines = [];
for (const file of this.getFilesByPriority()) {
lines.push(`<!-- ${file.name} -->`);
lines.push("");
lines.push(file.content);
lines.push("");
lines.push("---");
lines.push("");
}
return lines.join("\n");
}
/**
* Get default file name for a type
*/
static getDefaultFileName(type) {
return DEFAULT_FILE_NAMES[type];
}
};
function createBootstrapManager() {
return new BootstrapManager();
}
function createBootstrapSet(options) {
const manager = new BootstrapManager();
if (options.agents) {
manager.createAgentsFile(options.agents);
}
if (options.soul) {
manager.createSoulFile(options.soul);
}
if (options.tools) {
manager.createToolsFile(options.tools);
}
if (options.identity) {
manager.createIdentityFile(options.identity);
}
if (options.context) {
manager.createContextFile(options.context);
}
return manager;
}
// src/features/modes.ts
var DEFAULT_MODES = {
code: {
mode: "code",
description: "Code editing and implementation mode",
promptPrefix: "You are in code mode. Focus on writing and editing code."
},
architect: {
mode: "architect",
description: "Architecture and planning mode",
promptPrefix: "You are in architect mode. Focus on system design and planning."
},
ask: {
mode: "ask",
description: "Question and answer mode",
promptPrefix: "You are in ask mode. Focus on answering questions clearly."
},
debug: {
mode: "debug",
description: "Debugging and troubleshooting mode",
promptPrefix: "You are in debug mode. Focus on finding and fixing issues."
},
review: {
mode: "review",
description: "Code review mode",
promptPrefix: "You are in review mode. Focus on reviewing code quality."
},
test: {
mode: "test",
description: "Testing mode",
promptPrefix: "You are in test mode. Focus on writing and running tests."
},
docs: {
mode: "docs",
description: "Documentation mode",
promptPrefix: "You are in docs mode. Focus on writing documentation."
}
};
var ModeManager = class {
modes = /* @__PURE__ */ new Map();
currentMode = "code";
modeListeners = /* @__PURE__ */ new Set();
constructor(modes) {
if (modes) {
for (const mode of modes) {
this.addMode(mode);
}
}
}
/**
* Add a mode configuration
*/
addMode(config) {
this.modes.set(config.mode, config);
}
/**
* Get a mode configuration
*/
getMode(mode) {
return this.modes.get(mode);
}
/**
* Get all mode configurations
*/
getAllModes() {
return Array.from(this.modes.values());
}
/**
* Get available mode names
*/
getAvailableModes() {
return Array.from(this.modes.keys());
}
/**
* Set the current mode
*/
setMode(mode) {
const config = this.modes.get(mode);
if (!config) {
throw new Error(`Mode not configured: ${mode}`);
}
const previousMode = this.currentMode;
this.currentMode = mode;
for (const listener of this.modeListeners) {
listener(mode, previousMode, config);
}
}
/**
* Get the current mode
*/
getCurrentMode() {
return this.currentMode;
}
/**
* Get current mode configuration
*/
getCurrentModeConfig() {
return this.modes.get(this.currentMode);
}
/**
* Get skills for current mode
*/
getCurrentSkills() {
const config = this.getCurrentModeConfig();
return config?.skills || [];
}
/**
* Get tools for current mode
*/
getCurrentTools() {
const config = this.getCurrentModeConfig();
return config?.tools || [];
}
/**
* Check if a skill is available in current mode
*/
isSkillAvailable(skillName) {
const skills = this.getCurrentSkills();
return skills.length === 0 || skills.includes(skillName);
}
/**
* Check if a file is allowed in current mode
*/
isFileAllowed(filePath) {
const config = this.getCurrentModeConfig();
if (!config?.allowedFiles || config.allowedFiles.length === 0) {
return true;
}
const matcher = new GlobMatcher({ include: config.allowedFiles });
return matcher.matches(filePath);
}
/**
* Add mode change listener
*/
addModeListener(listener) {
this.modeListeners.add(listener);
}
/**
* Remove mode change listener
*/
removeModeListener(listener) {
this.modeListeners.delete(listener);
}
/**
* Create a mode from default configuration
*/
addDefaultMode(mode, skills) {
const defaultConfig = DEFAULT_MODES[mode];
this.addMode({
...defaultConfig,
skills
});
}
/**
* Generate mode-specific prompt prefix
*/
getPromptPrefix() {
const config = this.getCurrentModeConfig();
return config?.promptPrefix || "";
}
/**
* Generate Roo-compatible mode configuration
*/
generateRooConfig() {
const modes = {};
for (const config of this.modes.values()) {
modes[config.mode] = {
description: config.description,
skills: config.skills,
tools: config.tools,
promptPrefix: config.promptPrefix
};
}
return {
defaultMode: this.currentMode,
modes
};
}
/**
* Generate mode documentation
*/
generateModeDocumentation() {
const lines = [];
lines.push("# Available Modes");
lines.push("");
for (const config of this.modes.values()) {
lines.push(`## ${config.mode}`);
lines.push("");
lines.push(config.description);
lines.push("");
if (config.skills.length > 0) {
lines.push("### Skills");
lines.push("");
for (const skill of config.skills) {
lines.push(`- ${skill}`);
}
lines.push("");
}
if (config.tools && config.tools.length > 0) {
lines.push("### Tools");
lines.push("");
for (const tool of config.tools) {
lines.push(`- ${tool}`);
}
lines.push("");
}
}
return lines.join("\n");
}
};
function createModeManager(modes) {
return new ModeManager(modes);
}
function createDefaultModeManager(skillsPerMode) {
const manager = new ModeManager();
for (const [mode, config] of Object.entries(DEFAULT_MODES)) {
const skills = skillsPerMode[mode] || [];
manager.addMode({
...config,
skills
});
}
return manager;
}
function getDefaultModeConfig(mode) {
return DEFAULT_MODES[mode];
}
var ALL_MODES = ["code", "architect", "ask", "debug", "review", "test", "docs"];
// src/index.ts

@@ -1166,4 +2071,7 @@ var adapters = {

export {
ALL_MODES,
AmpAdapter,
AntigravityAdapter,
BootstrapManager,
COMMON_PATTERNS,
ClaudeCodeAdapter,

@@ -1176,6 +2084,9 @@ ClawdbotAdapter,

GitHubCopilotAdapter,
GlobMatcher,
GooseAdapter,
KiloAdapter,
KiroCliAdapter,
ModeManager,
OpenCodeAdapter,
PermissionManager,
RooAdapter,

@@ -1185,10 +2096,23 @@ TraeAdapter,

WindsurfAdapter,
createBootstrapManager,
createBootstrapSet,
createDefaultModeManager,
createGlobMatcher,
createModeManager,
createPermissionManager,
createSkillXml,
detectAgent,
escapeXml,
fromCommonPatterns,
getAdapter,
getAllAdapters,
getConfigFile,
getSkillsDir
getDefaultModeConfig,
getSkillsDir,
isAllowed,
isDenied,
matchPattern,
needsConfirmation,
parseGlobsFromMDC
};
//# sourceMappingURL=index.js.map
+3
-2
{
"name": "@skillkit/agents",
"version": "1.5.0",
"version": "1.6.0",
"description": "Agent adapters for SkillKit - supports 17+ AI coding agents",

@@ -18,3 +18,4 @@ "type": "module",

"dependencies": {
"@skillkit/core": "1.5.0"
"minimatch": "^9.0.0",
"@skillkit/core": "1.6.0"
},

@@ -21,0 +22,0 @@ "devDependencies": {

Sorry, the diff of this file is too big to display