Skip to content

Commit e80e20b

Browse files
committed
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)
1 parent a23d39a commit e80e20b

4 files changed

Lines changed: 24 additions & 20 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The Awesome GitHub Copilot repository is a community-driven collection of custom
1919
├── prompts/ # Task-specific prompts (.prompt.md files)
2020
├── instructions/ # Coding standards and guidelines (.instructions.md files)
2121
├── skills/ # Agent Skills folders (each with SKILL.md and optional bundled assets)
22-
├── hooks/ # Automated workflow hooks (.hook.md files)
22+
├── hooks/ # Automated workflow hooks (folders with README.md + hooks.json)
2323
├── collections/ # Curated collections of resources (.md files)
2424
├── docs/ # Documentation for different resource types
2525
├── eng/ # Build and automation scripts
@@ -52,7 +52,7 @@ npm run skill:create -- --name <skill-name>
5252

5353
### Working with Agents, Prompts, Instructions, Skills, and Hooks
5454

55-
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:
55+
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:
5656

5757
#### Agent Files (*.agent.md)
5858
- Must have `description` field (wrapped in single quotes)

eng/collection-to-plugin.mjs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import fs from "fs";
44
import path from "path";
55
import readline from "readline";
66
import { COLLECTIONS_DIR, ROOT_FOLDER } from "./constants.mjs";
7-
import { parseCollectionYaml, parseFrontmatter } from "./yaml-parser.mjs";
7+
import {
8+
parseCollectionYaml,
9+
parseFrontmatter,
10+
parseHookMetadata,
11+
} from "./yaml-parser.mjs";
812

913
const PLUGINS_DIR = path.join(ROOT_FOLDER, "plugins");
1014

@@ -238,7 +242,11 @@ function generateReadme(collection, items) {
238242
const name = getDisplayName(item.path, "hook");
239243
const description =
240244
item.frontmatter?.description || item.frontmatter?.name || name;
241-
const event = item.frontmatter?.event || "N/A";
245+
// Extract events from hooks.json rather than frontmatter
246+
const hookFolderPath = path.join(ROOT_FOLDER, path.dirname(item.path));
247+
const hookMeta = parseHookMetadata(hookFolderPath);
248+
const event =
249+
hookMeta?.hooks?.length > 0 ? hookMeta.hooks.join(", ") : "N/A";
242250
lines.push(`| \`${name}\` | ${description} | ${event} |`);
243251
}
244252
lines.push("");

hooks/session-logger/README.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@ Comprehensive logging for GitHub Copilot coding agent sessions, tracking session
1111
## Overview
1212

1313
This hook provides detailed logging of Copilot coding agent activity:
14-
- Session start/end times
15-
- User prompts and questions
16-
- Session duration
17-
- Working directory context
14+
- Session start/end times with working directory context
15+
- User prompt submission events
16+
- Configurable log levels
1817

1918
## Features
2019

21-
- **Complete Audit Trail**: Track all Copilot interactions
20+
- **Session Tracking**: Log session start and end events
21+
- **Prompt Logging**: Record when user prompts are submitted
2222
- **Structured Logging**: JSON format for easy parsing
23-
- **Searchable History**: Review past sessions and prompts
24-
- **Analytics Ready**: Export data for usage analysis
25-
- **Privacy Aware**: Configurable to exclude sensitive data
23+
- **Privacy Aware**: Configurable to disable logging entirely
2624

2725
## Installation
2826

@@ -45,15 +43,11 @@ This hook provides detailed logging of Copilot coding agent activity:
4543

4644
## Log Format
4745

48-
Logs are written to `logs/copilot/session.log` in JSON format:
46+
Session events are written to `logs/copilot/session.log` and prompt events to `logs/copilot/prompts.log` in JSON format:
4947

5048
```json
51-
{
52-
"timestamp": "2024-01-15T10:30:00Z",
53-
"event": "sessionStart",
54-
"sessionId": "abc123",
55-
"cwd": "/workspace/project"
56-
}
49+
{"timestamp":"2024-01-15T10:30:00Z","event":"sessionStart","cwd":"/workspace/project"}
50+
{"timestamp":"2024-01-15T10:35:00Z","event":"sessionEnd"}
5751
```
5852

5953
## Privacy & Security

website/src/scripts/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,5 +503,7 @@ export function getLastUpdatedHtml(isoDate: string | null | undefined): string {
503503
return `<span class="last-updated">Updated: Unknown</span>`;
504504
}
505505

506-
return `<span class="last-updated" title="${escapeHtml(fullDate)}">Updated ${relativeTime}</span>`;
506+
return `<span class="last-updated" title="${escapeHtml(
507+
fullDate
508+
)}">Updated ${relativeTime}</span>`;
507509
}

0 commit comments

Comments
 (0)