@uncarved/jade 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/jade.js +5 -27
- package/dist/api.d.ts +266 -0
- package/dist/api.js +38 -0
- package/dist/api.js.map +1 -0
- package/dist/config.d.ts +13 -32
- package/dist/config.js +39 -121
- package/dist/config.js.map +1 -1
- package/dist/fetch.d.ts +20 -0
- package/dist/fetch.js +190 -0
- package/dist/fetch.js.map +1 -0
- package/dist/hash.d.ts +2 -0
- package/dist/hash.js +42 -0
- package/dist/hash.js.map +1 -0
- package/dist/host.d.ts +71 -0
- package/dist/host.js +400 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +11 -30
- package/dist/index.js +11 -30
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +78 -0
- package/dist/install.js +292 -0
- package/dist/install.js.map +1 -0
- package/dist/main.d.ts +1 -2
- package/dist/main.js +159 -1362
- package/dist/main.js.map +1 -1
- package/dist/manifest.d.ts +23 -0
- package/dist/manifest.js +159 -0
- package/dist/manifest.js.map +1 -0
- package/dist/membrane.d.ts +33 -0
- package/dist/membrane.js +140 -0
- package/dist/membrane.js.map +1 -0
- package/dist/remote.d.ts +10 -0
- package/dist/remote.js +292 -0
- package/dist/remote.js.map +1 -0
- package/dist/rescue.d.ts +10 -0
- package/dist/rescue.js +216 -0
- package/dist/rescue.js.map +1 -0
- package/dist/resolve.d.ts +34 -0
- package/dist/resolve.js +178 -0
- package/dist/resolve.js.map +1 -0
- package/dist/rpc.d.ts +26 -0
- package/dist/rpc.js +144 -0
- package/dist/rpc.js.map +1 -0
- package/dist/secrets.d.ts +12 -0
- package/dist/secrets.js +125 -0
- package/dist/secrets.js.map +1 -0
- package/dist/session.d.ts +45 -0
- package/dist/session.js +401 -0
- package/dist/session.js.map +1 -0
- package/dist/source.d.ts +12 -0
- package/dist/source.js +72 -0
- package/dist/source.js.map +1 -0
- package/dist/state.d.ts +37 -0
- package/dist/state.js +93 -0
- package/dist/state.js.map +1 -0
- package/dist/update.d.ts +2 -0
- package/dist/update.js +6 -3
- package/dist/update.js.map +1 -1
- package/package.json +10 -8
- package/plugins/approval/index.ts +297 -0
- package/plugins/approval/plugin.json +18 -0
- package/{src/plugins → plugins/approval}/policy.ts +21 -100
- package/{src/plugins → plugins/approval}/review.ts +62 -16
- package/plugins/ask/index.ts +159 -0
- package/plugins/ask/plugin.json +8 -0
- package/plugins/budget/index.ts +38 -0
- package/plugins/budget/plugin.json +13 -0
- package/{src/plugins → plugins/checks}/checks.ts +48 -38
- package/plugins/checks/index.ts +158 -0
- package/plugins/checks/plugin.json +14 -0
- package/plugins/checks/project.ts +81 -0
- package/plugins/commands/index.ts +76 -0
- package/plugins/commands/plugin.json +7 -0
- package/{src/plugins → plugins/compact}/compact.ts +73 -38
- package/plugins/compact/index.ts +115 -0
- package/plugins/compact/plugin.json +17 -0
- package/plugins/compact/style.ts +17 -0
- package/plugins/continue/index.ts +58 -0
- package/plugins/continue/plugin.json +13 -0
- package/{src/ui → plugins/fs}/diff.ts +2 -2
- package/{src/tools → plugins/fs}/fs.ts +19 -42
- package/{src/tools → plugins/fs}/grep.ts +1 -1
- package/plugins/fs/index.ts +34 -0
- package/plugins/fs/plugin.json +7 -0
- package/{src/ui → plugins/fs}/renderers.ts +25 -70
- package/plugins/fs/style.ts +18 -0
- package/plugins/fs/sys.ts +81 -0
- package/plugins/keys/index.ts +53 -0
- package/plugins/keys/plugin.json +7 -0
- package/plugins/mcp/index.ts +192 -0
- package/{src → plugins/mcp}/mcp.ts +32 -32
- package/plugins/mcp/plugin.json +7 -0
- package/plugins/mcp/project.ts +93 -0
- package/plugins/memory/index.ts +105 -0
- package/{src → plugins/memory}/memory.ts +20 -2
- package/plugins/memory/notes.ts +43 -0
- package/plugins/memory/plugin.json +7 -0
- package/plugins/memory/style.ts +17 -0
- package/plugins/mentions/attach.ts +127 -0
- package/plugins/mentions/index.ts +79 -0
- package/plugins/mentions/plugin.json +7 -0
- package/plugins/mentions/style.ts +17 -0
- package/plugins/models/config.ts +53 -0
- package/plugins/models/configure.ts +455 -0
- package/plugins/models/context.ts +32 -0
- package/plugins/models/index.ts +198 -0
- package/plugins/models/plugin.json +8 -0
- package/{src → plugins/models}/provider.ts +16 -119
- package/plugins/models/saved.ts +94 -0
- package/plugins/modes/index.ts +222 -0
- package/plugins/modes/plugin.json +9 -0
- package/plugins/plugins/index.ts +38 -0
- package/plugins/plugins/plugin.json +7 -0
- package/plugins/print/index.ts +142 -0
- package/plugins/print/plugin.json +8 -0
- package/plugins/prompts/index.ts +83 -0
- package/plugins/prompts/plugin.json +8 -0
- package/plugins/prompts/prompts.ts +253 -0
- package/plugins/prompts/sys.ts +72 -0
- package/plugins/renderers/index.ts +78 -0
- package/plugins/renderers/plugin.json +7 -0
- package/plugins/repeats/index.ts +165 -0
- package/plugins/repeats/plugin.json +6 -0
- package/plugins/schedule/cron.ts +74 -0
- package/plugins/schedule/index.ts +292 -0
- package/plugins/schedule/plugin.json +13 -0
- package/plugins/schedule/store.ts +149 -0
- package/plugins/scratch/index.ts +31 -0
- package/plugins/scratch/plugin.json +7 -0
- package/plugins/screenshot/index.ts +40 -0
- package/plugins/screenshot/plugin.json +7 -0
- package/plugins/screenshot/sys.ts +84 -0
- package/{src/tools/screenshot.ts → plugins/screenshot/tool.ts} +6 -6
- package/plugins/sessions/index.ts +148 -0
- package/plugins/sessions/plugin.json +8 -0
- package/plugins/shell/index.ts +33 -0
- package/plugins/shell/plugin.json +17 -0
- package/plugins/shell/renderers.ts +45 -0
- package/plugins/shell/service.ts +44 -0
- package/{src/tools → plugins/shell}/shell.ts +31 -20
- package/{src → plugins/shell}/sys.ts +2 -43
- package/plugins/skills/index.ts +96 -0
- package/plugins/skills/plugin.json +7 -0
- package/plugins/skills/project.ts +49 -0
- package/{src → plugins/skills}/skills.ts +4 -11
- package/plugins/suggest/index.ts +286 -0
- package/plugins/suggest/plugin.json +18 -0
- package/plugins/task/index.ts +167 -0
- package/plugins/task/plugin.json +15 -0
- package/plugins/task/style.ts +17 -0
- package/plugins/task/subagent.ts +257 -0
- package/{src/tools/todo.ts → plugins/todo/index.ts} +33 -7
- package/plugins/todo/plugin.json +7 -0
- package/{src/ui → plugins/tui}/editor.ts +3 -0
- package/plugins/tui/frontend.ts +596 -0
- package/plugins/tui/index.ts +37 -0
- package/plugins/tui/mentions.ts +113 -0
- package/plugins/tui/plugin.json +10 -0
- package/{src/ui → plugins/tui}/render.ts +8 -2
- package/{src/ui → plugins/tui}/screen.ts +8 -3
- package/{src/ui → plugins/tui}/transcript.ts +74 -99
- package/{src/ui/tui.tsx → plugins/tui/tui.ts} +358 -387
- package/{src/tools → plugins/undo}/checkpoint.ts +21 -60
- package/plugins/undo/index.ts +139 -0
- package/plugins/undo/notes.ts +43 -0
- package/plugins/undo/plugin.json +7 -0
- package/plugins/undo/style.ts +17 -0
- package/plugins/update/index.ts +40 -0
- package/plugins/update/plugin.json +13 -0
- package/plugins/web/env.ts +78 -0
- package/plugins/web/index.ts +133 -0
- package/plugins/web/plugin.json +15 -0
- package/plugins/web/renderers.ts +11 -0
- package/{src/tools → plugins/web}/web.ts +58 -26
- package/plugins-dist/approval/index.js +271 -0
- package/plugins-dist/approval/plugin.json +24 -0
- package/{dist/plugins → plugins-dist/approval}/policy.js +15 -81
- package/{dist/plugins → plugins-dist/approval}/review.js +56 -10
- package/{dist/plugins → plugins-dist/approval}/schema.js +0 -1
- package/plugins-dist/ask/index.js +145 -0
- package/plugins-dist/ask/plugin.json +12 -0
- package/plugins-dist/budget/index.js +37 -0
- package/plugins-dist/budget/plugin.json +15 -0
- package/{dist/plugins → plugins-dist/checks}/checks.js +46 -35
- package/plugins-dist/checks/index.js +150 -0
- package/plugins-dist/checks/plugin.json +21 -0
- package/plugins-dist/checks/project.js +76 -0
- package/plugins-dist/commands/index.js +33 -0
- package/plugins-dist/commands/plugin.json +9 -0
- package/{dist/plugins → plugins-dist/compact}/compact.js +51 -33
- package/plugins-dist/compact/index.js +100 -0
- package/plugins-dist/compact/plugin.json +25 -0
- package/plugins-dist/compact/style.js +14 -0
- package/plugins-dist/continue/index.js +57 -0
- package/plugins-dist/continue/plugin.json +15 -0
- package/{dist/ui → plugins-dist/fs}/diff.js +2 -3
- package/{dist/tools → plugins-dist/fs}/fs.js +17 -42
- package/{dist/tools → plugins-dist/fs}/grep.js +1 -2
- package/plugins-dist/fs/index.js +36 -0
- package/plugins-dist/fs/plugin.json +10 -0
- package/{dist/ui → plugins-dist/fs}/renderers.js +24 -61
- package/plugins-dist/fs/style.js +15 -0
- package/plugins-dist/fs/sys.js +54 -0
- package/plugins-dist/keys/index.js +36 -0
- package/plugins-dist/keys/plugin.json +9 -0
- package/plugins-dist/mcp/index.js +187 -0
- package/{dist → plugins-dist/mcp}/mcp.js +34 -30
- package/plugins-dist/mcp/plugin.json +12 -0
- package/plugins-dist/mcp/project.js +90 -0
- package/plugins-dist/memory/index.js +94 -0
- package/{dist → plugins-dist/memory}/memory.js +21 -3
- package/plugins-dist/memory/notes.js +36 -0
- package/plugins-dist/memory/plugin.json +11 -0
- package/plugins-dist/memory/style.js +14 -0
- package/plugins-dist/mentions/attach.js +120 -0
- package/plugins-dist/mentions/index.js +69 -0
- package/plugins-dist/mentions/plugin.json +9 -0
- package/plugins-dist/mentions/style.js +14 -0
- package/plugins-dist/models/config.js +53 -0
- package/plugins-dist/models/configure.js +415 -0
- package/plugins-dist/models/context.js +27 -0
- package/plugins-dist/models/index.js +167 -0
- package/plugins-dist/models/plugin.json +14 -0
- package/{dist → plugins-dist/models}/provider.js +18 -81
- package/plugins-dist/models/saved.js +80 -0
- package/plugins-dist/modes/index.js +190 -0
- package/plugins-dist/modes/plugin.json +18 -0
- package/plugins-dist/plugins/index.js +37 -0
- package/plugins-dist/plugins/plugin.json +10 -0
- package/plugins-dist/print/index.js +153 -0
- package/plugins-dist/print/plugin.json +14 -0
- package/plugins-dist/prompts/index.js +57 -0
- package/plugins-dist/prompts/plugin.json +13 -0
- package/plugins-dist/prompts/prompts.js +227 -0
- package/plugins-dist/prompts/sys.js +46 -0
- package/plugins-dist/renderers/index.js +36 -0
- package/plugins-dist/renderers/plugin.json +9 -0
- package/plugins-dist/repeats/index.js +165 -0
- package/plugins-dist/repeats/plugin.json +6 -0
- package/plugins-dist/schedule/cron.js +67 -0
- package/plugins-dist/schedule/index.js +281 -0
- package/plugins-dist/schedule/plugin.json +16 -0
- package/plugins-dist/schedule/store.js +125 -0
- package/plugins-dist/scratch/index.js +26 -0
- package/plugins-dist/scratch/plugin.json +10 -0
- package/plugins-dist/screenshot/index.js +35 -0
- package/plugins-dist/screenshot/plugin.json +11 -0
- package/plugins-dist/screenshot/sys.js +76 -0
- package/{dist/tools/screenshot.js → plugins-dist/screenshot/tool.js} +5 -4
- package/plugins-dist/sessions/index.js +136 -0
- package/plugins-dist/sessions/plugin.json +12 -0
- package/plugins-dist/shell/index.js +33 -0
- package/plugins-dist/shell/plugin.json +19 -0
- package/plugins-dist/shell/renderers.js +40 -0
- package/plugins-dist/shell/service.js +29 -0
- package/{dist/tools → plugins-dist/shell}/shell.js +31 -22
- package/{dist → plugins-dist/shell}/sys.js +2 -43
- package/plugins-dist/skills/index.js +90 -0
- package/plugins-dist/skills/plugin.json +12 -0
- package/plugins-dist/skills/project.js +47 -0
- package/{dist → plugins-dist/skills}/skills.js +3 -7
- package/plugins-dist/suggest/index.js +282 -0
- package/plugins-dist/suggest/plugin.json +23 -0
- package/plugins-dist/task/index.js +151 -0
- package/plugins-dist/task/plugin.json +23 -0
- package/plugins-dist/task/style.js +14 -0
- package/plugins-dist/task/subagent.js +208 -0
- package/{dist/tools/todo.js → plugins-dist/todo/index.js} +29 -7
- package/plugins-dist/todo/plugin.json +9 -0
- package/{dist/ui → plugins-dist/tui}/editor.js +3 -1
- package/plugins-dist/tui/frontend.js +586 -0
- package/{dist → plugins-dist/tui}/history.js +0 -1
- package/plugins-dist/tui/index.js +21 -0
- package/{dist/ui → plugins-dist/tui}/markdown.js +0 -1
- package/plugins-dist/tui/mentions.js +115 -0
- package/plugins-dist/tui/plugin.json +25 -0
- package/{dist/ui → plugins-dist/tui}/render.js +7 -3
- package/{dist/ui → plugins-dist/tui}/screen.js +6 -2
- package/{dist/ui → plugins-dist/tui}/transcript.js +76 -98
- package/{dist/ui → plugins-dist/tui}/tui.js +185 -53
- package/{dist/tools → plugins-dist/undo}/checkpoint.js +21 -55
- package/plugins-dist/undo/index.js +140 -0
- package/plugins-dist/undo/notes.js +36 -0
- package/plugins-dist/undo/plugin.json +9 -0
- package/plugins-dist/undo/style.js +14 -0
- package/plugins-dist/update/index.js +34 -0
- package/plugins-dist/update/plugin.json +15 -0
- package/plugins-dist/web/env.js +80 -0
- package/plugins-dist/web/index.js +124 -0
- package/plugins-dist/web/plugin.json +21 -0
- package/plugins-dist/web/renderers.js +7 -0
- package/{dist/tools → plugins-dist/web}/web.js +50 -24
- package/sdk/python/__pycache__/jade_plugin.cpython-312.pyc +0 -0
- package/sdk/python/jade_plugin.py +380 -0
- package/src/api.ts +298 -0
- package/src/config.ts +32 -134
- package/src/fetch.ts +216 -0
- package/src/hash.ts +39 -0
- package/src/host.ts +429 -0
- package/src/index.ts +23 -30
- package/src/install.ts +355 -0
- package/src/main.ts +155 -1387
- package/src/manifest.ts +160 -0
- package/src/membrane.ts +142 -0
- package/src/remote.ts +288 -0
- package/src/rescue.ts +217 -0
- package/src/resolve.ts +199 -0
- package/src/rpc.ts +144 -0
- package/src/secrets.ts +122 -0
- package/src/session.ts +458 -0
- package/src/source.ts +83 -0
- package/src/state.ts +120 -0
- package/src/update.ts +265 -262
- package/LICENSE +0 -21
- package/README.md +0 -204
- package/dist/commands.d.ts +0 -50
- package/dist/commands.js +0 -126
- package/dist/commands.js.map +0 -1
- package/dist/context.d.ts +0 -17
- package/dist/context.js +0 -53
- package/dist/context.js.map +0 -1
- package/dist/distro.d.ts +0 -141
- package/dist/distro.js +0 -462
- package/dist/distro.js.map +0 -1
- package/dist/history.d.ts +0 -10
- package/dist/history.js.map +0 -1
- package/dist/mcp.d.ts +0 -114
- package/dist/mcp.js.map +0 -1
- package/dist/memory.d.ts +0 -19
- package/dist/memory.js.map +0 -1
- package/dist/mentions.d.ts +0 -35
- package/dist/mentions.js +0 -130
- package/dist/mentions.js.map +0 -1
- package/dist/plugin-cli.d.ts +0 -16
- package/dist/plugin-cli.js +0 -294
- package/dist/plugin-cli.js.map +0 -1
- package/dist/plugins/budget.d.ts +0 -9
- package/dist/plugins/budget.js +0 -30
- package/dist/plugins/budget.js.map +0 -1
- package/dist/plugins/builtins.d.ts +0 -10
- package/dist/plugins/builtins.js +0 -25
- package/dist/plugins/builtins.js.map +0 -1
- package/dist/plugins/checks.d.ts +0 -71
- package/dist/plugins/checks.js.map +0 -1
- package/dist/plugins/compact.d.ts +0 -26
- package/dist/plugins/compact.js.map +0 -1
- package/dist/plugins/core.d.ts +0 -47
- package/dist/plugins/core.js +0 -229
- package/dist/plugins/core.js.map +0 -1
- package/dist/plugins/host.d.ts +0 -52
- package/dist/plugins/host.js +0 -115
- package/dist/plugins/host.js.map +0 -1
- package/dist/plugins/install.d.ts +0 -68
- package/dist/plugins/install.js +0 -377
- package/dist/plugins/install.js.map +0 -1
- package/dist/plugins/loader.d.ts +0 -410
- package/dist/plugins/loader.js +0 -407
- package/dist/plugins/loader.js.map +0 -1
- package/dist/plugins/policy.d.ts +0 -98
- package/dist/plugins/policy.js.map +0 -1
- package/dist/plugins/prompts.d.ts +0 -43
- package/dist/plugins/prompts.js +0 -284
- package/dist/plugins/prompts.js.map +0 -1
- package/dist/plugins/repeats.d.ts +0 -16
- package/dist/plugins/repeats.js +0 -151
- package/dist/plugins/repeats.js.map +0 -1
- package/dist/plugins/review.d.ts +0 -18
- package/dist/plugins/review.js.map +0 -1
- package/dist/plugins/schema.d.ts +0 -2
- package/dist/plugins/schema.js.map +0 -1
- package/dist/plugins/sessions.d.ts +0 -7
- package/dist/plugins/sessions.js +0 -110
- package/dist/plugins/sessions.js.map +0 -1
- package/dist/provider.d.ts +0 -165
- package/dist/provider.js.map +0 -1
- package/dist/session-lifecycle.d.ts +0 -61
- package/dist/session-lifecycle.js +0 -167
- package/dist/session-lifecycle.js.map +0 -1
- package/dist/session-scope.d.ts +0 -53
- package/dist/session-scope.js +0 -116
- package/dist/session-scope.js.map +0 -1
- package/dist/sessions.d.ts +0 -28
- package/dist/sessions.js +0 -73
- package/dist/sessions.js.map +0 -1
- package/dist/skills.d.ts +0 -37
- package/dist/skills.js.map +0 -1
- package/dist/sys.d.ts +0 -51
- package/dist/sys.js.map +0 -1
- package/dist/tools/ask.d.ts +0 -11
- package/dist/tools/ask.js +0 -62
- package/dist/tools/ask.js.map +0 -1
- package/dist/tools/checkpoint.d.ts +0 -43
- package/dist/tools/checkpoint.js.map +0 -1
- package/dist/tools/fs.d.ts +0 -39
- package/dist/tools/fs.js.map +0 -1
- package/dist/tools/grep.d.ts +0 -6
- package/dist/tools/grep.js.map +0 -1
- package/dist/tools/screenshot.d.ts +0 -15
- package/dist/tools/screenshot.js.map +0 -1
- package/dist/tools/shell.d.ts +0 -55
- package/dist/tools/shell.js.map +0 -1
- package/dist/tools/task.d.ts +0 -39
- package/dist/tools/task.js +0 -117
- package/dist/tools/task.js.map +0 -1
- package/dist/tools/todo.d.ts +0 -10
- package/dist/tools/todo.js.map +0 -1
- package/dist/tools/web.d.ts +0 -53
- package/dist/tools/web.js.map +0 -1
- package/dist/ui/configure.d.ts +0 -20
- package/dist/ui/configure.js +0 -447
- package/dist/ui/configure.js.map +0 -1
- package/dist/ui/diff.d.ts +0 -20
- package/dist/ui/diff.js.map +0 -1
- package/dist/ui/editor.d.ts +0 -41
- package/dist/ui/editor.js.map +0 -1
- package/dist/ui/markdown.d.ts +0 -22
- package/dist/ui/markdown.js.map +0 -1
- package/dist/ui/render.d.ts +0 -14
- package/dist/ui/render.js.map +0 -1
- package/dist/ui/renderers.d.ts +0 -8
- package/dist/ui/renderers.js.map +0 -1
- package/dist/ui/screen.d.ts +0 -118
- package/dist/ui/screen.js.map +0 -1
- package/dist/ui/transcript.d.ts +0 -46
- package/dist/ui/transcript.js.map +0 -1
- package/dist/ui/tui.d.ts +0 -47
- package/dist/ui/tui.js.map +0 -1
- package/src/commands.ts +0 -144
- package/src/context.ts +0 -64
- package/src/distro.ts +0 -577
- package/src/mentions.ts +0 -135
- package/src/plugin-cli.ts +0 -278
- package/src/plugins/budget.ts +0 -37
- package/src/plugins/builtins.ts +0 -34
- package/src/plugins/core.ts +0 -257
- package/src/plugins/host.ts +0 -146
- package/src/plugins/install.ts +0 -429
- package/src/plugins/loader.ts +0 -742
- package/src/plugins/prompts.ts +0 -327
- package/src/plugins/repeats.ts +0 -157
- package/src/plugins/sessions.ts +0 -109
- package/src/session-lifecycle.ts +0 -194
- package/src/session-scope.ts +0 -135
- package/src/sessions.ts +0 -78
- package/src/tools/ask.ts +0 -72
- package/src/tools/task.ts +0 -149
- package/src/ui/configure.ts +0 -471
- /package/{src/plugins → plugins/approval}/schema.ts +0 -0
- /package/{src → plugins/tui}/history.ts +0 -0
- /package/{src/ui → plugins/tui}/markdown.ts +0 -0
package/dist/plugins/host.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
// 进程级的插件管理(PluginHost):发现、读清单、加载、注册模型服务、退出时结束进程外插件。
|
|
2
|
-
//
|
|
3
|
-
// 整个 jade 进程只有一个。进程级的东西(插件模块、进程外插件的进程、模型服务)只在这里创建、只在这里销毁;
|
|
4
|
-
// 会话级的插件实例由 createJade 每个会话创建一套。见 docs/design/jade-plugin-lifecycle.md 第 3.1 节。
|
|
5
|
-
import { UntrustedPlugin } from "uncarved";
|
|
6
|
-
import { PROVIDER_KIND, registerProviders, SETTING_ENV } from "../provider.js";
|
|
7
|
-
import { discoverPlugins, loadPlugin, resolvePlugins } from "./loader.js";
|
|
8
|
-
/** 发现插件并读清单(不执行代码);按 id 停用的、id 重复的在这里去掉 */
|
|
9
|
-
export async function openPluginHost(opts) {
|
|
10
|
-
const show = opts.display ?? ((dir) => dir);
|
|
11
|
-
const errorText = (err) => (err instanceof Error ? err.message : String(err));
|
|
12
|
-
const resolved = await resolvePlugins(await discoverPlugins({ home: opts.home, root: opts.root, cwd: opts.cwd }), opts.disabled);
|
|
13
|
-
const loaded = [];
|
|
14
|
-
let loading;
|
|
15
|
-
let closing = false;
|
|
16
|
-
async function load() {
|
|
17
|
-
for (const { found, error } of resolved.broken)
|
|
18
|
-
opts.report("skipped", `plugin ${show(found.dir)}: ${errorText(error)}`);
|
|
19
|
-
for (const w of resolved.warnings)
|
|
20
|
-
opts.report("skipped", w);
|
|
21
|
-
for (const p of resolved.plugins) {
|
|
22
|
-
if (p.info.bundle.unsupported.length)
|
|
23
|
-
opts.report("note", `plugin ${p.id}: jade does not support its ${p.info.bundle.unsupported.join(" and ")} yet; they are ignored`);
|
|
24
|
-
try {
|
|
25
|
-
loaded.push(await loadPlugin(p, {
|
|
26
|
-
trust: opts.trust,
|
|
27
|
-
confirm: opts.confirm,
|
|
28
|
-
onExit: (plugin, { code, signal }) => {
|
|
29
|
-
if (!closing)
|
|
30
|
-
opts.report("warning", `plugin ${plugin.id} exited (${signal ?? `code ${code}`}); its hooks fail until jade restarts. /plugins shows its stderr`);
|
|
31
|
-
},
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
const hint = p.layer === "project" && err instanceof UntrustedPlugin && opts.untrustedHint ? ` ${opts.untrustedHint}` : "";
|
|
36
|
-
opts.report("skipped", `plugin ${show(p.dir)}: ${errorText(err)}${hint}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// 模型服务是插件模块导出的,不属于哪套插件实例:加载完注册一次,所有会话共用
|
|
40
|
-
const collected = collectProviders(loaded);
|
|
41
|
-
for (const w of [...collected.warnings, ...registerProviders(collected.providers)])
|
|
42
|
-
opts.report("warning", w);
|
|
43
|
-
return loaded;
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
plugins: resolved.plugins,
|
|
47
|
-
bundled: (pick) => resolved.plugins.flatMap((p) => pick(p.info.bundle).map((dir) => ({ plugin: p.id, dir, layer: p.layer }))),
|
|
48
|
-
load: () => (loading ??= load()),
|
|
49
|
-
loaded,
|
|
50
|
-
async close() {
|
|
51
|
-
closing = true;
|
|
52
|
-
await Promise.all(loaded.map((p) => p.close?.().catch(() => { })));
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* 插件模块导出的模型服务(LoadedPlugin.providers):检查后返回要注册的服务和要告诉用户的问题。
|
|
58
|
-
* 只认用户层插件:服务能看到全部对话和 API key。不用创建插件实例,所以宿主可以先注册服务、配置好模型,再创建插件
|
|
59
|
-
*/
|
|
60
|
-
export function collectProviders(sources) {
|
|
61
|
-
const warnings = [];
|
|
62
|
-
const providers = sources.flatMap((source) => {
|
|
63
|
-
if (source.providers === undefined)
|
|
64
|
-
return [];
|
|
65
|
-
const where = `plugin ${source.id} (${source.layer})`;
|
|
66
|
-
if (source.layer === "project") {
|
|
67
|
-
warnings.push(`${where}: providers are ignored: only user plugins can provide model services`);
|
|
68
|
-
return [];
|
|
69
|
-
}
|
|
70
|
-
if (!Array.isArray(source.providers)) {
|
|
71
|
-
warnings.push(`${where}: providers is ignored: it must be an array`);
|
|
72
|
-
return [];
|
|
73
|
-
}
|
|
74
|
-
return source.providers.flatMap((d) => {
|
|
75
|
-
const ok = d && typeof d.kind === "string" && PROVIDER_KIND.test(d.kind) && typeof d.model === "function" && typeof d.create === "function";
|
|
76
|
-
if (!ok) {
|
|
77
|
-
warnings.push(`${where}: provider ${JSON.stringify(d?.kind)} is ignored: it needs a kind of letters, digits, - and _, and model and create functions`);
|
|
78
|
-
return [];
|
|
79
|
-
}
|
|
80
|
-
// 不改插件导出的对象:用检查过的字段另做一个,方法绑定到原对象(插件的方法里可能用 this)
|
|
81
|
-
const def = {
|
|
82
|
-
kind: d.kind,
|
|
83
|
-
model: d.model.bind(d),
|
|
84
|
-
create: d.create.bind(d),
|
|
85
|
-
...(typeof d.via === "function" ? { via: d.via.bind(d) } : {}),
|
|
86
|
-
...(typeof d.listModels === "function" ? { listModels: d.listModels.bind(d) } : {}),
|
|
87
|
-
...(d.settings !== undefined ? { settings: providerSettings(d.settings, `${where}: provider ${d.kind}`, warnings) } : {}),
|
|
88
|
-
};
|
|
89
|
-
return [{ plugin: source.id, def }];
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
return { providers, warnings };
|
|
93
|
-
}
|
|
94
|
-
/** 插件服务的配置项:格式不对、用了 jade 自己的变量、重复、第二个 model 的跳过并警告 */
|
|
95
|
-
function providerSettings(raw, where, warnings) {
|
|
96
|
-
if (!Array.isArray(raw)) {
|
|
97
|
-
warnings.push(`${where}: settings are ignored: they must be an array`);
|
|
98
|
-
return [];
|
|
99
|
-
}
|
|
100
|
-
const out = [];
|
|
101
|
-
for (const x of raw) {
|
|
102
|
-
const env = x?.env;
|
|
103
|
-
if (typeof env !== "string" || !SETTING_ENV.test(env) || env.startsWith("JADE_") || typeof x.label !== "string") {
|
|
104
|
-
warnings.push(`${where}: setting ${JSON.stringify(env)} is ignored: it needs an env name of capital letters, digits and _ (not JADE_…) and a label`);
|
|
105
|
-
}
|
|
106
|
-
else if (out.some((o) => o.env === env))
|
|
107
|
-
warnings.push(`${where}: setting ${env} is ignored: it is listed twice`);
|
|
108
|
-
else if (x.model && out.some((o) => o.model))
|
|
109
|
-
warnings.push(`${where}: setting ${env} is ignored: only one setting can be the model`);
|
|
110
|
-
else
|
|
111
|
-
out.push(x);
|
|
112
|
-
}
|
|
113
|
-
return out;
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=host.js.map
|
package/dist/plugins/host.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/plugins/host.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,0DAA0D;AAC1D,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AAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,GAAG,iCAAiC,CAAC,CAAC;aAC/G,IAAI,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,GAAG,gDAAgD,CAAC,CAAC;;YACjI,GAAG,CAAC,IAAI,CAAC,CAAoB,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { type PluginInfo } from "./loader.ts";
|
|
2
|
-
export type SourceKind = "git" | "npm" | "local";
|
|
3
|
-
export interface PluginSource {
|
|
4
|
-
kind: SourceKind;
|
|
5
|
-
/** git:仓库地址;npm:交给 bun add 的写法;local:绝对路径 */
|
|
6
|
-
location: string;
|
|
7
|
-
/** git 的分支、tag 或提交 */
|
|
8
|
-
ref?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface InstallRecord {
|
|
11
|
-
/** 用户写的来源(本地路径换成了绝对路径) */
|
|
12
|
-
source: string;
|
|
13
|
-
kind: SourceKind | "link";
|
|
14
|
-
/** 只安装来源里的这个子目录 */
|
|
15
|
-
subdir?: string;
|
|
16
|
-
/** git:安装的提交 */
|
|
17
|
-
commit?: string;
|
|
18
|
-
version?: string;
|
|
19
|
-
installedAt: string;
|
|
20
|
-
updatedAt?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface InstallOptions {
|
|
23
|
-
/** 插件目录:$JADE_HOME/plugins 或 <仓库>/.jade/plugins */
|
|
24
|
-
pluginsDir: string;
|
|
25
|
-
/** 解析相对路径用 */
|
|
26
|
-
cwd: string;
|
|
27
|
-
/** 安装后的目录名,默认取插件声明的 name、包名或仓库名 */
|
|
28
|
-
name?: string;
|
|
29
|
-
subdir?: string;
|
|
30
|
-
/** 本地目录:建链接而不是复制 */
|
|
31
|
-
link?: boolean;
|
|
32
|
-
/** 已经有同名插件时替换它 */
|
|
33
|
-
force?: boolean;
|
|
34
|
-
/** 进度(正在下载、正在安装依赖) */
|
|
35
|
-
log?: (text: string) => void;
|
|
36
|
-
}
|
|
37
|
-
export interface Installed {
|
|
38
|
-
name: string;
|
|
39
|
-
dir: string;
|
|
40
|
-
record: InstallRecord;
|
|
41
|
-
info: PluginInfo;
|
|
42
|
-
}
|
|
43
|
-
/** 插件目录名 */
|
|
44
|
-
export declare const PLUGIN_NAME: RegExp;
|
|
45
|
-
/** 识别来源的种类 */
|
|
46
|
-
export declare function parseSource(spec: string, cwd: string): Promise<PluginSource>;
|
|
47
|
-
export declare function addPlugin(spec: string, opts: InstallOptions): Promise<Installed>;
|
|
48
|
-
export interface UpdateResult {
|
|
49
|
-
name: string;
|
|
50
|
-
status: "updated" | "current" | "linked" | "unmanaged" | "failed";
|
|
51
|
-
from?: string;
|
|
52
|
-
to?: string;
|
|
53
|
-
error?: string;
|
|
54
|
-
}
|
|
55
|
-
/** 按安装记录重新下载;没给名字时更新这个插件目录里所有用 jade plugin add 装的插件 */
|
|
56
|
-
export declare function updatePlugins(names: string[], opts: Omit<InstallOptions, "name" | "subdir" | "link" | "force">): Promise<UpdateResult[]>;
|
|
57
|
-
/** 删除插件目录(链接只删链接本身)和安装记录;不存在时返回 false */
|
|
58
|
-
export declare function removePlugin(name: string, pluginsDir: string): Promise<boolean>;
|
|
59
|
-
export declare function readRecords(pluginsDir: string): Promise<Record<string, InstallRecord>>;
|
|
60
|
-
/** $JADE_HOME/plugins.json:只有用户层能停用插件,仓库不能停用用户的插件或内置插件 */
|
|
61
|
-
export interface PluginSettings {
|
|
62
|
-
/** 停用的插件的 id:内置插件(jade/web)或第三方插件(plugin.json 的 id) */
|
|
63
|
-
disabled: string[];
|
|
64
|
-
}
|
|
65
|
-
export declare function readPluginSettings(home: string): Promise<PluginSettings>;
|
|
66
|
-
export declare function setDisabled(home: string, name: string, disabled: boolean): Promise<boolean>;
|
|
67
|
-
/** 插件目录里的子目录名(不含 . 开头的临时目录) */
|
|
68
|
-
export declare function installedNames(pluginsDir: string): Promise<string[]>;
|
package/dist/plugins/install.js
DELETED
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
// 插件的安装、更新、卸载(jade plugin …)。
|
|
2
|
-
//
|
|
3
|
-
// 来源有三种:
|
|
4
|
-
// - git:https://…、git@…、github:user/repo、user/repo(本地没有这个路径时),可以用 #ref 指定分支、tag 或提交;
|
|
5
|
-
// - npm:包名(可以带 @版本)、npm:<任意 bun add 认识的写法>、本地的 .tgz;
|
|
6
|
-
// - 本地目录:复制过来;--link 时只建一个链接,方便开发插件。
|
|
7
|
-
// 先下载到插件目录里的 .staging-* 临时目录(以 . 开头,发现插件时会跳过),检查确实是插件、装好依赖之后再改名就位,
|
|
8
|
-
// 失败时不会留下装了一半的插件。安装记录在插件目录的 .installed.json 里,jade plugin update 按记录重新下载。
|
|
9
|
-
//
|
|
10
|
-
// 安装不执行插件的代码;插件的 package.json 有 dependencies 时安装依赖(Bun 下用 bun,Node 下用 npm,都不运行安装脚本)。
|
|
11
|
-
import { execFile } from "node:child_process";
|
|
12
|
-
import { randomBytes } from "node:crypto";
|
|
13
|
-
import { cp, lstat, mkdir, readdir, readFile, rename, rm, rmdir, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
14
|
-
import path from "node:path";
|
|
15
|
-
import { inspectPlugin } from "./loader.js";
|
|
16
|
-
import { npmCommand } from "../sys.js";
|
|
17
|
-
/** 插件目录名 */
|
|
18
|
-
export const PLUGIN_NAME = /^[a-z0-9][a-z0-9._-]*$/;
|
|
19
|
-
const RECORDS = ".installed.json";
|
|
20
|
-
/** 识别来源的种类 */
|
|
21
|
-
export async function parseSource(spec, cwd) {
|
|
22
|
-
const s = spec.trim();
|
|
23
|
-
if (!s)
|
|
24
|
-
throw new Error("no plugin source given");
|
|
25
|
-
if (s.startsWith("npm:"))
|
|
26
|
-
return { kind: "npm", location: s.slice(4) };
|
|
27
|
-
const [base, ref] = splitRef(s);
|
|
28
|
-
if (/^github:/.test(base))
|
|
29
|
-
return { kind: "git", location: `https://github.com/${base.slice(7).replace(/\.git$/, "")}.git`, ref };
|
|
30
|
-
if (/^gitlab:/.test(base))
|
|
31
|
-
return { kind: "git", location: `https://gitlab.com/${base.slice(7).replace(/\.git$/, "")}.git`, ref };
|
|
32
|
-
if (/^git\+/.test(base))
|
|
33
|
-
return { kind: "git", location: base.slice(4), ref };
|
|
34
|
-
if (/^(git@|ssh:\/\/|git:\/\/)/.test(base))
|
|
35
|
-
return { kind: "git", location: base, ref };
|
|
36
|
-
if (/^https?:\/\//.test(base)) {
|
|
37
|
-
if (/\.(tgz|tar\.gz)$/.test(base))
|
|
38
|
-
return { kind: "npm", location: s };
|
|
39
|
-
return { kind: "git", location: base, ref };
|
|
40
|
-
}
|
|
41
|
-
const local = path.resolve(cwd, s.replace(/^~(?=$|[\\/])/, process.env.HOME ?? process.env.USERPROFILE ?? "~"));
|
|
42
|
-
const info = await stat(local).catch(() => undefined);
|
|
43
|
-
if (info?.isDirectory())
|
|
44
|
-
return { kind: "local", location: local };
|
|
45
|
-
if (info?.isFile()) {
|
|
46
|
-
if (/\.(tgz|tar\.gz)$/.test(local))
|
|
47
|
-
return { kind: "npm", location: local };
|
|
48
|
-
throw new Error(`${s} is a file; give a plugin directory, a .tgz package, a git URL or an npm package`);
|
|
49
|
-
}
|
|
50
|
-
// user/repo:本地没有这个路径时按 GitHub 仓库处理(npm 的包名不含 /,带作用域的以 @ 开头)
|
|
51
|
-
if (/^[\w.-]+\/[\w.-]+$/.test(base) && !s.startsWith(".")) {
|
|
52
|
-
return { kind: "git", location: `https://github.com/${base.replace(/\.git$/, "")}.git`, ref };
|
|
53
|
-
}
|
|
54
|
-
if (/^(\.|\/|[a-zA-Z]:[\\/])/.test(s))
|
|
55
|
-
throw new Error(`${s} does not exist`);
|
|
56
|
-
return { kind: "npm", location: s };
|
|
57
|
-
}
|
|
58
|
-
/** "url#ref" 拆成两部分 */
|
|
59
|
-
function splitRef(s) {
|
|
60
|
-
const i = s.lastIndexOf("#");
|
|
61
|
-
return i > 0 ? [s.slice(0, i), s.slice(i + 1) || undefined] : [s, undefined];
|
|
62
|
-
}
|
|
63
|
-
export async function addPlugin(spec, opts) {
|
|
64
|
-
const source = await parseSource(spec, opts.cwd);
|
|
65
|
-
await mkdir(opts.pluginsDir, { recursive: true });
|
|
66
|
-
if (opts.link) {
|
|
67
|
-
if (source.kind !== "local")
|
|
68
|
-
throw new Error("--link only works with a local directory");
|
|
69
|
-
const dir = opts.subdir ? inSubdir(source.location, opts.subdir) : source.location;
|
|
70
|
-
const info = await inspectPlugin(dir);
|
|
71
|
-
const name = pickName(opts.name, info, dir);
|
|
72
|
-
const target = path.join(opts.pluginsDir, name);
|
|
73
|
-
await makeRoom(target, name, opts.force);
|
|
74
|
-
await symlink(dir, target, process.platform === "win32" ? "junction" : "dir");
|
|
75
|
-
const record = { source: dir, kind: "link", installedAt: now(), ...(info.version ? { version: info.version } : {}) };
|
|
76
|
-
await saveRecord(opts.pluginsDir, name, record);
|
|
77
|
-
return { name, dir: target, record, info };
|
|
78
|
-
}
|
|
79
|
-
const staging = path.join(opts.pluginsDir, `.staging-${randomBytes(4).toString("hex")}`);
|
|
80
|
-
try {
|
|
81
|
-
const fetched = await fetchInto(source, staging, opts.subdir, opts.log);
|
|
82
|
-
const name = pickName(opts.name, fetched.info, opts.subdir ?? nameHint(source));
|
|
83
|
-
const target = path.join(opts.pluginsDir, name);
|
|
84
|
-
await makeRoom(target, name, opts.force);
|
|
85
|
-
await rename(fetched.dir, target);
|
|
86
|
-
const record = {
|
|
87
|
-
source: source.kind === "local" ? source.location : spec.trim(),
|
|
88
|
-
kind: source.kind,
|
|
89
|
-
...(opts.subdir ? { subdir: opts.subdir } : {}),
|
|
90
|
-
...(fetched.commit ? { commit: fetched.commit } : {}),
|
|
91
|
-
...(fetched.info.version ? { version: fetched.info.version } : {}),
|
|
92
|
-
installedAt: now(),
|
|
93
|
-
};
|
|
94
|
-
await saveRecord(opts.pluginsDir, name, record);
|
|
95
|
-
return { name, dir: target, record, info: fetched.info };
|
|
96
|
-
}
|
|
97
|
-
finally {
|
|
98
|
-
await rm(staging, { recursive: true, force: true }).catch(() => { });
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/** 按安装记录重新下载;没给名字时更新这个插件目录里所有用 jade plugin add 装的插件 */
|
|
102
|
-
export async function updatePlugins(names, opts) {
|
|
103
|
-
const records = await readRecords(opts.pluginsDir);
|
|
104
|
-
const targets = names.length ? names : Object.keys(records).sort();
|
|
105
|
-
const out = [];
|
|
106
|
-
for (const name of targets) {
|
|
107
|
-
const rec = records[name];
|
|
108
|
-
const target = path.join(opts.pluginsDir, name);
|
|
109
|
-
if (!rec) {
|
|
110
|
-
const exists = await stat(target).catch(() => undefined);
|
|
111
|
-
out.push({ name, status: exists ? "unmanaged" : "failed", ...(exists ? {} : { error: "not installed" }) });
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
if (rec.kind === "link") {
|
|
115
|
-
out.push({ name, status: "linked" });
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
const staging = path.join(opts.pluginsDir, `.staging-${randomBytes(4).toString("hex")}`);
|
|
119
|
-
try {
|
|
120
|
-
opts.log?.(`${name}: fetching ${rec.source}`);
|
|
121
|
-
const source = await parseSource(rec.source, opts.cwd);
|
|
122
|
-
const fetched = await fetchInto(source, staging, rec.subdir, opts.log);
|
|
123
|
-
const from = rec.commit?.slice(0, 7) ?? rec.version;
|
|
124
|
-
const to = fetched.commit?.slice(0, 7) ?? fetched.info.version;
|
|
125
|
-
// git 看提交,npm 看版本;本地目录每次都重新复制
|
|
126
|
-
const same = rec.kind === "git" ? rec.commit === fetched.commit : rec.kind === "npm" ? rec.version !== undefined && rec.version === fetched.info.version : false;
|
|
127
|
-
if (same && (await stat(target).catch(() => undefined))) {
|
|
128
|
-
out.push({ name, status: "current", to });
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
const old = path.join(opts.pluginsDir, `.old-${randomBytes(4).toString("hex")}`);
|
|
132
|
-
const had = Boolean(await lstat(target).catch(() => undefined));
|
|
133
|
-
if (had)
|
|
134
|
-
await rename(target, old);
|
|
135
|
-
try {
|
|
136
|
-
await rename(fetched.dir, target);
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
if (had)
|
|
140
|
-
await rename(old, target).catch(() => { });
|
|
141
|
-
throw err;
|
|
142
|
-
}
|
|
143
|
-
if (had)
|
|
144
|
-
await removeDir(old);
|
|
145
|
-
const next = {
|
|
146
|
-
...rec,
|
|
147
|
-
...(fetched.commit ? { commit: fetched.commit } : {}),
|
|
148
|
-
...(fetched.info.version ? { version: fetched.info.version } : {}),
|
|
149
|
-
updatedAt: now(),
|
|
150
|
-
};
|
|
151
|
-
await saveRecord(opts.pluginsDir, name, next);
|
|
152
|
-
out.push({ name, status: "updated", from, to });
|
|
153
|
-
}
|
|
154
|
-
catch (err) {
|
|
155
|
-
out.push({ name, status: "failed", error: err instanceof Error ? err.message : String(err) });
|
|
156
|
-
}
|
|
157
|
-
finally {
|
|
158
|
-
await rm(staging, { recursive: true, force: true }).catch(() => { });
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return out;
|
|
162
|
-
}
|
|
163
|
-
/** 删除插件目录(链接只删链接本身)和安装记录;不存在时返回 false */
|
|
164
|
-
export async function removePlugin(name, pluginsDir) {
|
|
165
|
-
if (!PLUGIN_NAME.test(name))
|
|
166
|
-
throw new Error(`invalid plugin name ${JSON.stringify(name)}`);
|
|
167
|
-
const target = path.join(pluginsDir, name);
|
|
168
|
-
const existed = Boolean(await lstat(target).catch(() => undefined));
|
|
169
|
-
if (existed)
|
|
170
|
-
await removeDir(target);
|
|
171
|
-
const records = await readRecords(pluginsDir);
|
|
172
|
-
const recorded = name in records;
|
|
173
|
-
if (recorded) {
|
|
174
|
-
delete records[name];
|
|
175
|
-
await writeRecords(pluginsDir, records);
|
|
176
|
-
}
|
|
177
|
-
return existed || recorded;
|
|
178
|
-
}
|
|
179
|
-
export async function readRecords(pluginsDir) {
|
|
180
|
-
try {
|
|
181
|
-
const json = JSON.parse(await readFile(path.join(pluginsDir, RECORDS), "utf8"));
|
|
182
|
-
return typeof json?.plugins === "object" && json.plugins !== null ? json.plugins : {};
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
return {};
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
async function writeRecords(pluginsDir, records) {
|
|
189
|
-
const sorted = Object.fromEntries(Object.entries(records).sort(([a], [b]) => a.localeCompare(b)));
|
|
190
|
-
await writeFile(path.join(pluginsDir, RECORDS), `${JSON.stringify({ plugins: sorted }, null, 2)}\n`);
|
|
191
|
-
}
|
|
192
|
-
async function saveRecord(pluginsDir, name, record) {
|
|
193
|
-
const records = await readRecords(pluginsDir);
|
|
194
|
-
records[name] = record;
|
|
195
|
-
await writeRecords(pluginsDir, records);
|
|
196
|
-
}
|
|
197
|
-
// ---------- 下载 ----------
|
|
198
|
-
/** 下载到 staging 里,返回插件目录(staging 里的某个子目录) */
|
|
199
|
-
async function fetchInto(source, staging, subdir, log) {
|
|
200
|
-
await mkdir(staging, { recursive: true });
|
|
201
|
-
let root;
|
|
202
|
-
let commit;
|
|
203
|
-
if (source.kind === "git") {
|
|
204
|
-
root = path.join(staging, "repo");
|
|
205
|
-
log?.(`cloning ${source.location}${source.ref ? ` (${source.ref})` : ""}`);
|
|
206
|
-
try {
|
|
207
|
-
await run("git", ["clone", "--depth", "1", ...(source.ref ? ["--branch", source.ref] : []), "--", source.location, root], staging);
|
|
208
|
-
}
|
|
209
|
-
catch (err) {
|
|
210
|
-
// --branch 不认提交哈希:完整克隆后再切过去
|
|
211
|
-
if (!source.ref)
|
|
212
|
-
throw err;
|
|
213
|
-
await rm(root, { recursive: true, force: true });
|
|
214
|
-
await run("git", ["clone", "--", source.location, root], staging);
|
|
215
|
-
await run("git", ["checkout", "--detach", source.ref], root);
|
|
216
|
-
}
|
|
217
|
-
commit = (await run("git", ["rev-parse", "HEAD"], root)).trim();
|
|
218
|
-
await rm(path.join(root, ".git"), { recursive: true, force: true });
|
|
219
|
-
}
|
|
220
|
-
else if (source.kind === "npm") {
|
|
221
|
-
const work = path.join(staging, "npm");
|
|
222
|
-
await mkdir(work);
|
|
223
|
-
await writeFile(path.join(work, "package.json"), JSON.stringify({ name: "jade-plugin-download", private: true }));
|
|
224
|
-
log?.(`downloading ${source.location}`);
|
|
225
|
-
const pm = packageManager();
|
|
226
|
-
await run(pm.cmd, [...pm.prefix, ...pm.add(source.location)], work);
|
|
227
|
-
const deps = Object.keys((JSON.parse(await readFile(path.join(work, "package.json"), "utf8")).dependencies ?? {}));
|
|
228
|
-
if (deps.length !== 1)
|
|
229
|
-
throw new Error(`could not tell which package ${source.location} installed`);
|
|
230
|
-
root = path.join(staging, "package");
|
|
231
|
-
// 包的依赖装在外层的 node_modules 里,复制过去之后重新安装
|
|
232
|
-
await cp(path.join(work, "node_modules", deps[0]), root, { recursive: true, dereference: true });
|
|
233
|
-
// bun 在包目录里留下的标记,不属于插件
|
|
234
|
-
await rm(path.join(root, ".bun-tag"), { force: true });
|
|
235
|
-
await rm(work, { recursive: true, force: true });
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
root = path.join(staging, "local");
|
|
239
|
-
log?.(`copying ${source.location}`);
|
|
240
|
-
await cp(source.location, root, {
|
|
241
|
-
recursive: true,
|
|
242
|
-
filter: (src) => !/[\\/](node_modules|\.git)$/.test(src),
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
const dir = subdir ? inSubdir(root, subdir) : root;
|
|
246
|
-
const info = await inspectPlugin(dir);
|
|
247
|
-
await installDependencies(dir, log);
|
|
248
|
-
return { dir, commit, info };
|
|
249
|
-
}
|
|
250
|
-
async function installDependencies(dir, log) {
|
|
251
|
-
let pkg;
|
|
252
|
-
try {
|
|
253
|
-
pkg = JSON.parse(await readFile(path.join(dir, "package.json"), "utf8"));
|
|
254
|
-
}
|
|
255
|
-
catch {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
if (!pkg.dependencies || Object.keys(pkg.dependencies).length === 0)
|
|
259
|
-
return;
|
|
260
|
-
log?.("installing dependencies");
|
|
261
|
-
const pm = packageManager();
|
|
262
|
-
await run(pm.cmd, [...pm.prefix, ...pm.install], dir);
|
|
263
|
-
}
|
|
264
|
-
function inSubdir(root, subdir) {
|
|
265
|
-
const full = path.resolve(root, subdir);
|
|
266
|
-
const rel = path.relative(root, full);
|
|
267
|
-
if (rel === ".." || rel.startsWith(`..${path.sep}`) || path.isAbsolute(rel))
|
|
268
|
-
throw new Error(`--path ${subdir} points outside the source`);
|
|
269
|
-
return full;
|
|
270
|
-
}
|
|
271
|
-
function nameHint(source) {
|
|
272
|
-
if (source.kind === "npm")
|
|
273
|
-
return source.location.replace(/^(@[^/]+\/)?/, "").replace(/@.*$/, "").replace(/\.(tgz|tar\.gz)$/, "");
|
|
274
|
-
return source.location.replace(/[\\/]+$/, "").replace(/\.git$/, "");
|
|
275
|
-
}
|
|
276
|
-
/** --name,否则插件声明的名字,否则来源的最后一段;整理成合法的目录名 */
|
|
277
|
-
function pickName(given, info, hint) {
|
|
278
|
-
if (given !== undefined) {
|
|
279
|
-
if (!PLUGIN_NAME.test(given))
|
|
280
|
-
throw new Error(`--name may only contain lowercase letters, digits, '.', '_' and '-'`);
|
|
281
|
-
return given;
|
|
282
|
-
}
|
|
283
|
-
const raw = info.name ?? path.basename(hint);
|
|
284
|
-
const name = raw
|
|
285
|
-
.toLowerCase()
|
|
286
|
-
.replace(/^@[^/]+\//, "")
|
|
287
|
-
.replace(/[^a-z0-9._-]+/g, "-")
|
|
288
|
-
.replace(/^[^a-z0-9]+/, "")
|
|
289
|
-
.replace(/-+$/, "");
|
|
290
|
-
if (!PLUGIN_NAME.test(name))
|
|
291
|
-
throw new Error(`cannot derive a directory name from ${JSON.stringify(raw)}; pass --name`);
|
|
292
|
-
return name;
|
|
293
|
-
}
|
|
294
|
-
async function makeRoom(target, name, force) {
|
|
295
|
-
if (!(await lstat(target).catch(() => undefined)))
|
|
296
|
-
return;
|
|
297
|
-
if (!force)
|
|
298
|
-
throw new Error(`plugin ${name} is already installed (${target}); use jade plugin update, or --force to replace it`);
|
|
299
|
-
await removeDir(target);
|
|
300
|
-
}
|
|
301
|
-
/** 链接(包括 Windows 的 junction)只删链接本身,不碰它指向的目录 */
|
|
302
|
-
async function removeDir(p) {
|
|
303
|
-
const info = await lstat(p);
|
|
304
|
-
if (info.isSymbolicLink()) {
|
|
305
|
-
await unlink(p).catch(() => rmdir(p));
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
await rm(p, { recursive: true, force: true });
|
|
309
|
-
}
|
|
310
|
-
const now = () => new Date().toISOString();
|
|
311
|
-
/** 跑在 Bun 下用 bun 自己;跑在 Node 下用 npm(Windows 上的 npm.cmd 不能直接执行,用 node 运行 npm 的 CLI 脚本) */
|
|
312
|
-
function packageManager() {
|
|
313
|
-
if (process.versions.bun) {
|
|
314
|
-
return { cmd: process.execPath, prefix: [], add: (spec) => ["add", "--ignore-scripts", spec], install: ["install", "--production"] };
|
|
315
|
-
}
|
|
316
|
-
const npm = npmCommand();
|
|
317
|
-
if (!npm)
|
|
318
|
-
throw new Error("npm was not found; it is needed to install plugins from npm or plugins with dependencies");
|
|
319
|
-
const quiet = ["--ignore-scripts", "--no-audit", "--no-fund", "--loglevel=error"];
|
|
320
|
-
return { cmd: npm[0], prefix: npm.slice(1), add: (spec) => ["install", ...quiet, spec], install: ["install", "--omit=dev", ...quiet] };
|
|
321
|
-
}
|
|
322
|
-
function run(cmd, args, cwd) {
|
|
323
|
-
return new Promise((resolve, reject) => {
|
|
324
|
-
execFile(cmd, args, { cwd, windowsHide: true, maxBuffer: 16 * 1024 * 1024, env: { ...process.env, GIT_TERMINAL_PROMPT: "0" } }, (err, stdout, stderr) => {
|
|
325
|
-
if (err) {
|
|
326
|
-
const detail = `${stderr || stdout}`.trim().split(/\r?\n/).slice(-6).join("\n");
|
|
327
|
-
const missing = err.code === "ENOENT";
|
|
328
|
-
const name = args[0]?.endsWith(".js") ? `npm ${args[1]}` : `${path.basename(cmd)} ${args[0]}`;
|
|
329
|
-
reject(new Error(missing ? `${cmd} is not installed or not on PATH` : `${name} failed${detail ? `:\n${detail}` : ""}`));
|
|
330
|
-
}
|
|
331
|
-
else
|
|
332
|
-
resolve(stdout);
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
export async function readPluginSettings(home) {
|
|
337
|
-
try {
|
|
338
|
-
const json = JSON.parse(await readFile(path.join(home, "plugins.json"), "utf8"));
|
|
339
|
-
const disabled = Array.isArray(json?.disabled) ? json.disabled.filter((x) => typeof x === "string") : [];
|
|
340
|
-
return { disabled };
|
|
341
|
-
}
|
|
342
|
-
catch {
|
|
343
|
-
return { disabled: [] };
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
export async function setDisabled(home, name, disabled) {
|
|
347
|
-
const s = await readPluginSettings(home);
|
|
348
|
-
const has = s.disabled.includes(name);
|
|
349
|
-
if (has === disabled)
|
|
350
|
-
return false;
|
|
351
|
-
const next = disabled ? [...s.disabled, name].sort() : s.disabled.filter((x) => x !== name);
|
|
352
|
-
await mkdir(home, { recursive: true });
|
|
353
|
-
let json = {};
|
|
354
|
-
try {
|
|
355
|
-
json = JSON.parse(await readFile(path.join(home, "plugins.json"), "utf8"));
|
|
356
|
-
}
|
|
357
|
-
catch {
|
|
358
|
-
// 不存在或格式不对时重写
|
|
359
|
-
}
|
|
360
|
-
await writeFile(path.join(home, "plugins.json"), `${JSON.stringify({ ...json, disabled: next }, null, 2)}\n`);
|
|
361
|
-
return true;
|
|
362
|
-
}
|
|
363
|
-
/** 插件目录里的子目录名(不含 . 开头的临时目录) */
|
|
364
|
-
export async function installedNames(pluginsDir) {
|
|
365
|
-
try {
|
|
366
|
-
const names = (await readdir(pluginsDir)).filter((n) => !n.startsWith("."));
|
|
367
|
-
const out = [];
|
|
368
|
-
for (const n of names.sort())
|
|
369
|
-
if ((await stat(path.join(pluginsDir, n)).catch(() => undefined))?.isDirectory())
|
|
370
|
-
out.push(n);
|
|
371
|
-
return out;
|
|
372
|
-
}
|
|
373
|
-
catch {
|
|
374
|
-
return [];
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
//# sourceMappingURL=install.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/plugins/install.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,SAAS;AACT,qFAAqF;AACrF,qDAAqD;AACrD,qCAAqC;AACrC,mEAAmE;AACnE,0EAA0E;AAC1E,EAAE;AACF,qFAAqF;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5H,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAmB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAgDvC,YAAY;AACZ,MAAM,CAAC,MAAM,WAAW,GAAG,wBAAwB,CAAC;AACpD,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAElC,cAAc;AACd,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,GAAW;IACzD,MAAM,CAAC,GAAG,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