@@ -347,6 +347,8 @@ export class SkillInstaller {
347347
348348 // Create Skill in DB first, then move the cloned repo into the managed
349349 // variant container so all My Skills entries share one disk layout.
350+ const repoFiles = await this . readLocalRepoFileBuffersByPath ( skillDir ) ;
351+ const sourceDirectory = path . relative ( installDir , skillDir ) . replace ( / \\ / g, "/" ) || undefined ;
350352 const skill = db . create ( {
351353 name : manifest . name || repoName ,
352354 description : manifest . description || `Installed from ${ url } ` ,
@@ -356,7 +358,11 @@ export class SkillInstaller {
356358 instructions : manifest . instructions || "" ,
357359 protocol_type : "skill" ,
358360 source_url : url ,
361+ source_label : `${ userDir } /${ repoName } ` ,
362+ source_directory : sourceDirectory ,
363+ canonical_skill_path : sourceDirectory ? `${ sourceDirectory } /SKILL.md` : "SKILL.md" ,
359364 local_repo_path : installDir ,
365+ directory_fingerprint : computeDirectoryFingerprint ( repoFiles ) ,
360366 is_favorite : false ,
361367 tags : [ ] ,
362368 original_tags : manifest . tags || [ "github" ] ,
@@ -474,9 +480,9 @@ export class SkillInstaller {
474480 ) ;
475481 }
476482
477- const sanitized = sanitizeImportedSkillDraft (
478- {
479- name : skillName ,
483+ const sanitized = sanitizeImportedSkillDraft (
484+ {
485+ name : skillName ,
480486 description : parsed ?. frontmatter . description ,
481487 fallbackDescription :
482488 manifest . description ||
@@ -494,6 +500,7 @@ export class SkillInstaller {
494500 } ,
495501 { defaultTags : [ ] } ,
496502 ) ;
503+ const canonicalSkillPath = options ?. repoSourceDir ? "SKILL.md" : undefined ;
497504
498505 // Save files first, then create DB record to avoid orphaned records
499506 const createdSkill = db . create ( {
@@ -508,7 +515,9 @@ export class SkillInstaller {
508515 original_tags : sanitized . tags ,
509516 is_favorite : false ,
510517 source_url : sanitized . source_url ,
518+ source_label : options ?. sourceUrl ,
511519 local_repo_path : sanitized . local_repo_path ,
520+ canonical_skill_path : canonicalSkillPath ,
512521 } ) ;
513522
514523 let localRepoPath : string | undefined ;
@@ -526,7 +535,16 @@ export class SkillInstaller {
526535 }
527536
528537 if ( localRepoPath && createdSkill . local_repo_path !== localRepoPath ) {
529- db . update ( createdSkill . id , { local_repo_path : localRepoPath } ) ;
538+ const repoFiles = await this . readLocalRepoFileBuffersByPath ( localRepoPath ) ;
539+ db . update ( createdSkill . id , {
540+ local_repo_path : localRepoPath ,
541+ directory_fingerprint : computeDirectoryFingerprint ( repoFiles ) ,
542+ } ) ;
543+ } else if ( localRepoPath ) {
544+ const repoFiles = await this . readLocalRepoFileBuffersByPath ( localRepoPath ) ;
545+ db . update ( createdSkill . id , {
546+ directory_fingerprint : computeDirectoryFingerprint ( repoFiles ) ,
547+ } ) ;
530548 }
531549
532550 return createdSkill . id ;
@@ -659,9 +677,7 @@ export class SkillInstaller {
659677 source_branch : normalizedBranch ,
660678 source_directory : normalizedDirectory || undefined ,
661679 canonical_skill_path : skill . filePath ,
662- directory_fingerprint : computeDirectoryFingerprint ( [
663- { path : "SKILL.md" , content : skill . instructions , isDirectory : false } ,
664- ] ) ,
680+ directory_fingerprint : skill . directory_fingerprint ,
665681 description : builtin ?. description || skill . description || `${ skill . name } skill` ,
666682 category : builtin ?. category || "general" ,
667683 icon_url : builtin ?. icon_url ,
@@ -873,6 +889,9 @@ export class SkillInstaller {
873889 ) ;
874890
875891 skillMap . set ( skillFolderPath , {
892+ directory_fingerprint : computeDirectoryFingerprint (
893+ await this . readLocalRepoFileBuffersByPath ( skillFolderPath ) ,
894+ ) ,
876895 name : sanitized . name ! ,
877896 description : sanitized . description || manifest . description ,
878897 version : sanitized . version ,
0 commit comments