@skillkit/agents 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -200,10 +200,608 @@ declare class UniversalAdapter implements AgentAdapter {
200
200
  isDetected(): Promise<boolean>;
201
201
  }
202
202
 
203
+ /**
204
+ * Agent Features Types
205
+ *
206
+ * Type definitions for enhanced agent-specific features.
207
+ */
208
+
209
+ /**
210
+ * Permission level for agent actions
211
+ */
212
+ type PermissionLevel = 'allow' | 'deny' | 'ask';
213
+ /**
214
+ * Permission pattern for file/resource access
215
+ */
216
+ interface PermissionPattern {
217
+ /** Pattern to match (glob or regex) */
218
+ pattern: string;
219
+ /** Permission level */
220
+ level: PermissionLevel;
221
+ /** Description of why this permission is needed */
222
+ reason?: string;
223
+ }
224
+ /**
225
+ * Permission configuration for skills
226
+ */
227
+ interface PermissionConfig {
228
+ /** File access permissions */
229
+ files?: PermissionPattern[];
230
+ /** Command execution permissions */
231
+ commands?: PermissionPattern[];
232
+ /** Network access permissions */
233
+ network?: PermissionPattern[];
234
+ /** Environment variable access */
235
+ env?: PermissionPattern[];
236
+ /** Default permission level */
237
+ default?: PermissionLevel;
238
+ }
239
+ /**
240
+ * Glob pattern configuration for file-scoped skills
241
+ */
242
+ interface GlobConfig {
243
+ /** Patterns to include */
244
+ include: string[];
245
+ /** Patterns to exclude */
246
+ exclude?: string[];
247
+ /** Whether to match directories */
248
+ matchDirectories?: boolean;
249
+ /** Whether to match hidden files */
250
+ matchHidden?: boolean;
251
+ }
252
+ /**
253
+ * Bootstrap file types
254
+ */
255
+ type BootstrapFileType = 'agents' | 'soul' | 'tools' | 'identity' | 'context' | 'brief' | 'history';
256
+ /**
257
+ * Bootstrap file configuration
258
+ */
259
+ interface BootstrapFile {
260
+ /** File type */
261
+ type: BootstrapFileType;
262
+ /** File name */
263
+ name: string;
264
+ /** File content */
265
+ content: string;
266
+ /** Priority (higher = loaded first) */
267
+ priority?: number;
268
+ /** Whether file is required */
269
+ required?: boolean;
270
+ }
271
+ /**
272
+ * Agent mode types
273
+ */
274
+ type AgentMode = 'code' | 'architect' | 'ask' | 'debug' | 'review' | 'test' | 'docs';
275
+ /**
276
+ * Mode configuration
277
+ */
278
+ interface ModeConfig {
279
+ /** Mode name */
280
+ mode: AgentMode;
281
+ /** Mode description */
282
+ description: string;
283
+ /** Skills available in this mode */
284
+ skills: string[];
285
+ /** Tools available in this mode */
286
+ tools?: string[];
287
+ /** Default prompt prefix for this mode */
288
+ promptPrefix?: string;
289
+ /** Allowed file patterns in this mode */
290
+ allowedFiles?: string[];
291
+ }
292
+ /**
293
+ * Tool whitelist configuration
294
+ */
295
+ interface ToolWhitelistConfig {
296
+ /** Allowed tools */
297
+ allowed: string[];
298
+ /** Denied tools */
299
+ denied?: string[];
300
+ /** Mode for handling unlisted tools */
301
+ unlisted?: 'allow' | 'deny' | 'ask';
302
+ }
303
+ /**
304
+ * Skill package configuration (for .skill bundles)
305
+ */
306
+ interface SkillPackageConfig {
307
+ /** Package name */
308
+ name: string;
309
+ /** Package version */
310
+ version: string;
311
+ /** Package description */
312
+ description?: string;
313
+ /** Entry point skill */
314
+ entryPoint: string;
315
+ /** Included skill files */
316
+ files: string[];
317
+ /** Dependencies */
318
+ dependencies?: string[];
319
+ /** Metadata */
320
+ metadata?: Record<string, unknown>;
321
+ }
322
+ /**
323
+ * Agent feature capabilities
324
+ */
325
+ interface AgentCapabilities {
326
+ /** Supports permission system */
327
+ permissions: boolean;
328
+ /** Supports glob patterns */
329
+ globs: boolean;
330
+ /** Supports bootstrap files */
331
+ bootstrapFiles: boolean;
332
+ /** Supports multi-mode */
333
+ multiMode: boolean;
334
+ /** Supports tool whitelisting */
335
+ toolWhitelist: boolean;
336
+ /** Supports .skill packages */
337
+ skillPackages: boolean;
338
+ /** Supports hooks */
339
+ hooks: boolean;
340
+ /** Supports subagents */
341
+ subagents: boolean;
342
+ }
343
+ /**
344
+ * Agent feature set
345
+ */
346
+ interface AgentFeatures {
347
+ /** Agent type */
348
+ agent: AgentType;
349
+ /** Agent capabilities */
350
+ capabilities: AgentCapabilities;
351
+ /** Permission configuration */
352
+ permissions?: PermissionConfig;
353
+ /** Glob configuration */
354
+ globs?: GlobConfig;
355
+ /** Bootstrap files */
356
+ bootstrapFiles?: BootstrapFile[];
357
+ /** Mode configurations */
358
+ modes?: ModeConfig[];
359
+ /** Tool whitelist */
360
+ toolWhitelist?: ToolWhitelistConfig;
361
+ }
362
+ /**
363
+ * Feature generation options
364
+ */
365
+ interface FeatureGenerationOptions {
366
+ /** Target agent */
367
+ agent: AgentType;
368
+ /** Output directory */
369
+ outputDir?: string;
370
+ /** Include optional files */
371
+ includeOptional?: boolean;
372
+ /** Dry run (don't write files) */
373
+ dryRun?: boolean;
374
+ }
375
+ /**
376
+ * Feature validation result
377
+ */
378
+ interface FeatureValidationResult {
379
+ /** Whether features are valid */
380
+ valid: boolean;
381
+ /** Validation errors */
382
+ errors: string[];
383
+ /** Validation warnings */
384
+ warnings: string[];
385
+ /** Agent capabilities used */
386
+ usedCapabilities: (keyof AgentCapabilities)[];
387
+ }
388
+
389
+ /**
390
+ * Permissions System
391
+ *
392
+ * Implements permission patterns for agent skill access control.
393
+ */
394
+
395
+ /**
396
+ * PermissionManager - Manage skill permissions
397
+ */
398
+ declare class PermissionManager {
399
+ private config;
400
+ constructor(config?: PermissionConfig);
401
+ /**
402
+ * Set permission configuration
403
+ */
404
+ setConfig(config: PermissionConfig): void;
405
+ /**
406
+ * Get permission configuration
407
+ */
408
+ getConfig(): PermissionConfig;
409
+ /**
410
+ * Check file access permission
411
+ */
412
+ checkFileAccess(path: string): PermissionLevel;
413
+ /**
414
+ * Check command execution permission
415
+ */
416
+ checkCommandAccess(command: string): PermissionLevel;
417
+ /**
418
+ * Check network access permission
419
+ */
420
+ checkNetworkAccess(url: string): PermissionLevel;
421
+ /**
422
+ * Check environment variable access
423
+ */
424
+ checkEnvAccess(varName: string): PermissionLevel;
425
+ /**
426
+ * Add file permission pattern
427
+ */
428
+ addFilePattern(pattern: PermissionPattern): void;
429
+ /**
430
+ * Add command permission pattern
431
+ */
432
+ addCommandPattern(pattern: PermissionPattern): void;
433
+ /**
434
+ * Check pattern against permission list
435
+ */
436
+ private checkPattern;
437
+ /**
438
+ * Match value against pattern (glob-style)
439
+ *
440
+ * Uses minimatch for safe glob matching, avoiding ReDoS vulnerabilities.
441
+ */
442
+ private matchPattern;
443
+ /**
444
+ * Generate OpenCode-compatible permission config
445
+ */
446
+ generateOpenCodeConfig(): string;
447
+ /**
448
+ * Generate SKILL.md metadata for permissions
449
+ */
450
+ generateSkillMetadata(): Record<string, unknown>;
451
+ /**
452
+ * Parse permissions from SKILL.md metadata
453
+ */
454
+ static fromMetadata(metadata: Record<string, unknown>): PermissionConfig;
455
+ /**
456
+ * Merge two permission configs
457
+ */
458
+ static merge(base: PermissionConfig, override: PermissionConfig): PermissionConfig;
459
+ }
460
+ /**
461
+ * Create a PermissionManager instance
462
+ */
463
+ declare function createPermissionManager(config?: PermissionConfig): PermissionManager;
464
+ /**
465
+ * Quick permission check helpers
466
+ */
467
+ declare function isAllowed(level: PermissionLevel): boolean;
468
+ declare function isDenied(level: PermissionLevel): boolean;
469
+ declare function needsConfirmation(level: PermissionLevel): boolean;
470
+
471
+ /**
472
+ * Glob Pattern System
473
+ *
474
+ * Implements file pattern matching for file-scoped skills.
475
+ */
476
+
477
+ /**
478
+ * GlobMatcher - Match files against glob patterns
479
+ */
480
+ declare class GlobMatcher {
481
+ private config;
482
+ private includePatterns;
483
+ private excludePatterns;
484
+ constructor(config: GlobConfig);
485
+ /**
486
+ * Check if a file matches the glob patterns
487
+ */
488
+ matches(filePath: string): boolean;
489
+ /**
490
+ * Filter a list of files
491
+ */
492
+ filter(filePaths: string[]): string[];
493
+ /**
494
+ * Get all include patterns
495
+ */
496
+ getIncludePatterns(): string[];
497
+ /**
498
+ * Get all exclude patterns
499
+ */
500
+ getExcludePatterns(): string[];
501
+ /**
502
+ * Add an include pattern
503
+ */
504
+ addInclude(pattern: string): void;
505
+ /**
506
+ * Add an exclude pattern
507
+ */
508
+ addExclude(pattern: string): void;
509
+ /**
510
+ * Convert glob pattern to regex using minimatch
511
+ *
512
+ * Uses the battle-tested minimatch library to avoid ReDoS vulnerabilities
513
+ * and ensure consistent glob matching behavior.
514
+ */
515
+ private patternToRegex;
516
+ /**
517
+ * Check if file is hidden (starts with .)
518
+ */
519
+ private isHiddenFile;
520
+ /**
521
+ * Generate Cursor-compatible globs field
522
+ */
523
+ generateCursorGlobs(): string[];
524
+ /**
525
+ * Generate MDC frontmatter
526
+ */
527
+ generateMDCFrontmatter(): string;
528
+ }
529
+ /**
530
+ * Create a GlobMatcher instance
531
+ */
532
+ declare function createGlobMatcher(config: GlobConfig): GlobMatcher;
533
+ /**
534
+ * Create a GlobMatcher from a single pattern
535
+ */
536
+ declare function matchPattern(pattern: string): GlobMatcher;
537
+ /**
538
+ * Parse glob patterns from Cursor MDC format
539
+ */
540
+ declare function parseGlobsFromMDC(content: string): GlobConfig | null;
541
+ /**
542
+ * Common glob patterns for different file types
543
+ */
544
+ declare const COMMON_PATTERNS: {
545
+ /** All TypeScript files */
546
+ readonly typescript: readonly ["**/*.ts", "**/*.tsx"];
547
+ /** All JavaScript files */
548
+ readonly javascript: readonly ["**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"];
549
+ /** All test files */
550
+ readonly tests: readonly ["**/*.test.*", "**/*.spec.*", "**/__tests__/**"];
551
+ /** All config files */
552
+ readonly configs: readonly ["*.config.*", "*rc", "*rc.*", "*.json", "*.yaml", "*.yml"];
553
+ /** All source files */
554
+ readonly source: readonly ["src/**/*"];
555
+ /** All documentation */
556
+ readonly docs: readonly ["**/*.md", "docs/**/*", "README*"];
557
+ /** Node modules (usually excluded) */
558
+ readonly nodeModules: readonly ["**/node_modules/**"];
559
+ /** Build outputs (usually excluded) */
560
+ readonly buildOutputs: readonly ["**/dist/**", "**/build/**", "**/.next/**"];
561
+ /** All files */
562
+ readonly all: readonly ["**/*"];
563
+ };
564
+ /**
565
+ * Create glob config from common pattern names
566
+ */
567
+ declare function fromCommonPatterns(includeNames: (keyof typeof COMMON_PATTERNS)[], excludeNames?: (keyof typeof COMMON_PATTERNS)[]): GlobConfig;
568
+
569
+ /**
570
+ * Bootstrap Files System
571
+ *
572
+ * Implements bootstrap file generation for agents that support them.
573
+ */
574
+
575
+ /**
576
+ * BootstrapManager - Manage bootstrap files for agents
577
+ */
578
+ declare class BootstrapManager {
579
+ private files;
580
+ /**
581
+ * Add a bootstrap file
582
+ */
583
+ addFile(file: BootstrapFile): void;
584
+ /**
585
+ * Get a bootstrap file by type
586
+ */
587
+ getFile(type: BootstrapFileType): BootstrapFile | undefined;
588
+ /**
589
+ * Get all bootstrap files
590
+ */
591
+ getAllFiles(): BootstrapFile[];
592
+ /**
593
+ * Get files sorted by priority
594
+ */
595
+ getFilesByPriority(): BootstrapFile[];
596
+ /**
597
+ * Remove a bootstrap file
598
+ */
599
+ removeFile(type: BootstrapFileType): boolean;
600
+ /**
601
+ * Check if a file type exists
602
+ */
603
+ hasFile(type: BootstrapFileType): boolean;
604
+ /**
605
+ * Create AGENTS.md file
606
+ */
607
+ createAgentsFile(agents: AgentDefinition[]): void;
608
+ /**
609
+ * Create SOUL.md file
610
+ */
611
+ createSoulFile(soul: SoulDefinition): void;
612
+ /**
613
+ * Create TOOLS.md file
614
+ */
615
+ createToolsFile(tools: ToolDefinition[]): void;
616
+ /**
617
+ * Create IDENTITY.md file
618
+ */
619
+ createIdentityFile(identity: IdentityDefinition): void;
620
+ /**
621
+ * Create CONTEXT.md file
622
+ */
623
+ createContextFile(context: ContextDefinition): void;
624
+ /**
625
+ * Generate all files as a map
626
+ */
627
+ generateFiles(): Map<string, string>;
628
+ /**
629
+ * Generate combined content for agents without file support
630
+ */
631
+ generateCombinedContent(): string;
632
+ /**
633
+ * Get default file name for a type
634
+ */
635
+ static getDefaultFileName(type: BootstrapFileType): string;
636
+ }
637
+ /**
638
+ * Agent definition for AGENTS.md
639
+ */
640
+ interface AgentDefinition {
641
+ name: string;
642
+ description?: string;
643
+ capabilities?: string[];
644
+ constraints?: string[];
645
+ }
646
+ /**
647
+ * Soul definition for SOUL.md
648
+ */
649
+ interface SoulDefinition {
650
+ personality?: string;
651
+ values?: string[];
652
+ communication?: string;
653
+ rules?: string[];
654
+ }
655
+ /**
656
+ * Tool definition for TOOLS.md
657
+ */
658
+ interface ToolDefinition {
659
+ name: string;
660
+ description?: string;
661
+ usage?: string;
662
+ examples?: string[];
663
+ }
664
+ /**
665
+ * Identity definition for IDENTITY.md
666
+ */
667
+ interface IdentityDefinition {
668
+ name?: string;
669
+ role?: string;
670
+ description?: string;
671
+ expertise?: string[];
672
+ }
673
+ /**
674
+ * Context definition for CONTEXT.md
675
+ */
676
+ interface ContextDefinition {
677
+ project?: string;
678
+ techStack?: string[];
679
+ conventions?: string[];
680
+ currentTask?: string;
681
+ }
682
+ /**
683
+ * Create a BootstrapManager instance
684
+ */
685
+ declare function createBootstrapManager(): BootstrapManager;
686
+ /**
687
+ * Create a complete bootstrap set from definitions
688
+ */
689
+ declare function createBootstrapSet(options: {
690
+ agents?: AgentDefinition[];
691
+ soul?: SoulDefinition;
692
+ tools?: ToolDefinition[];
693
+ identity?: IdentityDefinition;
694
+ context?: ContextDefinition;
695
+ }): BootstrapManager;
696
+
697
+ /**
698
+ * Multi-Mode System
699
+ *
700
+ * Implements multi-mode support for agents that support different operating modes.
701
+ */
702
+
703
+ /**
704
+ * ModeManager - Manage agent operating modes
705
+ */
706
+ declare class ModeManager {
707
+ private modes;
708
+ private currentMode;
709
+ private modeListeners;
710
+ constructor(modes?: ModeConfig[]);
711
+ /**
712
+ * Add a mode configuration
713
+ */
714
+ addMode(config: ModeConfig): void;
715
+ /**
716
+ * Get a mode configuration
717
+ */
718
+ getMode(mode: AgentMode): ModeConfig | undefined;
719
+ /**
720
+ * Get all mode configurations
721
+ */
722
+ getAllModes(): ModeConfig[];
723
+ /**
724
+ * Get available mode names
725
+ */
726
+ getAvailableModes(): AgentMode[];
727
+ /**
728
+ * Set the current mode
729
+ */
730
+ setMode(mode: AgentMode): void;
731
+ /**
732
+ * Get the current mode
733
+ */
734
+ getCurrentMode(): AgentMode;
735
+ /**
736
+ * Get current mode configuration
737
+ */
738
+ getCurrentModeConfig(): ModeConfig | undefined;
739
+ /**
740
+ * Get skills for current mode
741
+ */
742
+ getCurrentSkills(): string[];
743
+ /**
744
+ * Get tools for current mode
745
+ */
746
+ getCurrentTools(): string[];
747
+ /**
748
+ * Check if a skill is available in current mode
749
+ */
750
+ isSkillAvailable(skillName: string): boolean;
751
+ /**
752
+ * Check if a file is allowed in current mode
753
+ */
754
+ isFileAllowed(filePath: string): boolean;
755
+ /**
756
+ * Add mode change listener
757
+ */
758
+ addModeListener(listener: ModeChangeListener): void;
759
+ /**
760
+ * Remove mode change listener
761
+ */
762
+ removeModeListener(listener: ModeChangeListener): void;
763
+ /**
764
+ * Create a mode from default configuration
765
+ */
766
+ addDefaultMode(mode: AgentMode, skills: string[]): void;
767
+ /**
768
+ * Generate mode-specific prompt prefix
769
+ */
770
+ getPromptPrefix(): string;
771
+ /**
772
+ * Generate Roo-compatible mode configuration
773
+ */
774
+ generateRooConfig(): Record<string, unknown>;
775
+ /**
776
+ * Generate mode documentation
777
+ */
778
+ generateModeDocumentation(): string;
779
+ }
780
+ /**
781
+ * Mode change listener type
782
+ */
783
+ type ModeChangeListener = (newMode: AgentMode, previousMode: AgentMode, config: ModeConfig) => void;
784
+ /**
785
+ * Create a ModeManager instance
786
+ */
787
+ declare function createModeManager(modes?: ModeConfig[]): ModeManager;
788
+ /**
789
+ * Create a ModeManager with all default modes
790
+ */
791
+ declare function createDefaultModeManager(skillsPerMode: Partial<Record<AgentMode, string[]>>): ModeManager;
792
+ /**
793
+ * Get default configuration for a mode
794
+ */
795
+ declare function getDefaultModeConfig(mode: AgentMode): Omit<ModeConfig, 'skills'>;
796
+ /**
797
+ * All available agent modes
798
+ */
799
+ declare const ALL_MODES: AgentMode[];
800
+
203
801
  declare function getAdapter(type: AgentType): AgentAdapter;
204
802
  declare function getAllAdapters(): AgentAdapter[];
205
803
  declare function detectAgent(): Promise<AgentType>;
206
804
  declare function getSkillsDir(type: AgentType): string;
207
805
  declare function getConfigFile(type: AgentType): string;
208
806
 
209
- 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 };
807
+ 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 };