@@ -42,6 +42,23 @@ const PROJECT_ROOT = getProjectRoot()
4242const PRIVACY_POLICY_FILEPATH = posix . join ( 'src' , 'pages' , 'privacy' , 'index.astro' )
4343const GIT_DIRECTORY_PATH = join ( PROJECT_ROOT , '.git' )
4444
45+ const debugListDirectory = ( label : string , directoryPath : string ) : void => {
46+ try {
47+ const entries = fs . readdirSync ( directoryPath )
48+ const maxEntriesToLog = 60
49+ const visibleEntries = entries . slice ( 0 , maxEntriesToLog )
50+ const suffix = entries . length > maxEntriesToLog ? ` … (+${ entries . length - maxEntriesToLog } more)` : ''
51+
52+ console . log (
53+ `[privacy-policy-version] Debug: ls ${ label } : ${ directoryPath } -> ${ visibleEntries . join ( ', ' ) } ${ suffix } ` ,
54+ )
55+ } catch ( error ) {
56+ console . log (
57+ `[privacy-policy-version] Debug: ls ${ label } failed for ${ directoryPath } : ${ error instanceof Error ? error . message : String ( error ) } ` ,
58+ )
59+ }
60+ }
61+
4562export const toIsoDateString = ( date : Date ) : string => date . toISOString ( ) . slice ( 0 , 10 )
4663
4764const formatGitShortDate = ( timestamp : number , timezoneOffset : number ) : string => {
@@ -116,6 +133,21 @@ export async function resolvePrivacyPolicyVersion(): Promise<string> {
116133 }
117134 } else {
118135 console . warn ( '[privacy-policy-version] Git metadata not found. Skipping git lookup.' )
136+
137+ // Debugging for Vercel/CI environments where git history may be absent.
138+ console . log ( `[privacy-policy-version] Debug: pwd (process.cwd): ${ process . cwd ( ) } ` )
139+ console . log ( `[privacy-policy-version] Debug: PROJECT_ROOT: ${ PROJECT_ROOT } ` )
140+ console . log ( `[privacy-policy-version] Debug: expected .git directory: ${ GIT_DIRECTORY_PATH } ` )
141+
142+ debugListDirectory ( 'PROJECT_ROOT' , PROJECT_ROOT )
143+ debugListDirectory ( 'process.cwd()' , process . cwd ( ) )
144+
145+ const privacyPolicyAbsolute = join ( PROJECT_ROOT , PRIVACY_POLICY_FILEPATH )
146+ console . log ( `[privacy-policy-version] Debug: privacy policy filepath (relative): ${ PRIVACY_POLICY_FILEPATH } ` )
147+ console . log ( `[privacy-policy-version] Debug: privacy policy filepath (absolute): ${ privacyPolicyAbsolute } ` )
148+ console . log (
149+ `[privacy-policy-version] Debug: privacy policy file exists: ${ fs . existsSync ( privacyPolicyAbsolute ) } ` ,
150+ )
119151 }
120152
121153 const fallback = toIsoDateString ( new Date ( ) )
0 commit comments