skilld 0.0.1 → 0.1.1

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.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -88
  3. package/dist/_chunks/config.mjs +20 -0
  4. package/dist/_chunks/config.mjs.map +1 -0
  5. package/dist/_chunks/llm.mjs +877 -0
  6. package/dist/_chunks/llm.mjs.map +1 -0
  7. package/dist/_chunks/releases.mjs +986 -0
  8. package/dist/_chunks/releases.mjs.map +1 -0
  9. package/dist/_chunks/storage.mjs +198 -0
  10. package/dist/_chunks/storage.mjs.map +1 -0
  11. package/dist/_chunks/sync-parallel.mjs +540 -0
  12. package/dist/_chunks/sync-parallel.mjs.map +1 -0
  13. package/dist/_chunks/types.d.mts +87 -0
  14. package/dist/_chunks/types.d.mts.map +1 -0
  15. package/dist/_chunks/utils.d.mts +352 -0
  16. package/dist/_chunks/utils.d.mts.map +1 -0
  17. package/dist/_chunks/version.d.mts +147 -0
  18. package/dist/_chunks/version.d.mts.map +1 -0
  19. package/dist/agent/index.d.mts +205 -0
  20. package/dist/agent/index.d.mts.map +1 -0
  21. package/dist/agent/index.mjs +2 -0
  22. package/dist/cache/index.d.mts +2 -0
  23. package/dist/cache/index.mjs +3 -0
  24. package/dist/cli.mjs +2650 -449
  25. package/dist/cli.mjs.map +1 -1
  26. package/dist/index.d.mts +5 -14
  27. package/dist/index.mjs +7 -181
  28. package/dist/retriv/index.d.mts +12 -0
  29. package/dist/retriv/index.d.mts.map +1 -0
  30. package/dist/retriv/index.mjs +76 -0
  31. package/dist/retriv/index.mjs.map +1 -0
  32. package/dist/sources/index.d.mts +2 -0
  33. package/dist/sources/index.mjs +3 -0
  34. package/dist/types.d.mts +4 -37
  35. package/package.json +39 -13
  36. package/dist/agents.d.mts +0 -56
  37. package/dist/agents.d.mts.map +0 -1
  38. package/dist/agents.mjs +0 -148
  39. package/dist/agents.mjs.map +0 -1
  40. package/dist/index.d.mts.map +0 -1
  41. package/dist/index.mjs.map +0 -1
  42. package/dist/npm.d.mts +0 -48
  43. package/dist/npm.d.mts.map +0 -1
  44. package/dist/npm.mjs +0 -90
  45. package/dist/npm.mjs.map +0 -1
  46. package/dist/split-text.d.mts +0 -24
  47. package/dist/split-text.d.mts.map +0 -1
  48. package/dist/split-text.mjs +0 -87
  49. package/dist/split-text.mjs.map +0 -1
  50. package/dist/types.d.mts.map +0 -1
@@ -0,0 +1,205 @@
1
+ //#region src/agent/types.d.ts
2
+ /**
3
+ * Agent types and interfaces
4
+ */
5
+ type AgentType = 'claude-code' | 'cursor' | 'windsurf' | 'cline' | 'codex' | 'github-copilot' | 'gemini-cli' | 'goose' | 'amp' | 'opencode' | 'roo';
6
+ interface AgentConfig {
7
+ name: AgentType;
8
+ displayName: string;
9
+ /** Project-level skills directory (e.g., .claude/skills) */
10
+ skillsDir: string;
11
+ /** Global skills directory (e.g., ~/.claude/skills) */
12
+ globalSkillsDir: string | undefined;
13
+ /** Check if agent is installed on the system */
14
+ detectInstalled: () => boolean;
15
+ /** CLI command name (if agent has a CLI) */
16
+ cli?: string;
17
+ }
18
+ interface SkillMetadata {
19
+ name: string;
20
+ version?: string;
21
+ /** ISO date string when this version was released */
22
+ releasedAt?: string;
23
+ description?: string;
24
+ /** File patterns this skill applies to (e.g., ["*.vue", "*.ts"]) */
25
+ globs?: string[];
26
+ }
27
+ /**
28
+ * Mapping of packages to file patterns they process.
29
+ * Used to generate skill descriptions with file extension triggers.
30
+ */
31
+ declare const FILE_PATTERN_MAP: Record<string, string[]>;
32
+ //#endregion
33
+ //#region src/agent/detect.d.ts
34
+ /**
35
+ * Detect which agents are installed on the system
36
+ */
37
+ declare function detectInstalledAgents(): AgentType[];
38
+ /**
39
+ * Detect the target agent (where skills are installed) from env vars and cwd.
40
+ * This is NOT the generator LLM — it determines the skills directory.
41
+ */
42
+ declare function detectTargetAgent(): AgentType | null;
43
+ /**
44
+ * Get the version of an agent's CLI (if available)
45
+ */
46
+ declare function getAgentVersion(agentType: AgentType): string | null;
47
+ //#endregion
48
+ //#region src/agent/detect-imports.d.ts
49
+ /**
50
+ * Detect directly-used npm packages by scanning source files
51
+ * Uses mlly for proper ES module parsing + globby for gitignore support
52
+ */
53
+ interface PackageUsage {
54
+ name: string;
55
+ count: number;
56
+ source?: 'import' | 'preset';
57
+ }
58
+ interface DetectResult {
59
+ packages: PackageUsage[];
60
+ error?: string;
61
+ }
62
+ /**
63
+ * Scan source files to detect all directly-imported npm packages
64
+ * Async with gitignore support for proper spinner animation
65
+ */
66
+ declare function detectImportedPackages(cwd?: string): Promise<DetectResult>;
67
+ //#endregion
68
+ //#region src/agent/install.d.ts
69
+ /**
70
+ * Sanitize skill name for filesystem
71
+ */
72
+ declare function sanitizeName(name: string): string;
73
+ /**
74
+ * Install a skill directly to agent skill directories
75
+ * Writes to each agent's skill folder in the project (e.g., .claude/skills/package-name/)
76
+ */
77
+ declare function installSkillForAgents(skillName: string, skillContent: string, options?: {
78
+ global?: boolean;
79
+ cwd?: string;
80
+ agents?: AgentType[]; /** Additional files to write (filename -> content) */
81
+ files?: Record<string, string>;
82
+ }): {
83
+ installed: AgentType[];
84
+ paths: string[];
85
+ };
86
+ //#endregion
87
+ //#region src/agent/prompts/prompt.d.ts
88
+ /**
89
+ * Skill generation prompt - minimal, agent explores via tools
90
+ */
91
+ type SkillSection = 'best-practices' | 'api' | 'custom';
92
+ interface BuildSkillPromptOptions {
93
+ packageName: string;
94
+ /** Absolute path to skill directory with ./.skilld/ */
95
+ skillDir: string;
96
+ /** Package version (e.g., "3.5.13") */
97
+ version?: string;
98
+ /** Has GitHub data (issues + discussions) indexed */
99
+ hasGithub?: boolean;
100
+ /** Has release notes */
101
+ hasReleases?: boolean;
102
+ /** CHANGELOG filename if found in package (e.g. CHANGELOG.md, changelog.md) */
103
+ hasChangelog?: string | false;
104
+ /** Resolved absolute paths to .md doc files */
105
+ docFiles?: string[];
106
+ /** Doc source type */
107
+ docsType?: 'llms.txt' | 'readme' | 'docs';
108
+ /** Package ships its own docs */
109
+ hasShippedDocs?: boolean;
110
+ /** Which sections to generate (defaults to all) */
111
+ sections?: SkillSection[];
112
+ /** Custom instructions from the user (when 'custom' section selected) */
113
+ customPrompt?: string;
114
+ }
115
+ /**
116
+ * Build the skill generation prompt - agent uses tools to explore
117
+ */
118
+ declare function buildSkillPrompt(opts: BuildSkillPromptOptions): string;
119
+ //#endregion
120
+ //#region src/agent/prompts/skill.d.ts
121
+ /**
122
+ * SKILL.md file generation
123
+ */
124
+ interface SkillOptions {
125
+ name: string;
126
+ version?: string;
127
+ releasedAt?: string;
128
+ /** Production dependencies with version specifiers */
129
+ dependencies?: Record<string, string>;
130
+ /** npm dist-tags with version and release date */
131
+ distTags?: Record<string, {
132
+ version: string;
133
+ releasedAt?: string;
134
+ }>;
135
+ globs?: string[];
136
+ description?: string;
137
+ /** LLM-generated body — replaces default heading + description */
138
+ body?: string;
139
+ relatedSkills: string[];
140
+ hasGithub?: boolean;
141
+ hasReleases?: boolean;
142
+ hasChangelog?: string | false;
143
+ docsType?: 'llms.txt' | 'readme' | 'docs';
144
+ hasShippedDocs?: boolean;
145
+ /** Key files in package (entry points + docs) */
146
+ pkgFiles?: string[];
147
+ }
148
+ declare function generateSkillMd(opts: SkillOptions): string;
149
+ //#endregion
150
+ //#region src/agent/llm/index.d.ts
151
+ type OptimizeModel = 'opus' | 'sonnet' | 'haiku' | 'gemini-3-pro' | 'gemini-3-flash' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'codex';
152
+ interface ModelInfo {
153
+ id: OptimizeModel;
154
+ name: string;
155
+ hint: string;
156
+ recommended?: boolean;
157
+ agentId: string;
158
+ agentName: string;
159
+ }
160
+ interface StreamProgress {
161
+ chunk: string;
162
+ type: 'reasoning' | 'text';
163
+ text: string;
164
+ reasoning: string;
165
+ }
166
+ interface OptimizeDocsOptions {
167
+ packageName: string;
168
+ skillDir: string;
169
+ model?: OptimizeModel;
170
+ version?: string;
171
+ hasGithub?: boolean;
172
+ hasReleases?: boolean;
173
+ hasChangelog?: string | false;
174
+ docFiles?: string[];
175
+ onProgress?: (progress: StreamProgress) => void;
176
+ timeout?: number;
177
+ verbose?: boolean;
178
+ noCache?: boolean;
179
+ /** Which sections to generate */
180
+ sections?: SkillSection[];
181
+ /** Custom instructions from the user */
182
+ customPrompt?: string;
183
+ }
184
+ interface OptimizeResult {
185
+ optimized: string;
186
+ wasOptimized: boolean;
187
+ error?: string;
188
+ reasoning?: string;
189
+ finishReason?: string;
190
+ usage?: {
191
+ inputTokens: number;
192
+ outputTokens: number;
193
+ totalTokens: number;
194
+ };
195
+ cost?: number;
196
+ }
197
+ declare function getModelName(id: OptimizeModel): string;
198
+ declare function getAvailableModels(): Promise<ModelInfo[]>;
199
+ declare function optimizeDocs(opts: OptimizeDocsOptions): Promise<OptimizeResult>;
200
+ //#endregion
201
+ //#region src/agent/registry.d.ts
202
+ declare const agents: Record<AgentType, AgentConfig>;
203
+ //#endregion
204
+ export { type AgentConfig, type AgentType, FILE_PATTERN_MAP, type ModelInfo, type OptimizeDocsOptions, type OptimizeModel, type OptimizeResult, type SkillMetadata, type SkillOptions, type SkillSection, type StreamProgress, agents, buildSkillPrompt, detectImportedPackages, detectInstalledAgents, detectTargetAgent, generateSkillMd, getAgentVersion, getAvailableModels, getModelName, installSkillForAgents, optimizeDocs, sanitizeName };
205
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/agent/types.ts","../../src/agent/detect.ts","../../src/agent/detect-imports.ts","../../src/agent/install.ts","../../src/agent/prompts/prompt.ts","../../src/agent/prompts/skill.ts","../../src/agent/llm/index.ts","../../src/agent/registry.ts"],"mappings":";;AAIA;;KAAY,SAAA;AAAA,UAaK,WAAA;EACf,IAAA,EAAM,SAAA;EACN,WAAA;EAF0B;EAI1B,SAAA;EAHe;EAKf,eAAA;EALM;EAON,eAAA;EAJA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AAA;ELQA;EKNA,QAAA;AAAA;AAAA,iBAGc,eAAA,CAAgB,IAAA,EAAM,YAAA;;;KCP1B,aAAA;AAAA,UAWK,SAAA;EACf,EAAA,EAAI,aAAA;EACJ,IAAA;EACA,IAAA;EACA,WAAA;EACA,OAAA;EACA,SAAA;AAAA;AAAA,UAGe,cAAA;EACf,KAAA;EACA,IAAA;EACA,IAAA;EACA,SAAA;AAAA;AAAA,UAGe,mBAAA;EACf,WAAA;EACA,QAAA;EACA,KAAA,GAAQ,aAAA;EACR,OAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA;EACA,QAAA;EACA,UAAA,IAAc,QAAA,EAAU,cAAA;EACxB,OAAA;EACA,OAAA;EACA,OAAA;ELhDc;EKkDd,QAAA,GAAW,YAAA;;EAEX,YAAA;AAAA;AAAA,UAGe,cAAA;EACf,SAAA;EACA,YAAA;EACA,KAAA;EACA,SAAA;EACA,YAAA;EACA,KAAA;IAAU,WAAA;IAAqB,YAAA;IAAsB,WAAA;EAAA;EACrD,IAAA;AAAA;AAAA,iBA0Bc,YAAA,CAAa,EAAA,EAAI,aAAA;AAAA,iBAIX,kBAAA,CAAA,GAAsB,OAAA,CAAQ,SAAA;AAAA,iBAoO9B,YAAA,CAAa,IAAA,EAAM,mBAAA,GAAsB,OAAA,CAAQ,cAAA;;;cC/T1D,MAAA,EAAQ,MAAA,CAAO,SAAA,EAAW,WAAA"}
@@ -0,0 +1,2 @@
1
+ import { a as FILE_PATTERN_MAP, c as sanitizeName, d as detectTargetAgent, f as getAgentVersion, i as generateSkillMd, l as detectImportedPackages, n as getModelName, o as buildSkillPrompt, p as agents, r as optimizeDocs, s as installSkillForAgents, t as getAvailableModels, u as detectInstalledAgents } from "../_chunks/llm.mjs";
2
+ export { FILE_PATTERN_MAP, agents, buildSkillPrompt, detectImportedPackages, detectInstalledAgents, detectTargetAgent, generateSkillMd, getAgentVersion, getAvailableModels, getModelName, installSkillForAgents, optimizeDocs, sanitizeName };
@@ -0,0 +1,2 @@
1
+ import { C as CachedDoc, D as SEARCH_DB, E as REFERENCES_DIR, O as getPackageDbPath, S as CacheConfig, T as CACHE_DIR, _ as listCached, a as clearAllCache, b as resolvePkgDir, c as getPkgKeyFiles, d as isCached, f as linkGithub, g as linkShippedSkill, h as linkReleases, i as ShippedSkill, l as getShippedSkills, m as linkReferences, n as getCacheKey, o as clearCache, p as linkPkg, r as getVersionKey, s as ensureCacheDir, t as getCacheDir, u as hasShippedDocs, v as listReferenceFiles, w as CachedPackage, x as writeToCache, y as readCachedDocs } from "../_chunks/version.mjs";
2
+ export { CACHE_DIR, type CacheConfig, type CachedDoc, type CachedPackage, REFERENCES_DIR, SEARCH_DB, type ShippedSkill, clearAllCache, clearCache, ensureCacheDir, getCacheDir, getCacheKey, getPackageDbPath, getPkgKeyFiles, getShippedSkills, getVersionKey, hasShippedDocs, isCached, linkGithub, linkPkg, linkReferences, linkReleases, linkShippedSkill, listCached, listReferenceFiles, readCachedDocs, resolvePkgDir, writeToCache };
@@ -0,0 +1,3 @@
1
+ import { a as getCacheDir, i as getPackageDbPath, n as REFERENCES_DIR, o as getCacheKey, r as SEARCH_DB, s as getVersionKey, t as CACHE_DIR } from "../_chunks/config.mjs";
2
+ import { _ as writeToCache, a as getShippedSkills, c as linkGithub, d as linkReleases, f as linkShippedSkill, g as resolvePkgDir, h as readCachedDocs, i as getPkgKeyFiles, l as linkPkg, m as listReferenceFiles, n as clearCache, o as hasShippedDocs, p as listCached, r as ensureCacheDir, s as isCached, t as clearAllCache, u as linkReferences } from "../_chunks/storage.mjs";
3
+ export { CACHE_DIR, REFERENCES_DIR, SEARCH_DB, clearAllCache, clearCache, ensureCacheDir, getCacheDir, getCacheKey, getPackageDbPath, getPkgKeyFiles, getShippedSkills, getVersionKey, hasShippedDocs, isCached, linkGithub, linkPkg, linkReferences, linkReleases, linkShippedSkill, listCached, listReferenceFiles, readCachedDocs, resolvePkgDir, writeToCache };