foliko 1.1.7 → 1.1.8
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/.agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/core.py +258 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/search.py +106 -0
- package/.agent/ARCHITECTURE.md +288 -0
- package/.agent/agents/ambient-agent.md +57 -0
- package/.agent/agents/debugger.md +55 -0
- package/.agent/agents/email-assistant.md +49 -0
- package/.agent/agents/file-manager.md +42 -0
- package/.agent/agents/python-developer.md +60 -0
- package/.agent/agents/scheduler.md +59 -0
- package/.agent/agents/web-developer.md +45 -0
- package/.agent/data/default.json +412 -3
- package/.agent/data/plugins-state.json +172 -173
- package/.agent/data/puppeteer-sessions/undefined.json +6 -0
- package/.agent/data/weixin-media/2026-04-08/img_1775618677512.jpg +0 -0
- package/.agent/data/weixin-media/2026-04-08/img_1775619073340.jpg +0 -0
- package/.agent/data/weixin-media/2026-04-08/img_1775619097536.jpg +0 -0
- package/.agent/data/weixin-media/2026-04-08/img_1775619209388.jpg +0 -0
- package/.agent/mcp_config.json +11 -3
- package/.agent/memory/feedback/mnrdvj5i-ca3dkd.md +9 -0
- package/.agent/memory/feedback/mnre365e-7s4zax.md +9 -0
- package/.agent/memory/feedback/mnre36jn-nkfgmp.md +9 -0
- package/.agent/memory/feedback/mnre3805-kjiq6h.md +9 -0
- package/.agent/memory/feedback/mnsf66kp-b10rcd.md +9 -0
- package/.agent/memory/feedback/mnsi3sz8-p5g2cw.md +9 -0
- package/.agent/memory/feedback/mnsibe47-sv2ni1.md +9 -0
- package/.agent/memory/feedback/mnsic89w-nn228o.md +9 -0
- package/.agent/memory/feedback/mnsj1xe9-x83ba0.md +9 -0
- package/.agent/memory/feedback/mnsj21iv-wnwelx.md +9 -0
- package/.agent/memory/feedback/mnsj2g4a-cog7a2.md +9 -0
- package/.agent/memory/feedback/mnsj4js7-lktjp6.md +9 -0
- package/.agent/memory/feedback/mnsj5d4y-uglwvp.md +9 -0
- package/.agent/memory/feedback/mnslkuo9-uous66.md +24 -0
- package/.agent/memory/feedback/mnsm3vq0-megoil.md +9 -0
- package/.agent/memory/feedback/mnsnn5x2-sxcihd.md +9 -0
- package/.agent/memory/feedback/mnsnq17s-nabrn9.md +9 -0
- package/.agent/memory/feedback/mnsnybet-wz7rn3.md +9 -0
- package/.agent/memory/feedback/mnsrw0s7-7s9e30.md +9 -0
- package/.agent/memory/feedback/mnu5hpnd-tlm16q.md +9 -0
- package/.agent/memory/feedback/mnu60uqe-xuoxp4.md +9 -0
- package/.agent/memory/project/mnqx54u5-loqtoe.md +9 -0
- package/.agent/memory/project/mnqx84cv-mx6dmd.md +9 -0
- package/.agent/memory/project/mnsacuyr-hgtk5n.md +20 -0
- package/.agent/memory/project/mnu5hy2x-bjsg7u.md +9 -0
- package/.agent/memory/reference/mnre3cww-penbo1.md +9 -0
- package/.agent/memory/reference/mns9wn48-luerua.md +14 -0
- package/.agent/memory/reference/mns9yz5c-thc2s0.md +16 -0
- package/.agent/memory/reference/mnsfy4um-910f1o.md +23 -0
- package/.agent/memory/reference/mnsg37dp-lmfj18.md +32 -0
- package/.agent/memory/reference/mnsll60q-0j911u.md +36 -0
- package/.agent/memory/reference/mnsmlb5y-nej31u.md +16 -0
- package/.agent/memory/reference/mnssle72-yrot96.md +9 -0
- package/.agent/memory/user/mnsfuon6-l416q1.md +21 -0
- package/.agent/memory/user/mnsg9kut-95m7rf.md +20 -0
- package/.agent/memory/user/mnu2eo1v-yy6fhe.md +9 -0
- package/.agent/memory/user/mnu2etuo-8u8jk8.md +9 -0
- package/.agent/plugins/poster-plugin/fonts/NotoColorEmoji-Regular.ttf +0 -0
- package/.agent/plugins/poster-plugin/fonts/Symbola_hint.ttf +0 -0
- package/.agent/plugins/poster-plugin/package.json +3 -3
- package/.agent/plugins/poster-plugin/src/canvas.js +8 -0
- package/.agent/plugins/poster-plugin/src/components/barcode.js +5 -2
- package/.agent/plugins/poster-plugin/src/components/bubble.js +3 -2
- package/.agent/plugins/poster-plugin/src/components/button.js +74 -30
- package/.agent/plugins/poster-plugin/src/components/columns.js +97 -83
- package/.agent/plugins/poster-plugin/src/components/grid.js +104 -92
- package/.agent/plugins/poster-plugin/src/components/highlightText.js +2 -1
- package/.agent/plugins/poster-plugin/src/components/imageFrame.js +143 -93
- package/.agent/plugins/poster-plugin/src/components/quote.js +85 -13
- package/.agent/plugins/poster-plugin/src/components/ribbon.js +13 -9
- package/.agent/plugins/poster-plugin/src/components/seal.js +5 -3
- package/.agent/plugins/poster-plugin/src/components/star.js +3 -3
- package/.agent/plugins/poster-plugin/src/components/table.js +1 -1
- package/.agent/plugins/poster-plugin/src/components/watermark.js +4 -2
- package/.agent/plugins/poster-plugin/src/composer.js +181 -13
- package/.agent/plugins/poster-plugin/src/elements/artText.js +16 -7
- package/.agent/plugins/poster-plugin/src/elements/background.js +20 -5
- package/.agent/plugins/poster-plugin/src/elements/richText.js +160 -107
- package/.agent/plugins/poster-plugin/src/elements/text.js +48 -45
- package/.agent/plugins/poster-plugin/src/fonts.js +556 -125
- package/.agent/plugins/poster-plugin/src/index.js +46 -1
- package/.agent/plugins/poster-plugin/yarn.lock +186 -356
- package/.agent/plugins/puppeteer-plugin/README.md +147 -0
- package/.agent/plugins/puppeteer-plugin/index.js +1422 -0
- package/.agent/plugins/puppeteer-plugin/package.json +9 -0
- package/.agent/plugins.json +5 -11
- package/.agent/rules/GEMINI.md +273 -0
- package/.agent/rules/allow-rule.md +77 -0
- package/.agent/rules/log-rule.md +83 -0
- package/.agent/rules/security-rule.md +93 -0
- package/.agent/scripts/auto_preview.py +148 -0
- package/.agent/scripts/checklist.py +217 -0
- package/.agent/scripts/session_manager.py +120 -0
- package/.agent/scripts/verify_all.py +327 -0
- package/.agent/sessions/cli_default.json +122 -689
- package/.agent/skills/api-patterns/SKILL.md +81 -0
- package/.agent/skills/api-patterns/api-style.md +42 -0
- package/.agent/skills/api-patterns/auth.md +24 -0
- package/.agent/skills/api-patterns/documentation.md +26 -0
- package/.agent/skills/api-patterns/graphql.md +41 -0
- package/.agent/skills/api-patterns/rate-limiting.md +31 -0
- package/.agent/skills/api-patterns/response.md +37 -0
- package/.agent/skills/api-patterns/rest.md +40 -0
- package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
- package/.agent/skills/api-patterns/security-testing.md +122 -0
- package/.agent/skills/api-patterns/trpc.md +41 -0
- package/.agent/skills/api-patterns/versioning.md +22 -0
- package/.agent/skills/app-builder/SKILL.md +75 -0
- package/.agent/skills/app-builder/agent-coordination.md +71 -0
- package/.agent/skills/app-builder/feature-building.md +53 -0
- package/.agent/skills/app-builder/project-detection.md +34 -0
- package/.agent/skills/app-builder/scaffolding.md +118 -0
- package/.agent/skills/app-builder/tech-stack.md +40 -0
- package/.agent/skills/app-builder/templates/SKILL.md +39 -0
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
- package/.agent/skills/architecture/SKILL.md +55 -0
- package/.agent/skills/architecture/context-discovery.md +43 -0
- package/.agent/skills/architecture/examples.md +94 -0
- package/.agent/skills/architecture/pattern-selection.md +68 -0
- package/.agent/skills/architecture/patterns-reference.md +50 -0
- package/.agent/skills/architecture/trade-off-analysis.md +77 -0
- package/.agent/skills/clean-code/SKILL.md +201 -0
- package/.agent/skills/doc.md +177 -0
- package/.agent/skills/frontend-design/SKILL.md +418 -0
- package/.agent/skills/frontend-design/animation-guide.md +331 -0
- package/.agent/skills/frontend-design/color-system.md +311 -0
- package/.agent/skills/frontend-design/decision-trees.md +418 -0
- package/.agent/skills/frontend-design/motion-graphics.md +306 -0
- package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/.agent/skills/frontend-design/typography-system.md +345 -0
- package/.agent/skills/frontend-design/ux-psychology.md +1116 -0
- package/.agent/skills/frontend-design/visual-effects.md +383 -0
- package/.agent/skills/i18n-localization/SKILL.md +154 -0
- package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/.agent/skills/mcp-builder/SKILL.md +176 -0
- package/.agent/skills/poster-design/SKILL.md +385 -0
- package/.agent/skills/web-design-guidelines/SKILL.md +57 -0
- package/.agent/workflows/brainstorm.md +113 -0
- package/.agent/workflows/create.md +59 -0
- package/.agent/workflows/debug.md +103 -0
- package/.agent/workflows/deploy.md +176 -0
- package/.agent/workflows/enhance.md +63 -0
- package/.agent/workflows/orchestrate.md +237 -0
- package/.agent/workflows/plan.md +89 -0
- package/.agent/workflows/preview.md +81 -0
- package/.agent/workflows/simple-test.md +42 -0
- package/.agent/workflows/status.md +86 -0
- package/.agent/workflows/structured-orchestrate.md +180 -0
- package/.agent/workflows/test.md +144 -0
- package/.agent/workflows/ui-ux-pro-max.md +296 -0
- package/.claude/settings.local.json +1 -2
- package/.env.example +56 -56
- package/README.md +441 -441
- package/output/foliko-poster.png +0 -0
- package/outputs/emoji-font-showcase.png +0 -0
- package/outputs/foliko-muji-style.png +0 -0
- package/package.json +3 -2
- package/plugins/default-plugins.js +2 -1
- package/plugins/extension-executor-plugin.js +24 -1
- package/plugins/feishu-plugin.js +2 -2
- package/plugins/telegram-plugin.js +2 -2
- package/plugins/weixin-plugin.js +2 -2
- package/skills/find-skills/AGENTS.md +162 -162
- package/skills/find-skills/SKILL.md +133 -133
- package/src/core/agent.js +117 -29
- package/src/executors/mcp-executor.js +282 -26
- package/system.md +719 -570
- package/.agent/agents/code-assistant.json +0 -17
- package/.agent/agents/email-assistant.json +0 -14
- package/.agent/agents/file-assistant.json +0 -18
- package/.agent/agents/orchestrator-demo.md +0 -53
- package/.agent/agents/orchestrator.json +0 -7
- package/.agent/agents/system-assistant.json +0 -15
- package/.agent/agents/web-assistant.json +0 -12
- package/.agent/data/email/processed-emails.json +0 -1
- package/.agent/data/scheduler/tasks.json +0 -1
- package/.agent/data/web/web-config.json +0 -5
- package/.agent/memory/feedback/mnt7jrlt-d67qs7.md +0 -15
- package/.agent/memory/feedback/mnt88ja3-al4fuy.md +0 -9
- package/.agent/package.json +0 -8
- package/.agent/plugins/__pycache__/file_writer.cpython-312.pyc +0 -0
- package/.agent/plugins/daytona/README.md +0 -89
- package/.agent/plugins/daytona/index.js +0 -377
- package/.agent/plugins/daytona/package.json +0 -12
- package/.agent/plugins/marknative/README.md +0 -134
- package/.agent/plugins/marknative/fonts/SegoeUI Emoji.ttf +0 -0
- package/.agent/plugins/marknative/fonts.zip +0 -0
- package/.agent/plugins/marknative/index.js +0 -256
- package/.agent/plugins/marknative/package.json +0 -12
- package/.agent/plugins/poster-plugin/emojis/rocket.png +0 -1
- package/.agent/plugins/poster-plugin/test-background.svg +0 -1
- package/.agent/plugins/poster-plugin/test-full-poster.svg +0 -2
- package/.agent/plugins/poster-plugin/test-image.png +0 -0
- package/.agent/plugins/system-info/index.js +0 -387
- package/.agent/plugins/system-info/package.json +0 -4
- package/.agent/plugins/system-info/test.js +0 -40
- package/.agent/plugins/test-plugin.py +0 -108
- package/.agent/python-scripts/test_sample.py +0 -24
- package/.agent/skills/agent-browser/SKILL.md +0 -311
- package/.agent/skills/agent-browser/TEST_PLAN.md +0 -200
- package/.agent/skills/sysinfo/SKILL.md +0 -38
- package/.agent/skills/sysinfo/system-info.sh +0 -130
- package/.agent/skills/workflow/SKILL.md +0 -324
- package/.agent/test-agent.js +0 -35
- package/.agent/weixin.json +0 -6
- package/.agent/workflows/email-digest.json +0 -50
- package/.agent/workflows/file-backup.json +0 -21
- package/.agent/workflows/get-ip-notify.json +0 -32
- package/.agent/workflows/news-aggregator.json +0 -93
- package/.agent/workflows/news-dashboard-v2.json +0 -94
- package/.agent/workflows/notification-batch.json +0 -32
- package/output/zen_silence.png +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foliko",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "简约的插件化 Agent 框架",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -54,10 +54,11 @@
|
|
|
54
54
|
"@ai-sdk/openai-compatible": "^2.0.35",
|
|
55
55
|
"@anthropic-ai/sdk": "^0.39.0",
|
|
56
56
|
"@chnak/weixin-bot": "^1.2.7",
|
|
57
|
-
"@chnak/zod-to-markdown": "1.0.
|
|
57
|
+
"@chnak/zod-to-markdown": "1.0.7",
|
|
58
58
|
"@hono/node-server": "^1.19.11",
|
|
59
59
|
"@larksuiteoapi/node-sdk": "^1.59.0",
|
|
60
60
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
61
|
+
"@napi-rs/canvas": "^0.1.97",
|
|
61
62
|
"ai": "^6.0.146",
|
|
62
63
|
"dotenv": "^17.3.1",
|
|
63
64
|
"gate-api": "^7.2.57",
|
|
@@ -325,7 +325,8 @@ async function bootstrapDefaults(framework, config = {}) {
|
|
|
325
325
|
args: cfg.args || [],
|
|
326
326
|
env: cfg.env || {},
|
|
327
327
|
url: cfg.url,
|
|
328
|
-
headers: cfg.headers
|
|
328
|
+
headers: cfg.headers,
|
|
329
|
+
enabled: cfg.enabled !== false // 默认为 true
|
|
329
330
|
}))
|
|
330
331
|
const { MCPExecutorPlugin } = require('../src/executors/mcp-executor')
|
|
331
332
|
await framework.loadPlugin(new MCPExecutorPlugin({ servers }))
|
|
@@ -550,7 +550,7 @@ class ExtensionExecutorPlugin extends Plugin {
|
|
|
550
550
|
}));
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
reload(framework) {
|
|
553
|
+
async reload(framework) {
|
|
554
554
|
this._framework = framework;
|
|
555
555
|
// 重新扫描所有已加载插件的 tools
|
|
556
556
|
this._extensions.clear();
|
|
@@ -562,6 +562,29 @@ class ExtensionExecutorPlugin extends Plugin {
|
|
|
562
562
|
this._mcpExecutor = framework.pluginManager?.get('mcp') || null;
|
|
563
563
|
// 刷新所有 Agent 的扩展提示词
|
|
564
564
|
this._refreshAllAgentsExtPrompt(framework);
|
|
565
|
+
|
|
566
|
+
// 同时重载 MCP 配置
|
|
567
|
+
await this._reloadMCPConfig(framework);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// 重载 MCP 配置
|
|
571
|
+
async _reloadMCPConfig(framework) {
|
|
572
|
+
const fs = require('fs');
|
|
573
|
+
const path = require('path');
|
|
574
|
+
const mcpExecutor = framework.pluginManager?.get('mcp');
|
|
575
|
+
if (!mcpExecutor) return;
|
|
576
|
+
|
|
577
|
+
try {
|
|
578
|
+
const configPath = path.resolve('.agent/mcp_config.json');
|
|
579
|
+
if (fs.existsSync(configPath)) {
|
|
580
|
+
const configContent = fs.readFileSync(configPath, 'utf8');
|
|
581
|
+
const config = JSON.parse(configContent);
|
|
582
|
+
await mcpExecutor.reloadConfig(config);
|
|
583
|
+
logger.info(' MCP config reloaded via extension-executor');
|
|
584
|
+
}
|
|
585
|
+
} catch (err) {
|
|
586
|
+
logger.warn(' Failed to reload MCP config:', err.message);
|
|
587
|
+
}
|
|
565
588
|
}
|
|
566
589
|
|
|
567
590
|
async uninstall(framework) {
|
package/plugins/feishu-plugin.js
CHANGED
|
@@ -288,7 +288,7 @@ class FeishuPlugin extends Plugin {
|
|
|
288
288
|
* 处理统一通知
|
|
289
289
|
*/
|
|
290
290
|
async _handleNotification(data) {
|
|
291
|
-
const { title, message, source, level, sessionId } = data
|
|
291
|
+
const { title, message, source = '系统消息', level, sessionId } = data
|
|
292
292
|
|
|
293
293
|
// 确定 openId
|
|
294
294
|
let openId = null
|
|
@@ -327,7 +327,7 @@ class FeishuPlugin extends Plugin {
|
|
|
327
327
|
error: '❌'
|
|
328
328
|
}
|
|
329
329
|
const emoji = levelEmoji[level] || 'ℹ️'
|
|
330
|
-
const notificationText = `${emoji} [${source}] ${title}\n\n${message}`
|
|
330
|
+
const notificationText = `${emoji} [${source}] ${title || '通知'}\n\n${message || ''}`
|
|
331
331
|
|
|
332
332
|
try {
|
|
333
333
|
await this._sendTextMessage(openId, notificationText)
|
|
@@ -126,7 +126,7 @@ class TelegramPlugin extends Plugin {
|
|
|
126
126
|
* 处理统一通知
|
|
127
127
|
*/
|
|
128
128
|
async _handleNotification(data) {
|
|
129
|
-
const { title, message, source, level } = data
|
|
129
|
+
const { title, message, source = '系统消息', level } = data
|
|
130
130
|
|
|
131
131
|
if (!this._bot) {
|
|
132
132
|
log.warn(' Bot not ready, cannot send notification')
|
|
@@ -170,7 +170,7 @@ class TelegramPlugin extends Plugin {
|
|
|
170
170
|
error: '❌'
|
|
171
171
|
}
|
|
172
172
|
const emoji = levelEmoji[level] || 'ℹ️'
|
|
173
|
-
const notificationText = `${emoji} [${source}] ${title}\n\n${message}`
|
|
173
|
+
const notificationText = `${emoji} [${source}] ${title || '通知'}\n\n${message || ''}`
|
|
174
174
|
|
|
175
175
|
try {
|
|
176
176
|
await this._bot.sendMessage(chatId, notificationText)
|
package/plugins/weixin-plugin.js
CHANGED
|
@@ -673,7 +673,7 @@ class WeixinPlugin extends Plugin {
|
|
|
673
673
|
* 处理统一通知
|
|
674
674
|
*/
|
|
675
675
|
async _handleNotification(data) {
|
|
676
|
-
const { title, message, source, level, sessionId } = data
|
|
676
|
+
const { title, message, source = '系统消息', level, sessionId } = data
|
|
677
677
|
|
|
678
678
|
if (!this._bot) {
|
|
679
679
|
log.warn(' Bot not ready, cannot send notification')
|
|
@@ -717,7 +717,7 @@ class WeixinPlugin extends Plugin {
|
|
|
717
717
|
error: '❌'
|
|
718
718
|
}
|
|
719
719
|
const emoji = levelEmoji[level] || 'ℹ️'
|
|
720
|
-
const notificationText = `${emoji} [${source}] ${title}\n\n${message}`
|
|
720
|
+
const notificationText = `${emoji} [${source}] ${title || '通知'}\n\n${message || ''}`
|
|
721
721
|
|
|
722
722
|
try {
|
|
723
723
|
await this._sendMessageBatch(null, userId, notificationText, false)
|
|
@@ -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
|