@@ -14,6 +14,9 @@ import semver from 'semver'
1414import colors from 'yoctocolors-cjs'
1515
1616import { parseArgs } from '@socketsecurity/lib/argv/parse'
17+ import { getDefaultLogger } from '@socketsecurity/lib/logger'
18+
19+ const logger = getDefaultLogger ( )
1720
1821const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
1922const rootPath = path . join ( __dirname , '..' )
@@ -61,33 +64,33 @@ if (hasInteractivePrompts) {
6164
6265// Simple inline logger.
6366const log = {
64- info : msg => console . log ( msg ) ,
65- error : msg => console . error ( `${ colors . red ( '✗' ) } ${ msg } ` ) ,
66- success : msg => console . log ( `${ colors . green ( '✓' ) } ${ msg } ` ) ,
67- step : msg => console . log ( `\n${ msg } ` ) ,
68- substep : msg => console . log ( ` ${ msg } ` ) ,
69- progress : msg => process . stdout . write ( ` ∴ ${ msg } ` ) ,
67+ info : msg => logger . log ( msg ) ,
68+ error : msg => logger . error ( `${ colors . red ( '✗' ) } ${ msg } ` ) ,
69+ success : msg => logger . log ( `${ colors . green ( '✓' ) } ${ msg } ` ) ,
70+ step : msg => logger . log ( `\n${ msg } ` ) ,
71+ substep : msg => logger . log ( ` ${ msg } ` ) ,
72+ progress : msg => logger . progress ( msg ) ,
7073 done : msg => {
7174 process . stdout . write ( '\r\x1b[K' )
72- console . log ( ` ${ colors . green ( '✓' ) } ${ msg } ` )
75+ logger . log ( ` ${ colors . green ( '✓' ) } ${ msg } ` )
7376 } ,
7477 failed : msg => {
7578 process . stdout . write ( '\r\x1b[K' )
76- console . log ( ` ${ colors . red ( '✗' ) } ${ msg } ` )
79+ logger . log ( ` ${ colors . red ( '✗' ) } ${ msg } ` )
7780 } ,
78- warn : msg => console . log ( `${ colors . yellow ( '⚠' ) } ${ msg } ` ) ,
81+ warn : msg => logger . log ( `${ colors . yellow ( '⚠' ) } ${ msg } ` ) ,
7982}
8083
8184function printHeader ( title ) {
82- console . log ( `\n${ '─' . repeat ( 60 ) } ` )
83- console . log ( ` ${ title } ` )
84- console . log ( `${ '─' . repeat ( 60 ) } ` )
85+ logger . log ( `\n${ '─' . repeat ( 60 ) } ` )
86+ logger . log ( ` ${ title } ` )
87+ logger . log ( `${ '─' . repeat ( 60 ) } ` )
8588}
8689
8790function printFooter ( message ) {
88- console . log ( `\n${ '─' . repeat ( 60 ) } ` )
91+ logger . log ( `\n${ '─' . repeat ( 60 ) } ` )
8992 if ( message ) {
90- console . log ( ` ${ colors . green ( '✓' ) } ${ message } ` )
93+ logger . log ( ` ${ colors . green ( '✓' ) } ${ message } ` )
9194 }
9295}
9396
@@ -258,7 +261,7 @@ async function checkGitStatus() {
258261 if ( result . stdout . trim ( ) ) {
259262 log . error ( 'Working directory is not clean' )
260263 log . info ( 'Uncommitted changes:' )
261- console . log ( result . stdout )
264+ logger . log ( result . stdout )
262265 return false
263266 }
264267 return true
@@ -421,11 +424,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
421424 * Uses interactive prompts if available, falls back to basic readline prompts.
422425 */
423426async function reviewChangelog ( claudeCmd , changelogEntry , interactive = false ) {
424- console . log ( `\n${ colors . blue ( '━' . repeat ( 60 ) ) } ` )
425- console . log ( colors . blue ( 'Proposed Changelog Entry:' ) )
426- console . log ( colors . blue ( '━' . repeat ( 60 ) ) )
427- console . log ( changelogEntry )
428- console . log ( `${ colors . blue ( '━' . repeat ( 60 ) ) } \n` )
427+ logger . log ( `\n${ colors . blue ( '━' . repeat ( 60 ) ) } ` )
428+ logger . log ( colors . blue ( 'Proposed Changelog Entry:' ) )
429+ logger . log ( colors . blue ( '━' . repeat ( 60 ) ) )
430+ logger . log ( changelogEntry )
431+ logger . log ( `${ colors . blue ( '━' . repeat ( 60 ) ) } \n` )
429432
430433 // Use interactive prompts if available and requested.
431434 if ( interactive && prompts ) {
@@ -470,11 +473,11 @@ Provide the refined changelog entry in the same format.`
470473 changelogEntry = refineResult . stdout . trim ( )
471474 log . done ( 'Changelog refined' )
472475
473- console . log ( `\n${ colors . blue ( '━' . repeat ( 60 ) ) } ` )
474- console . log ( colors . blue ( 'Refined Changelog Entry:' ) )
475- console . log ( colors . blue ( '━' . repeat ( 60 ) ) )
476- console . log ( changelogEntry )
477- console . log ( `${ colors . blue ( '━' . repeat ( 60 ) ) } \n` )
476+ logger . log ( `\n${ colors . blue ( '━' . repeat ( 60 ) ) } ` )
477+ logger . log ( colors . blue ( 'Refined Changelog Entry:' ) )
478+ logger . log ( colors . blue ( '━' . repeat ( 60 ) ) )
479+ logger . log ( changelogEntry )
480+ logger . log ( `${ colors . blue ( '━' . repeat ( 60 ) ) } \n` )
478481 } else {
479482 log . failed ( 'Failed to refine changelog' )
480483 }
@@ -501,10 +504,10 @@ async function interactiveReviewChangelog(claudeCmd, changelogEntry) {
501504
502505 while ( true ) {
503506 // Show the current changelog.
504- console . log ( `\n${ colors . cyan ( 'Current Changelog Entry:' ) } ` )
505- console . log ( colors . dim ( '─' . repeat ( 60 ) ) )
506- console . log ( currentEntry )
507- console . log ( `${ colors . dim ( '─' . repeat ( 60 ) ) } \n` )
507+ logger . log ( `\n${ colors . cyan ( 'Current Changelog Entry:' ) } ` )
508+ logger . log ( colors . dim ( '─' . repeat ( 60 ) ) )
509+ logger . log ( currentEntry )
510+ logger . log ( `${ colors . dim ( '─' . repeat ( 60 ) ) } \n` )
508511
509512 // Offer action choices.
510513 const action = await prompts . select ( {
@@ -540,7 +543,7 @@ async function interactiveReviewChangelog(claudeCmd, changelogEntry) {
540543 }
541544
542545 if ( action === 'manual' ) {
543- console . log (
546+ logger . log (
544547 '\nEnter the changelog manually (paste and press Enter twice when done):' ,
545548 )
546549 const rl = createReadline ( )
@@ -692,41 +695,41 @@ async function main() {
692695
693696 // Show help if requested.
694697 if ( values . help ) {
695- console . log ( '\nUsage: pnpm bump [options]' )
696- console . log ( '\nOptions:' )
697- console . log ( ' --help Show this help message' )
698- console . log ( ' --bump <type> Version bump type (default: patch)' )
699- console . log (
698+ logger . log ( '\nUsage: pnpm bump [options]' )
699+ logger . log ( '\nOptions:' )
700+ logger . log ( ' --help Show this help message' )
701+ logger . log ( ' --bump <type> Version bump type (default: patch)' )
702+ logger . log (
700703 ' Can be: major, minor, patch, premajor, preminor,' ,
701704 )
702- console . log (
705+ logger . log (
703706 ' prepatch, prerelease, or a specific version' ,
704707 )
705- console . log ( ' --interactive Force interactive changelog review' )
706- console . log ( ' --no-interactive Disable interactive mode' )
707- console . log ( ' --skip-changelog Skip changelog generation with Claude' )
708- console . log ( ' --skip-checks Skip git status/branch checks' )
709- console . log ( ' --no-push Do not push changes to remote' )
710- console . log ( ' --force Force bump even with warnings' )
711- console . log ( '\nExamples:' )
712- console . log (
708+ logger . log ( ' --interactive Force interactive changelog review' )
709+ logger . log ( ' --no-interactive Disable interactive mode' )
710+ logger . log ( ' --skip-changelog Skip changelog generation with Claude' )
711+ logger . log ( ' --skip-checks Skip git status/branch checks' )
712+ logger . log ( ' --no-push Do not push changes to remote' )
713+ logger . log ( ' --force Force bump even with warnings' )
714+ logger . log ( '\nExamples:' )
715+ logger . log (
713716 ' pnpm bump # Bump patch (interactive by default)' ,
714717 )
715- console . log ( ' pnpm bump --bump=minor # Bump minor version' )
716- console . log ( ' pnpm bump --no-interactive # Use basic prompts' )
717- console . log ( ' pnpm bump --bump=2.0.0 # Set specific version' )
718- console . log (
718+ logger . log ( ' pnpm bump --bump=minor # Bump minor version' )
719+ logger . log ( ' pnpm bump --no-interactive # Use basic prompts' )
720+ logger . log ( ' pnpm bump --bump=2.0.0 # Set specific version' )
721+ logger . log (
719722 ' pnpm bump --skip-changelog # Skip AI changelog generation' ,
720723 )
721- console . log ( '\nRequires:' )
722- console . log ( ' - claude-console (or claude) CLI tool installed' )
723- console . log ( ' - Clean git working directory' )
724- console . log ( ' - Main/master branch (unless --force)' )
724+ logger . log ( '\nRequires:' )
725+ logger . log ( ' - claude-console (or claude) CLI tool installed' )
726+ logger . log ( ' - Clean git working directory' )
727+ logger . log ( ' - Main/master branch (unless --force)' )
725728 if ( hasInteractivePrompts ) {
726- console . log ( '\nInteractive mode: Available ✓ (default)' )
729+ logger . log ( '\nInteractive mode: Available ✓ (default)' )
727730 } else {
728- console . log ( '\nInteractive mode: Not available' )
729- console . log ( ' (install @socketsecurity/lib or build local registry)' )
731+ logger . log ( '\nInteractive mode: Not available' )
732+ logger . log ( ' (install @socketsecurity/lib or build local registry)' )
730733 }
731734 process . exitCode = 0
732735 return
@@ -902,6 +905,6 @@ async function main() {
902905}
903906
904907main ( ) . catch ( e => {
905- console . error ( e )
908+ logger . error ( e )
906909 process . exitCode = 1
907910} )
0 commit comments