skill-tree 0.1.4 → 0.1.6

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.mts CHANGED
@@ -14,18 +14,10 @@ interface Skill {
14
14
  version: string;
15
15
  /** Short description optimized for semantic matching (1-2 sentences) */
16
16
  description: string;
17
- /** What problem does this skill solve? */
18
- problem: string;
19
- /** When should this skill be triggered? */
20
- triggerConditions: TriggerCondition[];
21
- /** Step-by-step solution */
22
- solution: string;
23
- /** How to verify the skill worked */
24
- verification: string;
25
- /** Concrete examples of usage */
26
- examples: SkillExample[];
27
- /** Additional notes, caveats, edge cases */
28
- notes?: string;
17
+ /** Free-form markdown instructions (the SKILL.md body) */
18
+ instructions: string;
19
+ /** Related skill IDs */
20
+ related?: string[];
29
21
  author: string;
30
22
  tags: string[];
31
23
  createdAt: Date;
@@ -42,7 +34,7 @@ interface Skill {
42
34
  metrics: SkillMetrics;
43
35
  /** Upstream tracking for skills imported with 'link' mode */
44
36
  upstream?: SkillUpstream;
45
- source?: SkillSource;
37
+ source?: SkillSource$1;
46
38
  /** Taxonomy classification (from skill indexer) */
47
39
  taxonomy?: SkillTaxonomy;
48
40
  /** External source information (for imported skills) */
@@ -84,22 +76,6 @@ interface ExpandTriggerConfig {
84
76
  };
85
77
  }
86
78
  type SkillStatus = 'draft' | 'active' | 'deprecated' | 'experimental';
87
- interface TriggerCondition {
88
- /** Type of trigger */
89
- type: 'error' | 'pattern' | 'context' | 'keyword' | 'custom';
90
- /** The actual condition (regex, keyword, description) */
91
- value: string;
92
- /** Optional description of when this triggers */
93
- description?: string;
94
- }
95
- interface SkillExample {
96
- /** Description of the scenario */
97
- scenario: string;
98
- /** Input/before state */
99
- before: string;
100
- /** Output/after state */
101
- after: string;
102
- }
103
79
  interface SkillMetrics {
104
80
  /** Number of times this skill was used */
105
81
  usageCount: number;
@@ -114,7 +90,7 @@ interface SkillMetrics {
114
90
  /** Average confidence from matching */
115
91
  averageConfidence?: number;
116
92
  }
117
- interface SkillSource {
93
+ interface SkillSource$1 {
118
94
  /** Where the skill came from */
119
95
  type: 'extracted' | 'manual' | 'imported' | 'composed';
120
96
  /** Original source location (git URL, local path, etc.) */
@@ -257,83 +233,6 @@ interface SkillFork {
257
233
  /** When the fork happened */
258
234
  forkedAt: Date;
259
235
  }
260
- /**
261
- * Represents a parsed agent session/trajectory
262
- */
263
- interface Trajectory {
264
- /** Unique session identifier */
265
- sessionId: string;
266
- /** When the session started */
267
- startedAt: Date;
268
- /** When the session ended */
269
- endedAt?: Date;
270
- /** The messages/turns in this session */
271
- turns: Turn[];
272
- /** Overall session metadata */
273
- metadata: TrajectoryMetadata;
274
- /** Session outcome */
275
- outcome?: TrajectoryOutcome;
276
- }
277
- interface Turn {
278
- /** Turn index (0-based) */
279
- index: number;
280
- /** Role: user, assistant, system, tool */
281
- role: 'user' | 'assistant' | 'system' | 'tool';
282
- /** Content of the turn */
283
- content: string;
284
- /** Tool calls made in this turn */
285
- toolCalls?: ToolCall[];
286
- /** Tool results returned in this turn */
287
- toolResults?: ToolResult[];
288
- /** Timestamp of this turn */
289
- timestamp?: Date;
290
- /** Extension data from custom extractors */
291
- [key: string]: unknown;
292
- }
293
- interface ToolCall {
294
- /** Tool name */
295
- name: string;
296
- /** Tool input/arguments */
297
- input: Record<string, unknown>;
298
- /** Unique call ID */
299
- callId?: string;
300
- }
301
- interface ToolResult {
302
- /** Corresponding call ID */
303
- callId?: string;
304
- /** Tool name */
305
- name: string;
306
- /** Result content */
307
- output: string;
308
- /** Whether the tool succeeded */
309
- success: boolean;
310
- /** Error message if failed */
311
- error?: string;
312
- }
313
- interface TrajectoryMetadata {
314
- /** Agent type (claude-code, custom, etc.) */
315
- agentType: string;
316
- /** Model used */
317
- model?: string;
318
- /** Working directory */
319
- workingDirectory?: string;
320
- /** Project/repo name */
321
- projectName?: string;
322
- /** Custom metadata */
323
- custom?: Record<string, unknown>;
324
- }
325
- interface TrajectoryOutcome {
326
- /** Did the session succeed in its goal? */
327
- success: boolean;
328
- /** Summary of what was accomplished */
329
- summary?: string;
330
- /** Files modified */
331
- filesModified?: string[];
332
- /** Errors encountered */
333
- errors?: string[];
334
- /** User satisfaction signal if available */
335
- userSatisfaction?: 'positive' | 'negative' | 'neutral';
336
- }
337
236
  interface StorageAdapter {
338
237
  /** Initialize the storage */
339
238
  initialize(): Promise<void>;
@@ -402,6 +301,23 @@ type SkillTreeEvent = {
402
301
  skillId: string;
403
302
  };
404
303
  type SkillTreeEventHandler = (event: SkillTreeEvent) => void | Promise<void>;
304
+ /**
305
+ * Configuration for materializing skills to agent-discoverable locations
306
+ */
307
+ interface MaterializationConfig {
308
+ /** Enable automatic materialization on skill changes (default: false) */
309
+ enabled: boolean;
310
+ /** Materialization mode: 'symlink' creates symlinks, 'copy' copies directories (default: 'symlink') */
311
+ mode?: 'symlink' | 'copy';
312
+ /** Additional directories to symlink/copy skill dirs into (e.g. ['.claude/skills', '.agent/skills']) */
313
+ symlinkPaths?: string[];
314
+ /** Path to write AGENTS.md (e.g. './AGENTS.md'). If set, auto-regenerates on changes */
315
+ agentsMdPath?: string;
316
+ /** Format for AGENTS.md generation (default: 'xml') */
317
+ agentsMdFormat?: 'xml' | 'markdown' | 'json';
318
+ /** Debounce interval in ms for batch updates (default: 500) */
319
+ debounceMs?: number;
320
+ }
405
321
 
406
322
  /**
407
323
  * Semantic versioning utilities
@@ -487,10 +403,6 @@ type MergeStrategy = 'source' | 'target' | 'combine' | 'newest' | 'longest' | 'u
487
403
  interface MergeConfig {
488
404
  /** Default strategy for text fields */
489
405
  textStrategy?: MergeStrategy;
490
- /** Strategy for trigger conditions */
491
- triggerStrategy?: MergeStrategy;
492
- /** Strategy for examples */
493
- exampleStrategy?: MergeStrategy;
494
406
  /** Strategy for tags */
495
407
  tagStrategy?: MergeStrategy;
496
408
  /** Fields to include in merge (defaults to all) */
@@ -623,8 +535,6 @@ declare class SkillMerger {
623
535
  private getStrategyForField;
624
536
  private mergeField;
625
537
  private mergeArrays;
626
- private mergeTriggerConditions;
627
- private mergeExamples;
628
538
  private mergeStrings;
629
539
  private calculateSimilarity;
630
540
  private buildMergeSuggestion;
@@ -883,13 +793,17 @@ interface SkillSyncState {
883
793
  }
884
794
 
885
795
  /**
886
- * Types for the hooks and activation system
796
+ * Types for the hooks system
797
+ *
798
+ * Session lifecycle tracking belongs to sessionlog.
799
+ * Skill runtime hooks (matched/applied/feedback) belong to cognitive-core.
800
+ * skill-tree hooks cover storage and CRUD lifecycle only.
887
801
  */
888
802
 
889
803
  /**
890
804
  * Events that can trigger hooks
891
805
  */
892
- type HookEvent = 'storage:before-save' | 'storage:after-save' | 'storage:before-delete' | 'storage:after-delete' | 'session:start' | 'session:end' | 'session:message' | 'skill:activated' | 'skill:matched' | 'skill:applied' | 'skill:feedback' | 'skill:created' | 'skill:updated' | 'skill:deprecated' | 'skill:deleted';
806
+ type HookEvent = 'storage:before-save' | 'storage:after-save' | 'storage:before-delete' | 'storage:after-delete' | 'skill:created' | 'skill:updated' | 'skill:deprecated' | 'skill:deleted';
893
807
  /**
894
808
  * Priority levels for hook execution
895
809
  */
@@ -916,39 +830,6 @@ interface StorageHookContext extends BaseHookContext {
916
830
  /** Whether the operation was successful */
917
831
  success?: boolean;
918
832
  }
919
- /**
920
- * Context for session hooks
921
- */
922
- interface SessionHookContext extends BaseHookContext {
923
- event: 'session:start' | 'session:end' | 'session:message';
924
- sessionId: string;
925
- /** Available on session:end */
926
- trajectory?: Trajectory;
927
- /** Message content (on session:message) */
928
- message?: {
929
- role: 'user' | 'assistant';
930
- content: string;
931
- };
932
- }
933
- /**
934
- * Context for skill runtime hooks (activation/matching/usage)
935
- */
936
- interface SkillRuntimeHookContext extends BaseHookContext {
937
- event: 'skill:activated' | 'skill:matched' | 'skill:applied' | 'skill:feedback';
938
- skill: Skill;
939
- /** Match score (on skill:matched) */
940
- matchScore?: number;
941
- /** Application result (on skill:applied) */
942
- applicationResult?: {
943
- success: boolean;
944
- output?: string;
945
- };
946
- /** Feedback data (on skill:feedback) */
947
- feedback?: {
948
- type: 'positive' | 'negative' | 'neutral';
949
- comment?: string;
950
- };
951
- }
952
833
  /**
953
834
  * Context for skill CRUD hooks (create/update/deprecate/delete)
954
835
  */
@@ -960,15 +841,10 @@ interface SkillCrudHookContext extends BaseHookContext {
960
841
  /** Deprecation reason (on skill:deprecated) */
961
842
  deprecationReason?: string;
962
843
  }
963
- /**
964
- * Legacy alias for backward compatibility
965
- * @deprecated Use SkillRuntimeHookContext instead
966
- */
967
- type SkillHookContext = SkillRuntimeHookContext;
968
844
  /**
969
845
  * Union of all hook contexts
970
846
  */
971
- type HookContext = StorageHookContext | SessionHookContext | SkillRuntimeHookContext | SkillCrudHookContext;
847
+ type HookContext = StorageHookContext | SkillCrudHookContext;
972
848
  /**
973
849
  * Result from a hook handler
974
850
  */
@@ -1336,6 +1212,17 @@ interface LoadoutCompilerConfig {
1336
1212
  /** Minimum similarity threshold for semantic matching (default: 0.6) */
1337
1213
  semanticThreshold?: number;
1338
1214
  }
1215
+ /**
1216
+ * Configuration for CatalogRenderer (browsable skill catalog)
1217
+ */
1218
+ interface CatalogRendererConfig {
1219
+ /** Max categories to show at each level (default: 12) */
1220
+ maxCategoriesPerLevel: number;
1221
+ /** Max skills to list at leaf nodes (default: 8) */
1222
+ maxSkillsAtLeaf: number;
1223
+ /** Max summary length for leaf-level skill descriptions (default: 80) */
1224
+ maxSummaryLength: number;
1225
+ }
1339
1226
  /**
1340
1227
  * Eviction strategy when maxExpanded is reached
1341
1228
  */
@@ -1372,6 +1259,10 @@ interface GraphServerConfig {
1372
1259
  outputFormat?: 'xml' | 'markdown';
1373
1260
  /** Include token estimates in output (default: false) */
1374
1261
  includeTokenEstimates?: boolean;
1262
+ /** Enable catalog browsing for large libraries (default: true) */
1263
+ enableCatalog?: boolean;
1264
+ /** Catalog renderer config overrides */
1265
+ catalogConfig?: Partial<CatalogRendererConfig>;
1375
1266
  }
1376
1267
  /**
1377
1268
  * Events emitted by the serving layer
@@ -1394,6 +1285,12 @@ type ServingEvent = {
1394
1285
  } | {
1395
1286
  type: 'pending:denied';
1396
1287
  skillIds: string[];
1288
+ } | {
1289
+ type: 'catalog:browsed';
1290
+ path: string[];
1291
+ } | {
1292
+ type: 'catalog:added';
1293
+ skillId: string;
1397
1294
  };
1398
1295
  /**
1399
1296
  * Handler for serving events
@@ -1424,6 +1321,7 @@ declare class SkillGraphServer {
1424
1321
  private compiler;
1425
1322
  private projectDetector;
1426
1323
  private viewRenderer;
1324
+ private catalogRenderer;
1427
1325
  private state;
1428
1326
  private handlers;
1429
1327
  private lruOrder;
@@ -1532,9 +1430,25 @@ declare class SkillGraphServer {
1532
1430
  */
1533
1431
  agentListLoadout(): LoadoutView;
1534
1432
  /**
1535
- * Render current state as system prompt content
1433
+ * Agent browses the skill catalog at a given path.
1434
+ * Returns rendered category view (subcategories or skill summaries at leaf).
1435
+ * Pass no path for the top-level overview.
1536
1436
  */
1537
- renderSystemPrompt(): string;
1437
+ agentBrowseCatalog(path?: string[]): Promise<string>;
1438
+ /**
1439
+ * Agent adds a skill discovered via browsing directly to loadout and expands it.
1440
+ * Bridges browse → loadout: found it in catalog, now load it.
1441
+ */
1442
+ agentAddFromCatalog(skillId: string): Promise<{
1443
+ added: boolean;
1444
+ pending: boolean;
1445
+ expanded: boolean;
1446
+ }>;
1447
+ /**
1448
+ * Render current state as system prompt content.
1449
+ * Includes catalog overview when catalog is enabled.
1450
+ */
1451
+ renderSystemPrompt(): Promise<string>;
1538
1452
  /**
1539
1453
  * Estimate total tokens for current loadout
1540
1454
  */
@@ -2092,22 +2006,10 @@ declare class RemoteManager {
2092
2006
  * Parse YAML frontmatter (simple implementation)
2093
2007
  */
2094
2008
  private parseYamlFrontmatter;
2095
- /**
2096
- * Extract a section from markdown body
2097
- */
2098
- private extractSection;
2099
- /**
2100
- * Parse trigger conditions from metadata
2101
- */
2102
- private parseTriggerConditions;
2103
2009
  /**
2104
2010
  * Parse tags from metadata
2105
2011
  */
2106
2012
  private parseTags;
2107
- /**
2108
- * Parse examples from body
2109
- */
2110
- private parseExamples;
2111
2013
  /**
2112
2014
  * Serialize a skill to SKILL.md format
2113
2015
  */
@@ -2363,8 +2265,6 @@ declare class LineageTracker {
2363
2265
  * Get suggested next version based on changes
2364
2266
  */
2365
2267
  suggestNextVersion(skillId: string, changes: VersionChanges): Promise<string>;
2366
- private mergeTriggerConditions;
2367
- private mergeExamples;
2368
2268
  private mergeText;
2369
2269
  private diffSkills;
2370
2270
  }
@@ -2438,6 +2338,8 @@ interface SkillBankConfig {
2438
2338
  /** Pull remote changes on initialize() (default: false) */
2439
2339
  pullOnInit?: boolean;
2440
2340
  };
2341
+ /** Materialization configuration for agent-discoverable skill output */
2342
+ materialization?: MaterializationConfig;
2441
2343
  }
2442
2344
  /**
2443
2345
  * Main SkillBank class
@@ -2459,6 +2361,8 @@ declare class SkillBank {
2459
2361
  private syncManager?;
2460
2362
  /** Whether to pull on initialize */
2461
2363
  private syncPullOnInit;
2364
+ /** Materializer for agent-discoverable output */
2365
+ private materializer?;
2462
2366
  constructor(config?: SkillBankConfig);
2463
2367
  /**
2464
2368
  * Initialize the skill bank (required before use)
@@ -2872,12 +2776,6 @@ interface AgentsGeneratorConfig {
2872
2776
  includeIds?: boolean;
2873
2777
  /** Include version information (default: true) */
2874
2778
  includeVersions?: boolean;
2875
- /** Include trigger conditions (default: true) */
2876
- includeTriggers?: boolean;
2877
- /** Include examples (default: true) */
2878
- includeExamples?: boolean;
2879
- /** Maximum examples per skill (default: 3) */
2880
- maxExamples?: number;
2881
2779
  /** Group skills by tags (default: false) */
2882
2780
  groupByTags?: boolean;
2883
2781
  /** Custom header content */
@@ -2912,26 +2810,20 @@ interface ParsedAgentSkill {
2912
2810
  name: string;
2913
2811
  /** Skill description */
2914
2812
  description: string;
2915
- /** Problem this skill solves */
2813
+ /** Instructions content */
2814
+ instructions?: string;
2815
+ /** Problem this skill solves (legacy, used during parsing) */
2916
2816
  problem?: string;
2917
- /** Solution steps */
2817
+ /** Solution steps (legacy, used during parsing) */
2918
2818
  solution?: string;
2919
- /** Verification steps */
2819
+ /** Verification steps (legacy, used during parsing) */
2920
2820
  verification?: string;
2921
- /** Additional notes */
2821
+ /** Additional notes (legacy, used during parsing) */
2922
2822
  notes?: string;
2923
- /** Trigger conditions */
2924
- triggers?: string[];
2925
2823
  /** Tags extracted from content */
2926
2824
  tags?: string[];
2927
2825
  /** Version (if present) */
2928
2826
  version?: string;
2929
- /** Examples */
2930
- examples?: Array<{
2931
- scenario: string;
2932
- before?: string;
2933
- after?: string;
2934
- }>;
2935
2827
  /** Raw content block */
2936
2828
  rawContent: string;
2937
2829
  }
@@ -3080,10 +2972,6 @@ declare class AgentsParser {
3080
2972
  * Generate ID from skill name
3081
2973
  */
3082
2974
  private generateId;
3083
- /**
3084
- * Infer trigger type from content
3085
- */
3086
- private inferTriggerType;
3087
2975
  /**
3088
2976
  * Extract header content
3089
2977
  */
@@ -3173,6 +3061,9 @@ declare function importFromAgentsMd(filePath: string, storage: StorageAdapter, o
3173
3061
 
3174
3062
  /**
3175
3063
  * Built-in hooks for common use cases
3064
+ *
3065
+ * Runtime metrics hooks (matched/applied/feedback) have moved to cognitive-core
3066
+ * which handles skill usage tracking via sessionlog integration.
3176
3067
  */
3177
3068
 
3178
3069
  /**
@@ -3191,10 +3082,6 @@ declare function createSaveValidationHook(options: {
3191
3082
  maxDescriptionLength?: number;
3192
3083
  requireTriggers?: boolean;
3193
3084
  }): RegisterHookOptions;
3194
- /**
3195
- * Creates a hook that tracks skill usage metrics
3196
- */
3197
- declare function createMetricsHook(updateMetrics: (skillId: string, event: 'matched' | 'applied' | 'feedback', data?: unknown) => Promise<void>): RegisterHookOptions;
3198
3085
  /**
3199
3086
  * Combines multiple hook handlers into one
3200
3087
  */
@@ -3292,8 +3179,6 @@ interface ViewRendererConfig {
3292
3179
  includeTokenEstimates?: boolean;
3293
3180
  /** Maximum summary length (characters) */
3294
3181
  maxSummaryLength?: number;
3295
- /** Include examples in expanded content */
3296
- includeExamples?: boolean;
3297
3182
  }
3298
3183
  /**
3299
3184
  * Renders loadout state for agent consumption
@@ -3322,15 +3207,13 @@ declare class ViewRenderer {
3322
3207
  */
3323
3208
  toSummaries(state: LoadoutState): SkillSummary[];
3324
3209
  /**
3325
- * Get summary for a skill (short description)
3210
+ * Get summary for a skill (short description).
3211
+ * Delegates to shared getSkillSummary utility.
3326
3212
  */
3327
3213
  private getSummary;
3328
3214
  /**
3329
- * Render skill content for expanded view
3330
- */
3331
- private renderSkillContent;
3332
- /**
3333
- * Escape special XML characters
3215
+ * Escape special XML characters.
3216
+ * Delegates to shared escapeXml utility.
3334
3217
  */
3335
3218
  private escapeXml;
3336
3219
  /**
@@ -3405,6 +3288,63 @@ declare class ProjectDetector {
3405
3288
  private detectDirectoryPatterns;
3406
3289
  }
3407
3290
 
3291
+ /**
3292
+ * CatalogRenderer - Renders compressed, browsable skill catalog views
3293
+ *
3294
+ * Provides hierarchical discovery for large skill libraries by rendering
3295
+ * taxonomy trees or tag-based groupings at minimal token cost. Agents can
3296
+ * browse categories level by level instead of seeing a flat list.
3297
+ *
3298
+ * Two strategies:
3299
+ * 1. Taxonomy-based: Uses taxonomy_nodes from SQLite (preferred)
3300
+ * 2. Tag-based fallback: Groups skills by primary tag when no taxonomy exists
3301
+ *
3302
+ * @packageDocumentation
3303
+ */
3304
+
3305
+ /**
3306
+ * Renders compressed, browsable skill catalog views for agent consumption
3307
+ */
3308
+ declare class CatalogRenderer {
3309
+ private storage;
3310
+ private config;
3311
+ private overviewCache;
3312
+ private static readonly CACHE_TTL_MS;
3313
+ constructor(storage: StorageAdapter, config?: Partial<CatalogRendererConfig>);
3314
+ /**
3315
+ * Render level-0 catalog overview for system prompt injection.
3316
+ * Shows top-level categories with counts. ~200 tokens.
3317
+ * Returns empty string if no skills exist.
3318
+ * Results are cached for 60 seconds to avoid repeated storage queries.
3319
+ */
3320
+ renderOverview(): Promise<string>;
3321
+ /**
3322
+ * Render a specific category path for browse drill-down.
3323
+ * Shows subcategories at intermediate nodes, or skill summaries at leaf nodes.
3324
+ */
3325
+ renderCategory(path: string[]): Promise<string>;
3326
+ /**
3327
+ * Invalidate the overview cache (e.g., after skill changes).
3328
+ */
3329
+ invalidateCache(): void;
3330
+ /**
3331
+ * Render the overview XML shell with a list of categories.
3332
+ * Used by both taxonomy-based and tag-based paths.
3333
+ */
3334
+ private renderOverviewXml;
3335
+ private renderOverviewFromNodes;
3336
+ private renderCategoryFromTaxonomy;
3337
+ private renderOverviewFromTags;
3338
+ private renderCategoryFromTags;
3339
+ private renderLeafSkills;
3340
+ private groupByPrimaryTag;
3341
+ /**
3342
+ * Pre-compute counts for a list of nodes, avoiding redundant recursive walks.
3343
+ */
3344
+ private withCounts;
3345
+ private countNodeSkills;
3346
+ }
3347
+
3408
3348
  /**
3409
3349
  * Built-in Loadout Profiles
3410
3350
  *
@@ -3483,6 +3423,93 @@ declare function getBuiltInProfile(name: string): LoadoutCriteria | undefined;
3483
3423
  */
3484
3424
  declare function listBuiltInProfiles(): string[];
3485
3425
 
3426
+ /**
3427
+ * Materializer - Keeps agent-discoverable filesystem representations
3428
+ * in sync with the skill bank.
3429
+ *
3430
+ * Supports two modes:
3431
+ * - 'symlink': Creates symlinks from discovery paths into .skilltree/skills/
3432
+ * - 'copy': Copies skill directories to discovery paths
3433
+ *
3434
+ * Also auto-regenerates AGENTS.md on skill changes with marker-based sections.
3435
+ */
3436
+
3437
+ declare class Materializer {
3438
+ private storage;
3439
+ private basePath;
3440
+ private config;
3441
+ private debounceTimer;
3442
+ private pendingRegen;
3443
+ private regenerating;
3444
+ private watcher;
3445
+ private watchDebounceTimer;
3446
+ constructor(storage: StorageAdapter, basePath: string, config: MaterializationConfig);
3447
+ private get mode();
3448
+ private get skillsSourceDir();
3449
+ /**
3450
+ * Initial materialization: create all symlinks/copies + generate AGENTS.md
3451
+ */
3452
+ initialize(): Promise<void>;
3453
+ /**
3454
+ * Called when a skill is created or updated
3455
+ */
3456
+ onSkillChanged(skillId: string): Promise<void>;
3457
+ /**
3458
+ * Called when a skill is deleted
3459
+ */
3460
+ onSkillDeleted(skillId: string): Promise<void>;
3461
+ /**
3462
+ * Materialize a skill to all configured paths (symlink or copy)
3463
+ */
3464
+ private ensureMaterialized;
3465
+ /**
3466
+ * Remove a materialized skill from all configured paths
3467
+ */
3468
+ private removeMaterialized;
3469
+ /**
3470
+ * Create or verify a symlink
3471
+ */
3472
+ private ensureSymlink;
3473
+ /**
3474
+ * Copy a skill directory, adding a marker file so we know we manage it
3475
+ */
3476
+ private copyDir;
3477
+ /**
3478
+ * Schedule debounced AGENTS.md regeneration
3479
+ */
3480
+ private scheduleAgentsMdRegen;
3481
+ /**
3482
+ * Regenerate AGENTS.md with marker-based section replacement
3483
+ */
3484
+ regenerateAgentsMd(): Promise<void>;
3485
+ private _doRegenerateAgentsMd;
3486
+ /**
3487
+ * Remove stale entries (symlinks or copies) that point to non-existent skills
3488
+ */
3489
+ cleanup(): Promise<void>;
3490
+ /**
3491
+ * Start watching .skilltree/skills/ for external changes.
3492
+ * Re-materializes when files are added/changed/removed outside the SkillBank API.
3493
+ */
3494
+ watch(): void;
3495
+ /**
3496
+ * Stop watching for file changes
3497
+ */
3498
+ unwatch(): void;
3499
+ /**
3500
+ * Flush any pending debounced operations (useful for testing)
3501
+ */
3502
+ flush(): Promise<void>;
3503
+ /**
3504
+ * Tear down: cancel pending timers and stop watcher
3505
+ */
3506
+ shutdown(): void;
3507
+ /**
3508
+ * Resolve a path relative to basePath, handling ~ expansion
3509
+ */
3510
+ private resolvePath;
3511
+ }
3512
+
3486
3513
  /**
3487
3514
  * Git Sync Adapter
3488
3515
  *
@@ -3547,7 +3574,6 @@ declare class GitSyncAdapter {
3547
3574
  private applyStrategy;
3548
3575
  private getConflictingFields;
3549
3576
  private parseSkillContent;
3550
- private extractSection;
3551
3577
  private writeSkill;
3552
3578
  private buildSkillContent;
3553
3579
  private buildCommitMessage;
@@ -3637,6 +3663,218 @@ declare function createDefaultSyncConfig(remoteUrl: string, agentId: string, opt
3637
3663
  environment?: string;
3638
3664
  }): SyncConfig;
3639
3665
 
3666
+ /**
3667
+ * Indexer Service - Wraps the skill indexer functionality for use with SkillBank
3668
+ *
3669
+ * This service provides a bridge between the skill indexer (scraper/) and the
3670
+ * main skill-tree SkillBank. It can work in two modes:
3671
+ *
3672
+ * 1. Standalone mode: Direct database operations (default)
3673
+ * 2. Integrated mode: Uses SkillBank as the storage backend
3674
+ */
3675
+
3676
+ /**
3677
+ * Skill source for scraping
3678
+ */
3679
+ interface SkillSource {
3680
+ type: "awesome-list" | "repository";
3681
+ url: string;
3682
+ }
3683
+ /**
3684
+ * Indexer configuration (service-level)
3685
+ */
3686
+ interface IndexerServiceConfig {
3687
+ /** GitHub API token */
3688
+ githubToken?: string;
3689
+ /** Anthropic API key for classification */
3690
+ anthropicApiKey?: string;
3691
+ /** Claude model to use */
3692
+ claudeModel?: string;
3693
+ /** Database path for standalone mode */
3694
+ databasePath?: string;
3695
+ /** Batch size for processing */
3696
+ batchSize?: number;
3697
+ /** Concurrency limit */
3698
+ concurrency?: number;
3699
+ /** Minimum confidence for classification */
3700
+ minConfidence?: number;
3701
+ /** Cache directory */
3702
+ cacheDir?: string;
3703
+ /** Cache TTL in seconds */
3704
+ cacheTtlSeconds?: number;
3705
+ /** Pre-loaded scraper module. When provided, skips filesystem-based module discovery entirely. */
3706
+ scraperModules?: any;
3707
+ }
3708
+ /**
3709
+ * Scrape result
3710
+ */
3711
+ interface ScrapeResult {
3712
+ discovered: number;
3713
+ scraped: number;
3714
+ skipped: number;
3715
+ failed: number;
3716
+ unchanged: number;
3717
+ errors: string[];
3718
+ }
3719
+ /**
3720
+ * Index result
3721
+ */
3722
+ interface IndexResult {
3723
+ indexed: number;
3724
+ skipped: number;
3725
+ failed: number;
3726
+ errors: string[];
3727
+ }
3728
+ /**
3729
+ * Relationship detection result
3730
+ */
3731
+ interface RelationshipResult {
3732
+ detected: number;
3733
+ skipped: number;
3734
+ errors: string[];
3735
+ }
3736
+ /**
3737
+ * Taxonomy node for tree display
3738
+ */
3739
+ interface TaxonomyNode {
3740
+ id: string;
3741
+ name: string;
3742
+ path: string[];
3743
+ skillCount: number;
3744
+ children: TaxonomyNode[];
3745
+ }
3746
+ /**
3747
+ * Database statistics
3748
+ */
3749
+ interface IndexerStats {
3750
+ totalSkills: number;
3751
+ indexedSkills: number;
3752
+ rawSkills: number;
3753
+ failedSkills: number;
3754
+ taxonomyNodes: number;
3755
+ relationships: number;
3756
+ sources: number;
3757
+ }
3758
+ /**
3759
+ * IndexerService - Manages skill discovery, classification, and relationship detection
3760
+ */
3761
+ declare class IndexerService {
3762
+ private serviceConfig;
3763
+ private globalConfig;
3764
+ private skillBank?;
3765
+ private initialized;
3766
+ private scraperModule?;
3767
+ private indexerModule?;
3768
+ private databaseModule?;
3769
+ private db?;
3770
+ constructor(config?: IndexerServiceConfig, skillBank?: SkillBank);
3771
+ /**
3772
+ * Get effective configuration
3773
+ */
3774
+ getConfig(): IndexerServiceConfig;
3775
+ /**
3776
+ * Initialize the service (lazy load scraper modules)
3777
+ */
3778
+ initialize(): Promise<void>;
3779
+ /**
3780
+ * Check if the indexer is available
3781
+ */
3782
+ isAvailable(): boolean;
3783
+ /**
3784
+ * Check if running in degraded mode (no scraper modules)
3785
+ */
3786
+ isDegradedMode(): boolean;
3787
+ /**
3788
+ * Scrape skills from GitHub sources
3789
+ */
3790
+ scrape(sources: SkillSource[], options?: {
3791
+ force?: boolean;
3792
+ }): Promise<ScrapeResult>;
3793
+ /**
3794
+ * Classify unindexed skills using AI
3795
+ */
3796
+ classify(options?: {
3797
+ skillId?: string;
3798
+ all?: boolean;
3799
+ }): Promise<IndexResult>;
3800
+ /**
3801
+ * Detect relationships between skills
3802
+ */
3803
+ detectRelationships(options?: {
3804
+ skillId?: string;
3805
+ useAi?: boolean;
3806
+ }): Promise<RelationshipResult>;
3807
+ /**
3808
+ * Detect relationships for a single skill
3809
+ */
3810
+ private detectSkillRelationships;
3811
+ /**
3812
+ * Get taxonomy tree
3813
+ */
3814
+ getTaxonomyTree(rootPath?: string[]): Promise<TaxonomyNode>;
3815
+ /**
3816
+ * Wrap tree nodes returned from SQLite storage into a root node
3817
+ */
3818
+ private wrapTreeNodes;
3819
+ /**
3820
+ * Convert storage tree node to TaxonomyNode format
3821
+ */
3822
+ private convertToTaxonomyNode;
3823
+ /**
3824
+ * Count total skills in a node tree
3825
+ */
3826
+ private countNodeSkills;
3827
+ /**
3828
+ * Build taxonomy tree from flat nodes
3829
+ */
3830
+ private buildTaxonomyTree;
3831
+ /**
3832
+ * Build taxonomy tree from skills
3833
+ */
3834
+ private buildTaxonomyTreeFromSkills;
3835
+ /**
3836
+ * Get indexer statistics
3837
+ */
3838
+ getStats(): Promise<IndexerStats>;
3839
+ /**
3840
+ * Count nodes in taxonomy tree
3841
+ */
3842
+ private countTaxonomyNodes;
3843
+ /**
3844
+ * Scrape and index skills directly into SkillBank
3845
+ * This is the streamlined workflow for integrated mode
3846
+ */
3847
+ scrapeAndIndex(sources: SkillSource[], options?: {
3848
+ force?: boolean;
3849
+ autoClassify?: boolean;
3850
+ detectRelationships?: boolean;
3851
+ }): Promise<{
3852
+ scraped: ScrapeResult;
3853
+ indexed: IndexResult;
3854
+ relationships: RelationshipResult;
3855
+ skillsAdded: string[];
3856
+ }>;
3857
+ /**
3858
+ * Import skills from indexer database into SkillBank
3859
+ */
3860
+ importFromIndexerDb(options?: {
3861
+ status?: "raw" | "indexed" | "failed";
3862
+ limit?: number;
3863
+ }): Promise<{
3864
+ imported: number;
3865
+ failed: number;
3866
+ skills: Skill[];
3867
+ }>;
3868
+ /**
3869
+ * Get default skill sources from config
3870
+ */
3871
+ getDefaultSources(): SkillSource[];
3872
+ /**
3873
+ * Close database connections
3874
+ */
3875
+ close(): Promise<void>;
3876
+ }
3877
+
3640
3878
  /**
3641
3879
  * skill-tree - A library for managing agent skill versions and evolution
3642
3880
  *
@@ -3650,4 +3888,4 @@ declare function createDefaultSyncConfig(remoteUrl: string, agentId: string, opt
3650
3888
  */
3651
3889
  declare const VERSION = "0.1.0";
3652
3890
 
3653
- export { type AgentConfig, AgentsGenerator, type AgentsGeneratorConfig, AgentsParser, AgentsSync, type BaseHookContext, type BumpType, CachedStorageAdapter, type CachedStorageConfig, type ConflictConfig, type ConflictResolution$1 as ConflictResolution, ConflictStore, type ConflictStrategy, DEFAULT_AGENTS_CONFIG, type DiscoveredSkill, type EvictionStrategy, type ExpandTrigger, type ExpandTriggerConfig, type FederatedRemoteConfig, type FederationEvent, type FederationEventHandler, FederationManager, type FederationManagerOptions, type FetchResult, type ForkOptions, GitSyncAdapter, type GitSyncAdapterOptions, type SyncResult$1 as GitSyncResult, type GraphServerConfig, type HookContext, type HookEvent, type HookExecutionResult, type HookHandler, type HookPriority, HookRegistry, type HookResult, type ImportMode, type ImportOptions, type ImportResult, LineageTracker, type LineageTree, LoadoutCompiler, type LoadoutCompilerConfig, type LoadoutCriteria, type LoadoutSource, type LoadoutState, type LoadoutView, MemoryStorageAdapter, type MergeConfig, type MergeConflict, type MergePreview, type MergeResult, type MergeStrategy, type MergeSuggestion, type MigrationOptions, type MigrationProgressItem, type MigrationResult, type NewVersionOptions, type ParsedAgentSkill, type ParsedAgentsFile, type ParsedVersion, type ProjectContext, ProjectDetector, type PullOptions, type PullUpstreamOptions, type PullUpstreamResult, type PushOptions, type RegisterHookOptions, type RegisteredHook, type RemoteConfig, RemoteManager, type RemoteState, RemoteStore, type RollbackOptions, type ServingEvent, type ServingEventHandler, type ShareOptions, type ShareResult, type Skill, type SkillAccessControl, SkillBank, type SkillBankConfig, type SkillBankStats, type SkillChange, type SkillConflict, type SkillDiffChanges, type SkillExample, type SkillFilter, type SkillFork, type SkillFormat, SkillGraphServer, type SkillHookContext, type SkillLineage, type SkillMergeResult, SkillMerger, type SkillMetrics, type SkillNamespace, type SkillScope, type SkillSelector, type SkillServingMetadata, type SkillSource, type SkillState, type SkillStatus, type SkillSummary, type SkillSyncState, type SkillTreeEvent, type SkillTreeEventHandler, type SkillUpstream, type SkillVersion, type SkillVisibility, type StorageAdapter, type StorageConfig, type StorageHookContext, type SyncBehaviorConfig, type SyncConfig, type ConflictResolution as SyncConflictResolution, type SyncError, SyncManager, type SyncManagerOptions, type SyncOptions, type SyncResult, type SyncState, type SyncStatus, type TriggerCondition, type UpstreamUpdate, VERSION, type VersionChanges, type VersionDiff, ViewRenderer, type ViewRendererConfig, builtInProfiles, bumpVersion, codeReviewProfile, combineHandlers, compareVersions, conditionalHook, createAgentsGenerator, createAgentsParser, createAgentsSync, createBackupHook, createConflictStore, createDefaultSyncConfig, createFederationManager, createGitSyncAdapter, createLoggingHook, createMetricsHook, createSaveValidationHook, createSkillBank, createSkillMerger, createSyncManager, debuggingProfile, devopsProfile, discoverSkills, documentationProfile, formatVersion, generateAgentsMd, getBuiltInProfile, getLatestVersion, hasSkilltreeDir, hookRegistry, implementationProfile, importFromAgentsMd, inferBumpType, isValidVersion, listBuiltInProfiles, migrateStorage, parseVersion, refactoringProfile, satisfiesRange, securityProfile, sortVersions, testingProfile, writeAgentsMd };
3891
+ export { type AgentConfig, AgentsGenerator, type AgentsGeneratorConfig, AgentsParser, AgentsSync, type BaseHookContext, type BumpType, CachedStorageAdapter, type CachedStorageConfig, CatalogRenderer, type CatalogRendererConfig, type ConflictConfig, type ConflictResolution$1 as ConflictResolution, ConflictStore, type ConflictStrategy, DEFAULT_AGENTS_CONFIG, type DiscoveredSkill, type EvictionStrategy, type ExpandTrigger, type ExpandTriggerConfig, type FederatedRemoteConfig, type FederationEvent, type FederationEventHandler, FederationManager, type FederationManagerOptions, type FetchResult, type ForkOptions, GitSyncAdapter, type GitSyncAdapterOptions, type SyncResult$1 as GitSyncResult, type GraphServerConfig, type HookContext, type HookEvent, type HookExecutionResult, type HookHandler, type HookPriority, HookRegistry, type HookResult, type ImportMode, type ImportOptions, type ImportResult, type IndexResult, IndexerService, type IndexerServiceConfig, type SkillSource as IndexerSkillSource, type IndexerStats, LineageTracker, type LineageTree, LoadoutCompiler, type LoadoutCompilerConfig, type LoadoutCriteria, type LoadoutSource, type LoadoutState, type LoadoutView, type MaterializationConfig, Materializer, MemoryStorageAdapter, type MergeConfig, type MergeConflict, type MergePreview, type MergeResult, type MergeStrategy, type MergeSuggestion, type MigrationOptions, type MigrationProgressItem, type MigrationResult, type NewVersionOptions, type ParsedAgentSkill, type ParsedAgentsFile, type ParsedVersion, type ProjectContext, ProjectDetector, type PullOptions, type PullUpstreamOptions, type PullUpstreamResult, type PushOptions, type RegisterHookOptions, type RegisteredHook, type RelationshipResult, type RemoteConfig, RemoteManager, type RemoteState, RemoteStore, type RollbackOptions, type ScrapeResult, type ServingEvent, type ServingEventHandler, type ShareOptions, type ShareResult, type Skill, type SkillAccessControl, SkillBank, type SkillBankConfig, type SkillBankStats, type SkillChange, type SkillConflict, type SkillCrudHookContext, type SkillDiffChanges, type SkillFilter, type SkillFork, type SkillFormat, SkillGraphServer, type SkillLineage, type SkillMergeResult, SkillMerger, type SkillMetrics, type SkillNamespace, type SkillScope, type SkillSelector, type SkillServingMetadata, type SkillSource$1 as SkillSource, type SkillState, type SkillStatus, type SkillSummary, type SkillSyncState, type SkillTreeEvent, type SkillTreeEventHandler, type SkillUpstream, type SkillVersion, type SkillVisibility, type StorageAdapter, type StorageConfig, type StorageHookContext, type SyncBehaviorConfig, type SyncConfig, type ConflictResolution as SyncConflictResolution, type SyncError, SyncManager, type SyncManagerOptions, type SyncOptions, type SyncResult, type SyncState, type SyncStatus, type TaxonomyNode, type UpstreamUpdate, VERSION, type VersionChanges, type VersionDiff, ViewRenderer, type ViewRendererConfig, builtInProfiles, bumpVersion, codeReviewProfile, combineHandlers, compareVersions, conditionalHook, createAgentsGenerator, createAgentsParser, createAgentsSync, createBackupHook, createConflictStore, createDefaultSyncConfig, createFederationManager, createGitSyncAdapter, createLoggingHook, createSaveValidationHook, createSkillBank, createSkillMerger, createSyncManager, debuggingProfile, devopsProfile, discoverSkills, documentationProfile, formatVersion, generateAgentsMd, getBuiltInProfile, getLatestVersion, hasSkilltreeDir, hookRegistry, implementationProfile, importFromAgentsMd, inferBumpType, isValidVersion, listBuiltInProfiles, migrateStorage, parseVersion, refactoringProfile, satisfiesRange, securityProfile, sortVersions, testingProfile, writeAgentsMd };