@basou/cli 0.57.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +25 -7
- package/dist/index.js.map +1 -1
- package/dist/program.js +25 -7
- package/dist/program.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -95,6 +95,8 @@ function printSessionSkip(sid, reason) {
|
|
|
95
95
|
const short = shortSessionId(sid);
|
|
96
96
|
if (reason === "events_jsonl_unreadable") {
|
|
97
97
|
console.error(`Warning: skipped suspect check for ${short}: events.jsonl unreadable`);
|
|
98
|
+
} else if (reason === "session_dir_not_directory") {
|
|
99
|
+
console.error(`Skipped ${sid}: ${reason}`);
|
|
98
100
|
} else {
|
|
99
101
|
console.error(`Skipped ${short}: ${reason}`);
|
|
100
102
|
}
|
|
@@ -111,6 +113,9 @@ function printSessionListSkip(sid, reason) {
|
|
|
111
113
|
case "events_jsonl_unreadable":
|
|
112
114
|
console.error(`Warning: skipped suspect check for ${short}: events.jsonl unreadable`);
|
|
113
115
|
break;
|
|
116
|
+
case "session_dir_not_directory":
|
|
117
|
+
console.error(`Skipped ${sid}: not a directory (a symlink or a file is not followed)`);
|
|
118
|
+
break;
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
121
|
function printTaskSkip(taskId, reason) {
|
|
@@ -12049,12 +12054,19 @@ function maxLen3(values, floor) {
|
|
|
12049
12054
|
import {
|
|
12050
12055
|
assertBasouRootSafe as assertBasouRootSafe17,
|
|
12051
12056
|
basouPaths as basouPaths22,
|
|
12052
|
-
|
|
12057
|
+
enumerateSessionEntries,
|
|
12053
12058
|
findErrorCode as findErrorCode16,
|
|
12054
12059
|
resolveRepositoryRoot as resolveRepositoryRoot12,
|
|
12055
12060
|
resolveSessionId as resolveSessionId5,
|
|
12056
12061
|
verifyEventsChain
|
|
12057
12062
|
} from "@basou/core";
|
|
12063
|
+
var PASSING_STATUSES = /* @__PURE__ */ new Set([
|
|
12064
|
+
"verified",
|
|
12065
|
+
"unchained",
|
|
12066
|
+
"empty",
|
|
12067
|
+
"incomplete",
|
|
12068
|
+
"in_progress"
|
|
12069
|
+
]);
|
|
12058
12070
|
function registerVerifyCommand(program2) {
|
|
12059
12071
|
program2.command("verify").description("Verify the tamper-evidence hash chain of sessions' event logs (read-only)").option("--session <id>", "Verify a single session (unique id prefix accepted)").option("--all", "Verify every session (the default when --session is omitted)").option("--json", "Output the verdicts as JSON").option("-v, --verbose", "Show error causes").action(async (opts) => {
|
|
12060
12072
|
await runVerify(opts);
|
|
@@ -12076,7 +12088,7 @@ async function doRunVerify(options, ctx) {
|
|
|
12076
12088
|
const repositoryRoot = await resolveRepositoryRootForVerify(cwd);
|
|
12077
12089
|
const paths = basouPaths22(repositoryRoot);
|
|
12078
12090
|
await assertWorkspaceInitialized14(paths.root);
|
|
12079
|
-
const sessionIds = options.session !== void 0 ? [await resolveSessionId5(paths, options.session)] : await
|
|
12091
|
+
const sessionIds = options.session !== void 0 ? [await resolveSessionId5(paths, options.session, { allowNotDirectory: true })] : await enumerateAllSessionNames(paths);
|
|
12080
12092
|
const rows = [];
|
|
12081
12093
|
for (const sessionId of sessionIds) {
|
|
12082
12094
|
const verdict = await verifyEventsChain(paths, sessionId);
|
|
@@ -12089,8 +12101,6 @@ async function doRunVerify(options, ctx) {
|
|
|
12089
12101
|
...verdict.sessionYamlInvalid === true ? { session_yaml_invalid: true } : {}
|
|
12090
12102
|
});
|
|
12091
12103
|
}
|
|
12092
|
-
const tamperedCount = rows.filter((r) => r.status === "tampered").length;
|
|
12093
|
-
const unsupportedCount = rows.filter((r) => r.status === "unsupported").length;
|
|
12094
12104
|
if (options.json === true) {
|
|
12095
12105
|
console.log(JSON.stringify(rows, null, 2));
|
|
12096
12106
|
} else {
|
|
@@ -12100,10 +12110,10 @@ async function doRunVerify(options, ctx) {
|
|
|
12100
12110
|
}
|
|
12101
12111
|
const tally = (status) => rows.filter((r) => r.status === status).length;
|
|
12102
12112
|
console.log(
|
|
12103
|
-
`Sessions: ${rows.length} total \u2014 ${tally("verified")} verified, ${tally("unchained")} unchained, ${tally("empty")} empty, ${tally("incomplete")} incomplete, ${tally("in_progress")} in_progress, ${
|
|
12113
|
+
`Sessions: ${rows.length} total \u2014 ${tally("verified")} verified, ${tally("unchained")} unchained, ${tally("empty")} empty, ${tally("incomplete")} incomplete, ${tally("in_progress")} in_progress, ${tally("unsupported")} unsupported, ${tally("tampered")} tampered`
|
|
12104
12114
|
);
|
|
12105
12115
|
}
|
|
12106
|
-
if (
|
|
12116
|
+
if (rows.some((r) => !PASSING_STATUSES.has(r.status))) {
|
|
12107
12117
|
process.exitCode = 1;
|
|
12108
12118
|
}
|
|
12109
12119
|
}
|
|
@@ -12125,6 +12135,10 @@ function renderVerdict(row) {
|
|
|
12125
12135
|
return "empty";
|
|
12126
12136
|
}
|
|
12127
12137
|
}
|
|
12138
|
+
async function enumerateAllSessionNames(paths) {
|
|
12139
|
+
const { dirs, notDirectories } = await enumerateSessionEntries(paths);
|
|
12140
|
+
return [...dirs, ...notDirectories].sort();
|
|
12141
|
+
}
|
|
12128
12142
|
async function resolveRepositoryRootForVerify(cwd) {
|
|
12129
12143
|
try {
|
|
12130
12144
|
return await resolveRepositoryRoot12(cwd);
|
|
@@ -12673,6 +12687,7 @@ import {
|
|
|
12673
12687
|
readTaskFile as readTaskFile2,
|
|
12674
12688
|
renderDecisions as renderDecisions3,
|
|
12675
12689
|
renderHandoff as renderHandoff3,
|
|
12690
|
+
SessionIdSchema,
|
|
12676
12691
|
summarizeOrientation,
|
|
12677
12692
|
tryRemoteUrl
|
|
12678
12693
|
} from "@basou/core";
|
|
@@ -13736,6 +13751,9 @@ async function sessionsList(ws, nowProvider) {
|
|
|
13736
13751
|
return { sessions };
|
|
13737
13752
|
}
|
|
13738
13753
|
async function sessionDetail(ws, sessionId) {
|
|
13754
|
+
if (!SessionIdSchema.safeParse(sessionId).success) {
|
|
13755
|
+
throw new HttpError(404, "Session not found");
|
|
13756
|
+
}
|
|
13739
13757
|
let session;
|
|
13740
13758
|
try {
|
|
13741
13759
|
session = await readSessionYaml3(ws.paths, sessionId);
|
|
@@ -14118,7 +14136,7 @@ async function assertWorkspaceInitialized15(basouRoot) {
|
|
|
14118
14136
|
function readBuildStamp() {
|
|
14119
14137
|
if (false) return void 0;
|
|
14120
14138
|
try {
|
|
14121
|
-
return JSON.parse('{"version":"0.
|
|
14139
|
+
return JSON.parse('{"version":"0.58.0","commit":"4026254","committedAt":"2026-10-01T14:04:07+09:00"}');
|
|
14122
14140
|
} catch {
|
|
14123
14141
|
return void 0;
|
|
14124
14142
|
}
|