@@ -24,6 +24,7 @@ import {
2424 parseSkillMetadata ,
2525 parseYamlFile ,
2626} from "./yaml-parser.mjs" ;
27+ import { getGitFileDates } from "./utils/git-dates.mjs" ;
2728
2829const __filename = fileURLToPath ( import . meta. url ) ;
2930const __dirname = dirname ( __filename ) ;
@@ -65,7 +66,7 @@ function extractTitle(filePath, frontmatter) {
6566/**
6667 * Generate agents metadata
6768 */
68- function generateAgentsData ( ) {
69+ function generateAgentsData ( gitDates ) {
6970 const agents = [ ] ;
7071 const files = fs
7172 . readdirSync ( AGENTS_DIR )
@@ -106,6 +107,7 @@ function generateAgentsData() {
106107 : [ ] ,
107108 path : relativePath ,
108109 filename : file ,
110+ lastUpdated : gitDates . get ( relativePath ) || null ,
109111 } ) ;
110112 }
111113
@@ -124,7 +126,7 @@ function generateAgentsData() {
124126/**
125127 * Generate prompts metadata
126128 */
127- function generatePromptsData ( ) {
129+ function generatePromptsData ( gitDates ) {
128130 const prompts = [ ] ;
129131 const files = fs
130132 . readdirSync ( PROMPTS_DIR )
@@ -152,6 +154,7 @@ function generatePromptsData() {
152154 tools : tools ,
153155 path : relativePath ,
154156 filename : file ,
157+ lastUpdated : gitDates . get ( relativePath ) || null ,
155158 } ) ;
156159 }
157160
@@ -207,7 +210,7 @@ function extractExtensionFromPattern(pattern) {
207210/**
208211 * Generate instructions metadata
209212 */
210- function generateInstructionsData ( ) {
213+ function generateInstructionsData ( gitDates ) {
211214 const instructions = [ ] ;
212215 const files = fs
213216 . readdirSync ( INSTRUCTIONS_DIR )
@@ -254,6 +257,7 @@ function generateInstructionsData() {
254257 extensions : [ ...new Set ( extensions ) ] ,
255258 path : relativePath ,
256259 filename : file ,
260+ lastUpdated : gitDates . get ( relativePath ) || null ,
257261 } ) ;
258262 }
259263
@@ -317,7 +321,7 @@ function categorizeSkill(name, description) {
317321/**
318322 * Generate skills metadata
319323 */
320- function generateSkillsData ( ) {
324+ function generateSkillsData ( gitDates ) {
321325 const skills = [ ] ;
322326
323327 if ( ! fs . existsSync ( SKILLS_DIR ) ) {
@@ -344,6 +348,9 @@ function generateSkillsData() {
344348 // Get all files in the skill folder recursively
345349 const files = getSkillFiles ( skillPath , relativePath ) ;
346350
351+ // Get last updated from SKILL.md file
352+ const skillFilePath = `${ relativePath } /SKILL.md` ;
353+
347354 skills . push ( {
348355 id : folder ,
349356 name : metadata . name ,
@@ -357,8 +364,9 @@ function generateSkillsData() {
357364 assetCount : metadata . assets . length ,
358365 category : category ,
359366 path : relativePath ,
360- skillFile : ` ${ relativePath } /SKILL.md` ,
367+ skillFile : skillFilePath ,
361368 files : files ,
369+ lastUpdated : gitDates . get ( skillFilePath ) || null ,
362370 } ) ;
363371 }
364372 }
@@ -407,7 +415,7 @@ function getSkillFiles(skillPath, relativePath) {
407415/**
408416 * Generate collections metadata
409417 */
410- function generateCollectionsData ( ) {
418+ function generateCollectionsData ( gitDates ) {
411419 const collections = [ ] ;
412420
413421 if ( ! fs . existsSync ( COLLECTIONS_DIR ) ) {
@@ -448,6 +456,7 @@ function generateCollectionsData() {
448456 } ) ) ,
449457 path : relativePath ,
450458 filename : file ,
459+ lastUpdated : gitDates . get ( relativePath ) || null ,
451460 } ) ;
452461 }
453462 }
@@ -543,6 +552,7 @@ function generateSearchIndex(
543552 title : agent . title ,
544553 description : agent . description ,
545554 path : agent . path ,
555+ lastUpdated : agent . lastUpdated ,
546556 searchText : `${ agent . title } ${ agent . description } ${ agent . tools . join (
547557 " "
548558 ) } `. toLowerCase ( ) ,
@@ -556,6 +566,7 @@ function generateSearchIndex(
556566 title : prompt . title ,
557567 description : prompt . description ,
558568 path : prompt . path ,
569+ lastUpdated : prompt . lastUpdated ,
559570 searchText : `${ prompt . title } ${ prompt . description } ` . toLowerCase ( ) ,
560571 } ) ;
561572 }
@@ -567,6 +578,7 @@ function generateSearchIndex(
567578 title : instruction . title ,
568579 description : instruction . description ,
569580 path : instruction . path ,
581+ lastUpdated : instruction . lastUpdated ,
570582 searchText : `${ instruction . title } ${ instruction . description } ${
571583 instruction . applyTo || ""
572584 } `. toLowerCase ( ) ,
@@ -580,6 +592,7 @@ function generateSearchIndex(
580592 title : skill . title ,
581593 description : skill . description ,
582594 path : skill . skillFile ,
595+ lastUpdated : skill . lastUpdated ,
583596 searchText : `${ skill . title } ${ skill . description } ` . toLowerCase ( ) ,
584597 } ) ;
585598 }
@@ -592,6 +605,7 @@ function generateSearchIndex(
592605 description : collection . description ,
593606 path : collection . path ,
594607 tags : collection . tags ,
608+ lastUpdated : collection . lastUpdated ,
595609 searchText : `${ collection . name } ${
596610 collection . description
597611 } ${ collection . tags . join ( " " ) } `. toLowerCase ( ) ,
@@ -704,32 +718,40 @@ async function main() {
704718
705719 ensureDataDir ( ) ;
706720
721+ // Load git dates for all resource files (single efficient git command)
722+ console . log ( "Loading git history for last updated dates..." ) ;
723+ const gitDates = getGitFileDates (
724+ [ "agents/" , "prompts/" , "instructions/" , "skills/" , "collections/" ] ,
725+ ROOT_FOLDER
726+ ) ;
727+ console . log ( `✓ Loaded dates for ${ gitDates . size } files\n` ) ;
728+
707729 // Generate all data
708- const agentsData = generateAgentsData ( ) ;
730+ const agentsData = generateAgentsData ( gitDates ) ;
709731 const agents = agentsData . items ;
710732 console . log (
711733 `✓ Generated ${ agents . length } agents (${ agentsData . filters . models . length } models, ${ agentsData . filters . tools . length } tools)`
712734 ) ;
713735
714- const promptsData = generatePromptsData ( ) ;
736+ const promptsData = generatePromptsData ( gitDates ) ;
715737 const prompts = promptsData . items ;
716738 console . log (
717739 `✓ Generated ${ prompts . length } prompts (${ promptsData . filters . tools . length } tools)`
718740 ) ;
719741
720- const instructionsData = generateInstructionsData ( ) ;
742+ const instructionsData = generateInstructionsData ( gitDates ) ;
721743 const instructions = instructionsData . items ;
722744 console . log (
723745 `✓ Generated ${ instructions . length } instructions (${ instructionsData . filters . extensions . length } extensions)`
724746 ) ;
725747
726- const skillsData = generateSkillsData ( ) ;
748+ const skillsData = generateSkillsData ( gitDates ) ;
727749 const skills = skillsData . items ;
728750 console . log (
729751 `✓ Generated ${ skills . length } skills (${ skillsData . filters . categories . length } categories)`
730752 ) ;
731753
732- const collectionsData = generateCollectionsData ( ) ;
754+ const collectionsData = generateCollectionsData ( gitDates ) ;
733755 const collections = collectionsData . items ;
734756 console . log (
735757 `✓ Generated ${ collections . length } collections (${ collectionsData . filters . tags . length } tags)`
0 commit comments