feat(governance): add prompt versioning, rollback --list, and state backup

- governance/index.js: archive filenames now include ISO timestamp for
  deterministic sorting (<base>_<ts>_<hash>.md); write .meta.json sidecar
  on every archive with proposalId, author, reason, and archivedAt
- governance/index.js: add listPromptVersions(target) — returns archived
  versions for a prompt sorted newest-first with sidecar metadata surfaced
- cmd-rollback.mjs: add --list flag to list available versions without
  restoring (delegates to listPromptVersions)
- cli-parser.mjs: add --list and --output flags
- lib.mjs: pass list flag to cmdRollback; add backup command dispatch
- cmd-backup.mjs: new torch-lock backup command — snapshots
  .scheduler-memory/memory-store.json and scheduler run state to
  .torch/backups/<timestamp>/; supports --output override and --list
- docs/prompt-versioning.md: comprehensive guide to the full
  proposal → apply → list-versions → rollback workflow, state backup
  and restore procedure, and storage location reference
- test/governance.test.mjs: 7 scenario-based tests (SCN-proposal-create,
  SCN-proposal-list, SCN-proposal-reject, SCN-archive-naming,
  SCN-version-list, SCN-rollback-latest, SCN-rollback-hash)

https://claude.ai/code/session_01Ndq2D72Kp77BYo4owD63uY
This commit is contained in:
Claude committed 2026-02-20 02:27:57 +00:00
1 parent 158026bdb4
commit be5ec21d5c
7 files changed
+914 -47

No files matched your search

+8
View File
@@ -40,6 +40,8 @@ export function parseArgs(argv) {
reason: null,
strategy: null,
status: null,
list: false,
output: null,
};
let i = 0;
@@ -161,6 +163,12 @@ export function parseArgs(argv) {
args.status = argv[++i];
} else if (arg.startsWith('--status=')) {
args.status = arg.split('=')[1];
} else if (arg === '--list') {
args.list = true;
} else if (arg === '--output') {
args.output = argv[++i];
} else if (arg.startsWith('--output=')) {
args.output = arg.split('=')[1];
}
}