@neurocode-ai/web 1.18.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/README.md +54 -0
- package/astro.config.mjs +324 -0
- package/config.mjs +14 -0
- package/package.json +44 -0
- package/public/apple-touch-icon-v3.png +1 -0
- package/public/apple-touch-icon.png +1 -0
- package/public/favicon-96x96-v3.png +1 -0
- package/public/favicon-96x96.png +1 -0
- package/public/favicon-v3.ico +1 -0
- package/public/favicon-v3.svg +1 -0
- package/public/favicon.ico +1 -0
- package/public/favicon.svg +1 -0
- package/public/robots.txt +6 -0
- package/public/site.webmanifest +1 -0
- package/public/social-share-zen.png +1 -0
- package/public/social-share.png +1 -0
- package/public/theme.json +183 -0
- package/public/web-app-manifest-192x192.png +1 -0
- package/public/web-app-manifest-512x512.png +1 -0
- package/src/assets/lander/check.svg +2 -0
- package/src/assets/lander/copy.svg +2 -0
- package/src/assets/lander/screenshot-github.png +0 -0
- package/src/assets/lander/screenshot-splash.png +0 -0
- package/src/assets/lander/screenshot-vscode.png +0 -0
- package/src/assets/lander/screenshot.png +0 -0
- package/src/assets/logo-dark.svg +18 -0
- package/src/assets/logo-light.svg +18 -0
- package/src/assets/logo-ornate-dark.svg +18 -0
- package/src/assets/logo-ornate-light.svg +18 -0
- package/src/assets/web/web-homepage-active-session.png +0 -0
- package/src/assets/web/web-homepage-new-session.png +0 -0
- package/src/assets/web/web-homepage-see-servers.png +0 -0
- package/src/components/Footer.astro +125 -0
- package/src/components/Head.astro +54 -0
- package/src/components/Header.astro +136 -0
- package/src/components/Hero.astro +11 -0
- package/src/components/Lander.astro +721 -0
- package/src/components/LanguageSelect.astro +29 -0
- package/src/components/Share.tsx +644 -0
- package/src/components/SiteTitle.astro +59 -0
- package/src/components/icons/custom.tsx +87 -0
- package/src/components/icons/index.tsx +4454 -0
- package/src/components/share/common.tsx +128 -0
- package/src/components/share/content-bash.module.css +85 -0
- package/src/components/share/content-bash.tsx +67 -0
- package/src/components/share/content-code.module.css +26 -0
- package/src/components/share/content-code.tsx +30 -0
- package/src/components/share/content-diff.module.css +153 -0
- package/src/components/share/content-diff.tsx +240 -0
- package/src/components/share/content-error.module.css +64 -0
- package/src/components/share/content-error.tsx +25 -0
- package/src/components/share/content-markdown.module.css +154 -0
- package/src/components/share/content-markdown.tsx +74 -0
- package/src/components/share/content-text.module.css +63 -0
- package/src/components/share/content-text.tsx +38 -0
- package/src/components/share/copy-button.module.css +30 -0
- package/src/components/share/copy-button.tsx +36 -0
- package/src/components/share/part.module.css +428 -0
- package/src/components/share/part.tsx +816 -0
- package/src/components/share.module.css +832 -0
- package/src/content/docs/acp.mdx +156 -0
- package/src/content/docs/agents.mdx +781 -0
- package/src/content/docs/ar/acp.mdx +156 -0
- package/src/content/docs/ar/agents.mdx +754 -0
- package/src/content/docs/ar/cli.mdx +616 -0
- package/src/content/docs/ar/commands.mdx +322 -0
- package/src/content/docs/ar/config.mdx +685 -0
- package/src/content/docs/ar/custom-tools.mdx +196 -0
- package/src/content/docs/ar/ecosystem.mdx +78 -0
- package/src/content/docs/ar/enterprise.mdx +165 -0
- package/src/content/docs/ar/formatters.mdx +131 -0
- package/src/content/docs/ar/github.mdx +321 -0
- package/src/content/docs/ar/gitlab.mdx +195 -0
- package/src/content/docs/ar/go.mdx +224 -0
- package/src/content/docs/ar/ide.mdx +48 -0
- package/src/content/docs/ar/index.mdx +344 -0
- package/src/content/docs/ar/keybinds.mdx +194 -0
- package/src/content/docs/ar/lsp.mdx +207 -0
- package/src/content/docs/ar/mcp-servers.mdx +511 -0
- package/src/content/docs/ar/models.mdx +222 -0
- package/src/content/docs/ar/network.mdx +57 -0
- package/src/content/docs/ar/permissions.mdx +235 -0
- package/src/content/docs/ar/plugins.mdx +385 -0
- package/src/content/docs/ar/providers.mdx +1983 -0
- package/src/content/docs/ar/rules.mdx +180 -0
- package/src/content/docs/ar/sdk.mdx +463 -0
- package/src/content/docs/ar/server.mdx +287 -0
- package/src/content/docs/ar/share.mdx +127 -0
- package/src/content/docs/ar/skills.mdx +222 -0
- package/src/content/docs/ar/themes.mdx +369 -0
- package/src/content/docs/ar/tools.mdx +341 -0
- package/src/content/docs/ar/troubleshooting.mdx +299 -0
- package/src/content/docs/ar/tui.mdx +426 -0
- package/src/content/docs/ar/web.mdx +142 -0
- package/src/content/docs/ar/windows-wsl.mdx +113 -0
- package/src/content/docs/ar/zen.mdx +332 -0
- package/src/content/docs/bs/acp.mdx +156 -0
- package/src/content/docs/bs/agents.mdx +754 -0
- package/src/content/docs/bs/cli.mdx +614 -0
- package/src/content/docs/bs/commands.mdx +316 -0
- package/src/content/docs/bs/config.mdx +685 -0
- package/src/content/docs/bs/custom-tools.mdx +195 -0
- package/src/content/docs/bs/ecosystem.mdx +78 -0
- package/src/content/docs/bs/enterprise.mdx +165 -0
- package/src/content/docs/bs/formatters.mdx +124 -0
- package/src/content/docs/bs/github.mdx +311 -0
- package/src/content/docs/bs/gitlab.mdx +188 -0
- package/src/content/docs/bs/go.mdx +238 -0
- package/src/content/docs/bs/ide.mdx +47 -0
- package/src/content/docs/bs/index.mdx +323 -0
- package/src/content/docs/bs/keybinds.mdx +194 -0
- package/src/content/docs/bs/lsp.mdx +204 -0
- package/src/content/docs/bs/mcp-servers.mdx +482 -0
- package/src/content/docs/bs/models.mdx +201 -0
- package/src/content/docs/bs/network.mdx +51 -0
- package/src/content/docs/bs/permissions.mdx +228 -0
- package/src/content/docs/bs/plugins.mdx +371 -0
- package/src/content/docs/bs/providers.mdx +1993 -0
- package/src/content/docs/bs/rules.mdx +180 -0
- package/src/content/docs/bs/sdk.mdx +463 -0
- package/src/content/docs/bs/server.mdx +284 -0
- package/src/content/docs/bs/share.mdx +127 -0
- package/src/content/docs/bs/skills.mdx +222 -0
- package/src/content/docs/bs/themes.mdx +369 -0
- package/src/content/docs/bs/tools.mdx +341 -0
- package/src/content/docs/bs/troubleshooting.mdx +300 -0
- package/src/content/docs/bs/tui.mdx +432 -0
- package/src/content/docs/bs/web.mdx +142 -0
- package/src/content/docs/bs/windows-wsl.mdx +113 -0
- package/src/content/docs/bs/zen.mdx +350 -0
- package/src/content/docs/cli.mdx +733 -0
- package/src/content/docs/commands.mdx +323 -0
- package/src/content/docs/config.mdx +941 -0
- package/src/content/docs/custom-tools.mdx +196 -0
- package/src/content/docs/da/acp.mdx +156 -0
- package/src/content/docs/da/agents.mdx +755 -0
- package/src/content/docs/da/cli.mdx +617 -0
- package/src/content/docs/da/commands.mdx +323 -0
- package/src/content/docs/da/config.mdx +688 -0
- package/src/content/docs/da/custom-tools.mdx +196 -0
- package/src/content/docs/da/ecosystem.mdx +78 -0
- package/src/content/docs/da/enterprise.mdx +170 -0
- package/src/content/docs/da/formatters.mdx +131 -0
- package/src/content/docs/da/github.mdx +321 -0
- package/src/content/docs/da/gitlab.mdx +195 -0
- package/src/content/docs/da/go.mdx +238 -0
- package/src/content/docs/da/ide.mdx +48 -0
- package/src/content/docs/da/index.mdx +360 -0
- package/src/content/docs/da/keybinds.mdx +194 -0
- package/src/content/docs/da/lsp.mdx +208 -0
- package/src/content/docs/da/mcp-servers.mdx +511 -0
- package/src/content/docs/da/models.mdx +223 -0
- package/src/content/docs/da/network.mdx +57 -0
- package/src/content/docs/da/permissions.mdx +235 -0
- package/src/content/docs/da/plugins.mdx +389 -0
- package/src/content/docs/da/providers.mdx +1981 -0
- package/src/content/docs/da/rules.mdx +180 -0
- package/src/content/docs/da/sdk.mdx +463 -0
- package/src/content/docs/da/server.mdx +287 -0
- package/src/content/docs/da/share.mdx +128 -0
- package/src/content/docs/da/skills.mdx +222 -0
- package/src/content/docs/da/themes.mdx +369 -0
- package/src/content/docs/da/tools.mdx +341 -0
- package/src/content/docs/da/troubleshooting.mdx +300 -0
- package/src/content/docs/da/tui.mdx +426 -0
- package/src/content/docs/da/web.mdx +142 -0
- package/src/content/docs/da/windows-wsl.mdx +113 -0
- package/src/content/docs/da/zen.mdx +345 -0
- package/src/content/docs/de/acp.mdx +156 -0
- package/src/content/docs/de/agents.mdx +741 -0
- package/src/content/docs/de/cli.mdx +616 -0
- package/src/content/docs/de/commands.mdx +323 -0
- package/src/content/docs/de/config.mdx +684 -0
- package/src/content/docs/de/custom-tools.mdx +170 -0
- package/src/content/docs/de/ecosystem.mdx +78 -0
- package/src/content/docs/de/enterprise.mdx +170 -0
- package/src/content/docs/de/formatters.mdx +131 -0
- package/src/content/docs/de/github.mdx +321 -0
- package/src/content/docs/de/gitlab.mdx +195 -0
- package/src/content/docs/de/go.mdx +226 -0
- package/src/content/docs/de/ide.mdx +48 -0
- package/src/content/docs/de/index.mdx +356 -0
- package/src/content/docs/de/keybinds.mdx +194 -0
- package/src/content/docs/de/lsp.mdx +207 -0
- package/src/content/docs/de/mcp-servers.mdx +511 -0
- package/src/content/docs/de/models.mdx +223 -0
- package/src/content/docs/de/network.mdx +57 -0
- package/src/content/docs/de/permissions.mdx +235 -0
- package/src/content/docs/de/plugins.mdx +384 -0
- package/src/content/docs/de/providers.mdx +1987 -0
- package/src/content/docs/de/rules.mdx +190 -0
- package/src/content/docs/de/sdk.mdx +465 -0
- package/src/content/docs/de/server.mdx +291 -0
- package/src/content/docs/de/share.mdx +130 -0
- package/src/content/docs/de/skills.mdx +222 -0
- package/src/content/docs/de/themes.mdx +372 -0
- package/src/content/docs/de/tools.mdx +352 -0
- package/src/content/docs/de/troubleshooting.mdx +300 -0
- package/src/content/docs/de/tui.mdx +429 -0
- package/src/content/docs/de/web.mdx +142 -0
- package/src/content/docs/de/windows-wsl.mdx +115 -0
- package/src/content/docs/de/zen.mdx +327 -0
- package/src/content/docs/ecosystem.mdx +83 -0
- package/src/content/docs/enterprise.mdx +169 -0
- package/src/content/docs/es/acp.mdx +156 -0
- package/src/content/docs/es/agents.mdx +755 -0
- package/src/content/docs/es/cli.mdx +616 -0
- package/src/content/docs/es/commands.mdx +323 -0
- package/src/content/docs/es/config.mdx +685 -0
- package/src/content/docs/es/custom-tools.mdx +196 -0
- package/src/content/docs/es/ecosystem.mdx +78 -0
- package/src/content/docs/es/enterprise.mdx +170 -0
- package/src/content/docs/es/formatters.mdx +131 -0
- package/src/content/docs/es/github.mdx +321 -0
- package/src/content/docs/es/gitlab.mdx +195 -0
- package/src/content/docs/es/go.mdx +238 -0
- package/src/content/docs/es/ide.mdx +48 -0
- package/src/content/docs/es/index.mdx +345 -0
- package/src/content/docs/es/keybinds.mdx +194 -0
- package/src/content/docs/es/lsp.mdx +208 -0
- package/src/content/docs/es/mcp-servers.mdx +511 -0
- package/src/content/docs/es/models.mdx +223 -0
- package/src/content/docs/es/network.mdx +57 -0
- package/src/content/docs/es/permissions.mdx +235 -0
- package/src/content/docs/es/plugins.mdx +389 -0
- package/src/content/docs/es/providers.mdx +1989 -0
- package/src/content/docs/es/rules.mdx +180 -0
- package/src/content/docs/es/sdk.mdx +463 -0
- package/src/content/docs/es/server.mdx +287 -0
- package/src/content/docs/es/share.mdx +128 -0
- package/src/content/docs/es/skills.mdx +222 -0
- package/src/content/docs/es/themes.mdx +369 -0
- package/src/content/docs/es/tools.mdx +341 -0
- package/src/content/docs/es/troubleshooting.mdx +300 -0
- package/src/content/docs/es/tui.mdx +429 -0
- package/src/content/docs/es/web.mdx +142 -0
- package/src/content/docs/es/windows-wsl.mdx +113 -0
- package/src/content/docs/es/zen.mdx +345 -0
- package/src/content/docs/formatters.mdx +143 -0
- package/src/content/docs/fr/acp.mdx +156 -0
- package/src/content/docs/fr/agents.mdx +755 -0
- package/src/content/docs/fr/cli.mdx +617 -0
- package/src/content/docs/fr/commands.mdx +322 -0
- package/src/content/docs/fr/config.mdx +686 -0
- package/src/content/docs/fr/custom-tools.mdx +170 -0
- package/src/content/docs/fr/ecosystem.mdx +78 -0
- package/src/content/docs/fr/enterprise.mdx +165 -0
- package/src/content/docs/fr/formatters.mdx +131 -0
- package/src/content/docs/fr/github.mdx +322 -0
- package/src/content/docs/fr/gitlab.mdx +195 -0
- package/src/content/docs/fr/go.mdx +224 -0
- package/src/content/docs/fr/ide.mdx +48 -0
- package/src/content/docs/fr/index.mdx +344 -0
- package/src/content/docs/fr/keybinds.mdx +194 -0
- package/src/content/docs/fr/lsp.mdx +208 -0
- package/src/content/docs/fr/mcp-servers.mdx +511 -0
- package/src/content/docs/fr/models.mdx +222 -0
- package/src/content/docs/fr/network.mdx +57 -0
- package/src/content/docs/fr/permissions.mdx +235 -0
- package/src/content/docs/fr/plugins.mdx +384 -0
- package/src/content/docs/fr/providers.mdx +1996 -0
- package/src/content/docs/fr/rules.mdx +180 -0
- package/src/content/docs/fr/sdk.mdx +463 -0
- package/src/content/docs/fr/server.mdx +287 -0
- package/src/content/docs/fr/share.mdx +128 -0
- package/src/content/docs/fr/skills.mdx +222 -0
- package/src/content/docs/fr/themes.mdx +369 -0
- package/src/content/docs/fr/tools.mdx +341 -0
- package/src/content/docs/fr/troubleshooting.mdx +300 -0
- package/src/content/docs/fr/tui.mdx +429 -0
- package/src/content/docs/fr/web.mdx +142 -0
- package/src/content/docs/fr/windows-wsl.mdx +113 -0
- package/src/content/docs/fr/zen.mdx +327 -0
- package/src/content/docs/github.mdx +321 -0
- package/src/content/docs/gitlab.mdx +195 -0
- package/src/content/docs/go.mdx +238 -0
- package/src/content/docs/ide.mdx +48 -0
- package/src/content/docs/index.mdx +360 -0
- package/src/content/docs/it/acp.mdx +155 -0
- package/src/content/docs/it/agents.mdx +753 -0
- package/src/content/docs/it/cli.mdx +617 -0
- package/src/content/docs/it/commands.mdx +322 -0
- package/src/content/docs/it/config.mdx +685 -0
- package/src/content/docs/it/custom-tools.mdx +196 -0
- package/src/content/docs/it/ecosystem.mdx +78 -0
- package/src/content/docs/it/enterprise.mdx +165 -0
- package/src/content/docs/it/formatters.mdx +132 -0
- package/src/content/docs/it/github.mdx +321 -0
- package/src/content/docs/it/gitlab.mdx +195 -0
- package/src/content/docs/it/go.mdx +236 -0
- package/src/content/docs/it/ide.mdx +48 -0
- package/src/content/docs/it/index.mdx +344 -0
- package/src/content/docs/it/keybinds.mdx +194 -0
- package/src/content/docs/it/lsp.mdx +208 -0
- package/src/content/docs/it/mcp-servers.mdx +511 -0
- package/src/content/docs/it/models.mdx +222 -0
- package/src/content/docs/it/network.mdx +57 -0
- package/src/content/docs/it/permissions.mdx +235 -0
- package/src/content/docs/it/plugins.mdx +388 -0
- package/src/content/docs/it/providers.mdx +1964 -0
- package/src/content/docs/it/rules.mdx +180 -0
- package/src/content/docs/it/sdk.mdx +463 -0
- package/src/content/docs/it/server.mdx +284 -0
- package/src/content/docs/it/share.mdx +127 -0
- package/src/content/docs/it/skills.mdx +222 -0
- package/src/content/docs/it/themes.mdx +369 -0
- package/src/content/docs/it/tools.mdx +341 -0
- package/src/content/docs/it/troubleshooting.mdx +299 -0
- package/src/content/docs/it/tui.mdx +426 -0
- package/src/content/docs/it/web.mdx +142 -0
- package/src/content/docs/it/windows-wsl.mdx +113 -0
- package/src/content/docs/it/zen.mdx +345 -0
- package/src/content/docs/ja/acp.mdx +155 -0
- package/src/content/docs/ja/agents.mdx +751 -0
- package/src/content/docs/ja/cli.mdx +616 -0
- package/src/content/docs/ja/commands.mdx +322 -0
- package/src/content/docs/ja/config.mdx +684 -0
- package/src/content/docs/ja/custom-tools.mdx +196 -0
- package/src/content/docs/ja/ecosystem.mdx +78 -0
- package/src/content/docs/ja/enterprise.mdx +166 -0
- package/src/content/docs/ja/formatters.mdx +132 -0
- package/src/content/docs/ja/github.mdx +322 -0
- package/src/content/docs/ja/gitlab.mdx +195 -0
- package/src/content/docs/ja/go.mdx +224 -0
- package/src/content/docs/ja/ide.mdx +48 -0
- package/src/content/docs/ja/index.mdx +350 -0
- package/src/content/docs/ja/keybinds.mdx +194 -0
- package/src/content/docs/ja/lsp.mdx +208 -0
- package/src/content/docs/ja/mcp-servers.mdx +511 -0
- package/src/content/docs/ja/models.mdx +221 -0
- package/src/content/docs/ja/network.mdx +55 -0
- package/src/content/docs/ja/permissions.mdx +282 -0
- package/src/content/docs/ja/plugins.mdx +461 -0
- package/src/content/docs/ja/providers.mdx +1998 -0
- package/src/content/docs/ja/rules.mdx +179 -0
- package/src/content/docs/ja/sdk.mdx +463 -0
- package/src/content/docs/ja/server.mdx +282 -0
- package/src/content/docs/ja/share.mdx +128 -0
- package/src/content/docs/ja/skills.mdx +222 -0
- package/src/content/docs/ja/themes.mdx +667 -0
- package/src/content/docs/ja/tools.mdx +341 -0
- package/src/content/docs/ja/troubleshooting.mdx +300 -0
- package/src/content/docs/ja/tui.mdx +423 -0
- package/src/content/docs/ja/web.mdx +143 -0
- package/src/content/docs/ja/windows-wsl.mdx +116 -0
- package/src/content/docs/ja/zen.mdx +327 -0
- package/src/content/docs/keybinds.mdx +299 -0
- package/src/content/docs/ko/acp.mdx +156 -0
- package/src/content/docs/ko/agents.mdx +754 -0
- package/src/content/docs/ko/cli.mdx +616 -0
- package/src/content/docs/ko/commands.mdx +323 -0
- package/src/content/docs/ko/config.mdx +685 -0
- package/src/content/docs/ko/custom-tools.mdx +196 -0
- package/src/content/docs/ko/ecosystem.mdx +78 -0
- package/src/content/docs/ko/enterprise.mdx +165 -0
- package/src/content/docs/ko/formatters.mdx +132 -0
- package/src/content/docs/ko/github.mdx +321 -0
- package/src/content/docs/ko/gitlab.mdx +195 -0
- package/src/content/docs/ko/go.mdx +224 -0
- package/src/content/docs/ko/ide.mdx +48 -0
- package/src/content/docs/ko/index.mdx +344 -0
- package/src/content/docs/ko/keybinds.mdx +194 -0
- package/src/content/docs/ko/lsp.mdx +208 -0
- package/src/content/docs/ko/mcp-servers.mdx +511 -0
- package/src/content/docs/ko/models.mdx +223 -0
- package/src/content/docs/ko/network.mdx +57 -0
- package/src/content/docs/ko/permissions.mdx +235 -0
- package/src/content/docs/ko/plugins.mdx +388 -0
- package/src/content/docs/ko/providers.mdx +1984 -0
- package/src/content/docs/ko/rules.mdx +179 -0
- package/src/content/docs/ko/sdk.mdx +463 -0
- package/src/content/docs/ko/server.mdx +287 -0
- package/src/content/docs/ko/share.mdx +128 -0
- package/src/content/docs/ko/skills.mdx +222 -0
- package/src/content/docs/ko/themes.mdx +369 -0
- package/src/content/docs/ko/tools.mdx +341 -0
- package/src/content/docs/ko/troubleshooting.mdx +303 -0
- package/src/content/docs/ko/tui.mdx +425 -0
- package/src/content/docs/ko/web.mdx +142 -0
- package/src/content/docs/ko/windows-wsl.mdx +119 -0
- package/src/content/docs/ko/zen.mdx +327 -0
- package/src/content/docs/lsp.mdx +214 -0
- package/src/content/docs/mcp-servers.mdx +512 -0
- package/src/content/docs/models.mdx +223 -0
- package/src/content/docs/nb/acp.mdx +156 -0
- package/src/content/docs/nb/agents.mdx +754 -0
- package/src/content/docs/nb/cli.mdx +617 -0
- package/src/content/docs/nb/commands.mdx +323 -0
- package/src/content/docs/nb/config.mdx +688 -0
- package/src/content/docs/nb/custom-tools.mdx +196 -0
- package/src/content/docs/nb/ecosystem.mdx +78 -0
- package/src/content/docs/nb/enterprise.mdx +170 -0
- package/src/content/docs/nb/formatters.mdx +131 -0
- package/src/content/docs/nb/github.mdx +325 -0
- package/src/content/docs/nb/gitlab.mdx +195 -0
- package/src/content/docs/nb/go.mdx +238 -0
- package/src/content/docs/nb/ide.mdx +48 -0
- package/src/content/docs/nb/index.mdx +359 -0
- package/src/content/docs/nb/keybinds.mdx +194 -0
- package/src/content/docs/nb/lsp.mdx +208 -0
- package/src/content/docs/nb/mcp-servers.mdx +624 -0
- package/src/content/docs/nb/models.mdx +223 -0
- package/src/content/docs/nb/network.mdx +57 -0
- package/src/content/docs/nb/permissions.mdx +235 -0
- package/src/content/docs/nb/plugins.mdx +389 -0
- package/src/content/docs/nb/providers.mdx +1956 -0
- package/src/content/docs/nb/rules.mdx +180 -0
- package/src/content/docs/nb/sdk.mdx +463 -0
- package/src/content/docs/nb/server.mdx +287 -0
- package/src/content/docs/nb/share.mdx +128 -0
- package/src/content/docs/nb/skills.mdx +222 -0
- package/src/content/docs/nb/themes.mdx +369 -0
- package/src/content/docs/nb/tools.mdx +341 -0
- package/src/content/docs/nb/troubleshooting.mdx +225 -0
- package/src/content/docs/nb/tui.mdx +429 -0
- package/src/content/docs/nb/web.mdx +105 -0
- package/src/content/docs/nb/windows-wsl.mdx +113 -0
- package/src/content/docs/nb/zen.mdx +345 -0
- package/src/content/docs/network.mdx +57 -0
- package/src/content/docs/permissions.mdx +256 -0
- package/src/content/docs/pl/acp.mdx +158 -0
- package/src/content/docs/pl/agents.mdx +754 -0
- package/src/content/docs/pl/cli.mdx +617 -0
- package/src/content/docs/pl/commands.mdx +323 -0
- package/src/content/docs/pl/config.mdx +680 -0
- package/src/content/docs/pl/custom-tools.mdx +196 -0
- package/src/content/docs/pl/ecosystem.mdx +78 -0
- package/src/content/docs/pl/enterprise.mdx +170 -0
- package/src/content/docs/pl/formatters.mdx +131 -0
- package/src/content/docs/pl/github.mdx +321 -0
- package/src/content/docs/pl/gitlab.mdx +195 -0
- package/src/content/docs/pl/go.mdx +230 -0
- package/src/content/docs/pl/ide.mdx +48 -0
- package/src/content/docs/pl/index.mdx +347 -0
- package/src/content/docs/pl/keybinds.mdx +194 -0
- package/src/content/docs/pl/lsp.mdx +208 -0
- package/src/content/docs/pl/mcp-servers.mdx +511 -0
- package/src/content/docs/pl/models.mdx +223 -0
- package/src/content/docs/pl/network.mdx +57 -0
- package/src/content/docs/pl/permissions.mdx +235 -0
- package/src/content/docs/pl/plugins.mdx +385 -0
- package/src/content/docs/pl/providers.mdx +1986 -0
- package/src/content/docs/pl/rules.mdx +180 -0
- package/src/content/docs/pl/sdk.mdx +463 -0
- package/src/content/docs/pl/server.mdx +287 -0
- package/src/content/docs/pl/share.mdx +128 -0
- package/src/content/docs/pl/skills.mdx +222 -0
- package/src/content/docs/pl/themes.mdx +369 -0
- package/src/content/docs/pl/tools.mdx +341 -0
- package/src/content/docs/pl/troubleshooting.mdx +300 -0
- package/src/content/docs/pl/tui.mdx +429 -0
- package/src/content/docs/pl/web.mdx +142 -0
- package/src/content/docs/pl/windows-wsl.mdx +113 -0
- package/src/content/docs/pl/zen.mdx +344 -0
- package/src/content/docs/plugins.mdx +389 -0
- package/src/content/docs/policies.mdx +137 -0
- package/src/content/docs/providers.mdx +2501 -0
- package/src/content/docs/pt-br/acp.mdx +156 -0
- package/src/content/docs/pt-br/agents.mdx +755 -0
- package/src/content/docs/pt-br/cli.mdx +616 -0
- package/src/content/docs/pt-br/commands.mdx +322 -0
- package/src/content/docs/pt-br/config.mdx +687 -0
- package/src/content/docs/pt-br/custom-tools.mdx +196 -0
- package/src/content/docs/pt-br/ecosystem.mdx +78 -0
- package/src/content/docs/pt-br/enterprise.mdx +166 -0
- package/src/content/docs/pt-br/formatters.mdx +131 -0
- package/src/content/docs/pt-br/github.mdx +321 -0
- package/src/content/docs/pt-br/gitlab.mdx +195 -0
- package/src/content/docs/pt-br/go.mdx +238 -0
- package/src/content/docs/pt-br/ide.mdx +48 -0
- package/src/content/docs/pt-br/index.mdx +344 -0
- package/src/content/docs/pt-br/keybinds.mdx +194 -0
- package/src/content/docs/pt-br/lsp.mdx +208 -0
- package/src/content/docs/pt-br/mcp-servers.mdx +511 -0
- package/src/content/docs/pt-br/models.mdx +222 -0
- package/src/content/docs/pt-br/network.mdx +57 -0
- package/src/content/docs/pt-br/permissions.mdx +235 -0
- package/src/content/docs/pt-br/plugins.mdx +388 -0
- package/src/content/docs/pt-br/providers.mdx +1989 -0
- package/src/content/docs/pt-br/rules.mdx +180 -0
- package/src/content/docs/pt-br/sdk.mdx +463 -0
- package/src/content/docs/pt-br/server.mdx +284 -0
- package/src/content/docs/pt-br/share.mdx +127 -0
- package/src/content/docs/pt-br/skills.mdx +222 -0
- package/src/content/docs/pt-br/themes.mdx +369 -0
- package/src/content/docs/pt-br/tools.mdx +341 -0
- package/src/content/docs/pt-br/troubleshooting.mdx +299 -0
- package/src/content/docs/pt-br/tui.mdx +426 -0
- package/src/content/docs/pt-br/web.mdx +142 -0
- package/src/content/docs/pt-br/windows-wsl.mdx +113 -0
- package/src/content/docs/pt-br/zen.mdx +327 -0
- package/src/content/docs/references.mdx +157 -0
- package/src/content/docs/ru/acp.mdx +156 -0
- package/src/content/docs/ru/agents.mdx +754 -0
- package/src/content/docs/ru/cli.mdx +617 -0
- package/src/content/docs/ru/commands.mdx +323 -0
- package/src/content/docs/ru/config.mdx +685 -0
- package/src/content/docs/ru/custom-tools.mdx +170 -0
- package/src/content/docs/ru/ecosystem.mdx +78 -0
- package/src/content/docs/ru/enterprise.mdx +168 -0
- package/src/content/docs/ru/formatters.mdx +119 -0
- package/src/content/docs/ru/github.mdx +321 -0
- package/src/content/docs/ru/gitlab.mdx +195 -0
- package/src/content/docs/ru/go.mdx +238 -0
- package/src/content/docs/ru/ide.mdx +48 -0
- package/src/content/docs/ru/index.mdx +356 -0
- package/src/content/docs/ru/keybinds.mdx +194 -0
- package/src/content/docs/ru/lsp.mdx +207 -0
- package/src/content/docs/ru/mcp-servers.mdx +511 -0
- package/src/content/docs/ru/models.mdx +223 -0
- package/src/content/docs/ru/network.mdx +57 -0
- package/src/content/docs/ru/permissions.mdx +235 -0
- package/src/content/docs/ru/plugins.mdx +385 -0
- package/src/content/docs/ru/providers.mdx +1987 -0
- package/src/content/docs/ru/rules.mdx +180 -0
- package/src/content/docs/ru/sdk.mdx +463 -0
- package/src/content/docs/ru/server.mdx +287 -0
- package/src/content/docs/ru/share.mdx +128 -0
- package/src/content/docs/ru/skills.mdx +222 -0
- package/src/content/docs/ru/themes.mdx +369 -0
- package/src/content/docs/ru/tools.mdx +341 -0
- package/src/content/docs/ru/troubleshooting.mdx +300 -0
- package/src/content/docs/ru/tui.mdx +429 -0
- package/src/content/docs/ru/web.mdx +142 -0
- package/src/content/docs/ru/windows-wsl.mdx +113 -0
- package/src/content/docs/ru/zen.mdx +345 -0
- package/src/content/docs/rules.mdx +188 -0
- package/src/content/docs/sdk.mdx +463 -0
- package/src/content/docs/server.mdx +287 -0
- package/src/content/docs/share.mdx +128 -0
- package/src/content/docs/skills.mdx +222 -0
- package/src/content/docs/th/acp.mdx +156 -0
- package/src/content/docs/th/agents.mdx +744 -0
- package/src/content/docs/th/cli.mdx +618 -0
- package/src/content/docs/th/commands.mdx +320 -0
- package/src/content/docs/th/config.mdx +690 -0
- package/src/content/docs/th/custom-tools.mdx +196 -0
- package/src/content/docs/th/ecosystem.mdx +78 -0
- package/src/content/docs/th/enterprise.mdx +170 -0
- package/src/content/docs/th/formatters.mdx +131 -0
- package/src/content/docs/th/github.mdx +321 -0
- package/src/content/docs/th/gitlab.mdx +195 -0
- package/src/content/docs/th/go.mdx +224 -0
- package/src/content/docs/th/ide.mdx +48 -0
- package/src/content/docs/th/index.mdx +360 -0
- package/src/content/docs/th/keybinds.mdx +194 -0
- package/src/content/docs/th/lsp.mdx +208 -0
- package/src/content/docs/th/mcp-servers.mdx +511 -0
- package/src/content/docs/th/models.mdx +223 -0
- package/src/content/docs/th/network.mdx +57 -0
- package/src/content/docs/th/permissions.mdx +235 -0
- package/src/content/docs/th/plugins.mdx +389 -0
- package/src/content/docs/th/providers.mdx +2532 -0
- package/src/content/docs/th/rules.mdx +180 -0
- package/src/content/docs/th/sdk.mdx +463 -0
- package/src/content/docs/th/server.mdx +287 -0
- package/src/content/docs/th/share.mdx +128 -0
- package/src/content/docs/th/skills.mdx +222 -0
- package/src/content/docs/th/themes.mdx +369 -0
- package/src/content/docs/th/tools.mdx +341 -0
- package/src/content/docs/th/troubleshooting.mdx +300 -0
- package/src/content/docs/th/tui.mdx +429 -0
- package/src/content/docs/th/web.mdx +142 -0
- package/src/content/docs/th/windows-wsl.mdx +113 -0
- package/src/content/docs/th/zen.mdx +329 -0
- package/src/content/docs/themes.mdx +369 -0
- package/src/content/docs/tools.mdx +345 -0
- package/src/content/docs/tr/acp.mdx +156 -0
- package/src/content/docs/tr/agents.mdx +754 -0
- package/src/content/docs/tr/cli.mdx +617 -0
- package/src/content/docs/tr/commands.mdx +323 -0
- package/src/content/docs/tr/config.mdx +687 -0
- package/src/content/docs/tr/custom-tools.mdx +196 -0
- package/src/content/docs/tr/ecosystem.mdx +78 -0
- package/src/content/docs/tr/enterprise.mdx +170 -0
- package/src/content/docs/tr/formatters.mdx +131 -0
- package/src/content/docs/tr/github.mdx +321 -0
- package/src/content/docs/tr/gitlab.mdx +195 -0
- package/src/content/docs/tr/go.mdx +224 -0
- package/src/content/docs/tr/ide.mdx +48 -0
- package/src/content/docs/tr/index.mdx +347 -0
- package/src/content/docs/tr/keybinds.mdx +194 -0
- package/src/content/docs/tr/lsp.mdx +208 -0
- package/src/content/docs/tr/mcp-servers.mdx +511 -0
- package/src/content/docs/tr/models.mdx +223 -0
- package/src/content/docs/tr/network.mdx +57 -0
- package/src/content/docs/tr/permissions.mdx +235 -0
- package/src/content/docs/tr/plugins.mdx +388 -0
- package/src/content/docs/tr/providers.mdx +1988 -0
- package/src/content/docs/tr/rules.mdx +180 -0
- package/src/content/docs/tr/sdk.mdx +463 -0
- package/src/content/docs/tr/server.mdx +285 -0
- package/src/content/docs/tr/share.mdx +127 -0
- package/src/content/docs/tr/skills.mdx +222 -0
- package/src/content/docs/tr/themes.mdx +369 -0
- package/src/content/docs/tr/tools.mdx +341 -0
- package/src/content/docs/tr/troubleshooting.mdx +299 -0
- package/src/content/docs/tr/tui.mdx +427 -0
- package/src/content/docs/tr/web.mdx +142 -0
- package/src/content/docs/tr/windows-wsl.mdx +113 -0
- package/src/content/docs/tr/zen.mdx +327 -0
- package/src/content/docs/troubleshooting.mdx +314 -0
- package/src/content/docs/tui.mdx +427 -0
- package/src/content/docs/web.mdx +142 -0
- package/src/content/docs/windows-wsl.mdx +112 -0
- package/src/content/docs/zen.mdx +345 -0
- package/src/content/docs/zh-cn/acp.mdx +156 -0
- package/src/content/docs/zh-cn/agents.mdx +754 -0
- package/src/content/docs/zh-cn/cli.mdx +617 -0
- package/src/content/docs/zh-cn/commands.mdx +322 -0
- package/src/content/docs/zh-cn/config.mdx +683 -0
- package/src/content/docs/zh-cn/custom-tools.mdx +196 -0
- package/src/content/docs/zh-cn/ecosystem.mdx +78 -0
- package/src/content/docs/zh-cn/enterprise.mdx +165 -0
- package/src/content/docs/zh-cn/formatters.mdx +132 -0
- package/src/content/docs/zh-cn/github.mdx +321 -0
- package/src/content/docs/zh-cn/gitlab.mdx +194 -0
- package/src/content/docs/zh-cn/go.mdx +224 -0
- package/src/content/docs/zh-cn/ide.mdx +48 -0
- package/src/content/docs/zh-cn/index.mdx +343 -0
- package/src/content/docs/zh-cn/keybinds.mdx +194 -0
- package/src/content/docs/zh-cn/lsp.mdx +208 -0
- package/src/content/docs/zh-cn/mcp-servers.mdx +511 -0
- package/src/content/docs/zh-cn/models.mdx +222 -0
- package/src/content/docs/zh-cn/network.mdx +57 -0
- package/src/content/docs/zh-cn/permissions.mdx +235 -0
- package/src/content/docs/zh-cn/plugins.mdx +388 -0
- package/src/content/docs/zh-cn/providers.mdx +1949 -0
- package/src/content/docs/zh-cn/rules.mdx +180 -0
- package/src/content/docs/zh-cn/sdk.mdx +463 -0
- package/src/content/docs/zh-cn/server.mdx +284 -0
- package/src/content/docs/zh-cn/share.mdx +127 -0
- package/src/content/docs/zh-cn/skills.mdx +222 -0
- package/src/content/docs/zh-cn/themes.mdx +369 -0
- package/src/content/docs/zh-cn/tools.mdx +341 -0
- package/src/content/docs/zh-cn/troubleshooting.mdx +299 -0
- package/src/content/docs/zh-cn/tui.mdx +426 -0
- package/src/content/docs/zh-cn/web.mdx +142 -0
- package/src/content/docs/zh-cn/windows-wsl.mdx +112 -0
- package/src/content/docs/zh-cn/zen.mdx +327 -0
- package/src/content/docs/zh-tw/acp.mdx +156 -0
- package/src/content/docs/zh-tw/agents.mdx +754 -0
- package/src/content/docs/zh-tw/cli.mdx +617 -0
- package/src/content/docs/zh-tw/commands.mdx +322 -0
- package/src/content/docs/zh-tw/config.mdx +687 -0
- package/src/content/docs/zh-tw/custom-tools.mdx +196 -0
- package/src/content/docs/zh-tw/ecosystem.mdx +78 -0
- package/src/content/docs/zh-tw/enterprise.mdx +165 -0
- package/src/content/docs/zh-tw/formatters.mdx +132 -0
- package/src/content/docs/zh-tw/github.mdx +321 -0
- package/src/content/docs/zh-tw/gitlab.mdx +194 -0
- package/src/content/docs/zh-tw/go.mdx +224 -0
- package/src/content/docs/zh-tw/ide.mdx +48 -0
- package/src/content/docs/zh-tw/index.mdx +343 -0
- package/src/content/docs/zh-tw/keybinds.mdx +194 -0
- package/src/content/docs/zh-tw/lsp.mdx +208 -0
- package/src/content/docs/zh-tw/mcp-servers.mdx +511 -0
- package/src/content/docs/zh-tw/models.mdx +222 -0
- package/src/content/docs/zh-tw/network.mdx +57 -0
- package/src/content/docs/zh-tw/permissions.mdx +235 -0
- package/src/content/docs/zh-tw/plugins.mdx +388 -0
- package/src/content/docs/zh-tw/providers.mdx +1970 -0
- package/src/content/docs/zh-tw/rules.mdx +180 -0
- package/src/content/docs/zh-tw/sdk.mdx +463 -0
- package/src/content/docs/zh-tw/server.mdx +284 -0
- package/src/content/docs/zh-tw/share.mdx +127 -0
- package/src/content/docs/zh-tw/skills.mdx +222 -0
- package/src/content/docs/zh-tw/themes.mdx +369 -0
- package/src/content/docs/zh-tw/tools.mdx +341 -0
- package/src/content/docs/zh-tw/troubleshooting.mdx +299 -0
- package/src/content/docs/zh-tw/tui.mdx +426 -0
- package/src/content/docs/zh-tw/web.mdx +142 -0
- package/src/content/docs/zh-tw/windows-wsl.mdx +112 -0
- package/src/content/docs/zh-tw/zen.mdx +333 -0
- package/src/content/i18n/ar.json +75 -0
- package/src/content/i18n/bs.json +75 -0
- package/src/content/i18n/da.json +75 -0
- package/src/content/i18n/de.json +75 -0
- package/src/content/i18n/en.json +75 -0
- package/src/content/i18n/es.json +75 -0
- package/src/content/i18n/fr.json +75 -0
- package/src/content/i18n/it.json +75 -0
- package/src/content/i18n/ja.json +75 -0
- package/src/content/i18n/ko.json +75 -0
- package/src/content/i18n/nb.json +75 -0
- package/src/content/i18n/pl.json +75 -0
- package/src/content/i18n/pt-BR.json +75 -0
- package/src/content/i18n/ru.json +75 -0
- package/src/content/i18n/th.json +75 -0
- package/src/content/i18n/tr.json +75 -0
- package/src/content/i18n/zh-CN.json +75 -0
- package/src/content/i18n/zh-TW.json +75 -0
- package/src/content.config.ts +16 -0
- package/src/i18n/locales.ts +117 -0
- package/src/middleware.ts +94 -0
- package/src/pages/[...slug].md.ts +34 -0
- package/src/pages/s/[id].astro +164 -0
- package/src/styles/custom.css +405 -0
- package/src/types/lang-map.d.ts +27 -0
- package/src/types/starlight-virtual.d.ts +14 -0
- package/sst-env.d.ts +10 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 自定义工具
|
|
3
|
+
description: 创建 LLM 可在 opencode 中调用的工具。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
自定义工具是你创建的函数,LLM 可以在对话过程中调用它们。它们与 opencode 的[内置工具](/docs/tools)(如 `read`、`write` 和 `bash`)协同工作。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 创建工具
|
|
11
|
+
|
|
12
|
+
工具以 **TypeScript** 或 **JavaScript** 文件的形式定义。不过,工具定义可以调用**任何语言**编写的脚本——TypeScript 或 JavaScript 仅用于工具定义本身。
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
### 位置
|
|
17
|
+
|
|
18
|
+
工具可以在以下位置定义:
|
|
19
|
+
|
|
20
|
+
- 本地定义:将工具文件放在项目的 `.opencode/tools/` 目录中。
|
|
21
|
+
- 全局定义:将工具文件放在 `~/.config/opencode/tools/` 中。
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
### 结构
|
|
26
|
+
|
|
27
|
+
创建工具最简单的方式是使用 `tool()` 辅助函数,它提供类型安全和参数校验。
|
|
28
|
+
|
|
29
|
+
```ts title=".opencode/tools/database.ts" {1}
|
|
30
|
+
import { tool } from "@opencode-ai/plugin"
|
|
31
|
+
|
|
32
|
+
export default tool({
|
|
33
|
+
description: "Query the project database",
|
|
34
|
+
args: {
|
|
35
|
+
query: tool.schema.string().describe("SQL query to execute"),
|
|
36
|
+
},
|
|
37
|
+
async execute(args) {
|
|
38
|
+
// Your database logic here
|
|
39
|
+
return `Executed query: ${args.query}`
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**文件名**即为**工具名称**。上面的示例创建了一个名为 `database` 的工具。
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
#### 单文件多工具
|
|
49
|
+
|
|
50
|
+
你也可以从单个文件中导出多个工具。每个导出都会成为**一个独立的工具**,命名格式为 **`<filename>_<exportname>`**:
|
|
51
|
+
|
|
52
|
+
```ts title=".opencode/tools/math.ts"
|
|
53
|
+
import { tool } from "@opencode-ai/plugin"
|
|
54
|
+
|
|
55
|
+
export const add = tool({
|
|
56
|
+
description: "Add two numbers",
|
|
57
|
+
args: {
|
|
58
|
+
a: tool.schema.number().describe("First number"),
|
|
59
|
+
b: tool.schema.number().describe("Second number"),
|
|
60
|
+
},
|
|
61
|
+
async execute(args) {
|
|
62
|
+
return args.a + args.b
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
export const multiply = tool({
|
|
67
|
+
description: "Multiply two numbers",
|
|
68
|
+
args: {
|
|
69
|
+
a: tool.schema.number().describe("First number"),
|
|
70
|
+
b: tool.schema.number().describe("Second number"),
|
|
71
|
+
},
|
|
72
|
+
async execute(args) {
|
|
73
|
+
return args.a * args.b
|
|
74
|
+
},
|
|
75
|
+
})
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
这会创建两个工具:`math_add` 和 `math_multiply`。
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
#### 与内置工具的名称冲突
|
|
83
|
+
|
|
84
|
+
自定义工具通过工具名称进行索引。如果自定义工具使用了与内置工具相同的名称,则优先使用自定义工具。
|
|
85
|
+
|
|
86
|
+
例如,这个文件取代了内置的bash工具:
|
|
87
|
+
|
|
88
|
+
```ts title=".opencode/tools/bash.ts"
|
|
89
|
+
import { tool } from "@opencode-ai/plugin"
|
|
90
|
+
|
|
91
|
+
export default tool({
|
|
92
|
+
description: "Restricted bash wrapper",
|
|
93
|
+
args: {
|
|
94
|
+
command: tool.schema.string(),
|
|
95
|
+
},
|
|
96
|
+
async execute(args) {
|
|
97
|
+
return `blocked: ${args.command}`
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
:::note
|
|
103
|
+
除非你有意替换内置工具,否则最好用独特的名字。如果你想禁用内置工具但不想覆盖它,使用 [权限](/docs/permissions).
|
|
104
|
+
:::
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### 参数
|
|
109
|
+
|
|
110
|
+
你可以使用 `tool.schema`(即 [Zod](https://zod.dev))来定义参数类型。
|
|
111
|
+
|
|
112
|
+
```ts "tool.schema"
|
|
113
|
+
args: {
|
|
114
|
+
query: tool.schema.string().describe("SQL query to execute")
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
你也可以直接导入 [Zod](https://zod.dev) 并返回一个普通对象:
|
|
119
|
+
|
|
120
|
+
```ts {6}
|
|
121
|
+
import { z } from "zod"
|
|
122
|
+
|
|
123
|
+
export default {
|
|
124
|
+
description: "Tool description",
|
|
125
|
+
args: {
|
|
126
|
+
param: z.string().describe("Parameter description"),
|
|
127
|
+
},
|
|
128
|
+
async execute(args, context) {
|
|
129
|
+
// Tool implementation
|
|
130
|
+
return "result"
|
|
131
|
+
},
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### 上下文
|
|
138
|
+
|
|
139
|
+
工具会接收当前会话的上下文信息:
|
|
140
|
+
|
|
141
|
+
```ts title=".opencode/tools/project.ts" {8}
|
|
142
|
+
import { tool } from "@opencode-ai/plugin"
|
|
143
|
+
|
|
144
|
+
export default tool({
|
|
145
|
+
description: "Get project information",
|
|
146
|
+
args: {},
|
|
147
|
+
async execute(args, context) {
|
|
148
|
+
// Access context information
|
|
149
|
+
const { agent, sessionID, messageID, directory, worktree } = context
|
|
150
|
+
return `Agent: ${agent}, Session: ${sessionID}, Message: ${messageID}, Directory: ${directory}, Worktree: ${worktree}`
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
使用 `context.directory` 获取会话的工作目录。
|
|
156
|
+
使用 `context.worktree` 获取 git worktree 根目录。
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 示例
|
|
161
|
+
|
|
162
|
+
### 用 Python 编写工具
|
|
163
|
+
|
|
164
|
+
你可以使用任何语言编写工具。以下示例展示了如何用 Python 实现两数相加。
|
|
165
|
+
|
|
166
|
+
首先,创建一个 Python 脚本作为工具:
|
|
167
|
+
|
|
168
|
+
```python title=".opencode/tools/add.py"
|
|
169
|
+
import sys
|
|
170
|
+
|
|
171
|
+
a = int(sys.argv[1])
|
|
172
|
+
b = int(sys.argv[2])
|
|
173
|
+
print(a + b)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
然后创建调用该脚本的工具定义:
|
|
177
|
+
|
|
178
|
+
```ts title=".opencode/tools/python-add.ts" {10}
|
|
179
|
+
import { tool } from "@opencode-ai/plugin"
|
|
180
|
+
import path from "path"
|
|
181
|
+
|
|
182
|
+
export default tool({
|
|
183
|
+
description: "Add two numbers using Python",
|
|
184
|
+
args: {
|
|
185
|
+
a: tool.schema.number().describe("First number"),
|
|
186
|
+
b: tool.schema.number().describe("Second number"),
|
|
187
|
+
},
|
|
188
|
+
async execute(args, context) {
|
|
189
|
+
const script = path.join(context.worktree, ".opencode/tools/add.py")
|
|
190
|
+
const result = await Bun.$`python3 ${script} ${args.a} ${args.b}`.text()
|
|
191
|
+
return result.trim()
|
|
192
|
+
},
|
|
193
|
+
})
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
这里我们使用 [`Bun.$`](https://bun.com/docs/runtime/shell) 工具函数来运行 Python 脚本。
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 生态系统
|
|
3
|
+
description: 基于 OpenCode 构建的项目与集成。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
基于 OpenCode 构建的社区项目合集。
|
|
7
|
+
|
|
8
|
+
:::note
|
|
9
|
+
想将您的 OpenCode 相关项目添加到此列表中?欢迎提交 PR。
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
您还可以查看 [awesome-opencode](https://github.com/awesome-opencode/awesome-opencode) 和 [opencode.cafe](https://opencode.cafe),这是一个聚合生态系统与社区资源的社区。
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 插件
|
|
17
|
+
|
|
18
|
+
| 名称 | 描述 |
|
|
19
|
+
| -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
20
|
+
| [opencode-daytona](https://github.com/daytonaio/daytona/tree/main/libs/opencode-plugin) | 在隔离的 Daytona 沙箱中自动运行 OpenCode 会话,支持 git 同步和实时预览 |
|
|
21
|
+
| [opencode-helicone-session](https://github.com/H2Shami/opencode-helicone-session) | 自动注入 Helicone 会话头信息,用于请求分组 |
|
|
22
|
+
| [opencode-type-inject](https://github.com/nick-vi/opencode-type-inject) | 通过查找工具自动将 TypeScript/Svelte 类型注入到文件读取中 |
|
|
23
|
+
| [opencode-openai-codex-auth](https://github.com/numman-ali/opencode-openai-codex-auth) | 使用您的 ChatGPT Plus/Pro 订阅替代 API 额度 |
|
|
24
|
+
| [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) | 使用您现有的 Gemini 套餐替代 API 计费 |
|
|
25
|
+
| [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) | 使用 Antigravity 的免费模型替代 API 计费 |
|
|
26
|
+
| [opencode-devcontainers](https://github.com/athal7/opencode-devcontainers) | 多分支开发容器隔离,支持浅克隆和自动分配端口 |
|
|
27
|
+
| [opencode-google-antigravity-auth](https://github.com/shekohex/opencode-google-antigravity-auth) | Google Antigravity OAuth 插件,支持 Google 搜索及更强健的 API 处理 |
|
|
28
|
+
| [opencode-dynamic-context-pruning](https://github.com/Tarquinen/opencode-dynamic-context-pruning) | 通过修剪过时的工具输出来优化 Token 使用 |
|
|
29
|
+
| [opencode-vibeguard](https://github.com/inkdust2021/opencode-vibeguard) | 在调用 LLM 之前将机密/PII 替换为 VibeGuard 风格的占位符;并在本地恢复 |
|
|
30
|
+
| [opencode-websearch-cited](https://github.com/ghoulr/opencode-websearch-cited.git) | 为受支持的提供商添加原生网页搜索支持,采用 Google grounded 风格 |
|
|
31
|
+
| [opencode-pty](https://github.com/shekohex/opencode-pty.git) | 使 AI 代理能够在 PTY 中运行后台进程,并向其发送交互式输入 |
|
|
32
|
+
| [opencode-shell-strategy](https://github.com/JRedeker/opencode-shell-strategy) | 非交互式 shell 命令指令——防止依赖 TTY 的操作导致挂起 |
|
|
33
|
+
| [opencode-wakatime](https://github.com/angristan/opencode-wakatime) | 使用 Wakatime 追踪 OpenCode 的使用情况 |
|
|
34
|
+
| [opencode-md-table-formatter](https://github.com/franlol/opencode-md-table-formatter/tree/main) | 清理 LLM 生成的 Markdown 表格 |
|
|
35
|
+
| [opencode-morph-plugin](https://github.com/morphllm/opencode-morph-plugin) | 通过 Morph 提供 Fast Apply 编辑、WarpGrep 代码搜索和上下文压缩 |
|
|
36
|
+
| [oh-my-opencode](https://github.com/code-yeongyu/oh-my-opencode) | 后台代理、预构建的 LSP/AST/MCP 工具、精选代理,兼容 Claude Code |
|
|
37
|
+
| [opencode-notificator](https://github.com/panta82/opencode-notificator) | OpenCode 会话的桌面通知和声音提醒 |
|
|
38
|
+
| [opencode-notifier](https://github.com/mohak34/opencode-notifier) | 针对权限请求、任务完成和错误事件的桌面通知与声音提醒 |
|
|
39
|
+
| [opencode-zellij-namer](https://github.com/24601/opencode-zellij-namer) | 基于 OpenCode 上下文的 AI 驱动自动 Zellij 会话命名 |
|
|
40
|
+
| [opencode-skillful](https://github.com/zenobi-us/opencode-skillful) | 允许 OpenCode 代理通过技能发现和注入按需延迟加载提示词 |
|
|
41
|
+
| [opencode-supermemory](https://github.com/supermemoryai/opencode-supermemory) | 使用 Supermemory 实现跨会话的持久记忆 |
|
|
42
|
+
| [@plannotator/opencode](https://github.com/backnotprop/plannotator/tree/main/apps/opencode-plugin) | 支持可视化标注和私有/离线分享的交互式计划审查 |
|
|
43
|
+
| [@openspoon/subtask2](https://github.com/spoons-and-mirrors/subtask2) | 将 OpenCode /commands 扩展为具有精细流程控制的强大编排系统 |
|
|
44
|
+
| [opencode-scheduler](https://github.com/different-ai/opencode-scheduler) | 使用 cron 语法通过 launchd (Mac) 或 systemd (Linux) 调度周期性任务 |
|
|
45
|
+
| [micode](https://github.com/vtemian/micode) | 结构化的头脑风暴 → 计划 → 实现工作流,支持会话连续性 |
|
|
46
|
+
| [octto](https://github.com/vtemian/octto) | 用于 AI 头脑风暴的交互式浏览器 UI,支持多问题表单 |
|
|
47
|
+
| [opencode-background-agents](https://github.com/kdcokenny/opencode-background-agents) | Claude Code 风格的后台代理,支持异步委托和上下文持久化 |
|
|
48
|
+
| [opencode-notify](https://github.com/kdcokenny/opencode-notify) | OpenCode 的原生操作系统通知——随时了解任务完成情况 |
|
|
49
|
+
| [opencode-workspace](https://github.com/kdcokenny/opencode-workspace) | 捆绑式多代理编排套件——16 个组件,一次安装 |
|
|
50
|
+
| [opencode-worktree](https://github.com/kdcokenny/opencode-worktree) | OpenCode 的零摩擦 git worktree 管理 |
|
|
51
|
+
| [opencode-sentry-monitor](https://github.com/stolinski/opencode-sentry-monitor) | 使用 Sentry AI Monitoring 追踪和调试您的 AI 代理 |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 项目
|
|
56
|
+
|
|
57
|
+
| 名称 | 描述 |
|
|
58
|
+
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------- |
|
|
59
|
+
| [kimaki](https://github.com/remorses/kimaki) | 用于控制 OpenCode 会话的 Discord 机器人,基于 SDK 构建 |
|
|
60
|
+
| [opencode.nvim](https://github.com/NickvanDyke/opencode.nvim) | Neovim 插件,提供编辑器感知的提示词,基于 API 构建 |
|
|
61
|
+
| [portal](https://github.com/hosenur/portal) | 通过 Tailscale/VPN 使用的移动优先 OpenCode Web UI |
|
|
62
|
+
| [opencode plugin template](https://github.com/zenobi-us/opencode-plugin-template/) | 用于构建 OpenCode 插件的模板 |
|
|
63
|
+
| [opencode.nvim](https://github.com/sudo-tee/opencode.nvim) | OpenCode 的 Neovim 前端——基于终端的 AI 编码代理 |
|
|
64
|
+
| [ai-sdk-provider-opencode-sdk](https://github.com/ben-vargas/ai-sdk-provider-opencode-sdk) | Vercel AI SDK 提供商,用于通过 @opencode-ai/sdk 使用 OpenCode |
|
|
65
|
+
| [OpenChamber](https://github.com/btriapitsyn/openchamber) | OpenCode 的 Web / 桌面应用和 VS Code 扩展 |
|
|
66
|
+
| [OpenCode-Obsidian](https://github.com/mtymek/opencode-obsidian) | 将 OpenCode 嵌入 Obsidian UI 的 Obsidian 插件 |
|
|
67
|
+
| [OpenWork](https://github.com/different-ai/openwork) | Claude Cowork 的开源替代方案,由 OpenCode 驱动 |
|
|
68
|
+
| [ocx](https://github.com/kdcokenny/ocx) | OpenCode 扩展管理器,支持可移植的隔离配置 |
|
|
69
|
+
| [CodeNomad](https://github.com/NeuralNomadsAI/CodeNomad) | OpenCode 的桌面、Web、移动和远程客户端应用 |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 代理
|
|
74
|
+
|
|
75
|
+
| 名称 | 描述 |
|
|
76
|
+
| ----------------------------------------------------------------- | ---------------------------------------- |
|
|
77
|
+
| [Agentic](https://github.com/Cluster444/agentic) | 用于结构化开发的模块化 AI 代理和命令 |
|
|
78
|
+
| [opencode-agents](https://github.com/darrenhinde/opencode-agents) | 用于增强工作流的配置、提示词、代理和插件 |
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 企业版
|
|
3
|
+
description: 在您的组织中安全地使用 OpenCode。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import config from "../../../../config.mjs"
|
|
7
|
+
export const email = `mailto:${config.email}`
|
|
8
|
+
|
|
9
|
+
OpenCode 企业版面向希望确保代码和数据始终留在自有基础设施内的组织。它通过集中式配置与您的 SSO 和内部 AI 网关集成来实现这一目标。
|
|
10
|
+
|
|
11
|
+
:::note
|
|
12
|
+
OpenCode 不会存储您的任何代码或上下文数据。
|
|
13
|
+
:::
|
|
14
|
+
|
|
15
|
+
开始使用 OpenCode 企业版:
|
|
16
|
+
|
|
17
|
+
1. 在团队内部进行试用。
|
|
18
|
+
2. **<a href={email}>联系我们</a>**,讨论定价和实施方案。
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 试用
|
|
23
|
+
|
|
24
|
+
OpenCode 是开源的,不会存储您的任何代码或上下文数据,因此您的开发人员可以直接[开始使用](/docs/)并进行试用。
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
### 数据处理
|
|
29
|
+
|
|
30
|
+
**OpenCode 不会存储您的代码或上下文数据。**所有处理均在本地完成,或通过直接 API 调用发送至您的 AI 提供商。
|
|
31
|
+
|
|
32
|
+
这意味着,只要您使用的是信任的提供商或内部 AI 网关,就可以安全地使用 OpenCode。
|
|
33
|
+
|
|
34
|
+
唯一需要注意的是可选的 `/share` 功能。
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
#### 分享对话
|
|
39
|
+
|
|
40
|
+
如果用户启用了 `/share` 功能,对话及其关联数据将被发送到我们用于在 opencode.ai 上托管共享页面的服务。
|
|
41
|
+
|
|
42
|
+
数据目前通过我们 CDN 的边缘网络提供服务,并缓存在靠近用户的边缘节点上。
|
|
43
|
+
|
|
44
|
+
我们建议您在试用期间禁用此功能。
|
|
45
|
+
|
|
46
|
+
```json title="opencode.json"
|
|
47
|
+
{
|
|
48
|
+
"$schema": "https://opencode.ai/config.json",
|
|
49
|
+
"share": "disabled"
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
[了解更多关于分享的信息](/docs/share)。
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### 代码所有权
|
|
58
|
+
|
|
59
|
+
**您拥有 OpenCode 生成的所有代码。**不存在任何许可限制或所有权声明。
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 定价
|
|
64
|
+
|
|
65
|
+
OpenCode 企业版采用按席位定价模型。如果您拥有自己的 LLM 网关,我们不会对使用的 Token 收取费用。有关定价和实施方案的更多详情,请**<a href={email}>联系我们</a>**。
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 部署
|
|
70
|
+
|
|
71
|
+
完成试用并准备好在组织中使用 OpenCode 后,您可以**<a href={email}>联系我们</a>**,讨论定价和实施方案。
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### 集中式配置
|
|
76
|
+
|
|
77
|
+
我们可以为您的整个组织设置 OpenCode 的统一集中式配置。
|
|
78
|
+
|
|
79
|
+
该集中式配置可与您的 SSO 提供商集成,确保所有用户仅访问您的内部 AI 网关。
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### SSO 集成
|
|
84
|
+
|
|
85
|
+
通过集中式配置,OpenCode 可以与您组织的 SSO 提供商集成进行身份验证。
|
|
86
|
+
|
|
87
|
+
这使得 OpenCode 能够通过您现有的身份管理系统获取内部 AI 网关的凭据。
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### 内部 AI 网关
|
|
92
|
+
|
|
93
|
+
通过集中式配置,OpenCode 还可以被配置为仅使用您的内部 AI 网关。
|
|
94
|
+
|
|
95
|
+
您还可以禁用所有其他 AI 提供商,确保所有请求都经过组织批准的基础设施。
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### 自托管
|
|
100
|
+
|
|
101
|
+
虽然我们建议禁用共享页面以确保您的数据始终不会离开组织,但我们也可以帮助您在自己的基础设施上自行托管这些页面。
|
|
102
|
+
|
|
103
|
+
此功能目前已列入我们的路线图。如果您感兴趣,请**<a href={email}>告诉我们</a>**。
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 常见问题
|
|
108
|
+
|
|
109
|
+
<details>
|
|
110
|
+
<summary>什么是 OpenCode 企业版?</summary>
|
|
111
|
+
|
|
112
|
+
OpenCode 企业版面向希望确保代码和数据始终留在自有基础设施内的组织。它通过集中式配置与您的 SSO 和内部 AI 网关集成来实现这一目标。
|
|
113
|
+
|
|
114
|
+
</details>
|
|
115
|
+
|
|
116
|
+
<details>
|
|
117
|
+
<summary>如何开始使用 OpenCode 企业版?</summary>
|
|
118
|
+
|
|
119
|
+
只需在团队内部开始试用即可。OpenCode 默认不存储您的代码或上下文数据,因此可以轻松上手。
|
|
120
|
+
|
|
121
|
+
然后**<a href={email}>联系我们</a>**,讨论定价和实施方案。
|
|
122
|
+
|
|
123
|
+
</details>
|
|
124
|
+
|
|
125
|
+
<details>
|
|
126
|
+
<summary>企业版定价如何运作?</summary>
|
|
127
|
+
|
|
128
|
+
我们提供按席位的企业版定价。如果您拥有自己的 LLM 网关,我们不会对使用的 Token 收取费用。如需了解更多详情,请**<a href={email}>联系我们</a>**,获取根据您组织需求定制的报价。
|
|
129
|
+
|
|
130
|
+
</details>
|
|
131
|
+
|
|
132
|
+
<details>
|
|
133
|
+
<summary>我的数据在 OpenCode 企业版中是否安全?</summary>
|
|
134
|
+
|
|
135
|
+
是的。OpenCode 不会存储您的代码或上下文数据。所有处理均在本地完成,或通过直接 API 调用发送至您的 AI 提供商。通过集中式配置和 SSO 集成,您的数据将安全地保留在组织的基础设施内。
|
|
136
|
+
|
|
137
|
+
</details>
|
|
138
|
+
|
|
139
|
+
<details>
|
|
140
|
+
<summary>我们可以使用自己的私有 NPM 注册表吗?</summary>
|
|
141
|
+
|
|
142
|
+
OpenCode 通过 Bun 原生的 `.npmrc` 文件支持来支持私有 npm 注册表。如果您的组织使用私有注册表(例如 JFrog Artifactory、Nexus 或类似产品),请确保开发人员在运行 OpenCode 之前已完成身份验证。
|
|
143
|
+
|
|
144
|
+
要设置私有注册表的身份验证:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npm login --registry=https://your-company.jfrog.io/api/npm/npm-virtual/
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
这会创建包含身份验证信息的 `~/.npmrc` 文件。OpenCode 会自动识别并使用它。
|
|
151
|
+
|
|
152
|
+
:::caution
|
|
153
|
+
在运行 OpenCode 之前,您必须先登录私有注册表。
|
|
154
|
+
:::
|
|
155
|
+
|
|
156
|
+
或者,您也可以手动配置 `.npmrc` 文件:
|
|
157
|
+
|
|
158
|
+
```bash title="~/.npmrc"
|
|
159
|
+
registry=https://your-company.jfrog.io/api/npm/npm-virtual/
|
|
160
|
+
//your-company.jfrog.io/api/npm/npm-virtual/:_authToken=${NPM_AUTH_TOKEN}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
开发人员必须在运行 OpenCode 之前登录私有注册表,以确保能够从您的企业注册表安装软件包。
|
|
164
|
+
|
|
165
|
+
</details>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 格式化工具
|
|
3
|
+
description: OpenCode 使用特定语言的格式化工具。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
OpenCode 会在文件写入或编辑后,自动使用特定语言的格式化工具对其进行格式化。这确保了生成的代码遵循你项目的代码风格。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 内置格式化工具
|
|
11
|
+
|
|
12
|
+
OpenCode 内置了多种适用于主流语言和框架的格式化工具。下表列出了各格式化工具、支持的文件扩展名以及所需的命令或配置选项。
|
|
13
|
+
|
|
14
|
+
| 格式化工具 | 扩展名 | 要求 |
|
|
15
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
|
16
|
+
| air | .R | `air` 命令可用 |
|
|
17
|
+
| biome | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml 及[更多](https://biomejs.dev/) | `biome.json(c)` 配置文件 |
|
|
18
|
+
| cargofmt | .rs | `cargo fmt` 命令可用 |
|
|
19
|
+
| clang-format | .c, .cpp, .h, .hpp, .ino 及[更多](https://clang.llvm.org/docs/ClangFormat.html) | `.clang-format` 配置文件 |
|
|
20
|
+
| cljfmt | .clj, .cljs, .cljc, .edn | `cljfmt` 命令可用 |
|
|
21
|
+
| dart | .dart | `dart` 命令可用 |
|
|
22
|
+
| dfmt | .d | `dfmt` 命令可用 |
|
|
23
|
+
| gleam | .gleam | `gleam` 命令可用 |
|
|
24
|
+
| gofmt | .go | `gofmt` 命令可用 |
|
|
25
|
+
| htmlbeautifier | .erb, .html.erb | `htmlbeautifier` 命令可用 |
|
|
26
|
+
| ktlint | .kt, .kts | `ktlint` 命令可用 |
|
|
27
|
+
| mix | .ex, .exs, .eex, .heex, .leex, .neex, .sface | `mix` 命令可用 |
|
|
28
|
+
| nixfmt | .nix | `nixfmt` 命令可用 |
|
|
29
|
+
| ocamlformat | .ml, .mli | `ocamlformat` 命令可用且存在 `.ocamlformat` 配置文件 |
|
|
30
|
+
| ormolu | .hs | `ormolu` 命令可用 |
|
|
31
|
+
| oxfmt (Experimental) | .js, .jsx, .ts, .tsx | `package.json` 中有 `oxfmt` 依赖,且设置了[实验性环境变量标志](/docs/cli/#experimental) |
|
|
32
|
+
| pint | .php | `composer.json` 中有 `laravel/pint` 依赖 |
|
|
33
|
+
| prettier | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml 及[更多](https://prettier.io/docs/en/index.html) | `package.json` 中有 `prettier` 依赖 |
|
|
34
|
+
| rubocop | .rb, .rake, .gemspec, .ru | `rubocop` 命令可用 |
|
|
35
|
+
| ruff | .py, .pyi | `ruff` 命令可用且有相应配置 |
|
|
36
|
+
| rustfmt | .rs | `rustfmt` 命令可用 |
|
|
37
|
+
| shfmt | .sh, .bash | `shfmt` 命令可用 |
|
|
38
|
+
| standardrb | .rb, .rake, .gemspec, .ru | `standardrb` 命令可用 |
|
|
39
|
+
| terraform | .tf, .tfvars | `terraform` 命令可用 |
|
|
40
|
+
| uv | .py, .pyi | `uv` 命令可用 |
|
|
41
|
+
| zig | .zig, .zon | `zig` 命令可用 |
|
|
42
|
+
|
|
43
|
+
因此,如果你的项目 `package.json` 中包含 `prettier`,OpenCode 会自动使用它进行格式化。
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 工作原理
|
|
48
|
+
|
|
49
|
+
当 OpenCode 写入或编辑文件时,它会:
|
|
50
|
+
|
|
51
|
+
1. 根据所有已启用的格式化工具检查文件扩展名。
|
|
52
|
+
2. 对文件运行相应的格式化命令。
|
|
53
|
+
3. 自动应用格式化更改。
|
|
54
|
+
|
|
55
|
+
整个过程在后台完成,无需任何手动操作即可保持代码风格的一致性。
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 配置
|
|
60
|
+
|
|
61
|
+
你可以通过 OpenCode 配置中的 `formatter` 部分自定义格式化工具。
|
|
62
|
+
|
|
63
|
+
```json title="opencode.json"
|
|
64
|
+
{
|
|
65
|
+
"$schema": "https://opencode.ai/config.json",
|
|
66
|
+
"formatter": {}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
每个格式化工具的配置支持以下属性:
|
|
71
|
+
|
|
72
|
+
| 属性 | 类型 | 描述 |
|
|
73
|
+
| ------------- | -------- | ------------------------------ |
|
|
74
|
+
| `disabled` | boolean | 设为 `true` 可禁用该格式化工具 |
|
|
75
|
+
| `command` | string[] | 执行格式化的命令 |
|
|
76
|
+
| `environment` | object | 运行格式化工具时设置的环境变量 |
|
|
77
|
+
| `extensions` | string[] | 该格式化工具处理的文件扩展名 |
|
|
78
|
+
|
|
79
|
+
下面来看一些示例。
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### 禁用格式化工具
|
|
84
|
+
|
|
85
|
+
要全局禁用**所有**格式化工具,将 `formatter` 设为 `false`:
|
|
86
|
+
|
|
87
|
+
```json title="opencode.json" {3}
|
|
88
|
+
{
|
|
89
|
+
"$schema": "https://opencode.ai/config.json",
|
|
90
|
+
"formatter": false
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
要禁用**特定**格式化工具,将 `disabled` 设为 `true`:
|
|
95
|
+
|
|
96
|
+
```json title="opencode.json" {5}
|
|
97
|
+
{
|
|
98
|
+
"$schema": "https://opencode.ai/config.json",
|
|
99
|
+
"formatter": {
|
|
100
|
+
"prettier": {
|
|
101
|
+
"disabled": true
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### 自定义格式化工具
|
|
110
|
+
|
|
111
|
+
你可以通过指定命令、环境变量和文件扩展名来覆盖内置格式化工具或添加新的格式化工具:
|
|
112
|
+
|
|
113
|
+
```json title="opencode.json" {4-14}
|
|
114
|
+
{
|
|
115
|
+
"$schema": "https://opencode.ai/config.json",
|
|
116
|
+
"formatter": {
|
|
117
|
+
"prettier": {
|
|
118
|
+
"command": ["npx", "prettier", "--write", "$FILE"],
|
|
119
|
+
"environment": {
|
|
120
|
+
"NODE_ENV": "development"
|
|
121
|
+
},
|
|
122
|
+
"extensions": [".js", ".ts", ".jsx", ".tsx"]
|
|
123
|
+
},
|
|
124
|
+
"custom-markdown-formatter": {
|
|
125
|
+
"command": ["deno", "fmt", "$FILE"],
|
|
126
|
+
"extensions": [".md"]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
命令中的 **`$FILE` 占位符**会被替换为待格式化文件的路径。
|