validate the root meta-plugin and reject wildcards in required/optional lists - #2
validate the root meta-plugin and reject wildcards in required/optional lists#2charliemeyer2000 wants to merge 1 commit into
Conversation
…al lists Co-Authored-By: Staging-Devin AI <166158716+staging-devin-ai-integration[bot]@users.noreply.github.com>
Original prompt from charlie.meyer
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
| checkPlugin(dir, `plugins/${entry}`, { dirName: entry }); | ||
| } | ||
| if (names.size === 0) fail("no plugins found under plugins/"); | ||
| if (names.size < 2) fail("no plugins found under plugins/"); |
There was a problem hiding this comment.
🟡 Validator can wrongly claim there are no plugins, or stay silent when there really are none
The count used to decide whether any plugins exist (names.size < 2 at scripts/validate-template.mjs:129) now also includes the repo-root entry, so the check no longer reflects how many plugins actually live under the plugins folder.
Impact: A repository with exactly one valid plugin is reported as having none whenever the root manifest is missing/invalid, and the message shown is misleading.
How the shared name set conflates the root plugin with the plugins/ entries
names is now module-level (scripts/validate-template.mjs:61) and checkPlugin adds the root manifest's name to it (scripts/validate-template.mjs:77) before the plugins/ loop runs. Two failure modes:
- Root manifest missing/invalid JSON/missing
name→checkPluginreturns early without adding a name, so a repo with one legitimate plugin yieldsnames.size === 1and emits the spuriousno plugins found under plugins/error. - Conversely, if two plugins under plugins/ share the same name, the set dedupes them, again skewing the count (duplicate is separately reported, but the count is not a plugin count).
A robust fix is to count plugins encountered in the plugins/ loop with a dedicated counter rather than reusing the shared name set.
Prompt for agents
In scripts/validate-template.mjs, the 'no plugins found under plugins/' check was changed from names.size === 0 to names.size < 2 because the shared `names` set now also receives the root meta-plugin's name from checkPlugin(). This makes the count depend on whether the root manifest parsed successfully and on name uniqueness, so a repo with one valid plugin plus a broken root manifest reports a misleading 'no plugins found' error. Track the number of plugin directories actually validated under plugins/ with a separate counter (incremented in the loop) and use that for the emptiness check, keeping `names` solely for duplicate detection.
Was this helpful? React with 👍 or 👎 to provide feedback.
Debug
| if (typeof ref === "string" && ref.includes("*")) | ||
| fail(`${label}: ${list} entry "${ref}" contains a wildcard — globs are only allowed in forbiddenPlugins`); |
There was a problem hiding this comment.
🔍 Wildcard check only inspects string entries, not object refs
The new guard only rejects wildcards for string entries in requiredPlugins/optionalPlugins. An object ref such as { "source": "git-subdir", "path": "plugins/*" } (or a wildcard in url) would slip through, and the sibling-resolution check below would just report a non-resolving path (or nothing, if the URL isn't this repo). If the runtime rejects globs anywhere in required/optional refs, consider also checking ref.path/ref.url for *.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
CI passed on the commit that broke the meta-plugin (
c54cabf) because the validator only looked atplugins/*— it never checked the root manifest after the meta-plugin moved to the repo root. Two fixes toscripts/validate-template.mjs:checkPlugin(dir, label)and run it on the repo root too (skipping the name-matches-directory check there).requiredPlugins/optionalPluginscontaining*fail validation ("globs are only allowed in forbiddenPlugins"), matching the runtime's wildcard rejection.Verified: passes on current main; fails on the c54cabf manifest with
<root>: optionalPlugins entry "CognitionAI/**" contains a wildcard — globs are only allowed in forbiddenPlugins.Link to Devin session: https://staging.itsdev.in/sessions/4dedf92ab76a44c78c984fb138682bb0
Requested by: @charliemeyer2000
Devin Review
9953ac0