
    j_ja                        d dl Z d dlZd dlZd dlZd dlmZmZ d dlmZ  ee          	                                j
        d         Zedz  Zedz  Zedz  Zedz  Zed	z  Zed
z  edz  edz  edz  edz  edz  gZd Zd Zedk    rS	  ej         e                       dS # e$ r0Z ede ej                    ej        d           Y dZ[dS dZ[ww xY wdS )    N)datetimetimezone)Path   zstory/story-canon.txtzstory/spoken-narration.txtzstory/draft-report.jsonzstory/originality-report.jsonzstory/promotion-report.jsonzscript/story-brief.jsonzscript/outline.jsonzscript/story-ledger.jsonzscript/identity-registry.jsonzscript/reveal-ledger.jsonzscript/production-plan.jsonc                 r    t          j        |                                                                           S )N)hashlibsha256
read_bytes	hexdigest)paths    script/promote-story.pyshar      s(    >$//++,,66888    c                      t          j        t          j        t	          t
          dz            gd           t          j        t          j        t	          t
          dz            gd           t          j        t          	                    d                    } t          j        t          	                    d                    }t          j        t          d         	                    d                    }t                                          t                                          k    rt          d          |                    d	          dus|                    d
          durt          d          d t          D             }|                     d|                     d|                     d                              }|                     d|                     dt#          |                     dg                                         }i ddd	dddd|d         d|d         d|d         d|d         dt	          t                              t
                              dt'          t                    dt	          t                              t
                              dt'          t                    d|d|dt)          |d z  d!          d"|d#t'          t                    d$ddt+          j        t.          j                                                  d%}t4                              t          j        |d&d'(          d)z   d           t
          d*z  }t          j        |	                    d                    }d+|d<   |d         |d<   |d         |d<   d,|d-         d.<   |                    t          j        |d&d'(          d)z   d           t;          t          j        |d&/                     dS )0Nzscript/validate-story.pyT)checkzscript/validate-originality.pyzutf-8)encodingr   zcanon/spoken bytes differverifiedprimary_story_family_preservedzoriginality/family gate failedc                 x    i | ]7}t          |                    t                              t          |          8S  )strrelative_toPROJECTr   ).0r   s     r   
<dictcomp>zmain.<locals>.<dictcomp>'   s6    QQQtT%%g..//TQQQr   
word_countspoken_word_countaggregate_word_countchapterschapters_presentchapter_rowsversionr   statuspassed
project_idcanonical_titleprimary_story_familysecondary_story_family
canon_pathcanon_sha256spoken_pathspoken_sha256duration_minutes_at_231_wpm      authority_hashesoriginality_report_sha256originality_verified)family_adherence_verifiedpromoted_atF   )ensure_asciiindent
zscript/project-manifest.json&story_promoted_ready_for_pronunciation	completedstepsstory)r6   )
subprocessrunsys
executabler   r   jsonloadsREPORT	read_textORIGINALITY	AUTHORITYCANONr
   SPOKENRuntimeErrorgetlenr   r   roundr   nowr   utc	isoformatOUT
write_textdumpsprint)	reportoriginalitybrief	authorityr   chapter_countreceiptmanifest_pathmanifests	            r   mainr\      s   NCNC2L(L$M$MNVZ[[[[NCNC2R(R$S$ST\`aaaaZ(('(::;;F*[22G2DDEEKJy|--w-??@@EV..00006777z""$..+//Bb2c2cko2o2o;<<<QQyQQQIL&**5H&**UkJlJl*m*mnnJJJz6::6H#fjjYgikNlNlJmJm+n+nooM1D 	( 	eL)	
 	5!23 	&< = 	!%(@"A 	c%++G4455 	E

 	s6--g6677 	V 	j 	M 	&uZ#-=q'A'A 	I  	$S%5%5!" 	#$ &*|HL11;;=='  G* NN4:gE!DDDtKV]N^^^<<Mz-1171CCDDHAHX&~6H^$\2H\!,HWgTZuQOOORVVahiii	$*W5
1
1
12221r   __main__zPromotion blocked: )file)r   rA   r=   r?   r   r   pathlibr   __file__resolveparentsr   rG   rH   rC   rE   rP   rF   r   r\   __name__exit	ExceptionexcrS   stderrr   r   r   <module>rh      s         



 ' ' ' ' ' ' ' '      
$x..
 
 
"
"
*1
-))	/	/	,	,77--''##((--))++	9 9 9+ + +\ z   )C))
;;;; s   B! !C&%CC