@skillkit/core 1.3.1 → 1.4.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
@@ -1952,6 +1952,126 @@ declare function syncToAllAgents(projectPath?: string, options?: ContextSyncOpti
1952
1952
  */
1953
1953
  declare function syncToAgent(agent: AgentType, projectPath?: string, options?: ContextSyncOptions): Promise<SyncResult>;
1954
1954
 
1955
+ /**
1956
+ * Context Loader
1957
+ *
1958
+ * Smart context loading with token budgets and category-based loading.
1959
+ */
1960
+ /**
1961
+ * Context category with size limits
1962
+ */
1963
+ interface ContextCategory {
1964
+ /** Category name */
1965
+ name: string;
1966
+ /** Maximum tokens for this category */
1967
+ maxTokens: number;
1968
+ /** Whether to always load this category */
1969
+ alwaysLoad: boolean;
1970
+ /** File path (relative to project) */
1971
+ file?: string;
1972
+ /** Inline content */
1973
+ content?: string;
1974
+ }
1975
+ /**
1976
+ * Context loading options
1977
+ */
1978
+ interface ContextLoadOptions {
1979
+ /** Total token budget */
1980
+ totalBudget?: number;
1981
+ /** Categories to load (load all if not specified) */
1982
+ categories?: string[];
1983
+ /** Whether to warn when approaching budget limits */
1984
+ warnOnBudgetLimit?: boolean;
1985
+ }
1986
+ /**
1987
+ * Loaded context result
1988
+ */
1989
+ interface LoadedContext {
1990
+ /** All loaded content combined */
1991
+ content: string;
1992
+ /** Total tokens used */
1993
+ totalTokens: number;
1994
+ /** Budget remaining */
1995
+ budgetRemaining: number;
1996
+ /** Categories loaded */
1997
+ categoriesLoaded: string[];
1998
+ /** Categories skipped (due to budget or not found) */
1999
+ categoriesSkipped: string[];
2000
+ /** Warnings generated */
2001
+ warnings: string[];
2002
+ /** Whether budget is near limit (>50% used) */
2003
+ nearBudgetLimit: boolean;
2004
+ /** Whether context is degraded (>70% used) */
2005
+ contextDegraded: boolean;
2006
+ }
2007
+ /**
2008
+ * Default context categories
2009
+ */
2010
+ declare const DEFAULT_CONTEXT_CATEGORIES: ContextCategory[];
2011
+ /**
2012
+ * Rough estimate of tokens from text
2013
+ * (approximation: ~4 characters per token for English text)
2014
+ */
2015
+ declare function estimateTokens(text: string): number;
2016
+ /**
2017
+ * Context Loader class
2018
+ */
2019
+ declare class ContextLoader {
2020
+ private projectPath;
2021
+ private categories;
2022
+ private defaultBudget;
2023
+ constructor(projectPath: string, options?: {
2024
+ categories?: ContextCategory[];
2025
+ defaultBudget?: number;
2026
+ });
2027
+ /**
2028
+ * Load context based on options
2029
+ */
2030
+ load(options?: ContextLoadOptions): LoadedContext;
2031
+ /**
2032
+ * Load a single category
2033
+ */
2034
+ private loadCategory;
2035
+ /**
2036
+ * Get category by name
2037
+ */
2038
+ getCategory(name: string): ContextCategory | undefined;
2039
+ /**
2040
+ * Add a custom category
2041
+ */
2042
+ addCategory(category: ContextCategory): void;
2043
+ /**
2044
+ * Remove a category
2045
+ */
2046
+ removeCategory(name: string): void;
2047
+ /**
2048
+ * Get estimated context size for categories
2049
+ */
2050
+ estimateSize(categoryNames?: string[]): {
2051
+ category: string;
2052
+ tokens: number;
2053
+ available: boolean;
2054
+ }[];
2055
+ /**
2056
+ * Check if context would exceed budget threshold
2057
+ */
2058
+ wouldExceedThreshold(additionalTokens: number, threshold?: number): boolean;
2059
+ /**
2060
+ * Suggest spawning fresh agent if context is degraded
2061
+ */
2062
+ shouldSpawnFreshAgent(): {
2063
+ should: boolean;
2064
+ reason?: string;
2065
+ };
2066
+ }
2067
+ /**
2068
+ * Create a context loader
2069
+ */
2070
+ declare function createContextLoader(projectPath: string, options?: {
2071
+ categories?: ContextCategory[];
2072
+ defaultBudget?: number;
2073
+ }): ContextLoader;
2074
+
1955
2075
  /**
1956
2076
  * Skill summary for recommendation matching
1957
2077
  */
@@ -2231,4 +2351,2056 @@ declare class RecommendationEngine {
2231
2351
  */
2232
2352
  declare function createRecommendationEngine(weights?: Partial<ScoringWeights>): RecommendationEngine;
2233
2353
 
2234
- export { AGENT_FORMAT_MAP, type AgentAdapterInfo, AgentConfig, AgentType, BitbucketProvider, CONTEXT_DIR, CONTEXT_FILE, type CanonicalSkill, type CloneOptions, type CloneResult, type CommandResult, type ContextExportOptions, type ContextImportOptions, ContextManager, ContextSync, type ContextSyncOptions, CopilotTranslator, CursorTranslator, DEFAULT_SCORING_WEIGHTS, DependencyInfo, Detection, type DetectionSource, type DiscoveredSkill, type FormatCategory, type FormatTranslator, type FreshnessResult, GitHubProvider, GitLabProvider, GitProvider, type GitProviderAdapter, type IndexSource, type InstallOptions, LocalProvider, type MatchCategory, type MatchReason, PROJECT_TYPE_HINTS, ProjectContext, ProjectDetector, ProjectPatterns, type ProjectProfile, ProjectStack, type RecommendOptions, RecommendationEngine, type RecommendationResult, type RegistrySkill, SKILL_DISCOVERY_PATHS, type ScoredSkill, type ScoringWeights, type SearchOptions, type SearchResult, Skill, SkillFrontmatter, type SkillIndex, SkillLocation, SkillMdTranslator, SkillMetadata, SkillPreferences, SkillSummary, SkillkitConfig, type SyncOptions, type SyncReport, type SyncResult, TAG_TO_TECH, TranslatableSkillFrontmatter, type TranslationOptions, type TranslationPath, type TranslationResult, TranslatorRegistry, type UpdateOptions, WindsurfTranslator, analyzeProject, canTranslate, copilotTranslator, createContextManager, createContextSync, createRecommendationEngine, cursorTranslator, detectProvider, detectSkillFormat, discoverSkills, extractField, extractFrontmatter, findAllSkills, findSkill, getAgentConfigPath, getAllProviders, getGlobalConfigPath, getInstallDir, getProjectConfigPath, getProvider, getSearchDirs, getStackTags, getSupportedTranslationAgents, getTechTags, initContext, initProject, isGitUrl, isLocalPath, isPathInside, loadConfig, loadContext, loadMetadata, loadSkillMetadata, parseShorthand, parseSkill, parseSkillContent, parseSource, readSkillContent, saveConfig, saveSkillMetadata, setSkillEnabled, skillMdTranslator, syncToAgent, syncToAllAgents, translateSkill, translateSkillFile, translatorRegistry, validateSkill, windsurfTranslator };
2354
+ /**
2355
+ * Known skill repositories to index
2356
+ */
2357
+ declare const KNOWN_SKILL_REPOS: readonly [{
2358
+ readonly owner: "anthropics";
2359
+ readonly repo: "courses";
2360
+ readonly description: "Anthropic official courses and skills";
2361
+ }, {
2362
+ readonly owner: "vercel-labs";
2363
+ readonly repo: "ai-sdk-preview-internal-knowledge-base";
2364
+ readonly description: "Vercel AI SDK skills";
2365
+ }, {
2366
+ readonly owner: "composioHQ";
2367
+ readonly repo: "awesome-claude-code-skills";
2368
+ readonly description: "Curated Claude Code skills";
2369
+ }];
2370
+ /**
2371
+ * Index file path
2372
+ */
2373
+ declare const INDEX_PATH: string;
2374
+ declare const INDEX_CACHE_HOURS = 24;
2375
+ /**
2376
+ * Fetch skills from a GitHub repository
2377
+ */
2378
+ declare function fetchSkillsFromRepo(owner: string, repo: string): Promise<{
2379
+ skills: SkillSummary[];
2380
+ error?: string;
2381
+ }>;
2382
+ /**
2383
+ * Fetch skills from all known repositories and build index
2384
+ */
2385
+ declare function buildSkillIndex(repos?: typeof KNOWN_SKILL_REPOS, onProgress?: (message: string) => void): Promise<{
2386
+ index: SkillIndex;
2387
+ errors: string[];
2388
+ }>;
2389
+ /**
2390
+ * Save skill index to cache
2391
+ */
2392
+ declare function saveIndex(index: SkillIndex): void;
2393
+ /**
2394
+ * Load skill index from cache
2395
+ */
2396
+ declare function loadIndex(): SkillIndex | null;
2397
+ /**
2398
+ * Check if index is stale
2399
+ */
2400
+ declare function isIndexStale(index: SkillIndex): boolean;
2401
+ /**
2402
+ * Get index status
2403
+ */
2404
+ declare function getIndexStatus(): 'missing' | 'stale' | 'fresh';
2405
+
2406
+ /**
2407
+ * Session State Types
2408
+ *
2409
+ * Types for managing skill execution sessions with pause/resume support.
2410
+ */
2411
+ /**
2412
+ * Status of a task in execution
2413
+ */
2414
+ type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'paused';
2415
+ /**
2416
+ * A single task within a skill execution
2417
+ */
2418
+ interface SessionTask {
2419
+ /** Task identifier */
2420
+ id: string;
2421
+ /** Task name/description */
2422
+ name: string;
2423
+ /** Task type (auto, checkpoint:human-verify, checkpoint:decision, checkpoint:human-action) */
2424
+ type: 'auto' | 'checkpoint:human-verify' | 'checkpoint:decision' | 'checkpoint:human-action';
2425
+ /** Current status */
2426
+ status: TaskStatus;
2427
+ /** Start time */
2428
+ startedAt?: string;
2429
+ /** Completion time */
2430
+ completedAt?: string;
2431
+ /** Error message if failed */
2432
+ error?: string;
2433
+ /** Output/result of the task */
2434
+ output?: string;
2435
+ /** Files modified by this task */
2436
+ filesModified?: string[];
2437
+ /** Git commit SHA if committed */
2438
+ commitSha?: string;
2439
+ }
2440
+ /**
2441
+ * Current skill execution state
2442
+ */
2443
+ interface CurrentExecution {
2444
+ /** Skill being executed */
2445
+ skillName: string;
2446
+ /** Skill source (repo) */
2447
+ skillSource: string;
2448
+ /** Current step/task index */
2449
+ currentStep: number;
2450
+ /** Total steps */
2451
+ totalSteps: number;
2452
+ /** Execution status */
2453
+ status: 'running' | 'paused' | 'completed' | 'failed';
2454
+ /** When execution started */
2455
+ startedAt: string;
2456
+ /** When execution was paused (if paused) */
2457
+ pausedAt?: string;
2458
+ /** Tasks in this execution */
2459
+ tasks: SessionTask[];
2460
+ }
2461
+ /**
2462
+ * Historical execution record
2463
+ */
2464
+ interface ExecutionHistory {
2465
+ /** Skill name */
2466
+ skillName: string;
2467
+ /** Skill source */
2468
+ skillSource: string;
2469
+ /** When execution completed */
2470
+ completedAt: string;
2471
+ /** Duration in milliseconds */
2472
+ durationMs: number;
2473
+ /** Final status */
2474
+ status: 'completed' | 'failed' | 'cancelled';
2475
+ /** Git commits created */
2476
+ commits: string[];
2477
+ /** Files modified */
2478
+ filesModified: string[];
2479
+ /** Error if failed */
2480
+ error?: string;
2481
+ }
2482
+ /**
2483
+ * User decisions made during skill execution
2484
+ */
2485
+ interface SessionDecision {
2486
+ /** Decision key/identifier */
2487
+ key: string;
2488
+ /** Decision value */
2489
+ value: string;
2490
+ /** When decision was made */
2491
+ madeAt: string;
2492
+ /** Skill that prompted the decision */
2493
+ skillName?: string;
2494
+ }
2495
+ /**
2496
+ * Full session state
2497
+ */
2498
+ interface SessionState {
2499
+ /** Schema version */
2500
+ version: 1;
2501
+ /** Last activity timestamp */
2502
+ lastActivity: string;
2503
+ /** Project path this session is for */
2504
+ projectPath: string;
2505
+ /** Current execution (if any) */
2506
+ currentExecution?: CurrentExecution;
2507
+ /** Execution history */
2508
+ history: ExecutionHistory[];
2509
+ /** User decisions */
2510
+ decisions: SessionDecision[];
2511
+ }
2512
+ /**
2513
+ * Session state file path within .skillkit directory
2514
+ */
2515
+ declare const SESSION_FILE = "session.yaml";
2516
+
2517
+ /**
2518
+ * Session Manager
2519
+ *
2520
+ * Manages session state for skill execution with pause/resume support.
2521
+ */
2522
+
2523
+ /**
2524
+ * Session Manager for tracking skill execution state
2525
+ */
2526
+ declare class SessionManager {
2527
+ private projectPath;
2528
+ private sessionPath;
2529
+ private state;
2530
+ constructor(projectPath: string);
2531
+ /**
2532
+ * Get session file path
2533
+ */
2534
+ getSessionPath(): string;
2535
+ /**
2536
+ * Load session state from disk
2537
+ */
2538
+ load(): SessionState | null;
2539
+ /**
2540
+ * Save session state to disk
2541
+ */
2542
+ save(): void;
2543
+ /**
2544
+ * Initialize a new session
2545
+ */
2546
+ init(): SessionState;
2547
+ /**
2548
+ * Get current session state (load if needed)
2549
+ */
2550
+ get(): SessionState | null;
2551
+ /**
2552
+ * Get or create session
2553
+ */
2554
+ getOrCreate(): SessionState;
2555
+ /**
2556
+ * Start a new skill execution
2557
+ */
2558
+ startExecution(skillName: string, skillSource: string, tasks: Omit<SessionTask, 'status'>[]): CurrentExecution;
2559
+ /**
2560
+ * Update task status
2561
+ */
2562
+ updateTask(taskId: string, updates: Partial<Pick<SessionTask, 'status' | 'output' | 'error' | 'filesModified' | 'commitSha'>>): void;
2563
+ /**
2564
+ * Advance to next task
2565
+ */
2566
+ advanceToNextTask(): SessionTask | null;
2567
+ /**
2568
+ * Pause current execution
2569
+ */
2570
+ pause(): boolean;
2571
+ /**
2572
+ * Resume paused execution
2573
+ */
2574
+ resume(): boolean;
2575
+ /**
2576
+ * Complete current execution
2577
+ */
2578
+ completeExecution(status: 'completed' | 'failed' | 'cancelled', error?: string): void;
2579
+ /**
2580
+ * Record a user decision
2581
+ */
2582
+ recordDecision(key: string, value: string, skillName?: string): void;
2583
+ /**
2584
+ * Get a decision value
2585
+ */
2586
+ getDecision(key: string): string | undefined;
2587
+ /**
2588
+ * Get execution history
2589
+ */
2590
+ getHistory(limit?: number): ExecutionHistory[];
2591
+ /**
2592
+ * Check if there's an active execution
2593
+ */
2594
+ hasActiveExecution(): boolean;
2595
+ /**
2596
+ * Check if execution is paused
2597
+ */
2598
+ isPaused(): boolean;
2599
+ /**
2600
+ * Clear session (delete file)
2601
+ */
2602
+ clear(): void;
2603
+ }
2604
+ /**
2605
+ * Create a new session manager
2606
+ */
2607
+ declare function createSessionManager(projectPath: string): SessionManager;
2608
+
2609
+ /**
2610
+ * Workflow Types
2611
+ *
2612
+ * Types for skill composition and workflow orchestration.
2613
+ */
2614
+ /**
2615
+ * A skill reference within a workflow
2616
+ */
2617
+ interface WorkflowSkill {
2618
+ /** Skill name or source (e.g., "typescript-strict-mode" or "owner/repo/skill") */
2619
+ skill: string;
2620
+ /** Optional configuration overrides */
2621
+ config?: Record<string, unknown>;
2622
+ /** Optional condition to run this skill */
2623
+ condition?: string;
2624
+ }
2625
+ /**
2626
+ * A wave of skills to execute (parallel or sequential)
2627
+ */
2628
+ interface WorkflowWave {
2629
+ /** Wave name/description */
2630
+ name?: string;
2631
+ /** Whether skills in this wave run in parallel */
2632
+ parallel: boolean;
2633
+ /** Skills to execute in this wave */
2634
+ skills: (string | WorkflowSkill)[];
2635
+ /** Continue to next wave even if this wave has failures */
2636
+ continueOnError?: boolean;
2637
+ }
2638
+ /**
2639
+ * Workflow definition
2640
+ */
2641
+ interface Workflow {
2642
+ /** Workflow name (used as identifier) */
2643
+ name: string;
2644
+ /** Human-readable description */
2645
+ description?: string;
2646
+ /** Workflow version */
2647
+ version?: string;
2648
+ /** Author information */
2649
+ author?: string;
2650
+ /** Tags for discovery */
2651
+ tags?: string[];
2652
+ /** Waves of skills to execute */
2653
+ waves: WorkflowWave[];
2654
+ /** Environment variables to set */
2655
+ env?: Record<string, string>;
2656
+ /** Pre-execution hooks */
2657
+ preHooks?: string[];
2658
+ /** Post-execution hooks */
2659
+ postHooks?: string[];
2660
+ }
2661
+ /**
2662
+ * Workflow execution status
2663
+ */
2664
+ type WorkflowExecutionStatus = 'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
2665
+ /**
2666
+ * Status of a wave execution
2667
+ */
2668
+ interface WaveExecutionStatus {
2669
+ /** Wave index */
2670
+ waveIndex: number;
2671
+ /** Wave name */
2672
+ waveName?: string;
2673
+ /** Status */
2674
+ status: WorkflowExecutionStatus;
2675
+ /** Skills statuses */
2676
+ skills: {
2677
+ skill: string;
2678
+ status: WorkflowExecutionStatus;
2679
+ startedAt?: string;
2680
+ completedAt?: string;
2681
+ error?: string;
2682
+ }[];
2683
+ /** When wave started */
2684
+ startedAt?: string;
2685
+ /** When wave completed */
2686
+ completedAt?: string;
2687
+ }
2688
+ /**
2689
+ * Workflow execution state
2690
+ */
2691
+ interface WorkflowExecution {
2692
+ /** Workflow being executed */
2693
+ workflow: Workflow;
2694
+ /** Execution ID */
2695
+ executionId: string;
2696
+ /** Overall status */
2697
+ status: WorkflowExecutionStatus;
2698
+ /** Current wave index */
2699
+ currentWave: number;
2700
+ /** Wave statuses */
2701
+ waves: WaveExecutionStatus[];
2702
+ /** When execution started */
2703
+ startedAt: string;
2704
+ /** When execution completed */
2705
+ completedAt?: string;
2706
+ /** Error if failed */
2707
+ error?: string;
2708
+ }
2709
+ /**
2710
+ * Workflow file location
2711
+ */
2712
+ declare const WORKFLOWS_DIR = "workflows";
2713
+ declare const WORKFLOW_EXTENSION = ".yaml";
2714
+
2715
+ /**
2716
+ * Workflow Parser
2717
+ *
2718
+ * Parses workflow YAML files into Workflow objects.
2719
+ */
2720
+
2721
+ /**
2722
+ * Parse a workflow from YAML content
2723
+ */
2724
+ declare function parseWorkflow(content: string): Workflow;
2725
+ /**
2726
+ * Load a workflow from a file
2727
+ */
2728
+ declare function loadWorkflow(filePath: string): Workflow;
2729
+ /**
2730
+ * Load a workflow by name from the project's workflows directory
2731
+ */
2732
+ declare function loadWorkflowByName(projectPath: string, name: string): Workflow | null;
2733
+ /**
2734
+ * List all workflows in a project
2735
+ */
2736
+ declare function listWorkflows(projectPath: string): Workflow[];
2737
+ /**
2738
+ * Save a workflow to a file
2739
+ */
2740
+ declare function saveWorkflow(projectPath: string, workflow: Workflow): string;
2741
+ /**
2742
+ * Serialize a workflow to YAML
2743
+ */
2744
+ declare function serializeWorkflow(workflow: Workflow): string;
2745
+ /**
2746
+ * Validate a workflow
2747
+ */
2748
+ declare function validateWorkflow(workflow: Workflow): {
2749
+ valid: boolean;
2750
+ errors: string[];
2751
+ };
2752
+ /**
2753
+ * Create a new workflow from a template
2754
+ */
2755
+ declare function createWorkflowTemplate(name: string, description?: string): Workflow;
2756
+
2757
+ /**
2758
+ * Workflow Orchestrator
2759
+ *
2760
+ * Executes workflows with wave-based orchestration.
2761
+ */
2762
+
2763
+ /**
2764
+ * Skill executor function type
2765
+ */
2766
+ type SkillExecutor = (skillName: string, config?: Record<string, unknown>) => Promise<{
2767
+ success: boolean;
2768
+ error?: string;
2769
+ }>;
2770
+ /**
2771
+ * Progress callback for workflow execution
2772
+ */
2773
+ type WorkflowProgressCallback = (event: {
2774
+ type: 'wave_start' | 'wave_complete' | 'skill_start' | 'skill_complete' | 'workflow_complete';
2775
+ waveIndex?: number;
2776
+ waveName?: string;
2777
+ skillName?: string;
2778
+ status?: WorkflowExecutionStatus;
2779
+ error?: string;
2780
+ }) => void;
2781
+ /**
2782
+ * Workflow Orchestrator
2783
+ *
2784
+ * Manages the execution of workflows with parallel/sequential waves.
2785
+ */
2786
+ declare class WorkflowOrchestrator {
2787
+ private execution;
2788
+ private executor;
2789
+ private onProgress?;
2790
+ constructor(executor: SkillExecutor, onProgress?: WorkflowProgressCallback);
2791
+ /**
2792
+ * Get current execution state
2793
+ */
2794
+ getExecution(): WorkflowExecution | null;
2795
+ /**
2796
+ * Execute a workflow
2797
+ */
2798
+ execute(workflow: Workflow): Promise<WorkflowExecution>;
2799
+ /**
2800
+ * Execute a single wave
2801
+ */
2802
+ private executeWave;
2803
+ /**
2804
+ * Execute a single skill
2805
+ */
2806
+ private executeSkill;
2807
+ /**
2808
+ * Pause execution
2809
+ */
2810
+ pause(): boolean;
2811
+ /**
2812
+ * Check if execution should continue
2813
+ */
2814
+ private shouldContinue;
2815
+ /**
2816
+ * Resume execution
2817
+ */
2818
+ resume(): Promise<WorkflowExecution | null>;
2819
+ /**
2820
+ * Cancel execution
2821
+ */
2822
+ cancel(): boolean;
2823
+ }
2824
+ /**
2825
+ * Create a new workflow orchestrator
2826
+ */
2827
+ declare function createWorkflowOrchestrator(executor: SkillExecutor, onProgress?: WorkflowProgressCallback): WorkflowOrchestrator;
2828
+
2829
+ /**
2830
+ * Executor Types
2831
+ *
2832
+ * Types for skill execution engine.
2833
+ */
2834
+
2835
+ /**
2836
+ * Task type within a skill
2837
+ */
2838
+ type ExecutableTaskType = 'auto' | 'checkpoint:human-verify' | 'checkpoint:decision' | 'checkpoint:human-action';
2839
+ /**
2840
+ * Task status
2841
+ */
2842
+ type ExecutionTaskStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
2843
+ /**
2844
+ * Verification rule for a task
2845
+ */
2846
+ interface VerificationRule {
2847
+ /** Command to run for verification */
2848
+ command?: string;
2849
+ /** Expected result (success, contains:<text>, matches:<regex>) */
2850
+ expect?: string;
2851
+ /** Human verification prompt */
2852
+ description?: string;
2853
+ /** URL to show for verification */
2854
+ url?: string;
2855
+ }
2856
+ /**
2857
+ * An executable task within a skill
2858
+ */
2859
+ interface ExecutableTask {
2860
+ /** Task identifier */
2861
+ id: string;
2862
+ /** Task name/description */
2863
+ name: string;
2864
+ /** Task type */
2865
+ type: ExecutableTaskType;
2866
+ /** Action description for AI agent */
2867
+ action: string;
2868
+ /** Files expected to be modified */
2869
+ files?: string[];
2870
+ /** Verification rules */
2871
+ verify?: {
2872
+ automated?: VerificationRule[];
2873
+ human?: VerificationRule[];
2874
+ };
2875
+ /** Options for checkpoint:decision type */
2876
+ options?: string[];
2877
+ /** Dependencies (task IDs that must complete first) */
2878
+ dependsOn?: string[];
2879
+ }
2880
+ /**
2881
+ * Extended skill with execution metadata
2882
+ */
2883
+ interface ExecutableSkill {
2884
+ /** Skill name */
2885
+ name: string;
2886
+ /** Skill description */
2887
+ description?: string;
2888
+ /** Skill version */
2889
+ version?: string;
2890
+ /** Skill source (repo or path) */
2891
+ source: string;
2892
+ /** Skill content (instructions) */
2893
+ content: string;
2894
+ /** Executable tasks */
2895
+ tasks?: ExecutableTask[];
2896
+ /** Environment requirements */
2897
+ requirements?: {
2898
+ frameworks?: string[];
2899
+ languages?: string[];
2900
+ libraries?: string[];
2901
+ };
2902
+ }
2903
+ /**
2904
+ * Task execution result
2905
+ */
2906
+ interface TaskExecutionResult {
2907
+ /** Task ID */
2908
+ taskId: string;
2909
+ /** Task name */
2910
+ taskName: string;
2911
+ /** Final status */
2912
+ status: ExecutionTaskStatus;
2913
+ /** Start time */
2914
+ startedAt: string;
2915
+ /** End time (only present for completed/failed/skipped tasks) */
2916
+ completedAt?: string;
2917
+ /** Duration in milliseconds (only present for completed/failed/skipped tasks) */
2918
+ durationMs?: number;
2919
+ /** Output/result */
2920
+ output?: string;
2921
+ /** Error message if failed */
2922
+ error?: string;
2923
+ /** Files modified */
2924
+ filesModified?: string[];
2925
+ /** Git commit SHA if committed */
2926
+ commitSha?: string;
2927
+ /** Verification results */
2928
+ verificationResults?: {
2929
+ automated: {
2930
+ rule: string;
2931
+ passed: boolean;
2932
+ output?: string;
2933
+ }[];
2934
+ human: {
2935
+ description: string;
2936
+ passed: boolean;
2937
+ }[];
2938
+ };
2939
+ }
2940
+ /**
2941
+ * Skill execution result
2942
+ */
2943
+ interface SkillExecutionResult {
2944
+ /** Skill name */
2945
+ skillName: string;
2946
+ /** Skill source */
2947
+ skillSource: string;
2948
+ /** Overall status */
2949
+ status: 'completed' | 'failed' | 'cancelled' | 'paused';
2950
+ /** Start time */
2951
+ startedAt: string;
2952
+ /** End time */
2953
+ completedAt?: string;
2954
+ /** Total duration in milliseconds */
2955
+ durationMs?: number;
2956
+ /** Task results */
2957
+ tasks: TaskExecutionResult[];
2958
+ /** All files modified */
2959
+ filesModified: string[];
2960
+ /** All commits created */
2961
+ commits: string[];
2962
+ /** Error if failed */
2963
+ error?: string;
2964
+ }
2965
+ /**
2966
+ * Execution options
2967
+ */
2968
+ interface ExecutionOptions {
2969
+ /** Target agent to use */
2970
+ agent?: AgentType;
2971
+ /** Whether to create commits per task */
2972
+ autoCommit?: boolean;
2973
+ /** Whether to run verification checks */
2974
+ verify?: boolean;
2975
+ /** Dry run (show what would be done) */
2976
+ dryRun?: boolean;
2977
+ /** Continue on task failure */
2978
+ continueOnError?: boolean;
2979
+ /** Environment variables to set */
2980
+ env?: Record<string, string>;
2981
+ }
2982
+ /**
2983
+ * Checkpoint response from user
2984
+ */
2985
+ interface CheckpointResponse {
2986
+ /** Whether to continue */
2987
+ continue: boolean;
2988
+ /** Selected option (for decision checkpoints) */
2989
+ selectedOption?: string;
2990
+ /** User notes */
2991
+ notes?: string;
2992
+ }
2993
+ /**
2994
+ * Checkpoint handler function type
2995
+ */
2996
+ type CheckpointHandler = (task: ExecutableTask, context: {
2997
+ skillName: string;
2998
+ taskIndex: number;
2999
+ totalTasks: number;
3000
+ }) => Promise<CheckpointResponse>;
3001
+
3002
+ /**
3003
+ * Skill Execution Engine
3004
+ *
3005
+ * Executes skills with task-based orchestration, verification, and state management.
3006
+ */
3007
+
3008
+ /**
3009
+ * Progress event for execution
3010
+ */
3011
+ interface ExecutionProgressEvent {
3012
+ type: 'task_start' | 'task_complete' | 'checkpoint' | 'verification' | 'complete';
3013
+ taskId?: string;
3014
+ taskName?: string;
3015
+ taskIndex?: number;
3016
+ totalTasks?: number;
3017
+ status?: ExecutionTaskStatus | 'paused' | 'cancelled';
3018
+ message?: string;
3019
+ error?: string;
3020
+ }
3021
+ /**
3022
+ * Progress callback type
3023
+ */
3024
+ type ExecutionProgressCallback = (event: ExecutionProgressEvent) => void;
3025
+ /**
3026
+ * Skill Execution Engine
3027
+ */
3028
+ declare class SkillExecutionEngine {
3029
+ private projectPath;
3030
+ private sessionManager;
3031
+ private checkpointHandler?;
3032
+ private onProgress?;
3033
+ constructor(projectPath: string, options?: {
3034
+ checkpointHandler?: CheckpointHandler;
3035
+ onProgress?: ExecutionProgressCallback;
3036
+ });
3037
+ /**
3038
+ * Execute a skill
3039
+ */
3040
+ execute(skill: ExecutableSkill, options?: ExecutionOptions): Promise<SkillExecutionResult>;
3041
+ /**
3042
+ * Resume a paused execution
3043
+ */
3044
+ private resumeExecution;
3045
+ /**
3046
+ * Execute a single task
3047
+ */
3048
+ private executeTask;
3049
+ /**
3050
+ * Handle a checkpoint
3051
+ */
3052
+ private handleCheckpoint;
3053
+ /**
3054
+ * Check if a regex pattern is potentially dangerous (ReDoS-vulnerable)
3055
+ * Rejects patterns with nested quantifiers and other known problematic constructs
3056
+ */
3057
+ private isUnsafeRegexPattern;
3058
+ /**
3059
+ * Safely test a regex pattern with ReDoS prevention
3060
+ *
3061
+ * This method validates patterns before execution to prevent catastrophic backtracking.
3062
+ * Note: This cannot guarantee protection against all ReDoS patterns, but catches common ones.
3063
+ */
3064
+ private safeRegexTest;
3065
+ /**
3066
+ * Run verification for a task
3067
+ *
3068
+ * SECURITY NOTE: Verification commands are executed from skill configuration.
3069
+ * Only run skills from trusted sources. Commands run with the same privileges
3070
+ * as the skillkit process.
3071
+ */
3072
+ private runVerification;
3073
+ /**
3074
+ * Create a dry run result
3075
+ */
3076
+ private createDryRunResult;
3077
+ /**
3078
+ * Pause current execution
3079
+ */
3080
+ pause(): boolean;
3081
+ /**
3082
+ * Check if execution is paused
3083
+ */
3084
+ isPaused(): boolean;
3085
+ /**
3086
+ * Get session manager
3087
+ */
3088
+ getSessionManager(): SessionManager;
3089
+ }
3090
+ /**
3091
+ * Create a new skill execution engine
3092
+ */
3093
+ declare function createExecutionEngine(projectPath: string, options?: {
3094
+ checkpointHandler?: CheckpointHandler;
3095
+ onProgress?: ExecutionProgressCallback;
3096
+ }): SkillExecutionEngine;
3097
+
3098
+ /**
3099
+ * Agent Execution Module
3100
+ *
3101
+ * Handles real execution of skills through various AI agent CLIs.
3102
+ */
3103
+
3104
+ /**
3105
+ * Agent CLI configuration
3106
+ */
3107
+ interface AgentCLIConfig {
3108
+ /** Agent type */
3109
+ type: AgentType;
3110
+ /** CLI command name */
3111
+ command: string;
3112
+ /** Whether the agent supports CLI execution */
3113
+ supportsCLI: boolean;
3114
+ /** Arguments to pass the prompt/skill content */
3115
+ promptArgs?: string[];
3116
+ /** Arguments for non-interactive mode */
3117
+ nonInteractiveArgs?: string[];
3118
+ /** Environment variables needed */
3119
+ envVars?: Record<string, string>;
3120
+ /** How to check if agent is installed */
3121
+ checkCommand?: string;
3122
+ }
3123
+ /**
3124
+ * Execution result from an agent
3125
+ */
3126
+ interface AgentExecutionResult {
3127
+ success: boolean;
3128
+ output: string;
3129
+ error?: string;
3130
+ exitCode: number;
3131
+ duration: number;
3132
+ }
3133
+ /**
3134
+ * Agent CLI configurations
3135
+ */
3136
+ declare const AGENT_CLI_CONFIGS: AgentCLIConfig[];
3137
+ /**
3138
+ * Get CLI config for an agent
3139
+ */
3140
+ declare function getAgentCLIConfig(agentType: AgentType): AgentCLIConfig | undefined;
3141
+ /**
3142
+ * Check if an agent CLI is available
3143
+ */
3144
+ declare function isAgentCLIAvailable(agentType: AgentType): Promise<boolean>;
3145
+ /**
3146
+ * Get all available CLI agents
3147
+ */
3148
+ declare function getAvailableCLIAgents(): Promise<AgentType[]>;
3149
+ /**
3150
+ * Execute a skill using an agent CLI
3151
+ */
3152
+ declare function executeWithAgent(agentType: AgentType, prompt: string, options?: {
3153
+ cwd?: string;
3154
+ timeout?: number;
3155
+ env?: Record<string, string>;
3156
+ }): Promise<AgentExecutionResult>;
3157
+ /**
3158
+ * Format skill content as a prompt for an agent
3159
+ */
3160
+ declare function formatSkillAsPrompt(skillName: string, skillContent: string, taskDescription?: string): string;
3161
+ /**
3162
+ * Agent execution strategy
3163
+ */
3164
+ type ExecutionStrategy = 'cli' | 'ide' | 'api' | 'manual';
3165
+ /**
3166
+ * Get recommended execution strategy for an agent
3167
+ */
3168
+ declare function getExecutionStrategy(agentType: AgentType): ExecutionStrategy;
3169
+ /**
3170
+ * Get instructions for manual/IDE execution
3171
+ */
3172
+ declare function getManualExecutionInstructions(agentType: AgentType, skillPath: string): string;
3173
+
3174
+ /**
3175
+ * Skill Testing Framework Types
3176
+ *
3177
+ * Define test cases in skill frontmatter for automated verification.
3178
+ */
3179
+ /**
3180
+ * Test assertion types
3181
+ */
3182
+ type TestAssertionType = 'file_exists' | 'file_not_exists' | 'file_contains' | 'file_not_contains' | 'file_matches' | 'command_succeeds' | 'command_fails' | 'command_output_contains' | 'json_valid' | 'json_has_key' | 'yaml_valid' | 'type_check' | 'lint_passes' | 'test_passes' | 'env_var_set' | 'port_available' | 'url_responds' | 'custom';
3183
+ /**
3184
+ * Test assertion definition
3185
+ */
3186
+ interface TestAssertion {
3187
+ /** Assertion type */
3188
+ type: TestAssertionType;
3189
+ /** Target file, command, or URL */
3190
+ target?: string;
3191
+ /** Expected value or pattern */
3192
+ expected?: string | boolean | number;
3193
+ /** Custom command for 'custom' type */
3194
+ command?: string;
3195
+ /** Timeout in milliseconds */
3196
+ timeout?: number;
3197
+ /** Error message on failure */
3198
+ message?: string;
3199
+ }
3200
+ /**
3201
+ * Test case definition
3202
+ */
3203
+ interface SkillTestCase {
3204
+ /** Test name */
3205
+ name: string;
3206
+ /** Test description */
3207
+ description?: string;
3208
+ /** Assertions to run */
3209
+ assertions: TestAssertion[];
3210
+ /** Setup commands to run before test */
3211
+ setup?: string[];
3212
+ /** Cleanup commands to run after test */
3213
+ cleanup?: string[];
3214
+ /** Skip this test */
3215
+ skip?: boolean;
3216
+ /** Only run this test */
3217
+ only?: boolean;
3218
+ /** Tags for filtering */
3219
+ tags?: string[];
3220
+ }
3221
+ /**
3222
+ * Test suite for a skill
3223
+ */
3224
+ interface SkillTestSuite {
3225
+ /** Skill name */
3226
+ skillName: string;
3227
+ /** Test cases */
3228
+ tests: SkillTestCase[];
3229
+ /** Global setup commands */
3230
+ globalSetup?: string[];
3231
+ /** Global cleanup commands */
3232
+ globalCleanup?: string[];
3233
+ /** Default timeout for all tests */
3234
+ defaultTimeout?: number;
3235
+ }
3236
+ /**
3237
+ * Individual assertion result
3238
+ */
3239
+ interface AssertionResult {
3240
+ /** Assertion that was run */
3241
+ assertion: TestAssertion;
3242
+ /** Whether assertion passed */
3243
+ passed: boolean;
3244
+ /** Actual value found */
3245
+ actual?: string;
3246
+ /** Expected value */
3247
+ expected?: string;
3248
+ /** Error message if failed */
3249
+ error?: string;
3250
+ /** Duration in milliseconds */
3251
+ duration: number;
3252
+ }
3253
+ /**
3254
+ * Test case result
3255
+ */
3256
+ interface TestCaseResult {
3257
+ /** Test case that was run */
3258
+ testCase: SkillTestCase;
3259
+ /** Whether all assertions passed */
3260
+ passed: boolean;
3261
+ /** Individual assertion results */
3262
+ assertions: AssertionResult[];
3263
+ /** Setup error if any */
3264
+ setupError?: string;
3265
+ /** Cleanup error if any */
3266
+ cleanupError?: string;
3267
+ /** Total duration in milliseconds */
3268
+ duration: number;
3269
+ /** Whether test was skipped */
3270
+ skipped: boolean;
3271
+ }
3272
+ /**
3273
+ * Test suite result
3274
+ */
3275
+ interface TestSuiteResult {
3276
+ /** Skill name */
3277
+ skillName: string;
3278
+ /** Whether all tests passed */
3279
+ passed: boolean;
3280
+ /** Individual test results */
3281
+ tests: TestCaseResult[];
3282
+ /** Number of tests passed */
3283
+ passedCount: number;
3284
+ /** Number of tests failed */
3285
+ failedCount: number;
3286
+ /** Number of tests skipped */
3287
+ skippedCount: number;
3288
+ /** Total duration in milliseconds */
3289
+ duration: number;
3290
+ /** Global setup error if any */
3291
+ globalSetupError?: string;
3292
+ /** Global cleanup error if any */
3293
+ globalCleanupError?: string;
3294
+ }
3295
+ /**
3296
+ * Test runner options
3297
+ */
3298
+ interface TestRunnerOptions {
3299
+ /** Working directory */
3300
+ cwd?: string;
3301
+ /** Default timeout in milliseconds */
3302
+ timeout?: number;
3303
+ /** Only run tests with these tags */
3304
+ tags?: string[];
3305
+ /** Skip tests with these tags */
3306
+ skipTags?: string[];
3307
+ /** Verbose output */
3308
+ verbose?: boolean;
3309
+ /** Stop on first failure */
3310
+ bail?: boolean;
3311
+ /** Run tests in parallel */
3312
+ parallel?: boolean;
3313
+ /** Progress callback */
3314
+ onProgress?: (event: TestProgressEvent) => void;
3315
+ }
3316
+ /**
3317
+ * Test progress event
3318
+ */
3319
+ interface TestProgressEvent {
3320
+ type: 'suite_start' | 'suite_end' | 'test_start' | 'test_end' | 'assertion_start' | 'assertion_end';
3321
+ skillName?: string;
3322
+ testName?: string;
3323
+ assertionType?: TestAssertionType;
3324
+ passed?: boolean;
3325
+ error?: string;
3326
+ }
3327
+
3328
+ /**
3329
+ * Skill Test Runner
3330
+ *
3331
+ * Executes test suites and assertions for skill verification.
3332
+ */
3333
+
3334
+ /**
3335
+ * Run a test suite
3336
+ */
3337
+ declare function runTestSuite(suite: SkillTestSuite, options?: TestRunnerOptions): Promise<TestSuiteResult>;
3338
+ /**
3339
+ * Create a test suite from skill frontmatter
3340
+ */
3341
+ declare function createTestSuiteFromFrontmatter(skillName: string, frontmatter: Record<string, unknown>): SkillTestSuite | null;
3342
+
3343
+ /**
3344
+ * Skill Marketplace Types
3345
+ *
3346
+ * Types for the aggregated skill marketplace.
3347
+ */
3348
+ /**
3349
+ * Skill source repository
3350
+ */
3351
+ interface SkillSource {
3352
+ /** Repository owner */
3353
+ owner: string;
3354
+ /** Repository name */
3355
+ repo: string;
3356
+ /** Human-readable name */
3357
+ name: string;
3358
+ /** Description */
3359
+ description?: string;
3360
+ /** Whether this is an official source */
3361
+ official?: boolean;
3362
+ /** Branch to fetch from */
3363
+ branch?: string;
3364
+ /** Path to skills index file */
3365
+ indexPath?: string;
3366
+ }
3367
+ /**
3368
+ * Skill entry in the marketplace
3369
+ */
3370
+ interface MarketplaceSkill {
3371
+ /** Unique identifier (owner/repo/path) */
3372
+ id: string;
3373
+ /** Skill name */
3374
+ name: string;
3375
+ /** Description */
3376
+ description: string;
3377
+ /** Source repository */
3378
+ source: SkillSource;
3379
+ /** Path within the repository */
3380
+ path: string;
3381
+ /** Version if available */
3382
+ version?: string;
3383
+ /** Author */
3384
+ author?: string;
3385
+ /** Tags for categorization */
3386
+ tags: string[];
3387
+ /** Supported agents */
3388
+ agents?: string[];
3389
+ /** GitHub stars (if available) */
3390
+ stars?: number;
3391
+ /** Last updated date */
3392
+ updatedAt?: string;
3393
+ /** Download/install count */
3394
+ downloads?: number;
3395
+ /** Raw content URL */
3396
+ rawUrl?: string;
3397
+ }
3398
+ /**
3399
+ * Marketplace index (cached locally)
3400
+ */
3401
+ interface MarketplaceIndex {
3402
+ /** Index version */
3403
+ version: number;
3404
+ /** When the index was last updated */
3405
+ updatedAt: string;
3406
+ /** Sources included in this index */
3407
+ sources: SkillSource[];
3408
+ /** All skills in the index */
3409
+ skills: MarketplaceSkill[];
3410
+ /** Total skill count */
3411
+ totalCount: number;
3412
+ }
3413
+ /**
3414
+ * Search options for the marketplace
3415
+ */
3416
+ interface MarketplaceSearchOptions {
3417
+ /** Search query */
3418
+ query?: string;
3419
+ /** Filter by tags */
3420
+ tags?: string[];
3421
+ /** Filter by source */
3422
+ source?: string;
3423
+ /** Filter by agent compatibility */
3424
+ agent?: string;
3425
+ /** Sort by field */
3426
+ sortBy?: 'name' | 'stars' | 'downloads' | 'updatedAt';
3427
+ /** Sort direction */
3428
+ sortOrder?: 'asc' | 'desc';
3429
+ /** Limit results */
3430
+ limit?: number;
3431
+ /** Offset for pagination */
3432
+ offset?: number;
3433
+ }
3434
+ /**
3435
+ * Search result
3436
+ */
3437
+ interface MarketplaceSearchResult {
3438
+ /** Matching skills */
3439
+ skills: MarketplaceSkill[];
3440
+ /** Total matches (before limit) */
3441
+ total: number;
3442
+ /** Query that was searched */
3443
+ query?: string;
3444
+ }
3445
+ /**
3446
+ * Marketplace configuration
3447
+ */
3448
+ interface MarketplaceConfig {
3449
+ /** Custom sources to include */
3450
+ sources?: SkillSource[];
3451
+ /** Cache directory */
3452
+ cacheDir?: string;
3453
+ /** Cache TTL in milliseconds */
3454
+ cacheTTL?: number;
3455
+ /** GitHub token for API access */
3456
+ githubToken?: string;
3457
+ }
3458
+ /**
3459
+ * Default skill sources
3460
+ */
3461
+ declare const DEFAULT_SKILL_SOURCES: SkillSource[];
3462
+ /**
3463
+ * Cache file name
3464
+ */
3465
+ declare const MARKETPLACE_CACHE_FILE = "marketplace-index.json";
3466
+ /**
3467
+ * Default cache TTL (1 hour)
3468
+ */
3469
+ declare const DEFAULT_CACHE_TTL: number;
3470
+
3471
+ /**
3472
+ * Marketplace Aggregator
3473
+ *
3474
+ * Fetches and indexes skills from multiple GitHub repositories.
3475
+ */
3476
+
3477
+ /**
3478
+ * Marketplace Aggregator
3479
+ */
3480
+ declare class MarketplaceAggregator {
3481
+ private config;
3482
+ private cacheDir;
3483
+ private cachePath;
3484
+ private index;
3485
+ constructor(config?: MarketplaceConfig);
3486
+ /**
3487
+ * Get all sources (default + custom)
3488
+ */
3489
+ getSources(): SkillSource[];
3490
+ /**
3491
+ * Load cached index
3492
+ */
3493
+ loadCache(): MarketplaceIndex | null;
3494
+ /**
3495
+ * Save index to cache
3496
+ */
3497
+ saveCache(index: MarketplaceIndex): void;
3498
+ /**
3499
+ * Fetch skills from a single source
3500
+ */
3501
+ fetchSource(source: SkillSource): Promise<MarketplaceSkill[]>;
3502
+ /**
3503
+ * Check if a path is an absolute URL
3504
+ */
3505
+ private isAbsoluteUrl;
3506
+ /**
3507
+ * Convert a GitHub URL to raw content URL
3508
+ */
3509
+ private toRawUrl;
3510
+ /**
3511
+ * Parse a skill entry from JSON
3512
+ */
3513
+ private parseSkillEntry;
3514
+ /**
3515
+ * Parse README for skill links
3516
+ */
3517
+ private parseReadmeForSkills;
3518
+ /**
3519
+ * Build raw URL for a skill
3520
+ */
3521
+ private buildRawUrl;
3522
+ /**
3523
+ * Infer tags from name and description
3524
+ */
3525
+ private inferTags;
3526
+ /**
3527
+ * Refresh the marketplace index
3528
+ */
3529
+ refresh(): Promise<MarketplaceIndex>;
3530
+ /**
3531
+ * Get the marketplace index (from cache or refresh)
3532
+ */
3533
+ getIndex(forceRefresh?: boolean): Promise<MarketplaceIndex>;
3534
+ /**
3535
+ * Search the marketplace
3536
+ */
3537
+ search(options?: MarketplaceSearchOptions): Promise<MarketplaceSearchResult>;
3538
+ /**
3539
+ * Get a skill by ID
3540
+ */
3541
+ getSkill(id: string): Promise<MarketplaceSkill | null>;
3542
+ /**
3543
+ * Get skill content
3544
+ */
3545
+ getSkillContent(skill: MarketplaceSkill): Promise<string | null>;
3546
+ /**
3547
+ * Get popular tags
3548
+ */
3549
+ getPopularTags(limit?: number): Promise<{
3550
+ tag: string;
3551
+ count: number;
3552
+ }[]>;
3553
+ /**
3554
+ * Add a custom source
3555
+ */
3556
+ addSource(source: SkillSource): void;
3557
+ /**
3558
+ * Remove a custom source
3559
+ */
3560
+ removeSource(owner: string, repo: string): void;
3561
+ /**
3562
+ * Clear cache
3563
+ */
3564
+ clearCache(): void;
3565
+ }
3566
+ /**
3567
+ * Create a marketplace aggregator
3568
+ */
3569
+ declare function createMarketplaceAggregator(config?: MarketplaceConfig): MarketplaceAggregator;
3570
+
3571
+ /**
3572
+ * CI/CD Templates
3573
+ *
3574
+ * Provides templates for GitHub Actions, pre-commit hooks, and other CI/CD integrations.
3575
+ */
3576
+ /**
3577
+ * GitHub Action workflow for skill validation
3578
+ */
3579
+ declare const GITHUB_ACTION_TEMPLATE = "# Skill Validation Workflow\n# This workflow validates skills in your repository\n\nname: Validate Skills\n\non:\n push:\n paths:\n - '.claude/skills/**'\n - '.cursor/skills/**'\n - 'skills/**'\n pull_request:\n paths:\n - '.claude/skills/**'\n - '.cursor/skills/**'\n - 'skills/**'\n\njobs:\n validate:\n runs-on: ubuntu-latest\n\n steps:\n - name: Checkout\n uses: actions/checkout@v4\n\n - name: Setup Node.js\n uses: actions/setup-node@v4\n with:\n node-version: '20'\n\n - name: Install SkillKit\n run: npm install -g skillkit\n\n - name: Validate Skills\n run: skillkit validate\n\n - name: Run Skill Tests\n run: skillkit test --json > test-results.json\n continue-on-error: true\n\n - name: Upload Test Results\n uses: actions/upload-artifact@v4\n with:\n name: skill-test-results\n path: test-results.json\n retention-days: 30\n\n - name: Check Test Results\n run: |\n if [ -f test-results.json ]; then\n passed=$(cat test-results.json | jq -r '.passed')\n if [ \"$passed\" = \"false\" ]; then\n echo \"Some skill tests failed\"\n exit 1\n fi\n fi\n";
3580
+ /**
3581
+ * Pre-commit hook script for skill validation
3582
+ */
3583
+ declare const PRE_COMMIT_HOOK_TEMPLATE = "#!/bin/bash\n# SkillKit Pre-commit Hook\n# Validates skills before commit\n\n# Colors for output\nRED='\\033[0;31m'\nGREEN='\\033[0;32m'\nYELLOW='\\033[0;33m'\nNC='\\033[0m' # No Color\n\necho -e \"${YELLOW}Running SkillKit validation...${NC}\"\n\n# Check if skillkit is installed\nif ! command -v skillkit &> /dev/null; then\n echo -e \"${RED}SkillKit not found. Install with: npm install -g skillkit${NC}\"\n exit 1\nfi\n\n# Get list of staged skill files\nSKILL_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\\.(md|mdc)$' | grep -E '(skills|.claude|.cursor)')\n\nif [ -z \"$SKILL_FILES\" ]; then\n echo -e \"${GREEN}No skill files staged, skipping validation.${NC}\"\n exit 0\nfi\n\necho \"Validating skill files:\"\necho \"$SKILL_FILES\"\n\n# Run validation\nif ! skillkit validate; then\n echo -e \"${RED}Skill validation failed. Please fix the errors and try again.${NC}\"\n exit 1\nfi\n\n# Run tests if any\nif skillkit test --json 2>/dev/null | jq -e '.passed == false' > /dev/null 2>&1; then\n echo -e \"${RED}Skill tests failed. Please fix the failing tests.${NC}\"\n exit 1\nfi\n\necho -e \"${GREEN}All skills validated successfully!${NC}\"\nexit 0\n";
3584
+ /**
3585
+ * Pre-commit config for .pre-commit-config.yaml
3586
+ */
3587
+ declare const PRE_COMMIT_CONFIG_TEMPLATE = "# SkillKit Pre-commit Configuration\n# Add this to your .pre-commit-config.yaml\n\nrepos:\n - repo: local\n hooks:\n - id: skillkit-validate\n name: SkillKit Validate\n entry: skillkit validate\n language: system\n files: \\.(md|mdc)$\n pass_filenames: false\n\n - id: skillkit-test\n name: SkillKit Test\n entry: skillkit test\n language: system\n files: \\.(md|mdc)$\n pass_filenames: false\n";
3588
+ /**
3589
+ * GitLab CI template
3590
+ */
3591
+ declare const GITLAB_CI_TEMPLATE = "# SkillKit GitLab CI Configuration\n# Add this to your .gitlab-ci.yml\n\nskill-validation:\n image: node:20\n stage: test\n before_script:\n - npm install -g skillkit\n script:\n - skillkit validate\n - skillkit test --json > test-results.json\n artifacts:\n # Note: test-results.json is JSON format, not JUnit XML\n paths:\n - test-results.json\n expire_in: 30 days\n rules:\n - changes:\n - \".claude/skills/**\"\n - \".cursor/skills/**\"\n - \"skills/**\"\n";
3592
+ /**
3593
+ * CircleCI config template
3594
+ */
3595
+ declare const CIRCLECI_CONFIG_TEMPLATE = "# SkillKit CircleCI Configuration\n# Add this to your .circleci/config.yml\n\nversion: 2.1\n\njobs:\n validate-skills:\n docker:\n - image: cimg/node:20.0\n steps:\n - checkout\n - run:\n name: Install SkillKit\n command: npm install -g skillkit\n - run:\n name: Validate Skills\n command: skillkit validate\n - run:\n name: Run Skill Tests\n command: skillkit test --json > test-results.json\n - store_artifacts:\n path: test-results.json\n destination: skill-tests\n\nworkflows:\n skill-validation:\n jobs:\n - validate-skills:\n filters:\n branches:\n only: /.*/\n";
3596
+ /**
3597
+ * Get a CI/CD template by name
3598
+ */
3599
+ declare function getCICDTemplate(name: string): string | null;
3600
+ /**
3601
+ * List available CI/CD templates
3602
+ */
3603
+ declare function listCICDTemplates(): {
3604
+ name: string;
3605
+ description: string;
3606
+ }[];
3607
+
3608
+ type ObservationType = 'tool_use' | 'decision' | 'error' | 'solution' | 'pattern' | 'file_change' | 'checkpoint';
3609
+ interface ObservationContent {
3610
+ action: string;
3611
+ context: string;
3612
+ result?: string;
3613
+ files?: string[];
3614
+ tags?: string[];
3615
+ error?: string;
3616
+ solution?: string;
3617
+ }
3618
+ interface Observation {
3619
+ id: string;
3620
+ timestamp: string;
3621
+ sessionId: string;
3622
+ agent: AgentType;
3623
+ type: ObservationType;
3624
+ content: ObservationContent;
3625
+ relevance: number;
3626
+ }
3627
+ interface Learning {
3628
+ id: string;
3629
+ createdAt: string;
3630
+ updatedAt: string;
3631
+ source: 'session' | 'manual' | 'imported';
3632
+ sourceObservations?: string[];
3633
+ title: string;
3634
+ content: string;
3635
+ scope: 'project' | 'global';
3636
+ project?: string;
3637
+ tags: string[];
3638
+ frameworks?: string[];
3639
+ patterns?: string[];
3640
+ useCount: number;
3641
+ lastUsed?: string;
3642
+ effectiveness?: number;
3643
+ }
3644
+ interface MemoryIndex {
3645
+ version: 1;
3646
+ lastUpdated: string;
3647
+ entries: Record<string, string[]>;
3648
+ tags: Record<string, string[]>;
3649
+ }
3650
+ interface MemorySummary {
3651
+ id: string;
3652
+ title: string;
3653
+ tags: string[];
3654
+ relevance: number;
3655
+ }
3656
+ interface MemoryPreview extends MemorySummary {
3657
+ excerpt: string;
3658
+ lastUsed?: string;
3659
+ }
3660
+ interface MemoryFull extends MemoryPreview {
3661
+ content: string;
3662
+ sourceObservations?: Observation[];
3663
+ }
3664
+ interface ObservationStoreData {
3665
+ version: 1;
3666
+ sessionId: string;
3667
+ observations: Observation[];
3668
+ }
3669
+ interface LearningStoreData {
3670
+ version: 1;
3671
+ learnings: Learning[];
3672
+ }
3673
+ interface MemoryConfig {
3674
+ autoCompress: boolean;
3675
+ compressionThreshold: number;
3676
+ compressionModel?: string;
3677
+ maxObservations: number;
3678
+ maxLearnings: number;
3679
+ }
3680
+ declare const DEFAULT_MEMORY_CONFIG: MemoryConfig;
3681
+ interface MemorySearchOptions {
3682
+ query?: string;
3683
+ tags?: string[];
3684
+ scope?: 'project' | 'global' | 'all';
3685
+ limit?: number;
3686
+ minRelevance?: number;
3687
+ }
3688
+ interface MemorySearchResult {
3689
+ learning: Learning;
3690
+ score: number;
3691
+ matchedKeywords: string[];
3692
+ matchedTags: string[];
3693
+ }
3694
+
3695
+ declare class ObservationStore {
3696
+ private readonly filePath;
3697
+ private data;
3698
+ private sessionId;
3699
+ constructor(projectPath: string, sessionId?: string);
3700
+ private ensureDir;
3701
+ private load;
3702
+ private createEmpty;
3703
+ private save;
3704
+ add(type: ObservationType, content: ObservationContent, agent: AgentType, relevance?: number): Observation;
3705
+ getAll(): Observation[];
3706
+ getByType(type: ObservationType): Observation[];
3707
+ getByRelevance(minRelevance: number): Observation[];
3708
+ getRecent(count: number): Observation[];
3709
+ getUncompressed(compressedIds: string[]): Observation[];
3710
+ count(): number;
3711
+ clear(): void;
3712
+ getById(id: string): Observation | undefined;
3713
+ getByIds(ids: string[]): Observation[];
3714
+ getSessionId(): string;
3715
+ setSessionId(sessionId: string): void;
3716
+ exists(): boolean;
3717
+ delete(id: string): boolean;
3718
+ deleteMany(ids: string[]): number;
3719
+ }
3720
+
3721
+ declare class LearningStore {
3722
+ private readonly filePath;
3723
+ private readonly scope;
3724
+ private readonly projectName?;
3725
+ private data;
3726
+ constructor(scope: 'project' | 'global', projectPath?: string, projectName?: string);
3727
+ private ensureDir;
3728
+ private load;
3729
+ private createEmpty;
3730
+ private save;
3731
+ add(learning: Omit<Learning, 'id' | 'createdAt' | 'updatedAt' | 'useCount' | 'scope' | 'project'>): Learning;
3732
+ update(id: string, updates: Partial<Omit<Learning, 'id' | 'createdAt'>>): Learning | null;
3733
+ delete(id: string): boolean;
3734
+ getAll(): Learning[];
3735
+ getById(id: string): Learning | undefined;
3736
+ getByTags(tags: string[]): Learning[];
3737
+ getByFrameworks(frameworks: string[]): Learning[];
3738
+ getRecent(count: number): Learning[];
3739
+ getMostUsed(count: number): Learning[];
3740
+ getMostEffective(count: number): Learning[];
3741
+ incrementUseCount(id: string): void;
3742
+ setEffectiveness(id: string, effectiveness: number): void;
3743
+ search(query: string): Learning[];
3744
+ count(): number;
3745
+ clear(): void;
3746
+ exists(): boolean;
3747
+ getScope(): 'project' | 'global';
3748
+ }
3749
+
3750
+ declare class MemoryIndexStore {
3751
+ private readonly filePath;
3752
+ private data;
3753
+ constructor(basePath: string, _isGlobal?: boolean);
3754
+ private ensureDir;
3755
+ private load;
3756
+ private createEmpty;
3757
+ private save;
3758
+ private extractKeywords;
3759
+ indexLearning(learning: Learning): void;
3760
+ removeLearning(learningId: string): void;
3761
+ searchByKeywords(query: string): string[];
3762
+ searchByTags(tags: string[]): string[];
3763
+ search(query: string, tags?: string[]): string[];
3764
+ getAllTags(): string[];
3765
+ getTagCounts(): Record<string, number>;
3766
+ rebuildIndex(learnings: Learning[]): void;
3767
+ clear(): void;
3768
+ exists(): boolean;
3769
+ getStats(): {
3770
+ keywords: number;
3771
+ tags: number;
3772
+ lastUpdated: string;
3773
+ };
3774
+ }
3775
+
3776
+ interface MemoryPaths {
3777
+ projectMemoryDir: string;
3778
+ globalMemoryDir: string;
3779
+ observationsFile: string;
3780
+ learningsFile: string;
3781
+ indexFile: string;
3782
+ globalLearningsFile: string;
3783
+ globalIndexFile: string;
3784
+ }
3785
+ declare function getMemoryPaths(projectPath: string): MemoryPaths;
3786
+ declare function initializeMemoryDirectory(projectPath: string): MemoryPaths;
3787
+ declare function memoryDirectoryExists(projectPath: string): boolean;
3788
+ declare function globalMemoryDirectoryExists(): boolean;
3789
+ interface MemoryStatus {
3790
+ projectMemoryExists: boolean;
3791
+ globalMemoryExists: boolean;
3792
+ hasObservations: boolean;
3793
+ hasLearnings: boolean;
3794
+ hasGlobalLearnings: boolean;
3795
+ hasIndex: boolean;
3796
+ hasGlobalIndex: boolean;
3797
+ }
3798
+ declare function getMemoryStatus(projectPath: string): MemoryStatus;
3799
+
3800
+ /**
3801
+ * Memory Observer
3802
+ *
3803
+ * Captures observations during skill execution and stores them in the ObservationStore.
3804
+ * Provides intelligent filtering to capture only significant events.
3805
+ */
3806
+
3807
+ /**
3808
+ * Event types that can be observed
3809
+ */
3810
+ type ObservableEventType = 'task_start' | 'task_complete' | 'task_failed' | 'checkpoint_reached' | 'checkpoint_decision' | 'verification_passed' | 'verification_failed' | 'file_modified' | 'error_encountered' | 'solution_applied' | 'execution_start' | 'execution_complete' | 'execution_paused';
3811
+ /**
3812
+ * Observable event structure
3813
+ */
3814
+ interface ObservableEvent {
3815
+ type: ObservableEventType;
3816
+ timestamp: string;
3817
+ skillName?: string;
3818
+ taskId?: string;
3819
+ taskName?: string;
3820
+ taskAction?: string;
3821
+ files?: string[];
3822
+ error?: string;
3823
+ output?: string;
3824
+ decision?: string;
3825
+ context?: string;
3826
+ }
3827
+ /**
3828
+ * Observer configuration
3829
+ */
3830
+ interface MemoryObserverConfig {
3831
+ /** Minimum relevance score to store (0-100) */
3832
+ minRelevance?: number;
3833
+ /** Whether to capture task starts */
3834
+ captureTaskStarts?: boolean;
3835
+ /** Whether to capture checkpoints */
3836
+ captureCheckpoints?: boolean;
3837
+ /** Whether to capture file modifications */
3838
+ captureFileModifications?: boolean;
3839
+ /** Whether to capture errors */
3840
+ captureErrors?: boolean;
3841
+ /** Whether to capture solutions */
3842
+ captureSolutions?: boolean;
3843
+ /** Custom relevance scorer */
3844
+ relevanceScorer?: (event: ObservableEvent) => number;
3845
+ }
3846
+ /**
3847
+ * Memory Observer
3848
+ *
3849
+ * Captures and filters observations during skill execution.
3850
+ */
3851
+ declare class MemoryObserver {
3852
+ private store;
3853
+ private config;
3854
+ private currentAgent;
3855
+ private currentSkillName?;
3856
+ private pendingErrors;
3857
+ constructor(projectPath: string, sessionId?: string, config?: MemoryObserverConfig);
3858
+ /**
3859
+ * Set the current agent being used
3860
+ */
3861
+ setAgent(agent: AgentType): void;
3862
+ /**
3863
+ * Set the current skill being executed
3864
+ */
3865
+ setSkillName(skillName: string): void;
3866
+ /**
3867
+ * Get the underlying observation store
3868
+ */
3869
+ getStore(): ObservationStore;
3870
+ /**
3871
+ * Observe an event and potentially store it
3872
+ */
3873
+ observe(event: ObservableEvent): Observation | null;
3874
+ /**
3875
+ * Create an observation callback for the SkillExecutionEngine
3876
+ */
3877
+ createProgressCallback(): (event: ExecutionProgressEvent) => void;
3878
+ /**
3879
+ * Convert ExecutionProgressEvent to ObservableEvent
3880
+ */
3881
+ private convertProgressEvent;
3882
+ /**
3883
+ * Record a file modification event
3884
+ */
3885
+ recordFileModification(files: string[], context: string): Observation | null;
3886
+ /**
3887
+ * Record an error event
3888
+ */
3889
+ recordError(error: string, context: string, taskId?: string): Observation | null;
3890
+ /**
3891
+ * Record a solution event (potentially matching a previous error)
3892
+ */
3893
+ recordSolution(solution: string, context: string, relatedError?: string): Observation | null;
3894
+ /**
3895
+ * Record a decision event
3896
+ */
3897
+ recordDecision(decision: string, options: string[], context: string): Observation | null;
3898
+ /**
3899
+ * Record execution start
3900
+ */
3901
+ recordExecutionStart(skillName: string, agent: AgentType): Observation | null;
3902
+ /**
3903
+ * Record execution pause
3904
+ */
3905
+ recordExecutionPause(reason?: string): Observation | null;
3906
+ /**
3907
+ * Check if we should capture this event type
3908
+ */
3909
+ private shouldCapture;
3910
+ /**
3911
+ * Classify event into observation type
3912
+ */
3913
+ private classifyEvent;
3914
+ /**
3915
+ * Extract content from event
3916
+ */
3917
+ private extractContent;
3918
+ /**
3919
+ * Get action description from event
3920
+ */
3921
+ private getActionDescription;
3922
+ /**
3923
+ * Generate context if not provided
3924
+ */
3925
+ private generateContext;
3926
+ /**
3927
+ * Generate tags for event
3928
+ */
3929
+ private generateTags;
3930
+ /**
3931
+ * Score relevance of event
3932
+ */
3933
+ private scoreRelevance;
3934
+ /**
3935
+ * Generate a key for matching errors to solutions
3936
+ */
3937
+ private generateErrorKey;
3938
+ /**
3939
+ * Get session ID
3940
+ */
3941
+ getSessionId(): string;
3942
+ /**
3943
+ * Get all observations
3944
+ */
3945
+ getObservations(): Observation[];
3946
+ /**
3947
+ * Get observation count
3948
+ */
3949
+ getObservationCount(): number;
3950
+ /**
3951
+ * Clear all observations
3952
+ */
3953
+ clear(): void;
3954
+ }
3955
+ /**
3956
+ * Create a MemoryObserver instance
3957
+ */
3958
+ declare function createMemoryObserver(projectPath: string, sessionId?: string, config?: MemoryObserverConfig): MemoryObserver;
3959
+
3960
+ /**
3961
+ * Memory-Enabled Execution Engine Integration
3962
+ *
3963
+ * Provides utilities to integrate MemoryObserver with SkillExecutionEngine.
3964
+ */
3965
+
3966
+ /**
3967
+ * Options for creating a memory-enabled execution engine
3968
+ */
3969
+ interface MemoryEnabledEngineOptions {
3970
+ /** Checkpoint handler for interactive checkpoints */
3971
+ checkpointHandler?: CheckpointHandler;
3972
+ /** Additional progress callback (called alongside memory observer) */
3973
+ onProgress?: ExecutionProgressCallback;
3974
+ /** Memory observer configuration */
3975
+ memoryConfig?: MemoryObserverConfig;
3976
+ /** Session ID for the memory observer */
3977
+ sessionId?: string;
3978
+ /** Default agent type */
3979
+ defaultAgent?: AgentType;
3980
+ }
3981
+ /**
3982
+ * Memory-enabled execution engine wrapper
3983
+ */
3984
+ declare class MemoryEnabledEngine {
3985
+ private engine;
3986
+ private observer;
3987
+ private userProgressCallback?;
3988
+ constructor(projectPath: string, options?: MemoryEnabledEngineOptions);
3989
+ /**
3990
+ * Execute a skill with memory observation
3991
+ */
3992
+ execute(skill: ExecutableSkill, options?: ExecutionOptions): ReturnType<SkillExecutionEngine['execute']>;
3993
+ /**
3994
+ * Record a manual error observation
3995
+ */
3996
+ recordError(error: string, context: string, taskId?: string): void;
3997
+ /**
3998
+ * Record a manual solution observation
3999
+ */
4000
+ recordSolution(solution: string, context: string, relatedError?: string): void;
4001
+ /**
4002
+ * Record a file modification observation
4003
+ */
4004
+ recordFileModification(files: string[], context: string): void;
4005
+ /**
4006
+ * Record a decision observation
4007
+ */
4008
+ recordDecision(decision: string, options: string[], context: string): void;
4009
+ /**
4010
+ * Pause execution
4011
+ */
4012
+ pause(): boolean;
4013
+ /**
4014
+ * Check if execution is paused
4015
+ */
4016
+ isPaused(): boolean;
4017
+ /**
4018
+ * Get the memory observer
4019
+ */
4020
+ getObserver(): MemoryObserver;
4021
+ /**
4022
+ * Get the underlying execution engine
4023
+ */
4024
+ getEngine(): SkillExecutionEngine;
4025
+ /**
4026
+ * Get the session manager
4027
+ */
4028
+ getSessionManager(): ReturnType<SkillExecutionEngine['getSessionManager']>;
4029
+ /**
4030
+ * Get observation count
4031
+ */
4032
+ getObservationCount(): number;
4033
+ /**
4034
+ * Get all observations
4035
+ */
4036
+ getObservations(): ReturnType<MemoryObserver['getObservations']>;
4037
+ /**
4038
+ * Clear observations
4039
+ */
4040
+ clearObservations(): void;
4041
+ }
4042
+ /**
4043
+ * Create a memory-enabled execution engine
4044
+ */
4045
+ declare function createMemoryEnabledEngine(projectPath: string, options?: MemoryEnabledEngineOptions): MemoryEnabledEngine;
4046
+ /**
4047
+ * Wrap an existing progress callback with memory observation
4048
+ */
4049
+ declare function wrapProgressCallbackWithMemory(projectPath: string, existingCallback?: ExecutionProgressCallback, memoryConfig?: MemoryObserverConfig, sessionId?: string): {
4050
+ callback: ExecutionProgressCallback;
4051
+ observer: MemoryObserver;
4052
+ };
4053
+
4054
+ /**
4055
+ * Memory Compression Engine
4056
+ *
4057
+ * Compresses raw observations into learnings using either rule-based
4058
+ * extraction or AI-powered compression.
4059
+ */
4060
+
4061
+ /**
4062
+ * Compression result for a single learning
4063
+ */
4064
+ interface CompressedLearning {
4065
+ title: string;
4066
+ content: string;
4067
+ tags: string[];
4068
+ frameworks?: string[];
4069
+ patterns?: string[];
4070
+ importance: number;
4071
+ sourceObservationIds: string[];
4072
+ }
4073
+ /**
4074
+ * Compression result
4075
+ */
4076
+ interface CompressionResult {
4077
+ learnings: CompressedLearning[];
4078
+ processedObservationIds: string[];
4079
+ skippedObservationIds: string[];
4080
+ stats: {
4081
+ inputCount: number;
4082
+ outputCount: number;
4083
+ compressionRatio: number;
4084
+ };
4085
+ }
4086
+ /**
4087
+ * Compression options
4088
+ */
4089
+ interface CompressionOptions {
4090
+ /** Minimum observations to trigger compression */
4091
+ minObservations?: number;
4092
+ /** Maximum learnings to generate per compression */
4093
+ maxLearnings?: number;
4094
+ /** Minimum importance score (1-10) to keep a learning */
4095
+ minImportance?: number;
4096
+ /** Whether to include low-relevance observations */
4097
+ includeLowRelevance?: boolean;
4098
+ /** Custom tags to add to all learnings */
4099
+ additionalTags?: string[];
4100
+ /** Project name for context */
4101
+ projectName?: string;
4102
+ }
4103
+ /**
4104
+ * Compression engine interface
4105
+ */
4106
+ interface CompressionEngine {
4107
+ /**
4108
+ * Compress observations into learnings
4109
+ */
4110
+ compress(observations: Observation[], options?: CompressionOptions): Promise<CompressionResult>;
4111
+ /**
4112
+ * Get the engine type
4113
+ */
4114
+ getType(): 'rule-based' | 'api';
4115
+ }
4116
+ /**
4117
+ * Rule-based compression engine
4118
+ *
4119
+ * Uses heuristics and patterns to extract learnings without AI.
4120
+ */
4121
+ declare class RuleBasedCompressor implements CompressionEngine {
4122
+ getType(): 'rule-based' | 'api';
4123
+ compress(observations: Observation[], options?: CompressionOptions): Promise<CompressionResult>;
4124
+ private groupByType;
4125
+ private extractErrorSolutionPairs;
4126
+ private extractDecisionPatterns;
4127
+ private extractFileChangePatterns;
4128
+ private extractToolUsagePatterns;
4129
+ private generateTitle;
4130
+ private formatErrorSolutionContent;
4131
+ private formatStandaloneErrorContent;
4132
+ private formatSolutionContent;
4133
+ private formatDecisionContent;
4134
+ private formatFileChangeContent;
4135
+ private formatToolUsageContent;
4136
+ private extractTags;
4137
+ private extractFrameworks;
4138
+ private getFilePattern;
4139
+ private getActionType;
4140
+ private hasSimilarKeywords;
4141
+ /**
4142
+ * Check for strong keyword overlap (multiple matching words)
4143
+ * More strict than hasSimilarKeywords - requires at least 2 matching words
4144
+ */
4145
+ private hasStrongKeywordOverlap;
4146
+ }
4147
+ /**
4148
+ * API-based compression engine configuration
4149
+ */
4150
+ interface APICompressionConfig {
4151
+ /** API provider */
4152
+ provider: 'anthropic' | 'openai';
4153
+ /** API key */
4154
+ apiKey: string;
4155
+ /** Model to use */
4156
+ model?: string;
4157
+ /** Maximum tokens for response */
4158
+ maxTokens?: number;
4159
+ }
4160
+ /**
4161
+ * API-based compression engine
4162
+ *
4163
+ * Uses Claude or OpenAI to extract learnings from observations.
4164
+ */
4165
+ declare class APIBasedCompressor implements CompressionEngine {
4166
+ private config;
4167
+ constructor(config: APICompressionConfig);
4168
+ getType(): 'rule-based' | 'api';
4169
+ compress(observations: Observation[], options?: CompressionOptions): Promise<CompressionResult>;
4170
+ private formatObservationsForPrompt;
4171
+ private buildCompressionPrompt;
4172
+ private callAPI;
4173
+ private callAnthropic;
4174
+ private callOpenAI;
4175
+ private parseAPIResponse;
4176
+ }
4177
+ /**
4178
+ * Memory compressor that manages compression and stores results
4179
+ */
4180
+ declare class MemoryCompressor {
4181
+ private engine;
4182
+ private learningStore;
4183
+ private indexStore;
4184
+ private projectName?;
4185
+ constructor(projectPath: string, options?: {
4186
+ engine?: CompressionEngine;
4187
+ scope?: 'project' | 'global';
4188
+ projectName?: string;
4189
+ });
4190
+ /**
4191
+ * Set the compression engine
4192
+ */
4193
+ setEngine(engine: CompressionEngine): void;
4194
+ /**
4195
+ * Compress observations without storing (for dry-run/preview)
4196
+ */
4197
+ compress(observations: Observation[], options?: CompressionOptions): Promise<CompressionResult>;
4198
+ /**
4199
+ * Compress observations and store as learnings
4200
+ */
4201
+ compressAndStore(observations: Observation[], options?: CompressionOptions): Promise<{
4202
+ learnings: Learning[];
4203
+ result: CompressionResult;
4204
+ }>;
4205
+ /**
4206
+ * Get the learning store
4207
+ */
4208
+ getLearningStore(): LearningStore;
4209
+ /**
4210
+ * Get the index store
4211
+ */
4212
+ getIndexStore(): MemoryIndexStore;
4213
+ /**
4214
+ * Get compression engine type
4215
+ */
4216
+ getEngineType(): 'rule-based' | 'api';
4217
+ }
4218
+ /**
4219
+ * Learning consolidator
4220
+ *
4221
+ * Merges similar learnings to reduce redundancy.
4222
+ */
4223
+ declare class LearningConsolidator {
4224
+ /**
4225
+ * Find similar learnings
4226
+ */
4227
+ findSimilar(learnings: Learning[], similarity?: number): Array<[Learning, Learning]>;
4228
+ /**
4229
+ * Merge two similar learnings
4230
+ */
4231
+ merge(learning1: Learning, learning2: Learning): Omit<Learning, 'id' | 'createdAt' | 'updatedAt'>;
4232
+ /**
4233
+ * Consolidate a list of learnings
4234
+ */
4235
+ consolidate(learnings: Learning[], store: LearningStore, index: MemoryIndexStore, similarity?: number): {
4236
+ merged: number;
4237
+ remaining: number;
4238
+ };
4239
+ private calculateSimilarity;
4240
+ private getBetterLearning;
4241
+ private mergeContent;
4242
+ }
4243
+ /**
4244
+ * Create a rule-based compressor
4245
+ */
4246
+ declare function createRuleBasedCompressor(): RuleBasedCompressor;
4247
+ /**
4248
+ * Create an API-based compressor
4249
+ */
4250
+ declare function createAPIBasedCompressor(config: APICompressionConfig): APIBasedCompressor;
4251
+ /**
4252
+ * Create a memory compressor
4253
+ */
4254
+ declare function createMemoryCompressor(projectPath: string, options?: {
4255
+ engine?: CompressionEngine;
4256
+ scope?: 'project' | 'global';
4257
+ projectName?: string;
4258
+ }): MemoryCompressor;
4259
+
4260
+ /**
4261
+ * Memory Injector
4262
+ *
4263
+ * Injects relevant memories into agent context with relevance matching,
4264
+ * agent-specific formatting, and token budgeting.
4265
+ */
4266
+
4267
+ /**
4268
+ * Injection options
4269
+ */
4270
+ interface InjectionOptions {
4271
+ /** Maximum tokens to use for injected memories */
4272
+ maxTokens?: number;
4273
+ /** Minimum relevance score to include (0-100) */
4274
+ minRelevance?: number;
4275
+ /** Maximum number of learnings to inject */
4276
+ maxLearnings?: number;
4277
+ /** Include global memories */
4278
+ includeGlobal?: boolean;
4279
+ /** Specific tags to match */
4280
+ tags?: string[];
4281
+ /** Current task description for relevance matching */
4282
+ currentTask?: string;
4283
+ /** Progressive disclosure level */
4284
+ disclosureLevel?: 'summary' | 'preview' | 'full';
4285
+ }
4286
+ /**
4287
+ * Injected memory with relevance score
4288
+ */
4289
+ interface InjectedMemory {
4290
+ learning: Learning;
4291
+ relevanceScore: number;
4292
+ matchedBy: {
4293
+ frameworks: string[];
4294
+ tags: string[];
4295
+ keywords: string[];
4296
+ patterns: string[];
4297
+ };
4298
+ tokenEstimate: number;
4299
+ }
4300
+ /**
4301
+ * Injection result
4302
+ */
4303
+ interface InjectionResult {
4304
+ memories: InjectedMemory[];
4305
+ formattedContent: string;
4306
+ totalTokens: number;
4307
+ stats: {
4308
+ considered: number;
4309
+ matched: number;
4310
+ injected: number;
4311
+ truncated: number;
4312
+ };
4313
+ }
4314
+ /**
4315
+ * Memory Injector
4316
+ *
4317
+ * Retrieves and formats relevant memories for injection into agent context.
4318
+ */
4319
+ declare class MemoryInjector {
4320
+ private projectStore;
4321
+ private globalStore;
4322
+ private projectContext?;
4323
+ constructor(projectPath: string, projectName?: string, projectContext?: ProjectContext);
4324
+ /**
4325
+ * Set project context for better relevance matching
4326
+ */
4327
+ setProjectContext(context: ProjectContext): void;
4328
+ /**
4329
+ * Get relevant memories for injection
4330
+ */
4331
+ getRelevantMemories(options?: InjectionOptions): Promise<InjectedMemory[]>;
4332
+ /**
4333
+ * Score a learning for relevance to current context
4334
+ */
4335
+ private scoreLearning;
4336
+ /**
4337
+ * Extract framework names from project context
4338
+ */
4339
+ private extractFrameworkNames;
4340
+ /**
4341
+ * Extract keywords from text
4342
+ */
4343
+ private extractKeywords;
4344
+ /**
4345
+ * Calculate days since a date
4346
+ */
4347
+ private daysSince;
4348
+ /**
4349
+ * Estimate tokens for a learning
4350
+ */
4351
+ private estimateTokens;
4352
+ /**
4353
+ * Inject memories and return formatted content
4354
+ */
4355
+ inject(options?: InjectionOptions): Promise<InjectionResult>;
4356
+ /**
4357
+ * Inject memories formatted for a specific agent
4358
+ */
4359
+ injectForAgent(agent: AgentType, options?: InjectionOptions): Promise<InjectionResult>;
4360
+ /**
4361
+ * Format memories for display
4362
+ */
4363
+ private formatMemories;
4364
+ /**
4365
+ * Format memories for a specific agent
4366
+ */
4367
+ formatForAgent(memories: InjectedMemory[], agent: AgentType, level?: 'summary' | 'preview' | 'full'): string;
4368
+ /**
4369
+ * Format memories for Claude (XML tags)
4370
+ */
4371
+ private formatForClaude;
4372
+ /**
4373
+ * Format memories for Cursor (.mdc format)
4374
+ */
4375
+ private formatForCursor;
4376
+ /**
4377
+ * Format memories for Copilot/Codex (concise markdown)
4378
+ */
4379
+ private formatForCopilot;
4380
+ /**
4381
+ * Escape XML special characters
4382
+ */
4383
+ private escapeXml;
4384
+ /**
4385
+ * Get memory summaries (for progressive disclosure)
4386
+ */
4387
+ getSummaries(options?: InjectionOptions): MemorySummary[];
4388
+ /**
4389
+ * Get memory previews (for progressive disclosure)
4390
+ */
4391
+ getPreviews(ids: string[], options?: InjectionOptions): MemoryPreview[];
4392
+ /**
4393
+ * Get full memories (for progressive disclosure)
4394
+ */
4395
+ getFullMemories(ids: string[], options?: InjectionOptions): MemoryFull[];
4396
+ /**
4397
+ * Search memories by query
4398
+ */
4399
+ search(query: string, options?: InjectionOptions): InjectedMemory[];
4400
+ }
4401
+ /**
4402
+ * Create a MemoryInjector instance
4403
+ */
4404
+ declare function createMemoryInjector(projectPath: string, projectName?: string, projectContext?: ProjectContext): MemoryInjector;
4405
+
4406
+ export { AGENT_CLI_CONFIGS, AGENT_FORMAT_MAP, APIBasedCompressor, type APICompressionConfig, type AgentAdapterInfo, type AgentCLIConfig, AgentConfig, type AgentExecutionResult, AgentType, type AssertionResult, BitbucketProvider, CIRCLECI_CONFIG_TEMPLATE, CONTEXT_DIR, CONTEXT_FILE, type CanonicalSkill, type CheckpointHandler, type CheckpointResponse, type CloneOptions, type CloneResult, type CommandResult, type CompressedLearning, type CompressionEngine, type CompressionOptions, type CompressionResult, type ContextCategory, type ContextExportOptions, type ContextImportOptions, type ContextLoadOptions, ContextLoader, ContextManager, ContextSync, type ContextSyncOptions, CopilotTranslator, type CurrentExecution, CursorTranslator, DEFAULT_CACHE_TTL, DEFAULT_CONTEXT_CATEGORIES, DEFAULT_MEMORY_CONFIG, DEFAULT_SCORING_WEIGHTS, DEFAULT_SKILL_SOURCES, DependencyInfo, Detection, type DetectionSource, type DiscoveredSkill, type ExecutableSkill, type ExecutableTask, type ExecutableTaskType, type ExecutionHistory, type ExecutionOptions, type ExecutionProgressCallback, type ExecutionProgressEvent, type ExecutionStrategy, type ExecutionTaskStatus, type FormatCategory, type FormatTranslator, type FreshnessResult, GITHUB_ACTION_TEMPLATE, GITLAB_CI_TEMPLATE, GitHubProvider, GitLabProvider, GitProvider, type GitProviderAdapter, INDEX_CACHE_HOURS, INDEX_PATH, type IndexSource, type InjectedMemory, type InjectionOptions, type InjectionResult, type InstallOptions, KNOWN_SKILL_REPOS, type Learning, LearningConsolidator, LearningStore, type LearningStoreData, type LoadedContext, LocalProvider, MARKETPLACE_CACHE_FILE, MarketplaceAggregator, type MarketplaceConfig, type MarketplaceIndex, type MarketplaceSearchOptions, type MarketplaceSearchResult, type MarketplaceSkill, type MatchCategory, type MatchReason, MemoryCompressor, type MemoryConfig, MemoryEnabledEngine, type MemoryEnabledEngineOptions, type MemoryFull, type MemoryIndex, MemoryIndexStore, MemoryInjector, MemoryObserver, type MemoryObserverConfig, type MemoryPaths, type MemoryPreview, type MemorySearchOptions, type MemorySearchResult, type MemoryStatus, type MemorySummary, type ObservableEvent, type ObservableEventType, type Observation, type ObservationContent, ObservationStore, type ObservationStoreData, type ObservationType, PRE_COMMIT_CONFIG_TEMPLATE, PRE_COMMIT_HOOK_TEMPLATE, PROJECT_TYPE_HINTS, ProjectContext, ProjectDetector, ProjectPatterns, type ProjectProfile, ProjectStack, type RecommendOptions, RecommendationEngine, type RecommendationResult, type RegistrySkill, RuleBasedCompressor, SESSION_FILE, SKILL_DISCOVERY_PATHS, type ScoredSkill, type ScoringWeights, type SearchOptions, type SearchResult, type SessionDecision, SessionManager, type SessionState, type SessionTask, Skill, SkillExecutionEngine, type SkillExecutionResult, type SkillExecutor, SkillFrontmatter, type SkillIndex, SkillLocation, SkillMdTranslator, SkillMetadata, SkillPreferences, type SkillSource, SkillSummary, type SkillTestCase, type SkillTestSuite, SkillkitConfig, type SyncOptions, type SyncReport, type SyncResult, TAG_TO_TECH, type TaskExecutionResult, type TaskStatus, type TestAssertion, type TestAssertionType, type TestCaseResult, type TestProgressEvent, type TestRunnerOptions, type TestSuiteResult, TranslatableSkillFrontmatter, type TranslationOptions, type TranslationPath, type TranslationResult, TranslatorRegistry, type UpdateOptions, type VerificationRule, WORKFLOWS_DIR, WORKFLOW_EXTENSION, type WaveExecutionStatus, WindsurfTranslator, type Workflow, type WorkflowExecution, type WorkflowExecutionStatus, WorkflowOrchestrator, type WorkflowProgressCallback, type WorkflowSkill, type WorkflowWave, analyzeProject, buildSkillIndex, canTranslate, copilotTranslator, createAPIBasedCompressor, createContextLoader, createContextManager, createContextSync, createExecutionEngine, createMarketplaceAggregator, createMemoryCompressor, createMemoryEnabledEngine, createMemoryInjector, createMemoryObserver, createRecommendationEngine, createRuleBasedCompressor, createSessionManager, createTestSuiteFromFrontmatter, createWorkflowOrchestrator, createWorkflowTemplate, cursorTranslator, detectProvider, detectSkillFormat, discoverSkills, estimateTokens, executeWithAgent, extractField, extractFrontmatter, fetchSkillsFromRepo, findAllSkills, findSkill, formatSkillAsPrompt, getAgentCLIConfig, getAgentConfigPath, getAllProviders, getAvailableCLIAgents, getCICDTemplate, getExecutionStrategy, getGlobalConfigPath, getIndexStatus, getInstallDir, getManualExecutionInstructions, getMemoryPaths, getMemoryStatus, getProjectConfigPath, getProvider, getSearchDirs, getStackTags, getSupportedTranslationAgents, getTechTags, globalMemoryDirectoryExists, initContext, initProject, initializeMemoryDirectory, isAgentCLIAvailable, isGitUrl, isIndexStale, isLocalPath, isPathInside, listCICDTemplates, listWorkflows, loadConfig, loadContext, loadIndex, loadMetadata, loadSkillMetadata, loadWorkflow, loadWorkflowByName, memoryDirectoryExists, parseShorthand, parseSkill, parseSkillContent, parseSource, parseWorkflow, readSkillContent, runTestSuite, saveConfig, saveIndex, saveSkillMetadata, saveWorkflow, serializeWorkflow, setSkillEnabled, skillMdTranslator, syncToAgent, syncToAllAgents, translateSkill, translateSkillFile, translatorRegistry, validateSkill, validateWorkflow, windsurfTranslator, wrapProgressCallbackWithMemory };