VS Code extension that previews Archify diagrams from their JSON sources (live, as you type) and opens rendered Archify HTML in a viewer tab. Bundles the Archify 3.0.1 renderer and runs it on VS Code's Node runtime. Adds validation diagnostics, JSON schema help, source-link navigation, export saving, render-to-file and open-in-browser commands. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
import { recoverRetiredPublication } from '../renderers/shared/atomic-output.mjs';
|
|
|
|
function usage(stream = process.stderr) {
|
|
stream.write('Usage: node bin/recover-output.mjs <private-recovery-directory> [--json]\n');
|
|
}
|
|
|
|
const args = process.argv.slice(2);
|
|
if (args.length === 1 && ['--help', '-h'].includes(args[0])) {
|
|
usage(process.stdout);
|
|
} else {
|
|
let json = false;
|
|
let recoveryDirectory;
|
|
let invalid = false;
|
|
for (const argument of args) {
|
|
if (argument === '--json' && !json) {
|
|
json = true;
|
|
} else if (argument.startsWith('-') || recoveryDirectory !== undefined) {
|
|
invalid = true;
|
|
} else {
|
|
recoveryDirectory = argument;
|
|
}
|
|
}
|
|
|
|
if (invalid || recoveryDirectory === undefined) {
|
|
usage();
|
|
process.exitCode = 64;
|
|
} else {
|
|
const result = recoverRetiredPublication(recoveryDirectory);
|
|
if (json) {
|
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
} else {
|
|
const reason = result.reason?.code || 'publication-recovery-unknown';
|
|
process.stdout.write(`${result.status}: ${reason}\n`);
|
|
}
|
|
// A complete prior recovery is idempotent. A preserved target is a safe,
|
|
// deliberate non-action that needs the operator to inspect the claimant.
|
|
process.exitCode = ['recovered', 'absent'].includes(result.status)
|
|
? 0
|
|
: result.status === 'preserved' ? 2 : 1;
|
|
}
|
|
}
|