mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
- Imported `randomInt` from `node:crypto` in `src/lock-publisher.mjs` to fix CI failure. - Centralized `withTimeout` and `mergeRelayList` in `src/utils.mjs`. - Updated `src/lock-utils.mjs` to re-export them. - Removed local redefinitions in `src/lock-ops.mjs` and `src/lock-publisher.mjs`. - Fixed `test/utils.test.mjs` imports. - Verified all tests pass. This resolves the N/A documentation task by ensuring the codebase is in a valid state. Co-authored-by: PR0M3TH3AN <[email protected]>
31 lines
964 B
JavaScript
31 lines
964 B
JavaScript
import { rollbackPrompt, listPromptVersions } from './services/governance/index.js';
|
|
import { ExitError } from './errors.mjs';
|
|
|
|
export async function cmdRollback(target, strategy, { list = false } = {}) {
|
|
if (!target) {
|
|
console.error('Usage: torch-lock rollback --target <path> [--strategy <hash|latest>] [--list]');
|
|
throw new ExitError(1, 'Missing target');
|
|
}
|
|
|
|
if (list) {
|
|
try {
|
|
const versions = await listPromptVersions(target);
|
|
console.log(JSON.stringify(versions, null, 2));
|
|
} catch (e) {
|
|
console.error(`Failed to list versions: ${e.message}`);
|
|
throw new ExitError(1, 'List versions failed');
|
|
}
|
|
return;
|
|
}
|
|
|
|
const effectiveStrategy = strategy || 'latest';
|
|
|
|
try {
|
|
const result = await rollbackPrompt(target, effectiveStrategy);
|
|
console.log(JSON.stringify(result, null, 2));
|
|
} catch (e) {
|
|
console.error(`Rollback failed: ${e.message}`);
|
|
throw new ExitError(1, 'Rollback failed');
|
|
}
|
|
}
|