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:
@@ -4,7 +4,11 @@ import fs from "fs";
|
||||
import path from "path";
|
||||
import readline from "readline";
|
||||
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");
|
||||
|
||||
@@ -238,7 +242,11 @@ function generateReadme(collection, items) {
|
||||
const name = getDisplayName(item.path, "hook");
|
||||
const description =
|
||||
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("");
|
||||
|
||||
Reference in New Issue
Block a user