fix: show active passthrough capacity and separate program source publication
This commit is contained in:
@@ -7,6 +7,25 @@ export const REQUIRED_REPORTS = Object.freeze(['docs/RESEARCH.md', 'docs/researc
|
||||
const hash = bytes => createHash('sha256').update(bytes).digest('hex');
|
||||
const simple = value => value.replaceAll('\\', '/');
|
||||
|
||||
// Program publication carries readable guides, independently of historical
|
||||
// experiment archives and the data of any installed Workbench instance.
|
||||
export function createProgramGuides({ root, portableRoot, sourceCommit }) {
|
||||
const selected = fs.readdirSync(path.join(root, 'docs')).filter(name => name.endsWith('.md')).map(name => 'docs/' + name);
|
||||
for (const name of fs.readdirSync(path.join(root, 'docs/research'))) if (/\.(?:md|json)$/.test(name)) selected.push('docs/research/' + name);
|
||||
const shipped = [];
|
||||
for (const relative of selected) {
|
||||
const source = path.join(root, relative);
|
||||
if (!fs.lstatSync(source).isFile()) continue;
|
||||
const target = path.join(portableRoot, relative); fs.mkdirSync(path.dirname(target), { recursive: true });
|
||||
fs.copyFileSync(source, target);
|
||||
const bytes = fs.readFileSync(target); shipped.push({ path: relative, bytes: bytes.length, sha256: hash(bytes) });
|
||||
}
|
||||
fs.copyFileSync(path.join(root, 'README.md'), path.join(portableRoot, 'README.md'));
|
||||
const result = { schema: 1, sourceCommit, scope: 'Program and text guides only. Historical evidence stays at its original repository paths and is not required to run the program.', shipped };
|
||||
fs.writeFileSync(path.join(portableRoot, 'DOCUMENTATION.json'), JSON.stringify(result, null, 2) + '\n');
|
||||
return result;
|
||||
}
|
||||
|
||||
export function createDocumentationBundle({ root, portableRoot, evidenceRoot, archiveName, sourceCommit }) {
|
||||
if (!/^[a-f0-9]{40}$/.test(sourceCommit) || !/^[A-Za-z0-9._-]+\.zip$/.test(archiveName)) throw new Error('Documentation needs the fixed source commit and separate archive name.');
|
||||
if (fs.existsSync(evidenceRoot)) throw new Error('Historical evidence output must be a new directory.');
|
||||
|
||||
Reference in New Issue
Block a user