77 * npx ember-best-practices-agents-md --output AGENTS.md
88 */
99
10- import fs from "fs" ;
11- import path from " path" ;
10+ import fs from 'fs' ;
11+ import path from ' path' ;
1212import {
1313 DOCS_DIR_NAME ,
1414 collectDocFiles ,
1515 copyBestPractices ,
1616 ensureGitignoreEntry ,
1717 generateIndex ,
1818 injectIntoAgentsMd ,
19- } from " ../lib/agents-md.js" ;
19+ } from ' ../lib/agents-md.js' ;
2020
2121function formatSize ( bytes ) {
2222 if ( bytes < 1024 ) return `${ bytes } B` ;
@@ -38,18 +38,18 @@ function bold(s) {
3838
3939async function run ( options = { } ) {
4040 const cwd = process . cwd ( ) ;
41- const targetFile = options . output || " AGENTS.md" ;
41+ const targetFile = options . output || ' AGENTS.md' ;
4242 const claudeMdPath = path . join ( cwd , targetFile ) ;
4343 const docsPath = path . join ( cwd , DOCS_DIR_NAME ) ;
4444 const docsLinkPath = `./${ DOCS_DIR_NAME } ` ;
4545
4646 let sizeBefore = 0 ;
4747 let isNewFile = true ;
48- let existingContent = "" ;
48+ let existingContent = '' ;
4949
5050 if ( fs . existsSync ( claudeMdPath ) ) {
51- existingContent = fs . readFileSync ( claudeMdPath , " utf-8" ) ;
52- sizeBefore = Buffer . byteLength ( existingContent , " utf-8" ) ;
51+ existingContent = fs . readFileSync ( claudeMdPath , ' utf-8' ) ;
52+ sizeBefore = Buffer . byteLength ( existingContent , ' utf-8' ) ;
5353 isNewFile = false ;
5454 }
5555
@@ -58,11 +58,11 @@ async function run(options = {}) {
5858 try {
5959 copyBestPractices ( docsPath ) ;
6060 } catch ( err ) {
61- console . error ( " Error:" , err . message ) ;
61+ console . error ( ' Error:' , err . message ) ;
6262 process . exit ( 1 ) ;
6363 }
6464
65- const docFiles = collectDocFiles ( path . join ( docsPath , " rules" ) ) ;
65+ const docFiles = collectDocFiles ( path . join ( docsPath , ' rules' ) ) ;
6666 const filePaths = docFiles . map ( ( f ) => `rules/${ f . relativePath } ` ) ;
6767
6868 const indexContent = generateIndex ( {
@@ -72,30 +72,29 @@ async function run(options = {}) {
7272 } ) ;
7373
7474 const newContent = injectIntoAgentsMd ( existingContent , indexContent ) ;
75- fs . writeFileSync ( claudeMdPath , newContent , " utf-8" ) ;
75+ fs . writeFileSync ( claudeMdPath , newContent , ' utf-8' ) ;
7676
77- const sizeAfter = Buffer . byteLength ( newContent , " utf-8" ) ;
77+ const sizeAfter = Buffer . byteLength ( newContent , ' utf-8' ) ;
7878 const gitignoreResult = ensureGitignoreEntry ( cwd ) ;
7979
80- const action = isNewFile ? " Created" : " Updated" ;
80+ const action = isNewFile ? ' Created' : ' Updated' ;
8181 const sizeInfo = isNewFile
8282 ? formatSize ( sizeAfter )
8383 : `${ formatSize ( sizeBefore ) } → ${ formatSize ( sizeAfter ) } ` ;
8484
85- console . log ( `${ green ( "✓" ) } ${ action } ${ bold ( targetFile ) } (${ sizeInfo } )` ) ;
85+ console . log ( `${ green ( '✓' ) } ${ action } ${ bold ( targetFile ) } (${ sizeInfo } )` ) ;
8686 if ( gitignoreResult . updated ) {
87- console . log ( `${ green ( "✓" ) } Added ${ bold ( DOCS_DIR_NAME ) } to .gitignore` ) ;
87+ console . log ( `${ green ( '✓' ) } Added ${ bold ( DOCS_DIR_NAME ) } to .gitignore` ) ;
8888 }
89- console . log ( "" ) ;
89+ console . log ( '' ) ;
9090}
9191
9292// Parse args (minimal: --output)
9393const args = process . argv . slice ( 2 ) ;
94- const outputIdx = args . indexOf ( "--output" ) ;
95- const output =
96- outputIdx >= 0 && args [ outputIdx + 1 ] ? args [ outputIdx + 1 ] : null ;
94+ const outputIdx = args . indexOf ( '--output' ) ;
95+ const output = outputIdx >= 0 && args [ outputIdx + 1 ] ? args [ outputIdx + 1 ] : null ;
9796
98- if ( args . includes ( " --help" ) || args . includes ( "-h" ) ) {
97+ if ( args . includes ( ' --help' ) || args . includes ( '-h' ) ) {
9998 console . log ( `
10099ember-best-practices-agents-md - Ember.js best practices for AI coding agents
101100
0 commit comments