@prompt-registry/collection-scripts
v1.0.3
Published
Shared scripts for building, validating, and publishing Copilot prompt collections
Downloads
426
Maintainers
Readme
@prompt-registry/collection-scripts
Shared scripts for building, validating, and publishing Copilot prompt collections.
Installation
Option 1: Use with npx (Recommended)
No installation required - run from anywhere:
npx --package @prompt-registry/collection-scripts validate-collectionsOption 2: Install locally
npm install @prompt-registry/collection-scriptsOption 3: Install globally
npm install -g @prompt-registry/collection-scriptsUsage
npx (No Installation Required)
# Validate collections
npx --package @prompt-registry/collection-scripts validate-collections --verbose
# Create a new skill (interactive)
npx --package @prompt-registry/collection-scripts create-skill
# Create a skill (non-interactive)
npx --package @prompt-registry/collection-scripts create-skill my-skill --description "A helpful skill" --non-interactive
# Validate skills
npx --package @prompt-registry/collection-scripts validate-skills
# Build collection bundle
npx --package @prompt-registry/collection-scripts build-collection-bundle --collection-file collections/my.collection.yml --version 1.0.0
# List collections
npx --package @prompt-registry/collection-scripts list-collections
# Publish affected collections (CI/CD)
npx --package @prompt-registry/collection-scripts publish-collectionsAfter Installation
If installed locally or globally, you can run commands directly:
validate-collections --verbose
create-skill my-skill --description "A helpful skill"CLI Commands
| Command | Description |
|---------|-------------|
| validate-collections | Validate collection YAML files |
| validate-skills | Validate skill folders following Agent Skills spec |
| build-collection-bundle | Build a collection bundle ZIP |
| compute-collection-version | Compute next version from git tags |
| detect-affected-collections | Detect collections affected by file changes |
| generate-manifest | Generate deployment manifest |
| publish-collections | Build and publish affected collections |
| list-collections | List all collections in repo |
| create-skill | Create a new skill directory structure |
| compute-ratings | Compute ratings from GitHub Discussion feedback comments (star ratings) |
| setup-discussions | Create GitHub Discussions for bundle ratings |
Engagement Tools
These tools help set up and manage the engagement system for collecting bundle ratings and feedback.
setup-discussions
Creates GitHub Discussions for all bundles in a hub configuration. The discussions are used to collect ratings and feedback via comments with star ratings (1-5 ⭐).
# Basic usage - creates discussions for all bundles
GITHUB_TOKEN=ghp_xxx npx --package @prompt-registry/collection-scripts setup-discussions https://github.com/org/hub-config
# Dry run to preview what would be created
GITHUB_TOKEN=ghp_xxx npx --package @prompt-registry/collection-scripts setup-discussions --dry-run org/hub-config
# Specify branch and output file
GITHUB_TOKEN=ghp_xxx npx --package @prompt-registry/collection-scripts setup-discussions -b develop -o my-collections.yaml org/hub-config
# Specify discussion category
GITHUB_TOKEN=ghp_xxx npx --package @prompt-registry/collection-scripts setup-discussions --category "Bundle Ratings" org/hub-configRequirements:
- Hub config must have
engagement.backend.repositoryconfigured - GitHub token needs
repoandwrite:discussionscopes - Engagement repository must have GitHub Discussions enabled
Output: Creates a collections.yaml file mapping bundles to discussion numbers.
compute-ratings
Fetches feedback comments from GitHub Discussions, parses star ratings (1-5), and computes aggregate ratings. Also supports legacy thumbs up/down reactions for backward compatibility.
# Compute ratings from collections.yaml
GITHUB_TOKEN=ghp_xxx npx --package @prompt-registry/collection-scripts compute-ratings --config collections.yaml --output ratings.jsonWorkflow:
- Run
setup-discussionsonce to create discussions and generatecollections.yaml - Run
compute-ratingsperiodically (e.g., via GitHub Actions) to updateratings.json - Host
ratings.jsonstatically and reference it in hub config'sengagement.ratings.ratingsUrl
Programmatic API
import {
// Validation
validateCollectionId,
validateVersion,
validateItemKind,
validateCollectionFile,
validateAllCollections,
generateMarkdown,
VALIDATION_RULES,
// Collections
listCollectionFiles,
readCollection,
resolveCollectionItemPaths,
// Bundle ID
generateBundleId,
// CLI utilities
parseSingleArg,
parseMultiArg,
hasFlag,
getPositionalArg,
} from '@prompt-registry/collection-scripts';Usage in package.json
{
"scripts": {
"validate": "validate-collections",
"build": "build-collection-bundle --collection-file collections/my.collection.yml --version 1.0.0",
"publish": "publish-collections"
}
}Development
cd lib
npm install
npm run build
npm testLicense
MIT
