@@ -33,41 +33,83 @@ var __importStar = (this && this.__importStar) || (function () {
3333 return result ;
3434 } ;
3535} ) ( ) ;
36+ var __importDefault = ( this && this . __importDefault ) || function ( mod ) {
37+ return ( mod && mod . __esModule ) ? mod : { "default" : mod } ;
38+ } ;
3639Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3740const commander_1 = require ( "commander" ) ;
3841const constants_1 = require ( "./utils/constants" ) ;
3942const local_action_1 = require ( "./actions/local_action" ) ;
4043const dotenv = __importStar ( require ( "dotenv" ) ) ;
44+ const child_process_1 = require ( "child_process" ) ;
45+ const boxen_1 = __importDefault ( require ( "boxen" ) ) ;
46+ const chalk_1 = __importDefault ( require ( "chalk" ) ) ;
47+ const logger_1 = require ( "./utils/logger" ) ;
4148// Load environment variables from .env file
4249dotenv . config ( ) ;
4350const program = new commander_1 . Command ( ) ;
51+ // Function to get git repository info
52+ function getGitInfo ( ) {
53+ try {
54+ const remoteUrl = ( 0 , child_process_1 . execSync ) ( 'git config --get remote.origin.url' ) . toString ( ) . trim ( ) ;
55+ const match = remoteUrl . match ( / g i t h u b \. c o m [ / : ] ( [ ^ / ] + ) \/ ( [ ^ / ] + ) (?: \. g i t ) ? $ / ) ;
56+ if ( ! match ) {
57+ return { error : constants_1 . ERRORS . GIT_REPOSITORY_NOT_FOUND } ;
58+ }
59+ return {
60+ owner : match [ 1 ] ,
61+ repo : match [ 2 ] . replace ( '.git' , '' )
62+ } ;
63+ }
64+ catch ( error ) {
65+ return { error : constants_1 . ERRORS . GIT_REPOSITORY_NOT_FOUND } ;
66+ }
67+ }
4468program
4569 . name ( 'git-board-flow' )
4670 . description ( 'CLI tool for Git Board Flow' )
4771 . version ( '1.0.0' ) ;
4872program
4973 . command ( 'build-ai' )
5074 . description ( 'Build AI' )
51- . action ( ( ) => {
75+ . option ( '-i, --issue <number>' , 'Issue number to process' , '1' )
76+ . option ( '-b, --branch <name>' , 'Branch name' , 'master' )
77+ . option ( '-d, --debug' , 'Debug mode' , false )
78+ . option ( '-t, --token <token>' , 'Personal access token' , process . env . PERSONAL_ACCESS_TOKEN )
79+ . action ( ( options ) => {
80+ const gitInfo = getGitInfo ( ) ;
81+ if ( 'error' in gitInfo ) {
82+ console . log ( gitInfo . error ) ;
83+ return ;
84+ }
5285 const params = {
53- [ constants_1 . INPUT_KEYS . DEBUG ] : 'true' ,
86+ [ constants_1 . INPUT_KEYS . DEBUG ] : options . debug . toString ( ) ,
5487 [ constants_1 . INPUT_KEYS . SINGLE_ACTION ] : 'vector_action' ,
55- [ constants_1 . INPUT_KEYS . SINGLE_ACTION_ISSUE ] : '1' ,
88+ [ constants_1 . INPUT_KEYS . SINGLE_ACTION_ISSUE ] : options . issue ,
5689 [ constants_1 . INPUT_KEYS . SUPABASE_URL ] : process . env . SUPABASE_URL ,
5790 [ constants_1 . INPUT_KEYS . SUPABASE_KEY ] : process . env . SUPABASE_KEY ,
5891 [ constants_1 . INPUT_KEYS . TOKEN ] : process . env . PERSONAL_ACCESS_TOKEN ,
5992 [ constants_1 . INPUT_KEYS . AI_IGNORE_FILES ] : 'dist/*,bin/*' ,
6093 repo : {
61- owner : 'landamessenger' ,
62- repo : 'git-board-flow' ,
94+ owner : gitInfo . owner ,
95+ repo : gitInfo . repo ,
6396 } ,
6497 commits : {
65- ref : ' refs/heads/master' ,
98+ ref : ` refs/heads/${ options . branch } ` ,
6699 } ,
67100 issue : {
68- number : 1 ,
101+ number : parseInt ( options . issue ) ,
69102 } ,
70103 } ;
104+ ( 0 , logger_1 . logInfo ) ( ( 0 , boxen_1 . default ) ( chalk_1 . default . cyan ( '🚀 Vectorization started\n' ) +
105+ chalk_1 . default . gray ( `Processing code blocks on ${ gitInfo . owner } /${ gitInfo . repo } /${ options . branch } ...` ) , {
106+ padding : 1 ,
107+ margin : 1 ,
108+ borderStyle : 'round' ,
109+ borderColor : 'cyan' ,
110+ title : 'Git Board Flow' ,
111+ titleAlignment : 'center'
112+ } ) ) ;
71113 ( 0 , local_action_1 . runLocalAction ) ( params ) ;
72114} ) ;
73115program . parse ( process . argv ) ;
0 commit comments