Skip to content

Add hooks and plugins asset types with sync and CLI support#91

Draft
Copilot wants to merge 13 commits intomainfrom
copilot/add-sync-support-hooks-plugins
Draft

Add hooks and plugins asset types with sync and CLI support#91
Copilot wants to merge 13 commits intomainfrom
copilot/add-sync-support-hooks-plugins

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

Implementation Complete ✅

Successfully added full support for syncing hooks and plugins from upstream sources with CLI commands to interact with these new asset types.

All Items Complete

  • 1. Update upstream.config.json to include hooks and plugins from github/awesome-copilot
  • 2. Update sync-repo.js to handle hooks and plugins (add to resource types, patterns, extensions)
  • 3. Update CLI (bin/cli-functions.js and cli-functions.js) to support listing and downloading hooks and plugins
  • 4. Update manifest generation (generate-manifest.js) to include hooks and plugins
  • 5. Add npm scripts for sync-hooks and sync-plugins
  • 6. Update sync-skills.js to be generic for directory-based assets
  • 7. Create assets/hooks and assets/plugins directories
  • 8. Test dry-run syncing of hooks and plugins (verified working)
  • 9. Add tests for hooks and plugins CLI commands
  • 10. Run full test suite to validate changes (all 109 tests passing)
  • 11. Update documentation (README.md) to document hooks and plugins
  • 12. Test actual sync to ensure it works end-to-end (verified working)
  • 13. Test CLI list and download commands (verified working)
  • 14. Run code review and security checks (completed)
  • 15. Address PR review feedback - add download tests and remove unused syncPatterns
  • 16. Merge main branch and resolve conflicts
  • 17. Regenerate package-lock.json with updated dependencies
  • 18. Increase test coverage to meet CI thresholds (lines: 64%, functions: 77%, branches: 60%, statements: 64%)
  • 19. Sync package-lock.json with main branch to fix npm ci failure

PR Review Feedback Addressed

  • Added tests for hooks/plugins download with --dry-run (comment #2866284298)
  • Removed unused syncPatterns parameter from sync-skills.js (comment #2866284259)
  • Merged latest main branch changes and resolved conflicts
  • Regenerated package-lock.json (comment #3988526172)
  • Increased test coverage to meet thresholds (comment #3992488171)
  • Fixed package-lock.json sync issue with main branch (comment #3999988089)

Coverage Improvements

Added comprehensive unit tests for cli-functions.js to meet coverage thresholds:

  • Lines: 63.97% (threshold: 12%) ✅
  • Functions: 76.92% (threshold: 20%) ✅
  • Statements: 64.49% (threshold: 13%) ✅
  • Branches: 59.57% (threshold: 10%) ✅

New tests cover:

  • isLocal() function and caching behavior
  • getManifest() error handling
  • listAssets() for all asset types including hooks and plugins
  • downloadAsset() with various options (dryRun, output, force)
  • Error handling for invalid IDs and types
  • normalizeCollectionItems() edge cases

Package Lock Sync

Updated package-lock.json from main branch (v2.2.30) to include missing sub-dependencies:

  • conventional-commits-filter@5.0.0
  • conventional-commits-parser@6.2.1

These packages are required by git-semver-tags and were missing after the previous merge, causing npm ci to fail.

Merge Conflict Resolution

Resolved conflicts with main branch by:

  • Keeping hooks and plugins sync commands in README.md, adding note about prompts from main
  • Adopting main's dynamic displayUsage() function that reads from config (automatically includes hooks/plugins)
  • Removing prompts entry from upstream.config.json (as done in main) while keeping hooks and plugins
  • Merged all upstream asset updates from main branch

Notes on Upstream Content Issues

Comments #2866284208, #2866284277, and #2866284307 identified issues in the synced hook scripts from github/awesome-copilot (not authored by this PR):

  • local keyword misuse in audit-prompt.sh
  • Missing jq dependency documentation
  • Security concern about logging credentials in cleartext

These are upstream content issues and should be reported to github/awesome-copilot repository.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 4 commits February 27, 2026 17:58
Co-authored-by: archubbuck <3529902+archubbuck@users.noreply.github.com>
Co-authored-by: archubbuck <3529902+archubbuck@users.noreply.github.com>
Co-authored-by: archubbuck <3529902+archubbuck@users.noreply.github.com>
Co-authored-by: archubbuck <3529902+archubbuck@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for syncing hooks and plugins with CLI commands Add hooks and plugins asset types with sync and CLI support Feb 27, 2026
@archubbuck archubbuck requested a review from Copilot February 27, 2026 21:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the repository’s asset system to support syncing, manifest generation, and CLI list/download for new directory-based asset types: hooks and plugins (sourced from github/awesome-copilot).

Changes:

  • Adds hooks and plugins to upstream config + sync tooling (directory-based sync).
  • Updates manifest generation + CLI list/download to include hooks/plugins.
  • Introduces initial synced hook/plugin assets under assets/hooks and assets/plugins.

Reviewed changes

Copilot reviewed 61 out of 64 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
upstream.config.json.example Adds hooks/plugins mappings example for upstream sync configuration.
upstream.config.json Adds hooks/plugins mappings for actual upstream sync configuration.
tests/cli.test.js Extends CLI list tests for new hooks and plugins asset types.
scripts/utils/sync-skills.js Generalizes directory-based sync to handle skills/hooks/plugins via resourceType.
scripts/sync-repo.js Registers hooks/plugins as supported resource types and routes them through directory sync.
scripts/generation/generate-manifest.js Includes hooks/plugins in the generated manifest and processes them as directory assets.
package.json Adds sync-hooks and sync-plugins npm scripts.
package-lock.json Updates lockfile after dependency graph changes.
bin/cli.js Updates CLI help text and default list behavior to include hooks/plugins.
bin/cli-functions.js Adds directory-asset download support and enables listing hooks/plugins.
assets/plugins/csharp-dotnet-development/agents/expert-dotnet-software-engineer.md Adds plugin agent content for the C#/.NET development plugin.
assets/plugins/csharp-dotnet-development/README.md Adds README for the C#/.NET development plugin.
assets/plugins/csharp-dotnet-development/.github/plugin/plugin.json Adds plugin manifest/config for the C#/.NET development plugin.
assets/plugins/copilot-sdk/skills/copilot-sdk/SKILL.md Adds Copilot SDK plugin skill content.
assets/plugins/copilot-sdk/README.md Adds README for the Copilot SDK plugin.
assets/plugins/copilot-sdk/.github/plugin/plugin.json Adds plugin manifest/config for the Copilot SDK plugin.
assets/plugins/context-engineering/skills/what-context-needed/SKILL.md Adds context-engineering plugin skill content.
assets/plugins/context-engineering/skills/refactor-plan/SKILL.md Adds context-engineering plugin skill content.
assets/plugins/context-engineering/skills/context-map/SKILL.md Adds context-engineering plugin skill content.
assets/plugins/context-engineering/agents/context-architect.md Adds context-engineering plugin agent content.
assets/plugins/context-engineering/README.md Adds README for the context-engineering plugin.
assets/plugins/context-engineering/.github/plugin/plugin.json Adds plugin manifest/config for the context-engineering plugin.
assets/plugins/clojure-interactive-programming/skills/remember-interactive-programming/SKILL.md Adds clojure-interactive-programming plugin skill content.
assets/plugins/clojure-interactive-programming/agents/clojure-interactive-programming.md Adds clojure-interactive-programming plugin agent content.
assets/plugins/clojure-interactive-programming/README.md Adds README for the clojure-interactive-programming plugin.
assets/plugins/clojure-interactive-programming/.github/plugin/plugin.json Adds plugin manifest/config for the clojure-interactive-programming plugin.
assets/plugins/cast-imaging/agents/cast-imaging-structural-quality-advisor.md Adds CAST Imaging plugin agent content.
assets/plugins/cast-imaging/agents/cast-imaging-software-discovery.md Adds CAST Imaging plugin agent content.
assets/plugins/cast-imaging/agents/cast-imaging-impact-analysis.md Adds CAST Imaging plugin agent content.
assets/plugins/cast-imaging/README.md Adds README for the CAST Imaging plugin.
assets/plugins/cast-imaging/.github/plugin/plugin.json Adds plugin manifest/config for the CAST Imaging plugin.
assets/plugins/azure-cloud-development/skills/azure-resource-health-diagnose/SKILL.md Adds azure-cloud-development plugin skill content.
assets/plugins/azure-cloud-development/skills/az-cost-optimize/SKILL.md Adds azure-cloud-development plugin skill content.
assets/plugins/azure-cloud-development/agents/terraform-azure-planning.md Adds azure-cloud-development plugin agent content.
assets/plugins/azure-cloud-development/agents/terraform-azure-implement.md Adds azure-cloud-development plugin agent content.
assets/plugins/azure-cloud-development/agents/azure-verified-modules-terraform.md Adds azure-cloud-development plugin agent content.
assets/plugins/azure-cloud-development/agents/azure-verified-modules-bicep.md Adds azure-cloud-development plugin agent content.
assets/plugins/azure-cloud-development/agents/azure-saas-architect.md Adds azure-cloud-development plugin agent content.
assets/plugins/azure-cloud-development/agents/azure-principal-architect.md Adds azure-cloud-development plugin agent content.
assets/plugins/azure-cloud-development/agents/azure-logic-apps-expert.md Adds azure-cloud-development plugin agent content.
assets/plugins/azure-cloud-development/README.md Adds README for the azure-cloud-development plugin.
assets/plugins/azure-cloud-development/.github/plugin/plugin.json Adds plugin manifest/config for the azure-cloud-development plugin.
assets/plugins/awesome-copilot/skills/suggest-awesome-github-copilot-skills/SKILL.md Adds awesome-copilot plugin meta-skill content.
assets/plugins/awesome-copilot/skills/suggest-awesome-github-copilot-prompts/SKILL.md Adds awesome-copilot plugin meta-skill content.
assets/plugins/awesome-copilot/skills/suggest-awesome-github-copilot-instructions/SKILL.md Adds awesome-copilot plugin meta-skill content.
assets/plugins/awesome-copilot/skills/suggest-awesome-github-copilot-agents/SKILL.md Adds awesome-copilot plugin meta-skill content.
assets/plugins/awesome-copilot/agents/meta-agentic-project-scaffold.md Adds awesome-copilot plugin agent content.
assets/plugins/awesome-copilot/README.md Adds README for the awesome-copilot plugin.
assets/plugins/awesome-copilot/.github/plugin/plugin.json Adds plugin manifest/config for the awesome-copilot plugin.
assets/hooks/session-logger/log-session-start.sh Adds hook script to log session start events.
assets/hooks/session-logger/log-session-end.sh Adds hook script to log session end events.
assets/hooks/session-logger/log-prompt.sh Adds hook script to log prompt submission events.
assets/hooks/session-logger/hooks.json Adds hook configuration for session-logger hook.
assets/hooks/session-logger/README.md Adds documentation/metadata for session-logger hook.
assets/hooks/session-auto-commit/hooks.json Adds hook configuration for session-auto-commit hook.
assets/hooks/session-auto-commit/auto-commit.sh Adds hook script to auto-commit/push changes on session end.
assets/hooks/session-auto-commit/README.md Adds documentation/metadata for session-auto-commit hook.
assets/hooks/governance-audit/hooks.json Adds hook configuration for governance-audit hook.
assets/hooks/governance-audit/audit-session-start.sh Adds hook script to log governance context at session start.
assets/hooks/governance-audit/audit-session-end.sh Adds hook script to summarize governance audit at session end.
assets/hooks/governance-audit/audit-prompt.sh Adds hook script to scan prompts for threat signals and optionally block.
assets/hooks/governance-audit/README.md Adds documentation/metadata for governance-audit hook.
assets/hooks/.upstream-sync.json Records upstream sync metadata for hooks assets.
README.md Updates documentation to describe hooks/plugins and show CLI usage + sync scripts.
Comments suppressed due to low confidence (1)

scripts/sync-repo.js:176

  • Now that hooks and plugins are treated as syncable resource types, sync-repo.js will also invoke validate-assets.js hooks|plugins after sync. Currently validate-assets.js only understands skills as directory-based assets and otherwise looks for *.md files at assets/<type>/, so hooks/plugins validation becomes a no-op. Update the validation script to validate hooks/plugins directories (e.g., parse README.md frontmatter) or skip validation for these types until support is added.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

MAX_SEVERITY="0.0"
for threat in "${THREATS_FOUND[@]}"; do
IFS=$'\t' read -r category severity description evidence_encoded <<< "$threat"
local evidence
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local is used outside of a function (local evidence), which will cause the script to error ("local: can only be used in a function") and, with set -e, abort the hook. Remove local here or move this logic into a function where local is valid.

Suggested change
local evidence

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue exists in the upstream hook script from github/awesome-copilot. Since these files are synced from upstream and not authored by this PR, this should be reported to the github/awesome-copilot repository. Our sync process correctly pulls the hooks as-is from upstream.

Comment on lines 113 to 123
export async function syncSkillsFromGitHub(config) {
const {
repoOwner,
repoName,
remoteDir,
localDir,
resourceType = 'skills', // Default to 'skills' for backward compatibility
token = null,
syncPatterns = null,
dryRun = false
} = config;
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syncPatterns is documented and accepted in the syncSkillsFromGitHub config, but it’s never used to filter which files get downloaded (all files are always fetched recursively). Either apply the patterns when building files (e.g., filter getSkillFiles results) or remove the parameter/docs to avoid a misleading API.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the unused syncPatterns parameter from the function signature and documentation in commit 18b7590. Directory-based assets sync all files recursively without pattern filtering.

Comment on lines +25 to +40
## Installation

1. Copy this hook folder to your repository's `.github/hooks/` directory:
```bash
cp -r hooks/session-logger .github/hooks/
```

2. Create the logs directory:
```bash
mkdir -p logs/copilot
```

3. Ensure scripts are executable:
```bash
chmod +x .github/hooks/session-logger/*.sh
```
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log-session-start.sh depends on jq (jq -Rn ...) to produce JSON, but the README doesn’t mention this prerequisite. Either document jq as a requirement (and what happens if it’s missing) or adjust the script to avoid requiring jq so the hook works in minimal environments.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue exists in the upstream hook script and documentation from github/awesome-copilot. Since these files are synced from upstream and not authored by this PR, the missing jq requirement should be documented in the github/awesome-copilot repository.

Comment on lines +78 to +90
it('should list only hooks when type is hooks', () => {
const result = execCLI('list hooks');

expect(result.exitCode).toBe(0);
expect(result.stdout).toContain('hooks');
});

it('should list only plugins when type is plugins', () => {
const result = execCLI('list plugins');

expect(result.exitCode).toBe(0);
expect(result.stdout).toContain('plugins');
});
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR adds new download hooks / download plugins behavior (via downloadDirectoryAsset()), but there are no tests covering these new download paths (even just --dry-run). Add CLI tests similar to the existing skills/collections dry-run tests to ensure hooks/plugins downloads stay working and pathing/overwrite prompts don’t regress.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tests for hooks and plugins download with --dry-run in commit 18b7590. The new tests verify that both hooks and plugins display the correct dry-run output and directory creation messages.

Comment on lines +85 to +99
IFS=$'\t' read -r category severity description evidence_encoded <<< "$threat"
local evidence
evidence=$(printf '%s' "$evidence_encoded" | base64 -d 2>/dev/null || echo "[redacted]")

if [[ "$FIRST" != "true" ]]; then
THREATS_JSON+=","
fi
FIRST=false

THREATS_JSON+=$(jq -Rn \
--arg cat "$category" \
--arg sev "$severity" \
--arg desc "$description" \
--arg ev "$evidence" \
'{"category":$cat,"severity":($sev|tonumber),"description":$desc,"evidence":$ev}')
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The audit-prompt.sh hook logs the full matched evidence string from user prompts into logs/copilot/governance/audit.log, which for patterns like credential_exposure (API keys, passwords, tokens, AWS keys) will persist actual secrets in cleartext. An attacker who gains access to the filesystem, backups, or accidentally committed logs could harvest these credentials, turning the governance hook into a secondary exfiltration point. Instead of storing raw evidence, log only non-sensitive metadata (category, severity, and perhaps a redacted hash or truncated sample) so that secrets detected in prompts are never written to disk unredacted.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This security issue exists in the upstream hook script from github/awesome-copilot. Since these files are synced from upstream and not authored by this PR, this vulnerability should be reported and fixed in the github/awesome-copilot repository. Our sync process correctly pulls the hooks as-is from upstream without modifying their behavior.

@archubbuck
Copy link
Owner

@copilot apply changes based on the comments in this thread

…arameter

Co-authored-by: archubbuck <3529902+archubbuck@users.noreply.github.com>
@archubbuck
Copy link
Owner

@copilot there are merge conflicts with the target branch - review them and push changes so I can select the current changes when resolving the conflicts

…pport

Co-authored-by: archubbuck <3529902+archubbuck@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 2, 2026

@copilot there are merge conflicts with the target branch - review them and push changes so I can select the current changes when resolving the conflicts

Merge conflicts resolved in commit bb24010. Kept hooks and plugins support while integrating main branch changes:

Resolved conflicts:

  • README.md - Added hooks/plugins sync commands, kept note about prompts from main
  • scripts/sync-repo.js - Adopted main's dynamic displayUsage() that reads from config (automatically includes hooks/plugins)
  • upstream.config.json - Removed prompts entry (as main did), kept hooks and plugins

All changes preserve the hooks and plugins functionality. You can now merge this PR or select "Accept Current Changes" when GitHub shows the conflict resolution UI.

@archubbuck
Copy link
Owner

@copilot regenerate the package-lock

Co-authored-by: archubbuck <3529902+archubbuck@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot regenerate the package-lock

Regenerated package-lock.json in commit 7a42e1d. The file has been updated with current dependency versions from npm registry.

@archubbuck
Copy link
Owner

@copilot The job failed because test coverage thresholds were not met:

  • Coverage for lines (9.76%) is below the global threshold (12%)
  • Coverage for functions (15.38%) is below the global threshold (20%)
  • Coverage for statements (10.74%) is below the global threshold (13%)
  • Coverage for branches (9.04%) is below the global threshold (10%)

Solution:

  1. Increase test coverage for bin/cli-functions.js, which is currently poorly covered (see lines 16-19, 56, 107-616).
  2. Add or improve tests in your test suite to target under-tested functions and code paths in bin/cli-functions.js.
  3. Example: Add tests for code paths related to asset handling, manifest loading, and branch logic, especially for error paths and option branches.
  4. Run the job again after improving tests.

Reference files:

  • Workflow definition: .github/workflows/test-and-lint.yml (see job steps)
  • Code needing coverage: bin/cli-functions.js (focus on untested branches and functions)

Target your new or updated tests to address these coverage gaps.

Co-authored-by: archubbuck <3529902+archubbuck@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot The job failed because test coverage thresholds were not met:

  • Coverage for lines (9.76%) is below the global threshold (12%)
    ...

Added comprehensive unit tests in commit c39edee to increase coverage above all thresholds:

  • Lines: 63.97% (threshold: 12%) ✅
  • Functions: 76.92% (threshold: 20%) ✅
  • Statements: 64.49% (threshold: 13%) ✅
  • Branches: 59.57% (threshold: 10%) ✅

The new tests cover isLocal(), getManifest(), listAssets(), and downloadAsset() functions with various options and error conditions. All 109 tests now pass.

@archubbuck
Copy link
Owner

@copilot The failure in job 65772939685 is caused by an out-of-sync package-lock.json and package.json. The npm ci step reports:

npm error code EUSAGE
npm error npm ci can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with npm install before continuing.
npm error Missing: conventional-commits-filter@5.0.0 from lock file
npm error Missing: conventional-commits-parser@6.3.0 from lock file

Solution:

  • Run npm install locally to update your package-lock.json so that all dependencies and their versions match those listed in your package.json.
  • Commit the updated package-lock.json file.
  • Push your changes to re-trigger the workflow.

Relevant files:

  • package.json: view source
  • package-lock.json: view source
  • Workflow YAML: view source

After syncing these files, the npm ci job in .github/workflows/test-and-lint.yml should succeed.

Co-authored-by: archubbuck <3529902+archubbuck@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 4, 2026

@copilot The failure in job 65772939685 is caused by an out-of-sync package-lock.json and package.json. The npm ci step reports:

npm error code EUSAGE
...

Synced package-lock.json with main branch in commit fddc409. The issue was caused by the previous merge from main not properly updating the package-lock.json, which was missing the newer versions of conventional-commits-filter@5.0.0 and conventional-commits-parser@6.2.1 required by git-semver-tags. The npm ci command should now succeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants