mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-07-28 15:42:35 +00:00
Addresses 12 of 13 review comments from Copilot and CodeRabbit on PR #332. One comment (no-manifests in validate-plugins.yml) is declined and answered inline; the rest are applied here. Substantive fixes: - .github/workflows/validate-plugins.yml — add --noconftest to the schema-tests step. tests/conftest.py imports structlog at module level, but the CI job only installs requirements-test.txt (pytest/httpx/jsonschema), so pytest collection would fail at conftest import. The schema tests don't use shared fixtures, so skipping conftest is safe and avoids dragging the full runtime requirements into a 2 KB validation job. (Copilot) - schema/plugin.schema.json — tighten the server_files regex on both settings.server_files and diagnostics.server_files to match the runtime _validate_relpath rules in plugins/__init__.py. The previous regex only blocked absolute paths, drive letters, backslashes, and "..". The runtime also rejects "//", "./", "/./", and leading-dotfile segments. Schema-valid manifests are now also load-time-valid. Verified the regex against 12 cases: the 3 in-tree manifests still validate. (Copilot) - .claude/skills/plugin-validate/SKILL.md — add a per-iteration plugin_ok flag so we no longer print "OK <path>" after an earlier FAIL in the same manifest. Schema-pass + id-mismatch previously produced both FAIL and OK lines for one plugin. (CodeRabbit) - docs/websocket-protocol.md — clarify song_info.tuning array length is source-dependent (typically 6 guitar, 4 bass, but extended-range GP imports can be 7/8/5/6). Recommend highway.getStringCount() for the authoritative count. Line 30 already said this; the table row on line 12 was the stale half. (CodeRabbit) Trivial fixes: - .claude/rules/plugin-author.md — "wants included" -> "wants to include" in the settings.server_files rule. (CodeRabbit) - Markdown MD040 — add `text` language tags to 7 bare-fence code blocks across AGENTS.md, docs/PLUGIN_AUTHORING.md, docs/testing-plugins.md, docs/plugin-logging.md, .claude/README.md, .claude/agents/slopsmith-reviewer.md, and .claude/skills/plugin-validate/SKILL.md (two fences). (CodeRabbit) Declined: - .github/workflows/validate-plugins.yml no-manifests -> exit 0 (CodeRabbit suggested exit 1). Plugins in this repo are in-tree, not submodules (no .gitmodules, git submodule status empty), and the workflow has a path filter on plugins/**/plugin.json so it only runs when a manifest actually changes. Exit 0 is correct. Answered inline on the PR. Verification: pytest tests/test_plugin_schema.py -v --noconftest # 8 passed python -c "import json,glob,jsonschema; s=json.load(open('schema/plugin.schema.json')); [jsonschema.validate(json.load(open(p)), s) for p in sorted(glob.glob('plugins/*/plugin.json'))]" # ok — all 3 in-tree manifests validate against tightened schema Signed-off-by: Miguel_LZPF <mgcdreamer@gmail.com>
133 lines
5.3 KiB
JSON
133 lines
5.3 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://github.com/byrongamatos/slopsmith/blob/main/schema/plugin.schema.json",
|
|
"title": "Slopsmith plugin manifest",
|
|
"description": "Schema for plugins/<id>/plugin.json. See docs/plugin-manifest.md for prose. License enum mirrors the curated-plugin allowlist in CONTRIBUTING.md (keep them in sync; tests/test_plugin_schema.py asserts subset).",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["id", "name"],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)*$",
|
|
"description": "Snake-case identifier. Used to namespace localStorage, the plugin screen id (plugin-<id>), the backend logger (slopsmith.plugin.<id>), and the diagnostics bundle directory. Reverse-DNS form (com.example.foo) is supported via the load_sibling encoding."
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"description": "Human-readable name shown in UI surfaces."
|
|
},
|
|
"version": {
|
|
"type": "string",
|
|
"description": "Plain semver string. Advisory only; the plugin loader does not consume this."
|
|
},
|
|
"private": {
|
|
"type": "boolean",
|
|
"description": "Advisory metadata for plugin authors. Not consumed by the loader."
|
|
},
|
|
"bundled": {
|
|
"type": "boolean",
|
|
"description": "True for plugins shipped in-tree with Slopsmith. Used by tooling that distinguishes built-in plugins from user-installed ones."
|
|
},
|
|
"type": {
|
|
"type": "string",
|
|
"enum": ["visualization"],
|
|
"description": "Role hint (slopsmith#36). 'visualization' makes the plugin eligible for the viz picker; must pair with a window.slopsmithViz_<id> factory."
|
|
},
|
|
"license": {
|
|
"type": "string",
|
|
"description": "SPDX identifier. For curated plugins, must match CONTRIBUTING.md's allowlist.",
|
|
"enum": [
|
|
"AGPL-3.0-only",
|
|
"AGPL-3.0-or-later",
|
|
"GPL-3.0-only",
|
|
"GPL-3.0-or-later",
|
|
"LGPL-3.0-only",
|
|
"LGPL-3.0-or-later",
|
|
"MIT",
|
|
"BSD-2-Clause",
|
|
"BSD-3-Clause",
|
|
"Apache-2.0",
|
|
"ISC",
|
|
"Unlicense",
|
|
"CC0-1.0",
|
|
"0BSD"
|
|
]
|
|
},
|
|
"nav": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["label", "screen"],
|
|
"properties": {
|
|
"label": { "type": "string", "minLength": 1 },
|
|
"screen": { "type": "string", "pattern": "^[a-z][a-z0-9_-]*$" }
|
|
},
|
|
"description": "Adds a navbar entry that calls showScreen(<screen>). Typically screen is 'plugin-<id>'."
|
|
},
|
|
"screen": {
|
|
"type": "string",
|
|
"description": "Relative path to HTML mounted at #plugin-<id>."
|
|
},
|
|
"script": {
|
|
"type": "string",
|
|
"description": "Relative path to JS loaded in global scope on page load. Wrap your code in an IIFE."
|
|
},
|
|
"routes": {
|
|
"type": "string",
|
|
"description": "Relative path to Python module exporting setup(app, context). See docs/plugin-manifest.md."
|
|
},
|
|
"tour": {
|
|
"type": "string",
|
|
"description": "Relative path to tour JSON for the in-app onboarding tour."
|
|
},
|
|
"settings": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"html": {
|
|
"type": "string",
|
|
"description": "Relative path to settings-panel HTML."
|
|
},
|
|
"server_files": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"not": { "pattern": "^/|^[a-zA-Z]:|\\\\|(^|/)\\.\\.(/|$)|//|(^|/)\\.(/|$)|^\\." },
|
|
"description": "Relpath under context['config_dir']. No abs paths, no '..', no '//', no './', no leading dotfiles, no backslashes. Mirrors the runtime _validate_relpath rules in plugins/__init__.py so a schema-valid manifest is also load-time-valid. Trailing '/' denotes a directory (recurse)."
|
|
},
|
|
"uniqueItems": true,
|
|
"description": "Opt-in for Settings export/import (slopsmith#113). Files included in user-triggered backups. See docs/plugin-manifest.md."
|
|
}
|
|
}
|
|
},
|
|
"diagnostics": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"server_files": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"not": { "pattern": "^/|^[a-zA-Z]:|\\\\|(^|/)\\.\\.(/|$)|//|(^|/)\\.(/|$)|^\\." }
|
|
},
|
|
"uniqueItems": true,
|
|
"description": "Files copied verbatim into plugins/<id>/<relpath> inside the diagnostics bundle. Path rules match the settings.server_files pattern (no abs paths, no '..', no '//', no './', no leading dotfiles, no backslashes)."
|
|
},
|
|
"callable": {
|
|
"type": "string",
|
|
"pattern": "^[a-z][a-z0-9_]*:[A-Za-z_][A-Za-z0-9_]*$",
|
|
"description": "<module>:<function> resolved via load_sibling at export time. Called with {'plugin_id', 'config_dir'} dict; return dict/list/bytes/str."
|
|
}
|
|
},
|
|
"description": "Opt-in for the Export Diagnostics bundle (slopsmith#166). See docs/plugin-diagnostics.md."
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"$comment": "type=visualization requires a script (the window.slopsmithViz_<id> factory)",
|
|
"if": { "properties": { "type": { "const": "visualization" } }, "required": ["type"] },
|
|
"then": { "required": ["script"] }
|
|
}
|
|
]
|
|
}
|