[docs] Add contribution scaffolder script - #466
Open
mvanhorn wants to merge 1 commit into
Open
Conversation
Generate a gate-ready contribution skeleton from the category's existing _template/ folder instead of hand-copying and hand-authoring metadata.json. The _template/ folders remain the source of truth: the script copies from them rather than embedding template text, so editing a template changes generator output. Zero runtime dependencies, Node 18+ built-ins only. Output satisfies the automated review rules for all seven categories, including the category-conditional artifacts (schema.sql for schemas, index.html for dashboards, index.ts for integrations, SKILL.md for skills, both SQL and code for extensions). Non-interactive by default via flags so agent clients can drive it; interactive prompts are the fallback when a required flag is absent and stdin is a TTY. Refuses to overwrite an existing folder.
|
Hey @mvanhorn — welcome to Open Brain Source! 👋 Thanks for submitting your first PR. The automated review will run shortly and check things like metadata, folder structure, and README completeness. If anything needs fixing, the review comment will tell you exactly what. Once the automated checks pass, a human admin will review for quality and clarity. Expect a response within a few days. If you have questions, check out CONTRIBUTING.md or open an issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution Type
/recipes)/schemas)/dashboards)/integrations)/skills)What does this do?
node scripts/new-contribution.mjsgenerates a complete, correctly structured contribution folder from the category's existing_template/, so starting a contribution is one command instead of copy the right template, rename the folder, hand-authormetadata.json, and remember which extra fields your category needs.Why
Today CONTRIBUTING.md says "Check the
_template/folder in each category for a starter README", and the rest is manual. A contributor has to pick one of seven_template/directories, copy it, rename it, and hand-write ametadata.jsonwith nine required fields plus category-conditional extras (learning_orderfor extensions,requires_primitives/requires_skillswhen depending on other contributions).Getting any of that wrong is not a soft failure, it is a rule failure in the automated review: folder structure, required files, metadata validity, category-specific artifacts, and README completeness are all mechanically checked. The contributor finds out after opening a PR.
That lands hardest on exactly the people CONTRIBUTING.md goes out of its way to invite. The "Not a Developer? You Can Still Contribute" path and the mentor model bring in contributors least likely to hand-assemble a seven-way template choice and a conditional JSON manifest correctly.
The pattern is well established elsewhere: Home Assistant ships
python3 -m script.scaffold integration, and npm standardises oncreate-*initializers. The.github/ISSUE_TEMPLATE/directory here already shows the same instinct on the issue side; this is the PR-side equivalent.Design decisions
Three choices are load-bearing:
The
_template/folders stay the source of truth. The script copies from them rather than embedding template text, so a maintainer editing a template automatically changes generator output. There is no second copy of the prose to drift. It deliberately does not modify any_template/folder.Non-interactive first. Every value has a flag, so the AI clients this project targets can drive it directly. Interactive prompts are the fallback when a required flag is absent and stdin is a TTY.
It refuses to do damage. Scaffolding onto an existing folder exits without writing.
--forceis deliberately not implemented. Declared dependencies are validated as slugs and checked to exist, so a typo like--requires-skills meeting-triagefails immediately rather than producing metadata and README links that the review rules then reject.Testing
node --test scripts/*.test.mjscovers 15 cases: a scaffold in each of the seven categories asserting the artifacts that category requires, extensionlearning_orderand tool-audit link, skills emitting a plain-text skill file, schemas emitting SQL with the requiredgrantline,requires_skillswritten to metadata and linked from the README, invalid difficulty exiting without writing, refusing an existing target, and rejecting both malformed and nonexistent dependency slugs.I also generated a scaffold in all seven categories and checked each result against the rules in
.github/workflows/ob1-gate-v2.yml(folder structure, required files, metadata schema, category artifacts, README sections). All seven satisfied them. CI remains authoritative.Notes
Community extensions can omit
--learning-order; perextensions/_template/AGENT_SPEC.mdonly curated learning-path extensions set it. Supplied--requires-primitivesmerge with the template's mandatory primitives rather than replacing them.The generated primitive README includes the placeholder dependency reference as plain text rather than a relative link, so a fresh scaffold does not ship a link that resolves nowhere.
Requirements
Node.js 18 or newer. Nothing else: zero runtime dependencies, built-ins only (
node:fs,node:path,node:readline/promises,node:util), matching the existingscripts/update-readme-contributions.mjs. No rootpackage.jsonis added and no_template/folder is modified.AI was used for assistance. I ran the tests and the scaffolds shown above myself and verified the output against the repository's review rules.
Checklist
scripts/README.mdwith usage, flags, and exit codesThe remaining template items describe a contribution folder, which this PR does not add. Marking them honestly rather than ticking them:
README.md/metadata.jsonrequired fields: not applicable, no contribution folder is added here. The script's job is to produce those correctly, which the tests and the seven-category check above cover.