@coda-console/plugin-check 0.4.7 → 0.4.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/check/coda.mjs +6 -3
- package/check/manifest.mjs +2 -2
- package/package.json +1 -1
package/check/coda.mjs
CHANGED
|
@@ -107,9 +107,12 @@ export const SETTING_KEY = /^[a-z][a-z0-9-]*(\.[a-z][A-Za-z0-9]*)+$/;
|
|
|
107
107
|
export const STRING_FORMATS = ['duration', 'coda-repo', 'coda-directory', 'coda-model-provider', 'coda-model-url'];
|
|
108
108
|
export const MODEL_PROVIDER = /^[a-z][a-z0-9-]{0,39}\/[a-z][a-z0-9-]{0,39}$/;
|
|
109
109
|
export const CAPABILITY = /^[a-z][a-z0-9-]{0,63}$/;
|
|
110
|
-
// What a plugin may contribute (backend/src/components/plugins/plugin-rules.mjs CONTRIBUTES)
|
|
111
|
-
export const CONTRIBUTES = ['configuration', 'capabilities', 'instructions', '
|
|
112
|
-
'repositories', 'services', 'setup', 'skills', 'environment', 'path', 'endpoints', 'mcpServers', 'views', 'modelProviders'];
|
|
110
|
+
// What a plugin may contribute to Coda itself (backend/src/components/plugins/plugin-rules.mjs CONTRIBUTES).
|
|
111
|
+
export const CONTRIBUTES = ['configuration', 'capabilities', 'instructions', 'agents', 'extensionPoints', 'extensions', 'groups', 'events', 'commands', 'gitCredentials',
|
|
112
|
+
'repositories', 'services', 'setup', 'skills', 'environment', 'path', 'endpoints', 'mcpServers', 'views', 'modelProviders', 'executors'];
|
|
113
|
+
// The keys of `contributes` points of the plugins Coda ships take (Coda's docs/plugins.md「写在 contributes 里的扩展点」): the
|
|
114
|
+
// resources plugin's `panels`. Anything else is refused.
|
|
115
|
+
export const POINT_KEYS = ['panels'];
|
|
113
116
|
// What only a plugin Coda ships may contribute, one installed from a repository or npm being refused it
|
|
114
117
|
// (backend/src/components/plugins/plugin-source-rules.mjs catalogProblem): the clients do not show these in the confirmation yet.
|
|
115
118
|
export const BUILTIN_ONLY = { gitCredentials: '只有 Coda 自带的插件能提供 Git 凭据', repositories: '只有 Coda 自带的插件能提供仓库列表' };
|
package/check/manifest.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync } from '
|
|
|
8
8
|
import { basename, isAbsolute, join, normalize, relative, sep } from 'node:path';
|
|
9
9
|
import { inflateSync } from 'node:zlib';
|
|
10
10
|
import { AGENT_ID, AGENT_LIMITS, BUILTIN_AGENTS, BUILTIN_COMMANDS, BUILTIN_GROUPS, BUILTIN_HERE, BUILTIN_SCOPE, CAPABILITY,
|
|
11
|
-
CODA_COMMANDS, CODA_EVENT_DOMAINS, COMMAND, COMMAND_LIMIT, BUILTIN_ONLY, CONTRIBUTES, EVENT, EVENT_LIMIT, DEPTH, ICON_LIMIT, INSTRUCTIONS_LIMIT, NPM, NPM_LOCK, PANEL_ID, PANEL_LIMITS, PLUGIN_ID, POINT,
|
|
11
|
+
CODA_COMMANDS, CODA_EVENT_DOMAINS, COMMAND, COMMAND_LIMIT, BUILTIN_ONLY, CONTRIBUTES, POINT_KEYS, EVENT, EVENT_LIMIT, DEPTH, ICON_LIMIT, INSTRUCTIONS_LIMIT, NPM, NPM_LOCK, PANEL_ID, PANEL_LIMITS, PLUGIN_ID, POINT,
|
|
12
12
|
MODEL_PROVIDER, SEGMENT, SERVICE, SETTING_KEY, SETUP_KEYS, SIZE_LIMIT, STRING_FORMATS } from './coda.mjs';
|
|
13
13
|
|
|
14
14
|
class Invalid extends Error {}
|
|
@@ -290,7 +290,7 @@ export function checkManifest(dir, say) {
|
|
|
290
290
|
const contributes = part('manifest.contributes', () => {
|
|
291
291
|
check(manifest.contributes && typeof manifest.contributes === 'object' && !Array.isArray(manifest.contributes),
|
|
292
292
|
'contributes 须为对象(Coda 只把带 contributes 的目录当插件)');
|
|
293
|
-
const unknown = Object.keys(manifest.contributes).filter(k => !CONTRIBUTES.includes(k));
|
|
293
|
+
const unknown = Object.keys(manifest.contributes).filter(k => !CONTRIBUTES.includes(k) && !POINT_KEYS.includes(k));
|
|
294
294
|
check(!unknown.length, `contributes 里有 Coda 不支持的贡献:${unknown.join('、')}`);
|
|
295
295
|
// What is checked here is installed from a repository or npm, never as a copy Coda ships.
|
|
296
296
|
for (const [key, refusal] of Object.entries(BUILTIN_ONLY)) check(manifest.contributes[key] === undefined, `contributes.${key}:${refusal}`);
|