Skip to content

Commit 2f9412d

Browse files
fix provider runtime utilities
1 parent d06d303 commit 2f9412d

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

global-template/docgen/lib/core.mjs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
3-
import os from 'node:os';
43
import crypto from 'node:crypto';
54
import { spawnSync } from 'node:child_process';
65
import { 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

4949
export function ensureDir(dir) { fs.mkdirSync(dir, { recursive: true }); }
5050
export function now() { return new Date().toISOString(); }
51+
export function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); }
5152
export function posix(value) { return String(value).replaceAll('\\', '/'); }
5253
export function rel(root, file) { return posix(path.relative(root, file)); }
5354
export 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, {}); }
9586
export 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

Comments
 (0)