foliko 1.0.80 → 1.0.82

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 (154) hide show
  1. package/.agent/agents/code-assistant.json +14 -0
  2. package/.agent/agents/email-assistant.json +14 -0
  3. package/.agent/agents/file-assistant.json +15 -0
  4. package/.agent/agents/system-assistant.json +15 -0
  5. package/.agent/agents/web-assistant.json +12 -0
  6. package/.agent/data/ambient/goals.json +50 -0
  7. package/.agent/data/ambient/memories.json +7 -0
  8. package/.agent/data/default.json +15 -31894
  9. package/.agent/data/plugins-state.json +146 -181
  10. package/.agent/data/scheduler/tasks.json +1 -0
  11. package/.agent/mcp_config.json +1 -0
  12. package/.agent/package.json +8 -0
  13. package/.agent/plugins/__pycache__/test_plugin.cpython-312.pyc +0 -0
  14. package/.agent/plugins/system-info/index.js +387 -0
  15. package/.agent/plugins/system-info/package.json +4 -0
  16. package/.agent/plugins/system-info/test.js +40 -0
  17. package/.agent/plugins/test_plugin.py +304 -0
  18. package/.agent/plugins.json +14 -5
  19. package/.agent/python-scripts/test_sample.py +24 -0
  20. package/.agent/skills/sysinfo/SKILL.md +38 -0
  21. package/.agent/skills/sysinfo/system-info.sh +130 -0
  22. package/.agent/skills/workflow/SKILL.md +324 -0
  23. package/.agent/workflows/email-digest.json +50 -0
  24. package/.agent/workflows/file-backup.json +21 -0
  25. package/.agent/workflows/get-ip-notify.json +32 -0
  26. package/.agent/workflows/news-aggregator.json +93 -0
  27. package/.agent/workflows/news-dashboard-v2.json +94 -0
  28. package/.agent/workflows/notification-batch.json +32 -0
  29. package/.claude/settings.local.json +171 -171
  30. package/.env.example +56 -56
  31. package/cli/src/ui/chat-ui.js +8 -8
  32. package/package.json +1 -1
  33. package/plugins/feishu-plugin.js +6 -6
  34. package/plugins/file-system-plugin.js +54 -11
  35. package/plugins/telegram-plugin.js +6 -6
  36. package/plugins/weixin-plugin.js +6 -6
  37. package/skills/find-skills/AGENTS.md +162 -162
  38. package/skills/find-skills/SKILL.md +133 -133
  39. package/skills/foliko-dev/SKILL.md +563 -583
  40. package/skills/python-plugin-dev/SKILL.md +238 -238
  41. package/src/core/agent-chat.js +141 -134
  42. package/.agent/.shared/ui-ux-pro-max/data/charts.csv +0 -26
  43. package/.agent/.shared/ui-ux-pro-max/data/colors.csv +0 -97
  44. package/.agent/.shared/ui-ux-pro-max/data/icons.csv +0 -101
  45. package/.agent/.shared/ui-ux-pro-max/data/landing.csv +0 -31
  46. package/.agent/.shared/ui-ux-pro-max/data/products.csv +0 -97
  47. package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +0 -24
  48. package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +0 -45
  49. package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +0 -53
  50. package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +0 -56
  51. package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +0 -53
  52. package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +0 -53
  53. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +0 -51
  54. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +0 -59
  55. package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +0 -52
  56. package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +0 -54
  57. package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +0 -61
  58. package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +0 -54
  59. package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +0 -51
  60. package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +0 -50
  61. package/.agent/.shared/ui-ux-pro-max/data/styles.csv +0 -59
  62. package/.agent/.shared/ui-ux-pro-max/data/typography.csv +0 -58
  63. package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +0 -101
  64. package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +0 -100
  65. package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +0 -31
  66. package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
  67. package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
  68. package/.agent/.shared/ui-ux-pro-max/scripts/core.py +0 -258
  69. package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +0 -1067
  70. package/.agent/.shared/ui-ux-pro-max/scripts/search.py +0 -106
  71. package/.agent/ARCHITECTURE.md +0 -288
  72. package/.agent/agents/ambient-agent.md +0 -57
  73. package/.agent/agents/debugger.md +0 -55
  74. package/.agent/agents/email-assistant.md +0 -49
  75. package/.agent/agents/file-manager.md +0 -42
  76. package/.agent/agents/python-developer.md +0 -60
  77. package/.agent/agents/scheduler.md +0 -59
  78. package/.agent/agents/web-developer.md +0 -45
  79. package/.agent/mcp_config_updated.json +0 -12
  80. package/.agent/rules/GEMINI.md +0 -273
  81. package/.agent/rules/allow-rule.md +0 -77
  82. package/.agent/rules/log-rule.md +0 -83
  83. package/.agent/rules/security-rule.md +0 -93
  84. package/.agent/scripts/auto_preview.py +0 -148
  85. package/.agent/scripts/checklist.py +0 -217
  86. package/.agent/scripts/session_manager.py +0 -120
  87. package/.agent/scripts/verify_all.py +0 -327
  88. package/.agent/skills/api-patterns/SKILL.md +0 -81
  89. package/.agent/skills/api-patterns/api-style.md +0 -42
  90. package/.agent/skills/api-patterns/auth.md +0 -24
  91. package/.agent/skills/api-patterns/documentation.md +0 -26
  92. package/.agent/skills/api-patterns/graphql.md +0 -41
  93. package/.agent/skills/api-patterns/rate-limiting.md +0 -31
  94. package/.agent/skills/api-patterns/response.md +0 -37
  95. package/.agent/skills/api-patterns/rest.md +0 -40
  96. package/.agent/skills/api-patterns/scripts/api_validator.py +0 -211
  97. package/.agent/skills/api-patterns/security-testing.md +0 -122
  98. package/.agent/skills/api-patterns/trpc.md +0 -41
  99. package/.agent/skills/api-patterns/versioning.md +0 -22
  100. package/.agent/skills/app-builder/SKILL.md +0 -75
  101. package/.agent/skills/app-builder/agent-coordination.md +0 -71
  102. package/.agent/skills/app-builder/feature-building.md +0 -53
  103. package/.agent/skills/app-builder/project-detection.md +0 -34
  104. package/.agent/skills/app-builder/scaffolding.md +0 -118
  105. package/.agent/skills/app-builder/tech-stack.md +0 -40
  106. package/.agent/skills/app-builder/templates/SKILL.md +0 -39
  107. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +0 -76
  108. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +0 -92
  109. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +0 -88
  110. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +0 -88
  111. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +0 -83
  112. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +0 -90
  113. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +0 -90
  114. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +0 -122
  115. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +0 -122
  116. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +0 -169
  117. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +0 -134
  118. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +0 -83
  119. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +0 -119
  120. package/.agent/skills/architecture/SKILL.md +0 -55
  121. package/.agent/skills/architecture/context-discovery.md +0 -43
  122. package/.agent/skills/architecture/examples.md +0 -94
  123. package/.agent/skills/architecture/pattern-selection.md +0 -68
  124. package/.agent/skills/architecture/patterns-reference.md +0 -50
  125. package/.agent/skills/architecture/trade-off-analysis.md +0 -77
  126. package/.agent/skills/clean-code/SKILL.md +0 -201
  127. package/.agent/skills/doc.md +0 -177
  128. package/.agent/skills/frontend-design/SKILL.md +0 -418
  129. package/.agent/skills/frontend-design/animation-guide.md +0 -331
  130. package/.agent/skills/frontend-design/color-system.md +0 -311
  131. package/.agent/skills/frontend-design/decision-trees.md +0 -418
  132. package/.agent/skills/frontend-design/motion-graphics.md +0 -306
  133. package/.agent/skills/frontend-design/scripts/accessibility_checker.py +0 -183
  134. package/.agent/skills/frontend-design/scripts/ux_audit.py +0 -722
  135. package/.agent/skills/frontend-design/typography-system.md +0 -345
  136. package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
  137. package/.agent/skills/frontend-design/visual-effects.md +0 -383
  138. package/.agent/skills/i18n-localization/SKILL.md +0 -154
  139. package/.agent/skills/i18n-localization/scripts/i18n_checker.py +0 -241
  140. package/.agent/skills/mcp-builder/SKILL.md +0 -176
  141. package/.agent/skills/web-design-guidelines/SKILL.md +0 -57
  142. package/.agent/workflows/brainstorm.md +0 -113
  143. package/.agent/workflows/create.md +0 -59
  144. package/.agent/workflows/debug.md +0 -103
  145. package/.agent/workflows/deploy.md +0 -176
  146. package/.agent/workflows/enhance.md +0 -63
  147. package/.agent/workflows/orchestrate.md +0 -237
  148. package/.agent/workflows/plan.md +0 -89
  149. package/.agent/workflows/preview.md +0 -81
  150. package/.agent/workflows/simple-test.md +0 -42
  151. package/.agent/workflows/status.md +0 -86
  152. package/.agent/workflows/structured-orchestrate.md +0 -180
  153. package/.agent/workflows/test.md +0 -144
  154. package/.agent/workflows/ui-ux-pro-max.md +0 -296
@@ -5,6 +5,8 @@
5
5
 
6
6
  const { Plugin } = require('../src/core/plugin-base')
7
7
  const { NodeHtmlMarkdown } = require('node-html-markdown')
8
+ const { Readable } = require('stream')
9
+ const { pipeline } = require('stream/promises')
8
10
  class FileSystemPlugin extends Plugin {
9
11
  constructor(config = {}) {
10
12
  super()
@@ -152,18 +154,19 @@ class FileSystemPlugin extends Plugin {
152
154
  // 写入文件
153
155
  framework.registerTool({
154
156
  name: 'write_file',
155
- description: '创建或写入文件内容。content 是要写入的文本内容。',
157
+ description: `创建或写入文件内容。
158
+
159
+ 注意:
160
+ - 对于大文件(>100MB),建议分多次调用 append_to_file
161
+ - 支持覆盖写入和追加写入`,
156
162
  inputSchema: z.object({
157
- path: z.string().describe('文件路径(必须)'),
158
- content: z.string().describe('文件内容(必须)')
163
+ path: z.string().describe('文件路径'),
164
+ content: z.string().describe('文件内容'),
165
+ mode: z.enum(['write', 'append']).default('write').describe('写入模式:write=覆盖写入,append=追加内容')
159
166
  }),
160
167
  execute: async (args, framework) => {
161
- const { path: filePath, content } = args
162
- if (!filePath || !content) {
163
- return { success: false, error: 'path 和 content 都是必填参数' }
164
- }
165
-
166
- // 路径安全验证
168
+ const { path: filePath, content, mode = 'write' } = args
169
+
167
170
  const pathCheck = validatePath(filePath)
168
171
  if (!pathCheck.valid) {
169
172
  return { success: false, error: pathCheck.error }
@@ -174,8 +177,48 @@ class FileSystemPlugin extends Plugin {
174
177
  if (!fs.existsSync(dir)) {
175
178
  fs.mkdirSync(dir, { recursive: true })
176
179
  }
177
- fs.writeFileSync(pathCheck.resolved, content, 'utf8')
178
- return { success: true, message: `文件已写入: ${pathCheck.resolved}`, filePath: pathCheck.resolved, size: content.length }
180
+
181
+ const flag = mode === 'append' ? 'a' : 'w'
182
+ const writeStream = fs.createWriteStream(pathCheck.resolved, {
183
+ encoding: 'utf8',
184
+ flags: flag,
185
+ highWaterMark: 256 * 1024 // 256KB 缓冲区
186
+ })
187
+
188
+ // 分块写入,避免背压问题
189
+ const CHUNK_SIZE = 1024 * 1024 // 1MB 块
190
+ let offset = 0
191
+
192
+ const writeChunk = async () => {
193
+ while (offset < content.length) {
194
+ const end = Math.min(offset + CHUNK_SIZE, content.length)
195
+ const chunk = content.slice(offset, end)
196
+
197
+ const canContinue = writeStream.write(chunk)
198
+ offset = end
199
+
200
+ // 如果缓冲区满了,等待 drain 事件
201
+ if (!canContinue && offset < content.length) {
202
+ await new Promise(resolve => writeStream.once('drain', resolve))
203
+ }
204
+ }
205
+ }
206
+
207
+ await writeChunk()
208
+
209
+ return new Promise((resolve, reject) => {
210
+ writeStream.end((err) => {
211
+ if (err) reject(err)
212
+ else resolve({
213
+ success: true,
214
+ message: `文件已${mode === 'append' ? '追加' : '写入'}: ${pathCheck.resolved}`,
215
+ filePath: pathCheck.resolved,
216
+ size: content.length,
217
+ mode
218
+ })
219
+ })
220
+ })
221
+
179
222
  } catch (error) {
180
223
  return { success: false, error: error.message }
181
224
  }
@@ -296,9 +296,9 @@ class TelegramPlugin extends Plugin {
296
296
 
297
297
  const { agent, sessionId } = sessionInfo
298
298
 
299
- if (this._sessionPlugin) {
300
- this._sessionPlugin.addMessage(sessionId, { role: 'user', content: text })
301
- }
299
+ // if (this._sessionPlugin) {
300
+ // this._sessionPlugin.addMessage(sessionId, { role: 'user', content: text })
301
+ // }
302
302
 
303
303
  let thinkingMsg
304
304
  try {
@@ -326,9 +326,9 @@ class TelegramPlugin extends Plugin {
326
326
  }
327
327
  }
328
328
 
329
- if (this._sessionPlugin) {
330
- this._sessionPlugin.addMessage(sessionId, { role: 'assistant', content: fullResponse })
331
- }
329
+ // if (this._sessionPlugin) {
330
+ // this._sessionPlugin.addMessage(sessionId, { role: 'assistant', content: fullResponse })
331
+ // }
332
332
 
333
333
  const safeResponse = escapeMarkdown(fullResponse) || '抱歉,我没有收到有效的回复。'
334
334
  await this._bot.editMessageText(safeResponse, {
@@ -245,9 +245,9 @@ class WeixinPlugin extends Plugin {
245
245
  const { agent, sessionId } = sessionInfo
246
246
 
247
247
  // 使用 SessionPlugin 添加用户消息到历史
248
- if (this._sessionPlugin) {
249
- this._sessionPlugin.addMessage(sessionId, { role: 'user', content: text })
250
- }
248
+ // if (this._sessionPlugin) {
249
+ // this._sessionPlugin.addMessage(sessionId, { role: 'user', content: text })
250
+ // }
251
251
 
252
252
  // 发送正在输入状态
253
253
  try {
@@ -264,9 +264,9 @@ class WeixinPlugin extends Plugin {
264
264
  const fullResponse = cleanResponse(result.message || '')
265
265
 
266
266
  // 保存助手回复到历史(使用 SessionPlugin)
267
- if (this._sessionPlugin) {
268
- this._sessionPlugin.addMessage(sessionId, { role: 'assistant', content: fullResponse })
269
- }
267
+ // if (this._sessionPlugin) {
268
+ // this._sessionPlugin.addMessage(sessionId, { role: 'assistant', content: fullResponse })
269
+ // }
270
270
 
271
271
  // 发送回复(超过500字自动分批)
272
272
  if (fullResponse) {
@@ -1,162 +1,162 @@
1
- # AGENTS.md
2
-
3
- This file provides guidance to AI coding agents working on the `skills` CLI codebase.
4
-
5
- ## Project Overview
6
-
7
- `skills` is the CLI for the open agent skills ecosystem.
8
-
9
- ## Commands
10
-
11
- | Command | Description |
12
- | ----------------------------- | --------------------------------------------------- |
13
- | `skills` | Show banner with available commands |
14
- | `skills add <pkg>` | Install skills from git repos, URLs, or local paths |
15
- | `skills experimental_install` | Restore skills from skills-lock.json |
16
- | `skills experimental_sync` | Sync skills from node_modules into agent dirs |
17
- | `skills list` | List installed skills (alias: `ls`) |
18
- | `skills check` | Check for available skill updates |
19
- | `skills update` | Update all skills to latest versions |
20
- | `skills init [name]` | Create a new SKILL.md template |
21
-
22
- Aliases: `skills a` works for `add`. `skills i`, `skills install` (no args) restore from `skills-lock.json`. `skills ls` works for `list`. `skills experimental_install` restores from `skills-lock.json`. `skills experimental_sync` crawls `node_modules` for skills.
23
-
24
- ## Architecture
25
-
26
- ```
27
- src/
28
- ├── cli.ts # Main entry point, command routing, init/check/update
29
- ├── cli.test.ts # CLI tests
30
- ├── add.ts # Core add command logic
31
- ├── add.test.ts # Add command tests
32
- ├── list.ts # List installed skills command
33
- ├── list.test.ts # List command tests
34
- ├── agents.ts # Agent definitions and detection
35
- ├── installer.ts # Skill installation logic (symlink/copy) + listInstalledSkills
36
- ├── skills.ts # Skill discovery and parsing
37
- ├── skill-lock.ts # Global lock file management (~/.agents/.skill-lock.json)
38
- ├── local-lock.ts # Local lock file management (skills-lock.json, checked in)
39
- ├── sync.ts # Sync command - crawl node_modules for skills
40
- ├── source-parser.ts # Parse git URLs, GitHub shorthand, local paths
41
- ├── git.ts # Git clone operations
42
- ├── telemetry.ts # Anonymous usage tracking
43
- ├── types.ts # TypeScript types
44
- ├── mintlify.ts # Mintlify skill fetching (legacy)
45
- ├── providers/ # Remote skill providers (GitHub, HuggingFace, Mintlify)
46
- │ ├── index.ts
47
- │ ├── registry.ts
48
- │ ├── types.ts
49
- │ ├── huggingface.ts
50
- │ └── mintlify.ts
51
- ├── init.test.ts # Init command tests
52
- └── test-utils.ts # Test utilities
53
-
54
- tests/
55
- ├── sanitize-name.test.ts # Tests for sanitizeName (path traversal prevention)
56
- ├── skill-matching.test.ts # Tests for filterSkills (multi-word skill name matching)
57
- ├── source-parser.test.ts # Tests for URL/path parsing
58
- ├── installer-symlink.test.ts # Tests for symlink installation
59
- ├── list-installed.test.ts # Tests for listing installed skills
60
- ├── skill-path.test.ts # Tests for skill path handling
61
- ├── wellknown-provider.test.ts # Tests for well-known provider
62
- └── dist.test.ts # Tests for built distribution
63
- ```
64
-
65
- ## Update Checking System
66
-
67
- ### How `skills check` and `skills update` Work
68
-
69
- 1. Read `~/.agents/.skill-lock.json` for installed skills
70
- 2. For each skill, get `skillFolderHash` from lock file
71
- 3. POST to `https://add-skill.vercel.sh/check-updates` with:
72
- ```json
73
- {
74
- "skills": [{ "name": "...", "source": "...", "skillFolderHash": "..." }],
75
- "forceRefresh": true
76
- }
77
- ```
78
- 4. API fetches fresh content from GitHub, computes hash, compares
79
- 5. Returns list of skills with different hashes (updates available)
80
-
81
- ### Why `forceRefresh: true`?
82
-
83
- Both `check` and `update` always send `forceRefresh: true`. This ensures the API fetches fresh content from GitHub rather than using its Redis cache.
84
-
85
- **Without forceRefresh:** Users saw phantom "updates available" due to stale cached hashes. The fix was to always fetch fresh.
86
-
87
- **Tradeoff:** Slightly slower (GitHub API call per skill), but always accurate.
88
-
89
- ### Lock File Compatibility
90
-
91
- The lock file format is v3. Key field: `skillFolderHash` (GitHub tree SHA for the skill folder).
92
-
93
- If reading an older lock file version, it's wiped. Users must reinstall skills to populate the new format.
94
-
95
- ## Key Integration Points
96
-
97
- | Feature | Implementation |
98
- | -------------------------- | ------------------------------------------- |
99
- | `skills add` | `src/add.ts` - full implementation |
100
- | `skills experimental_sync` | `src/sync.ts` - crawl node_modules |
101
- | `skills check` | `POST /check-updates` API |
102
- | `skills update` | `POST /check-updates` + reinstall per skill |
103
-
104
- ## Development
105
-
106
- ```bash
107
- # Install dependencies
108
- pnpm install
109
-
110
- # Build
111
- pnpm build
112
-
113
- # Test locally
114
- pnpm dev add vercel-labs/agent-skills --list
115
- pnpm dev experimental_sync
116
- pnpm dev check
117
- pnpm dev update
118
- pnpm dev init my-skill
119
-
120
- # Run all tests
121
- pnpm test
122
-
123
- # Run specific test file(s)
124
- pnpm test tests/sanitize-name.test.ts
125
- pnpm test tests/skill-matching.test.ts tests/source-parser.test.ts
126
-
127
- # Type check
128
- pnpm type-check
129
-
130
- # Format code
131
- pnpm format
132
- ```
133
-
134
- ## Code Style
135
-
136
- This project uses Prettier for code formatting. **Always run `pnpm format` before committing changes** to ensure consistent formatting.
137
-
138
- ```bash
139
- # Format all files
140
- pnpm format
141
-
142
- # Check formatting without fixing
143
- pnpm prettier --check .
144
- ```
145
-
146
- CI will fail if code is not properly formatted.
147
-
148
- ## Publishing
149
-
150
- ```bash
151
- # 1. Bump version in package.json
152
- # 2. Build
153
- pnpm build
154
- # 3. Publish
155
- npm publish
156
- ```
157
-
158
- ## Adding a New Agent
159
-
160
- 1. Add the agent definition to `src/agents.ts`
161
- 2. Run `pnpm run -C scripts validate-agents.ts` to validate
162
- 3. Run `pnpm run -C scripts sync-agents.ts` to update README.md
1
+ # AGENTS.md
2
+
3
+ This file provides guidance to AI coding agents working on the `skills` CLI codebase.
4
+
5
+ ## Project Overview
6
+
7
+ `skills` is the CLI for the open agent skills ecosystem.
8
+
9
+ ## Commands
10
+
11
+ | Command | Description |
12
+ | ----------------------------- | --------------------------------------------------- |
13
+ | `skills` | Show banner with available commands |
14
+ | `skills add <pkg>` | Install skills from git repos, URLs, or local paths |
15
+ | `skills experimental_install` | Restore skills from skills-lock.json |
16
+ | `skills experimental_sync` | Sync skills from node_modules into agent dirs |
17
+ | `skills list` | List installed skills (alias: `ls`) |
18
+ | `skills check` | Check for available skill updates |
19
+ | `skills update` | Update all skills to latest versions |
20
+ | `skills init [name]` | Create a new SKILL.md template |
21
+
22
+ Aliases: `skills a` works for `add`. `skills i`, `skills install` (no args) restore from `skills-lock.json`. `skills ls` works for `list`. `skills experimental_install` restores from `skills-lock.json`. `skills experimental_sync` crawls `node_modules` for skills.
23
+
24
+ ## Architecture
25
+
26
+ ```
27
+ src/
28
+ ├── cli.ts # Main entry point, command routing, init/check/update
29
+ ├── cli.test.ts # CLI tests
30
+ ├── add.ts # Core add command logic
31
+ ├── add.test.ts # Add command tests
32
+ ├── list.ts # List installed skills command
33
+ ├── list.test.ts # List command tests
34
+ ├── agents.ts # Agent definitions and detection
35
+ ├── installer.ts # Skill installation logic (symlink/copy) + listInstalledSkills
36
+ ├── skills.ts # Skill discovery and parsing
37
+ ├── skill-lock.ts # Global lock file management (~/.agents/.skill-lock.json)
38
+ ├── local-lock.ts # Local lock file management (skills-lock.json, checked in)
39
+ ├── sync.ts # Sync command - crawl node_modules for skills
40
+ ├── source-parser.ts # Parse git URLs, GitHub shorthand, local paths
41
+ ├── git.ts # Git clone operations
42
+ ├── telemetry.ts # Anonymous usage tracking
43
+ ├── types.ts # TypeScript types
44
+ ├── mintlify.ts # Mintlify skill fetching (legacy)
45
+ ├── providers/ # Remote skill providers (GitHub, HuggingFace, Mintlify)
46
+ │ ├── index.ts
47
+ │ ├── registry.ts
48
+ │ ├── types.ts
49
+ │ ├── huggingface.ts
50
+ │ └── mintlify.ts
51
+ ├── init.test.ts # Init command tests
52
+ └── test-utils.ts # Test utilities
53
+
54
+ tests/
55
+ ├── sanitize-name.test.ts # Tests for sanitizeName (path traversal prevention)
56
+ ├── skill-matching.test.ts # Tests for filterSkills (multi-word skill name matching)
57
+ ├── source-parser.test.ts # Tests for URL/path parsing
58
+ ├── installer-symlink.test.ts # Tests for symlink installation
59
+ ├── list-installed.test.ts # Tests for listing installed skills
60
+ ├── skill-path.test.ts # Tests for skill path handling
61
+ ├── wellknown-provider.test.ts # Tests for well-known provider
62
+ └── dist.test.ts # Tests for built distribution
63
+ ```
64
+
65
+ ## Update Checking System
66
+
67
+ ### How `skills check` and `skills update` Work
68
+
69
+ 1. Read `~/.agents/.skill-lock.json` for installed skills
70
+ 2. For each skill, get `skillFolderHash` from lock file
71
+ 3. POST to `https://add-skill.vercel.sh/check-updates` with:
72
+ ```json
73
+ {
74
+ "skills": [{ "name": "...", "source": "...", "skillFolderHash": "..." }],
75
+ "forceRefresh": true
76
+ }
77
+ ```
78
+ 4. API fetches fresh content from GitHub, computes hash, compares
79
+ 5. Returns list of skills with different hashes (updates available)
80
+
81
+ ### Why `forceRefresh: true`?
82
+
83
+ Both `check` and `update` always send `forceRefresh: true`. This ensures the API fetches fresh content from GitHub rather than using its Redis cache.
84
+
85
+ **Without forceRefresh:** Users saw phantom "updates available" due to stale cached hashes. The fix was to always fetch fresh.
86
+
87
+ **Tradeoff:** Slightly slower (GitHub API call per skill), but always accurate.
88
+
89
+ ### Lock File Compatibility
90
+
91
+ The lock file format is v3. Key field: `skillFolderHash` (GitHub tree SHA for the skill folder).
92
+
93
+ If reading an older lock file version, it's wiped. Users must reinstall skills to populate the new format.
94
+
95
+ ## Key Integration Points
96
+
97
+ | Feature | Implementation |
98
+ | -------------------------- | ------------------------------------------- |
99
+ | `skills add` | `src/add.ts` - full implementation |
100
+ | `skills experimental_sync` | `src/sync.ts` - crawl node_modules |
101
+ | `skills check` | `POST /check-updates` API |
102
+ | `skills update` | `POST /check-updates` + reinstall per skill |
103
+
104
+ ## Development
105
+
106
+ ```bash
107
+ # Install dependencies
108
+ pnpm install
109
+
110
+ # Build
111
+ pnpm build
112
+
113
+ # Test locally
114
+ pnpm dev add vercel-labs/agent-skills --list
115
+ pnpm dev experimental_sync
116
+ pnpm dev check
117
+ pnpm dev update
118
+ pnpm dev init my-skill
119
+
120
+ # Run all tests
121
+ pnpm test
122
+
123
+ # Run specific test file(s)
124
+ pnpm test tests/sanitize-name.test.ts
125
+ pnpm test tests/skill-matching.test.ts tests/source-parser.test.ts
126
+
127
+ # Type check
128
+ pnpm type-check
129
+
130
+ # Format code
131
+ pnpm format
132
+ ```
133
+
134
+ ## Code Style
135
+
136
+ This project uses Prettier for code formatting. **Always run `pnpm format` before committing changes** to ensure consistent formatting.
137
+
138
+ ```bash
139
+ # Format all files
140
+ pnpm format
141
+
142
+ # Check formatting without fixing
143
+ pnpm prettier --check .
144
+ ```
145
+
146
+ CI will fail if code is not properly formatted.
147
+
148
+ ## Publishing
149
+
150
+ ```bash
151
+ # 1. Bump version in package.json
152
+ # 2. Build
153
+ pnpm build
154
+ # 3. Publish
155
+ npm publish
156
+ ```
157
+
158
+ ## Adding a New Agent
159
+
160
+ 1. Add the agent definition to `src/agents.ts`
161
+ 2. Run `pnpm run -C scripts validate-agents.ts` to validate
162
+ 3. Run `pnpm run -C scripts sync-agents.ts` to update README.md