
    ߿]jW                        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d	 Zd
 Zd Zedk    r ej         e                       dS dS )    N)datetimetimezone)Path   scriptstoryzproject-manifest.jsonzproduction-plan.jsonc                 v    t          j        t          j        dt	          |           gt
                    j        S )Nz-B)cwd)
subprocessrunsys
executablestrPROJECT
returncodepaths    script/promote-story.pyr   r      s)    >3>4T;IIITT    c                 r    t          j        |                                                                           S )N)hashlibsha256
read_bytes	hexdigestr   s    r   shar      s(    >$//++,,66888r   c                     t          t                    } t          t          dz            st          t          dz            r6t          t                    | k    rt	          d          t          d          t          j        t          dz  	                                          }t          j        t          dz  	                                          }t          j        t          	                                          }t          t          dz            t          t          dz            t          t          d	z            t          t          d
z            d}||                    d          k    rt          d          |                    d          dusC|                    d          dus,|                    d          |                    d          k    rt          d          t          j        t          j                                                  }t          j        t          	                                          }|                    d|d         |d         d|d         |d           |                    dd|d         |d         d|d         ||d           d|d         d<   t                              t          j        |dd           d!z              d"t          t                    z   |d#<   t                              t          j        |dd           d!z              dd|d         d|d         t          t          dz            t          t          dz            t          t                    ||d$
}t          d%z                      t          j        |dd           d!z              t)          t          j        d|d         |d         |d         d&d'                     d(S ))Nzvalidate-story.pyzvalidate-originality.pyz(manifest changed during failed promotionz*Story promotion blocked: validation failedzpromotion-report.jsonzoriginality-report.jsonzoutline.jsonzidentity-registry.jsonzreveal-ledger.jsonzstory-brief.json)outline_sha256identity_registry_sha256reveal_ledger_sha256story_brief_sha256authority_hashesz/Story promotion blocked: authority lock changedverifiedTspoken_sha256source_sha256z(Story promotion blocked: report mismatchstory_promoted_ready_for_ttstotal_words   estimated_minutes_at_baseline)statuscanon_sha256story_wordstts_words_per_minutestory_duration_estimate_minutespromoted_atstory_promotedr   )r)   canon_version
canon_hashstory_word_countr,   r-   authority_hashes_promoted
updated_at	completedstepsr   F   )ensure_asciiindent
zsha256:production_plan_hash)
versionr"   promoted_canon_sha256r,   r-   story_report_sha256originality_report_sha256production_plan_sha256r!   r.   zpromotion-receipt.json)promotedr*   wordsestimated_minutes)r8   r   )r   MANIFESTr   SCRIPTRuntimeError
SystemExitjsonloadsSTORY	read_textPLANgetr   nowr   utc	isoformatupdate
write_textdumpsprint)beforer   originalityplancurrent_authorityr.   manifestreceipts           r   mainr[      s   ]]F
6''(( GC9R0R,S,S Gx==F""IJJJEFFFJ 77BBDDEEE*e&??JJLLMMK:dnn&&''Df~566$'1I(I$J$J #F-A$A B B!&+="=>>	  DHH%78888JKKKyyD((KOOJ,G,Gt,S,SW\W`W`apWqWq  vA  vE  vE  FU  vV  vV  XV  XVCDDD,x|,,6688Kz(,,..//HKK95Q`Karw  yF  sG  ad  IN  On  Io  @K  L  L  M  M  MOO/!SXYhSi  @E  FS  @T  nq  V[  \{  V|  [l  |G  H  H  I  I  I!,HWgOODJt%BBBTIJJJ'03t99'<H#$
8%JJJTQRRRoH^x{  af  gF  aG  `c  di  lC  dC  `D  `D  cf  gl  oH  gH  cI  cI  eh  im  en  en  DU  fq  r  rG
%%11$*WSXab2c2c2cfj2jkkk	$*$o8NY^_lYm  EJ  Kj  Ek  l  l  {@  A  A  A  B  B  B1r   __main__)r   rH   r   r   r   r   pathlibr   __file__resolveparentsr   rE   rJ   rD   rL   r   r   r[   __name__exit r   r   <module>rd      s         



 ' ' ' ' ' ' ' '      
$x..
 
 
"
"
*1
-	8	'++&&U U U9 9 9  @ zCHTTVV r   