@basou/cli 0.22.0 → 0.24.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 +21 -13
- package/dist/index.js.map +1 -1
- package/dist/program.js +21 -13
- package/dist/program.js.map +1 -1
- package/package.json +2 -2
package/dist/program.js
CHANGED
|
@@ -2036,7 +2036,7 @@ async function assertWorkspaceInitialized4(basouRoot) {
|
|
|
2036
2036
|
// src/commands/hook.ts
|
|
2037
2037
|
import { open, readFile as readFile2, stat as stat2 } from "fs/promises";
|
|
2038
2038
|
import {
|
|
2039
|
-
|
|
2039
|
+
DEFAULT_STOP_HOOK_MIN_EDITS,
|
|
2040
2040
|
evaluateStopHook
|
|
2041
2041
|
} from "@basou/core";
|
|
2042
2042
|
var MAX_TRANSCRIPT_BYTES = 8 * 1024 * 1024;
|
|
@@ -2047,11 +2047,11 @@ function registerHookCommand(program) {
|
|
|
2047
2047
|
hook.command("stop").description(
|
|
2048
2048
|
"Stop-hook: when a substantive session recorded no decisions or next step, emit a non-blocking nudge to capture them. Reads the Stop hook JSON payload on stdin; never blocks and never fails the session."
|
|
2049
2049
|
).option(
|
|
2050
|
-
"--min-
|
|
2051
|
-
`Minimum
|
|
2050
|
+
"--min-edits <n>",
|
|
2051
|
+
`Minimum file edits before nudging on edits alone (default ${DEFAULT_STOP_HOOK_MIN_EDITS})`
|
|
2052
2052
|
).addHelpText("after", HOOK_STOP_HELP).action(async (options) => {
|
|
2053
|
-
const
|
|
2054
|
-
await runHookStop(
|
|
2053
|
+
const minEdits = parseMinEdits(options.minEdits);
|
|
2054
|
+
await runHookStop(minEdits !== void 0 ? { minEdits } : {});
|
|
2055
2055
|
});
|
|
2056
2056
|
}
|
|
2057
2057
|
var HOOK_STOP_HELP = `
|
|
@@ -2065,11 +2065,13 @@ Install as a Claude Code Stop hook in ~/.claude/settings.json:
|
|
|
2065
2065
|
}
|
|
2066
2066
|
|
|
2067
2067
|
On every turn end basou inspects the session transcript. If the session did
|
|
2068
|
-
substantive work
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2068
|
+
content-substantive work but ran no capture verb ('basou decision capture' /
|
|
2069
|
+
'decision record' / 'note'), it emits a non-blocking reminder so the agent can
|
|
2070
|
+
record the why / next step. Substantive = EITHER >= ${DEFAULT_STOP_HOOK_MIN_EDITS} file edits (default)
|
|
2071
|
+
OR a free-form AskUserQuestion answer (an uncaptured conversational decision).
|
|
2072
|
+
Read-only Bash (ls / grep / git status) does NOT count. The reminder is
|
|
2073
|
+
non-blocking: Claude sees it and may act on it or stop; it never forces the turn
|
|
2074
|
+
to continue. The 'stop_hook_active' flag is honored so the nudge cannot loop.
|
|
2073
2075
|
`;
|
|
2074
2076
|
async function runHookStop(options, ctx = {}) {
|
|
2075
2077
|
try {
|
|
@@ -2105,7 +2107,7 @@ async function doRunHookStop(options, ctx) {
|
|
|
2105
2107
|
records,
|
|
2106
2108
|
// stop_hook_active was already handled by the early return above.
|
|
2107
2109
|
stopHookActive: false,
|
|
2108
|
-
...options.
|
|
2110
|
+
...options.minEdits !== void 0 ? { minEdits: options.minEdits } : {}
|
|
2109
2111
|
});
|
|
2110
2112
|
if (evaluation.kind !== "nudge") return;
|
|
2111
2113
|
write(
|
|
@@ -2154,7 +2156,7 @@ async function readTranscriptBounded(path, maxBytes = MAX_TRANSCRIPT_BYTES) {
|
|
|
2154
2156
|
await handle.close();
|
|
2155
2157
|
}
|
|
2156
2158
|
}
|
|
2157
|
-
function
|
|
2159
|
+
function parseMinEdits(raw) {
|
|
2158
2160
|
if (raw === void 0 || !/^\d+$/.test(raw)) return void 0;
|
|
2159
2161
|
return Number(raw);
|
|
2160
2162
|
}
|
|
@@ -3287,7 +3289,10 @@ async function probeStaleness(args) {
|
|
|
3287
3289
|
|
|
3288
3290
|
// src/commands/orient.ts
|
|
3289
3291
|
function registerOrientCommand(program) {
|
|
3290
|
-
program.command("orient").description("Show the workspace's current position (also writes .basou/orientation.md)").option("-q, --quiet", "Write the file without printing the body").option(
|
|
3292
|
+
program.command("orient").description("Show the workspace's current position (also writes .basou/orientation.md)").option("-q, --quiet", "Write the file without printing the body").option(
|
|
3293
|
+
"--refresh",
|
|
3294
|
+
"Import all adapters first (writes provenance), then show a guaranteed-fresh position; bare orient is read-only"
|
|
3295
|
+
).option("-v, --verbose", "Show error causes").action(async (opts) => {
|
|
3291
3296
|
await runOrient(opts);
|
|
3292
3297
|
});
|
|
3293
3298
|
}
|
|
@@ -3308,6 +3313,9 @@ async function doRunOrient(options, ctx) {
|
|
|
3308
3313
|
const probeCtx = { cwd: repositoryRoot };
|
|
3309
3314
|
if (ctx.claudeProjectsDir !== void 0) probeCtx.claudeProjectsDir = ctx.claudeProjectsDir;
|
|
3310
3315
|
if (ctx.codexSessionsDir !== void 0) probeCtx.codexSessionsDir = ctx.codexSessionsDir;
|
|
3316
|
+
if (options.refresh === true) {
|
|
3317
|
+
await refreshAll({ options: {}, ctx: probeCtx, paths, nowIso });
|
|
3318
|
+
}
|
|
3311
3319
|
const staleness = await probeStaleness({ ctx: probeCtx, paths, nowIso });
|
|
3312
3320
|
let federatedRoots = [];
|
|
3313
3321
|
try {
|