mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-20 02:15:12 +00:00
Address PR review comments for hooks implementation
- Fix getResourceType() to match relative paths like hooks/<name>/README.md and skills/<name>/SKILL.md using regex instead of string includes - Extract hook events from hooks.json via parseHookMetadata() instead of non-existent frontmatter.event field in plugin README generation - Update AGENTS.md to describe hooks as folder-based (README.md + hooks.json) instead of .hook.md files - Update session-logger README to accurately reflect what scripts log (remove references to sessionId, duration, prompt content)
This commit is contained in:
@@ -19,7 +19,7 @@ The Awesome GitHub Copilot repository is a community-driven collection of custom
|
|||||||
├── prompts/ # Task-specific prompts (.prompt.md files)
|
├── prompts/ # Task-specific prompts (.prompt.md files)
|
||||||
├── instructions/ # Coding standards and guidelines (.instructions.md files)
|
├── instructions/ # Coding standards and guidelines (.instructions.md files)
|
||||||
├── skills/ # Agent Skills folders (each with SKILL.md and optional bundled assets)
|
├── skills/ # Agent Skills folders (each with SKILL.md and optional bundled assets)
|
||||||
├── hooks/ # Automated workflow hooks (.hook.md files)
|
├── hooks/ # Automated workflow hooks (folders with README.md + hooks.json)
|
||||||
├── collections/ # Curated collections of resources (.md files)
|
├── collections/ # Curated collections of resources (.md files)
|
||||||
├── docs/ # Documentation for different resource types
|
├── docs/ # Documentation for different resource types
|
||||||
├── eng/ # Build and automation scripts
|
├── eng/ # Build and automation scripts
|
||||||
@@ -52,7 +52,7 @@ npm run skill:create -- --name <skill-name>
|
|||||||
|
|
||||||
### Working with Agents, Prompts, Instructions, Skills, and Hooks
|
### Working with Agents, Prompts, Instructions, Skills, and Hooks
|
||||||
|
|
||||||
All agent files (`*.agent.md`), prompt files (`*.prompt.md`), instruction files (`*.instructions.md`), and hook files (`*.hook.md`) must include proper markdown front matter. Agent Skills are folders containing a `SKILL.md` file with frontmatter and optional bundled assets:
|
All agent files (`*.agent.md`), prompt files (`*.prompt.md`), and instruction files (`*.instructions.md`) must include proper markdown front matter. Agent Skills are folders containing a `SKILL.md` file with frontmatter and optional bundled assets. Hooks are folders containing a `README.md` with frontmatter and a `hooks.json` configuration file:
|
||||||
|
|
||||||
#### Agent Files (*.agent.md)
|
#### Agent Files (*.agent.md)
|
||||||
- Must have `description` field (wrapped in single quotes)
|
- Must have `description` field (wrapped in single quotes)
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ import fs from "fs";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import readline from "readline";
|
import readline from "readline";
|
||||||
import { COLLECTIONS_DIR, ROOT_FOLDER } from "./constants.mjs";
|
import { COLLECTIONS_DIR, ROOT_FOLDER } from "./constants.mjs";
|
||||||
import { parseCollectionYaml, parseFrontmatter } from "./yaml-parser.mjs";
|
import {
|
||||||
|
parseCollectionYaml,
|
||||||
|
parseFrontmatter,
|
||||||
|
parseHookMetadata,
|
||||||
|
} from "./yaml-parser.mjs";
|
||||||
|
|
||||||
const PLUGINS_DIR = path.join(ROOT_FOLDER, "plugins");
|
const PLUGINS_DIR = path.join(ROOT_FOLDER, "plugins");
|
||||||
|
|
||||||
@@ -238,7 +242,11 @@ function generateReadme(collection, items) {
|
|||||||
const name = getDisplayName(item.path, "hook");
|
const name = getDisplayName(item.path, "hook");
|
||||||
const description =
|
const description =
|
||||||
item.frontmatter?.description || item.frontmatter?.name || name;
|
item.frontmatter?.description || item.frontmatter?.name || name;
|
||||||
const event = item.frontmatter?.event || "N/A";
|
// Extract events from hooks.json rather than frontmatter
|
||||||
|
const hookFolderPath = path.join(ROOT_FOLDER, path.dirname(item.path));
|
||||||
|
const hookMeta = parseHookMetadata(hookFolderPath);
|
||||||
|
const event =
|
||||||
|
hookMeta?.hooks?.length > 0 ? hookMeta.hooks.join(", ") : "N/A";
|
||||||
lines.push(`| \`${name}\` | ${description} | ${event} |`);
|
lines.push(`| \`${name}\` | ${description} | ${event} |`);
|
||||||
}
|
}
|
||||||
lines.push("");
|
lines.push("");
|
||||||
|
|||||||
@@ -11,18 +11,16 @@ Comprehensive logging for GitHub Copilot coding agent sessions, tracking session
|
|||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
This hook provides detailed logging of Copilot coding agent activity:
|
This hook provides detailed logging of Copilot coding agent activity:
|
||||||
- Session start/end times
|
- Session start/end times with working directory context
|
||||||
- User prompts and questions
|
- User prompt submission events
|
||||||
- Session duration
|
- Configurable log levels
|
||||||
- Working directory context
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Complete Audit Trail**: Track all Copilot interactions
|
- **Session Tracking**: Log session start and end events
|
||||||
|
- **Prompt Logging**: Record when user prompts are submitted
|
||||||
- **Structured Logging**: JSON format for easy parsing
|
- **Structured Logging**: JSON format for easy parsing
|
||||||
- **Searchable History**: Review past sessions and prompts
|
- **Privacy Aware**: Configurable to disable logging entirely
|
||||||
- **Analytics Ready**: Export data for usage analysis
|
|
||||||
- **Privacy Aware**: Configurable to exclude sensitive data
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -45,15 +43,11 @@ This hook provides detailed logging of Copilot coding agent activity:
|
|||||||
|
|
||||||
## Log Format
|
## Log Format
|
||||||
|
|
||||||
Logs are written to `logs/copilot/session.log` in JSON format:
|
Session events are written to `logs/copilot/session.log` and prompt events to `logs/copilot/prompts.log` in JSON format:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{"timestamp":"2024-01-15T10:30:00Z","event":"sessionStart","cwd":"/workspace/project"}
|
||||||
"timestamp": "2024-01-15T10:30:00Z",
|
{"timestamp":"2024-01-15T10:35:00Z","event":"sessionEnd"}
|
||||||
"event": "sessionStart",
|
|
||||||
"sessionId": "abc123",
|
|
||||||
"cwd": "/workspace/project"
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Privacy & Security
|
## Privacy & Security
|
||||||
|
|||||||
@@ -503,5 +503,7 @@ export function getLastUpdatedHtml(isoDate: string | null | undefined): string {
|
|||||||
return `<span class="last-updated">Updated: Unknown</span>`;
|
return `<span class="last-updated">Updated: Unknown</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `<span class="last-updated" title="${escapeHtml(fullDate)}">Updated ${relativeTime}</span>`;
|
return `<span class="last-updated" title="${escapeHtml(
|
||||||
|
fullDate
|
||||||
|
)}">Updated ${relativeTime}</span>`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user