File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Rebuild Skill Index
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 0 * * 0'
6+ workflow_dispatch :
7+
8+ permissions :
9+ contents : write
10+
11+ jobs :
12+ rebuild-index :
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@v4
18+ with :
19+ token : ${{ secrets.GITHUB_TOKEN }}
20+
21+ - name : Setup Node.js
22+ uses : actions/setup-node@v4
23+ with :
24+ node-version : ' 20'
25+
26+ - name : Install CLI dependencies
27+ working-directory : packages/cli
28+ run : npm ci
29+
30+ - name : Build CLI
31+ working-directory : packages/cli
32+ run : npm run build
33+
34+ - name : Rebuild skill index
35+ working-directory : packages/cli
36+ env :
37+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
38+ run : node dist/cli.js skill rebuild-index --output ../../skills/index.json
39+
40+ - name : Check for changes
41+ id : git-check
42+ run : |
43+ git diff --quiet skills/index.json || echo "changed=true" >> $GITHUB_OUTPUT
44+
45+ - name : Commit and push changes
46+ if : steps.git-check.outputs.changed == 'true'
47+ run : |
48+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
49+ git config --local user.name "github-actions[bot]"
50+ git add skills/index.json
51+ git commit -m "chore: update skill index [automated]"
52+ git push
Original file line number Diff line number Diff line change @@ -11,10 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212- ** Skill Search** - New ` skill find ` command to discover skills across all registries
1313 - ** Keyword Search** : Find skills by name or description (e.g., ` ai-devkit skill find typescript ` )
14+ - ** Skill Index Rebuild** - New ` skill rebuild-index ` command for search feature
1415
1516### Changed
1617
17- - ** Native Fetch** - Migrated all network calls from ` https ` to native ` fetch ` API for better performance and cleaner code
18+ - ** Native Fetch** - Migrated network calls from ` https ` to native ` fetch ` API for cleaner code
19+ - ** GITHUB_TOKEN Support** - GitHub API calls now use ` GITHUB_TOKEN ` environment variable when available
1820
1921## [ 0.10.0] - 2026-02-01
2022
Original file line number Diff line number Diff line change @@ -124,4 +124,20 @@ export function registerSkillCommand(program: Command): void {
124124 process . exit ( 1 ) ;
125125 }
126126 } ) ;
127+
128+ skillCommand
129+ . command ( 'rebuild-index' )
130+ . description ( 'Rebuild the skill index from all registries (for CI use)' )
131+ . option ( '--output <path>' , 'Output path for the index file' )
132+ . action ( async ( options : { output ?: string } ) => {
133+ try {
134+ const configManager = new ConfigManager ( ) ;
135+ const skillManager = new SkillManager ( configManager ) ;
136+
137+ await skillManager . rebuildIndex ( options . output ) ;
138+ } catch ( error : any ) {
139+ ui . error ( `Failed to rebuild index: ${ error . message } ` ) ;
140+ process . exit ( 1 ) ;
141+ }
142+ } ) ;
127143}
Original file line number Diff line number Diff line change @@ -556,6 +556,28 @@ export class SkillManager {
556556 }
557557 }
558558
559+ /**
560+ * Rebuild skill index and write to specified output path
561+ * @param outputPath - Optional custom output path (defaults to SKILL_INDEX_PATH)
562+ */
563+ async rebuildIndex ( outputPath ?: string ) : Promise < void > {
564+ const targetPath = outputPath || SKILL_INDEX_PATH ;
565+
566+ const spinner = ui . spinner ( 'Rebuilding skill index from all registries...' ) ;
567+ spinner . start ( ) ;
568+
569+ try {
570+ const newIndex = await this . buildSkillIndex ( ) ;
571+ await fs . ensureDir ( path . dirname ( targetPath ) ) ;
572+ await fs . writeJson ( targetPath , newIndex , { spaces : 2 } ) ;
573+ spinner . succeed ( `Skill index rebuilt: ${ newIndex . skills . length } skills` ) ;
574+ ui . info ( `Written to: ${ targetPath } ` ) ;
575+ } catch ( error : any ) {
576+ spinner . fail ( 'Failed to rebuild index' ) ;
577+ throw new Error ( `Failed to rebuild skill index: ${ error . message } ` ) ;
578+ }
579+ }
580+
559581 /**
560582 * Build skill index from all registries
561583 * @returns Complete skill index
Original file line number Diff line number Diff line change @@ -23,20 +23,23 @@ export async function fetchGitHubSkillPaths(
2323) : Promise < string [ ] > {
2424 const url = `https://api.github.com/repos/${ owner } /${ repo } /git/trees/${ branch } ?recursive=1` ;
2525
26- const response = await fetch ( url , {
27- headers : {
28- 'User-Agent' : 'ai-devkit-cli' ,
29- 'Accept' : 'application/vnd.github.v3+json' ,
30- } ,
31- } ) ;
26+ const headers : Record < string , string > = {
27+ 'User-Agent' : 'ai-devkit-cli' ,
28+ 'Accept' : 'application/vnd.github.v3+json' ,
29+ } ;
30+
31+ if ( process . env . GITHUB_TOKEN ) {
32+ headers [ 'Authorization' ] = `Bearer ${ process . env . GITHUB_TOKEN } ` ;
33+ }
34+
35+ const response = await fetch ( url , { headers } ) ;
3236
3337 if ( ! response . ok ) {
3438 throw new Error ( `GitHub API returned ${ response . status } : ${ response . statusText } ` ) ;
3539 }
3640
3741 const data = ( await response . json ( ) ) as GitHubTreeResponse ;
3842
39- // Find all SKILL.md files under skills/ directory
4043 const skillPaths = data . tree
4144 . filter ( item =>
4245 item . path . startsWith ( 'skills/' ) &&
You can’t perform that action at this time.
0 commit comments