@@ -9,6 +9,7 @@ const RELEASE_TYPES = new Set(['major', 'minor', 'patch']);
99async function main ( ) {
1010 const releaseTypeArg = ( process . argv [ 2 ] || '' ) . toLowerCase ( ) ;
1111 const forceFlag = process . argv . includes ( '--force' ) || process . env . DEV_WORKFLOW_FORCE_RELEASE === '1' ;
12+ const additionalArgs = process . argv . slice ( 3 ) . filter ( ( arg ) => arg !== '--force' ) ;
1213
1314 if ( ! RELEASE_TYPES . has ( releaseTypeArg ) ) {
1415 console . error (
@@ -17,11 +18,13 @@ async function main() {
1718 process . exit ( 1 ) ;
1819 }
1920
20- const projectRoot = process . env . INIT_CWD || process . cwd ( ) ;
21- if ( projectRoot . includes ( `node_modules${ path . sep } ` ) ) {
21+ const repoRoot = process . cwd ( ) ;
22+ const projectRootCandidate = process . env . INIT_CWD || repoRoot ;
23+ if ( projectRootCandidate . includes ( `node_modules${ path . sep } ` ) ) {
2224 console . error ( '❌ Release guard: refusing to run inside node_modules.' ) ;
2325 process . exit ( 1 ) ;
2426 }
27+ const projectRoot = projectRootCandidate ;
2528
2629 // Prefer state under INIT_CWD to support per-project runs and tests.
2730 // If DEV_WORKFLOW_USER_ID is set and a user-scoped file exists, use it; otherwise fall back to legacy path.
@@ -95,6 +98,17 @@ async function main() {
9598 }
9699 }
97100
101+ const commiterReleaseScript = path . join ( repoRoot , 'node_modules' , '@programinglive' , 'commiter' , 'scripts' , 'release.js' ) ;
102+
103+ try {
104+ await fs . access ( commiterReleaseScript ) ;
105+ } catch {
106+ console . error ( '❌ Release guard: @programinglive/commiter release script not found.' ) ;
107+ console . error ( ' Ensure @programinglive/commiter is installed as a dev dependency.' ) ;
108+ console . error ( ' Try: npm install --save-dev @programinglive/commiter' ) ;
109+ process . exit ( 1 ) ;
110+ }
111+
98112 const runRelease = async ( ) => {
99113 if ( process . env . DEV_WORKFLOW_SKIP_RELEASE === '1' ) {
100114 console . log ( 'ℹ️ DEV_WORKFLOW_SKIP_RELEASE=1 detected. Skipping actual release command.' ) ;
@@ -103,9 +117,9 @@ async function main() {
103117
104118 return await new Promise ( ( resolve , reject ) => {
105119 const child = spawn (
106- 'npm' ,
107- [ 'run' , 'release' , '--' , '--release-as' , releaseTypeArg ] ,
108- { stdio : 'inherit' , shell : process . platform === 'win32' , cwd : projectRoot }
120+ process . execPath ,
121+ [ commiterReleaseScript , releaseTypeArg , ... additionalArgs ] ,
122+ { stdio : 'inherit' , cwd : repoRoot }
109123 ) ;
110124
111125 child . on ( 'error' , ( error ) => reject ( error ) ) ;
@@ -124,8 +138,10 @@ async function main() {
124138 process . exit ( 1 ) ;
125139 }
126140
141+ const recordedReleaseCommand = `node node_modules/@programinglive/commiter/scripts/release.js ${ releaseTypeArg } ` ;
142+
127143 state . released = true ;
128- state . releaseCommand = `npm run release: ${ releaseTypeArg } ` ;
144+ state . releaseCommand = recordedReleaseCommand ;
129145 state . currentPhase = 'ready_to_complete' ;
130146
131147 try {
0 commit comments