99 * npm run dev -- tsc
1010 */
1111
12- import { getConfig } from './src/config.mjs' ;
12+ import { Command } from 'commander' ;
13+
14+ import environmentConfig from './src/config.mjs' ;
1315import * as github from './src/github.mjs' ;
1416import * as google from './src/google.mjs' ;
1517import * as hackmd from './src/hackmd.mjs' ;
1618import * as meetings from './src/meeting.mjs' ;
1719
20+ const program = new Command ( ) ;
21+ program
22+ . argument ( '<group>' , 'Meeting group' )
23+ . option ( '--dry-run' , 'Show output without creating/updating anything' , false )
24+ . option ( '--verbose' , 'Show debug output' )
25+ . parse ( process . argv ) ;
26+
1827// Step 1: Application configuration
19- const config = getConfig ( ) ;
28+ /** @type {import('./src/types').AppConfig } */
29+ const config = {
30+ ...environmentConfig ,
31+ ...program . opts ( ) ,
32+ meetingGroup : program . args [ 0 ] ,
33+ } ;
2034
2135// Step 2: Initialize Google Calendar client with API Key
2236const calendarClient = google . createCalendarClient ( config . google ) ;
@@ -28,7 +42,8 @@ const githubClient = github.createGitHubClient(config);
2842const meetingConfig = await meetings . readMeetingConfig ( config ) ;
2943
3044// Step 5: Initialize HackMD client with meeting configuration
31- const hackmdClient = hackmd . createHackMDClient ( config , meetingConfig ) ;
45+ const hackmdClient =
46+ config . dryRun || hackmd . createHackMDClient ( config , meetingConfig ) ;
3247
3348// Step 6: Find next meeting event in calendar
3449const event = await google . findNextMeetingEvent ( calendarClient , meetingConfig ) ;
@@ -54,11 +69,9 @@ const gitHubAgendaIssues = await github.getAgendaIssues(
5469const meetingAgenda = meetings . generateMeetingAgenda ( gitHubAgendaIssues ) ;
5570
5671// Step 11: Create HackMD document with meeting notes and tags
57- const hackmdNote = await hackmd . createMeetingNotesDocument (
58- hackmdClient ,
59- meetingTitle ,
60- ''
61- ) ;
72+ const hackmdNote = config . dryRun
73+ ? { }
74+ : await hackmd . createMeetingNotesDocument ( hackmdClient , meetingTitle , '' ) ;
6275
6376// Step 12: Get the HackMD document link
6477const minutesDocLink =
@@ -74,12 +87,14 @@ const issueContent = await meetings.generateMeetingIssue(
7487) ;
7588
7689// Step 14: Create GitHub issue with HackMD link
77- const githubIssue = await github . createGitHubIssue (
78- githubClient ,
79- meetingConfig ,
80- meetingTitle ,
81- issueContent
82- ) ;
90+ const githubIssue = config . dryRun
91+ ? { }
92+ : await github . createGitHubIssue (
93+ githubClient ,
94+ meetingConfig ,
95+ meetingTitle ,
96+ issueContent
97+ ) ;
8398
8499// Step 15: Update the minutes content with the HackMD link
85100const minutesContent = await meetings . generateMeetingMinutes (
@@ -91,13 +106,19 @@ const minutesContent = await meetings.generateMeetingMinutes(
91106 githubIssue . html_url
92107) ;
93108
94- // Step 16: Update the HackMD document with the self-referencing link
95- await hackmd . updateMeetingNotesDocument (
96- hackmdClient ,
97- hackmdNote . id ,
98- minutesContent
99- ) ;
100-
101- // Output success information with links
102- console . log ( `Created GitHub issue: ${ githubIssue . html_url } ` ) ;
103- console . log ( `Created HackMD document: ${ minutesDocLink } ` ) ;
109+ if ( config . dryRun ) {
110+ console . log ( 'Would create GitHub issue with the following content:' ) ;
111+ console . log ( issueContent ) ;
112+ console . log ( 'Would create HackMD note with the following content:' ) ;
113+ console . log ( minutesContent ) ;
114+ } else {
115+ // Step 16: Update the HackMD document with the self-referencing link
116+ await hackmd . updateMeetingNotesDocument (
117+ hackmdClient ,
118+ hackmdNote . id ,
119+ minutesContent
120+ ) ;
121+
122+ console . log ( `Created GitHub issue: ${ githubIssue . html_url } ` ) ;
123+ console . log ( `Created HackMD document: ${ minutesDocLink } ` ) ;
124+ }
0 commit comments