11import fs from 'node:fs' ;
22import path from 'node:path' ;
3- import os from 'node:os' ;
43import crypto from 'node:crypto' ;
54import { spawnSync } from 'node:child_process' ;
65import { fileURLToPath } from 'node:url' ;
@@ -42,12 +41,14 @@ export function projectPaths(root) {
4241 docs : path . join ( root , 'docs' ) ,
4342 audit : path . join ( base , 'audit' ) ,
4443 publish : path . join ( base , 'publish' ) ,
44+ traceability : path . join ( base , 'traceability' ) ,
4545 runs : path . join ( base , 'runs' )
4646 } ;
4747}
4848
4949export function ensureDir ( dir ) { fs . mkdirSync ( dir , { recursive : true } ) ; }
5050export function now ( ) { return new Date ( ) . toISOString ( ) ; }
51+ export function sleep ( ms ) { return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ; }
5152export function posix ( value ) { return String ( value ) . replaceAll ( '\\' , '/' ) ; }
5253export function rel ( root , file ) { return posix ( path . relative ( root , file ) ) ; }
5354export function readJson ( file , fallback = undefined ) {
@@ -81,17 +82,7 @@ export function sourceSnapshot(root) {
8182 capturedAt : now ( )
8283 } ;
8384}
84- export function loadConfig ( root ) {
85- const paths = projectPaths ( root ) ;
86- return readJson ( paths . config , { } ) ;
87- }
88- export function saveState ( root , patch ) {
89- const paths = projectPaths ( root ) ;
90- const current = readJson ( paths . state , { schemaVersion : '2.0' , kitVersion, stages : { } } ) ;
91- const next = { ...current , ...patch , schemaVersion : '2.0' , kitVersion, updatedAt : now ( ) } ;
92- writeJson ( paths . state , next ) ;
93- return next ;
94- }
85+ export function loadConfig ( root ) { return readJson ( projectPaths ( root ) . config , { } ) ; }
9586export function updateStage ( root , stage , status , details = { } ) {
9687 const paths = projectPaths ( root ) ;
9788 const state = readJson ( paths . state , { schemaVersion : '2.0' , kitVersion, stages : { } } ) ;
@@ -112,4 +103,3 @@ export function parseArgs(argv) {
112103 }
113104 return { positional, options } ;
114105}
115- export function userHome ( ) { return os . homedir ( ) ; }
0 commit comments