@basou/cli 0.63.0 → 0.64.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 +47 -23
- package/dist/index.js.map +1 -1
- package/dist/program.js +47 -23
- package/dist/program.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2105,13 +2105,12 @@ async function assertWorkspaceInitialized3(basouRoot) {
|
|
|
2105
2105
|
}
|
|
2106
2106
|
|
|
2107
2107
|
// src/commands/exec.ts
|
|
2108
|
-
import { mkdir as mkdir2 } from "fs/promises";
|
|
2108
|
+
import { mkdir as mkdir2, rm } from "fs/promises";
|
|
2109
2109
|
import { homedir as homedir4 } from "os";
|
|
2110
2110
|
import { join as join6 } from "path";
|
|
2111
2111
|
import {
|
|
2112
2112
|
acquireLock as acquireLock3,
|
|
2113
2113
|
assertBasouRootSafe as assertBasouRootSafe4,
|
|
2114
|
-
assertLockStoreSafe as assertLockStoreSafe2,
|
|
2115
2114
|
assertSessionStoreSafe,
|
|
2116
2115
|
basouPaths as basouPaths6,
|
|
2117
2116
|
ChildProcessRunner,
|
|
@@ -2152,10 +2151,8 @@ async function runExec(command, args, options, ctx = {}) {
|
|
|
2152
2151
|
await assertBasouRootSafe4(paths.root);
|
|
2153
2152
|
const manifest = await readManifest3(paths);
|
|
2154
2153
|
await assertSessionStoreSafe(paths);
|
|
2155
|
-
await assertLockStoreSafe2(paths);
|
|
2156
2154
|
const sessionId = prefixedUlid3("ses");
|
|
2157
2155
|
const sessionDir = join6(paths.sessions, sessionId);
|
|
2158
|
-
await mkdir2(sessionDir, { recursive: true });
|
|
2159
2156
|
const appendEvent = ctx.appendEvent ?? (async (_sessionDir, event) => {
|
|
2160
2157
|
await coreAppendChainedEvent(paths, sessionId, event);
|
|
2161
2158
|
});
|
|
@@ -2169,7 +2166,22 @@ async function runExec(command, args, options, ctx = {}) {
|
|
|
2169
2166
|
workspaceId: manifest.workspace.id,
|
|
2170
2167
|
startedAt
|
|
2171
2168
|
});
|
|
2172
|
-
await
|
|
2169
|
+
const initialLock = await acquireLock3(paths, "session", sessionId);
|
|
2170
|
+
try {
|
|
2171
|
+
try {
|
|
2172
|
+
await mkdir2(sessionDir, { recursive: true });
|
|
2173
|
+
} catch (error) {
|
|
2174
|
+
throw new Error("Failed to create session directory", { cause: error });
|
|
2175
|
+
}
|
|
2176
|
+
try {
|
|
2177
|
+
await writeYamlFile(sessionYamlPath, session);
|
|
2178
|
+
} catch (error) {
|
|
2179
|
+
await rm(sessionDir, { recursive: true, force: true }).catch(() => void 0);
|
|
2180
|
+
throw error;
|
|
2181
|
+
}
|
|
2182
|
+
} finally {
|
|
2183
|
+
await initialLock.release();
|
|
2184
|
+
}
|
|
2173
2185
|
await appendEvent(sessionDir, {
|
|
2174
2186
|
schema_version: EVENT_SCHEMA_VERSION3,
|
|
2175
2187
|
type: "session_started",
|
|
@@ -2951,7 +2963,7 @@ async function loadHostsConfig(configPath = DEFAULT_HOSTS_CONFIG_PATH) {
|
|
|
2951
2963
|
// src/lib/provenance-actions.ts
|
|
2952
2964
|
import {
|
|
2953
2965
|
assertApprovalStoreSafe,
|
|
2954
|
-
assertLockStoreSafe as
|
|
2966
|
+
assertLockStoreSafe as assertLockStoreSafe3,
|
|
2955
2967
|
assertTaskStoreSafe,
|
|
2956
2968
|
readMarkdownFile as readMarkdownFile5,
|
|
2957
2969
|
renderDecisions as renderDecisions2,
|
|
@@ -2963,14 +2975,14 @@ import {
|
|
|
2963
2975
|
|
|
2964
2976
|
// src/commands/import.ts
|
|
2965
2977
|
import { createReadStream } from "fs";
|
|
2966
|
-
import { readdir, readFile as readFile2, rm, stat as stat3 } from "fs/promises";
|
|
2978
|
+
import { readdir, readFile as readFile2, rm as rm2, stat as stat3 } from "fs/promises";
|
|
2967
2979
|
import { homedir as homedir7 } from "os";
|
|
2968
2980
|
import { basename as basename4, dirname as dirname3, join as join9, resolve as resolve6 } from "path";
|
|
2969
2981
|
import { createInterface } from "readline";
|
|
2970
2982
|
import {
|
|
2971
2983
|
AGENT_INFRA_DIRS as AGENT_INFRA_DIRS2,
|
|
2972
2984
|
assertBasouRootSafe as assertBasouRootSafe6,
|
|
2973
|
-
assertLockStoreSafe as
|
|
2985
|
+
assertLockStoreSafe as assertLockStoreSafe2,
|
|
2974
2986
|
assertSessionStoreSafe as assertSessionStoreSafe2,
|
|
2975
2987
|
basouPaths as basouPaths8,
|
|
2976
2988
|
CLAUDE_IMPORT_SOURCE,
|
|
@@ -3144,7 +3156,7 @@ async function resolveImportTarget(ctx) {
|
|
|
3144
3156
|
}
|
|
3145
3157
|
async function importDerivedSessions(paths, manifest, options, sourceKind, candidates, projectPaths, boundaryDeclared) {
|
|
3146
3158
|
await assertSessionStoreSafe2(paths);
|
|
3147
|
-
if (options.dryRun !== true) await
|
|
3159
|
+
if (options.dryRun !== true) await assertLockStoreSafe2(paths);
|
|
3148
3160
|
const { byExternalId: existingByExternalId, notDirectories } = await loadExistingByExternalId(
|
|
3149
3161
|
paths,
|
|
3150
3162
|
sourceKind
|
|
@@ -3236,7 +3248,7 @@ async function importDerivedSessions(paths, manifest, options, sourceKind, candi
|
|
|
3236
3248
|
if (priors.length > 0 && options.force === true) {
|
|
3237
3249
|
if (options.dryRun !== true) {
|
|
3238
3250
|
for (const { sessionId } of priors) {
|
|
3239
|
-
await
|
|
3251
|
+
await rm2(join9(paths.sessions, sessionId), { recursive: true, force: true });
|
|
3240
3252
|
}
|
|
3241
3253
|
}
|
|
3242
3254
|
counts.replaced++;
|
|
@@ -3726,7 +3738,7 @@ async function refreshAll(args) {
|
|
|
3726
3738
|
if (!dryRun) {
|
|
3727
3739
|
await assertTaskStoreSafe(paths);
|
|
3728
3740
|
await assertApprovalStoreSafe(paths);
|
|
3729
|
-
await
|
|
3741
|
+
await assertLockStoreSafe3(paths);
|
|
3730
3742
|
}
|
|
3731
3743
|
const claudeCode = await importClaudeCode(options, ctx);
|
|
3732
3744
|
const codex = await importCodex(options, ctx);
|
|
@@ -8749,7 +8761,7 @@ import { homedir as homedir10 } from "os";
|
|
|
8749
8761
|
import { join as join13 } from "path";
|
|
8750
8762
|
import {
|
|
8751
8763
|
assertApprovalStoreSafe as assertApprovalStoreSafe2,
|
|
8752
|
-
assertLockStoreSafe as
|
|
8764
|
+
assertLockStoreSafe as assertLockStoreSafe4,
|
|
8753
8765
|
assertTaskStoreSafe as assertTaskStoreSafe2,
|
|
8754
8766
|
findErrorCode as findErrorCode8
|
|
8755
8767
|
} from "@basou/core";
|
|
@@ -8814,7 +8826,7 @@ function hms(date) {
|
|
|
8814
8826
|
async function runImports(deps) {
|
|
8815
8827
|
await assertTaskStoreSafe2(deps.paths);
|
|
8816
8828
|
await assertApprovalStoreSafe2(deps.paths);
|
|
8817
|
-
await
|
|
8829
|
+
await assertLockStoreSafe4(deps.paths);
|
|
8818
8830
|
const claude = await importClaudeCode(deps.importOptions, deps.ctx);
|
|
8819
8831
|
const codex = await importCodex(deps.importOptions, deps.ctx);
|
|
8820
8832
|
return { claude, codex, changed: changedCount(claude) + changedCount(codex) };
|
|
@@ -9636,13 +9648,12 @@ function unattachedLines(u) {
|
|
|
9636
9648
|
}
|
|
9637
9649
|
|
|
9638
9650
|
// src/commands/run.ts
|
|
9639
|
-
import { mkdir as mkdir3, readFile as readFile7 } from "fs/promises";
|
|
9651
|
+
import { mkdir as mkdir3, readFile as readFile7, rm as rm3 } from "fs/promises";
|
|
9640
9652
|
import { homedir as homedir12 } from "os";
|
|
9641
9653
|
import { join as join14 } from "path";
|
|
9642
9654
|
import {
|
|
9643
9655
|
acquireLock as acquireLock5,
|
|
9644
9656
|
assertBasouRootSafe as assertBasouRootSafe12,
|
|
9645
|
-
assertLockStoreSafe as assertLockStoreSafe6,
|
|
9646
9657
|
assertSessionStoreSafe as assertSessionStoreSafe3,
|
|
9647
9658
|
basouPaths as basouPaths17,
|
|
9648
9659
|
ChildProcessRunner as ChildProcessRunner2,
|
|
@@ -9720,10 +9731,8 @@ async function runTrackedTool(args, options, ctx, adapter) {
|
|
|
9720
9731
|
await assertBasouRootSafe12(paths.root);
|
|
9721
9732
|
const manifest = await readManifest10(paths);
|
|
9722
9733
|
await assertSessionStoreSafe3(paths);
|
|
9723
|
-
await assertLockStoreSafe6(paths);
|
|
9724
9734
|
const sessionId = prefixedUlid4("ses");
|
|
9725
9735
|
const sessionDir = join14(paths.sessions, sessionId);
|
|
9726
|
-
await mkdir3(sessionDir, { recursive: true });
|
|
9727
9736
|
const appendEvent = ctx.appendEvent ?? (async (_sessionDir, event) => {
|
|
9728
9737
|
await coreAppendChainedEvent2(paths, sessionId, event);
|
|
9729
9738
|
});
|
|
@@ -9738,7 +9747,22 @@ async function runTrackedTool(args, options, ctx, adapter) {
|
|
|
9738
9747
|
startedAt,
|
|
9739
9748
|
source: adapter.metadata
|
|
9740
9749
|
});
|
|
9741
|
-
await
|
|
9750
|
+
const initialLock = await acquireLock5(paths, "session", sessionId);
|
|
9751
|
+
try {
|
|
9752
|
+
try {
|
|
9753
|
+
await mkdir3(sessionDir, { recursive: true });
|
|
9754
|
+
} catch (error) {
|
|
9755
|
+
throw new Error("Failed to create session directory", { cause: error });
|
|
9756
|
+
}
|
|
9757
|
+
try {
|
|
9758
|
+
await writeYamlFile2(sessionYamlPath, session);
|
|
9759
|
+
} catch (error) {
|
|
9760
|
+
await rm3(sessionDir, { recursive: true, force: true }).catch(() => void 0);
|
|
9761
|
+
throw error;
|
|
9762
|
+
}
|
|
9763
|
+
} finally {
|
|
9764
|
+
await initialLock.release();
|
|
9765
|
+
}
|
|
9742
9766
|
await appendEvent(sessionDir, {
|
|
9743
9767
|
schema_version: EVENT_SCHEMA_VERSION5,
|
|
9744
9768
|
type: "session_started",
|
|
@@ -10107,7 +10131,7 @@ import {
|
|
|
10107
10131
|
acquireLock as acquireLock6,
|
|
10108
10132
|
appendEventToExistingSession as appendEventToExistingSession3,
|
|
10109
10133
|
assertBasouRootSafe as assertBasouRootSafe13,
|
|
10110
|
-
assertLockStoreSafe as
|
|
10134
|
+
assertLockStoreSafe as assertLockStoreSafe5,
|
|
10111
10135
|
basouPaths as basouPaths18,
|
|
10112
10136
|
displayPath as displayPath3,
|
|
10113
10137
|
EVENT_SCHEMA_VERSION as EVENT_SCHEMA_VERSION6,
|
|
@@ -10743,7 +10767,7 @@ async function doRunSessionRechain(options, ctx) {
|
|
|
10743
10767
|
const repositoryRoot = await resolveRepositoryRootForSession(cwd, "rechain");
|
|
10744
10768
|
const paths = basouPaths18(repositoryRoot);
|
|
10745
10769
|
await assertWorkspaceInitialized11(paths.root);
|
|
10746
|
-
await
|
|
10770
|
+
await assertLockStoreSafe5(paths);
|
|
10747
10771
|
const sessionIds = options.session !== void 0 ? [await resolveSessionId3(paths, options.session)] : await enumerateAllSessionNames(paths);
|
|
10748
10772
|
const dryRun = options.dryRun === true;
|
|
10749
10773
|
const rows = [];
|
|
@@ -11032,7 +11056,7 @@ import { join as join16 } from "path";
|
|
|
11032
11056
|
import {
|
|
11033
11057
|
archiveTask,
|
|
11034
11058
|
assertBasouRootSafe as assertBasouRootSafe16,
|
|
11035
|
-
assertLockStoreSafe as
|
|
11059
|
+
assertLockStoreSafe as assertLockStoreSafe6,
|
|
11036
11060
|
basouPaths as basouPaths21,
|
|
11037
11061
|
createTaskWithEvent,
|
|
11038
11062
|
deleteTask,
|
|
@@ -11570,7 +11594,7 @@ async function doRunTaskReconcile(options, ctx) {
|
|
|
11570
11594
|
const repositoryRoot = await resolveRepositoryRootForTask(cwd, "reconcile");
|
|
11571
11595
|
const paths = basouPaths21(repositoryRoot);
|
|
11572
11596
|
await assertWorkspaceInitialized13(paths.root);
|
|
11573
|
-
await
|
|
11597
|
+
await assertLockStoreSafe6(paths);
|
|
11574
11598
|
const manifest = await readManifest13(paths);
|
|
11575
11599
|
const nowProvider = ctx.nowProvider ?? (() => /* @__PURE__ */ new Date());
|
|
11576
11600
|
const write = options.write === true;
|
|
@@ -14242,7 +14266,7 @@ async function assertWorkspaceInitialized15(basouRoot) {
|
|
|
14242
14266
|
function readBuildStamp() {
|
|
14243
14267
|
if (false) return void 0;
|
|
14244
14268
|
try {
|
|
14245
|
-
return JSON.parse('{"version":"0.
|
|
14269
|
+
return JSON.parse('{"version":"0.64.0","commit":"1caea85","committedAt":"2026-10-04T11:34:39+09:00"}');
|
|
14246
14270
|
} catch {
|
|
14247
14271
|
return void 0;
|
|
14248
14272
|
}
|