@basou/cli 0.68.4 → 0.69.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/program.js CHANGED
@@ -2956,7 +2956,6 @@ async function doRunChannelClear(face, options) {
2956
2956
  }
2957
2957
 
2958
2958
  // src/commands/decision.ts
2959
- import { readFile as readFile3 } from "fs/promises";
2960
2959
  import { homedir as homedir3 } from "os";
2961
2960
  import { join as join7, resolve as resolve4 } from "path";
2962
2961
  import {
@@ -2969,7 +2968,7 @@ import {
2969
2968
  createAdHocSessionWithEvent,
2970
2969
  displayPath as displayPath4,
2971
2970
  EVENT_SCHEMA_VERSION as EVENT_SCHEMA_VERSION2,
2972
- findErrorCode as findErrorCode4,
2971
+ findErrorCode as findErrorCode5,
2973
2972
  isValidPrefixedId,
2974
2973
  LOCAL_CLI_EVENT_SOURCE as LOCAL_CLI_EVENT_SOURCE2,
2975
2974
  loadSessionEntries,
@@ -2981,6 +2980,35 @@ import {
2981
2980
  } from "@basou/core";
2982
2981
  import { InvalidArgumentError as InvalidArgumentError2 } from "commander";
2983
2982
 
2983
+ // src/lib/input-file.ts
2984
+ import { readFile as readFile3 } from "fs/promises";
2985
+ import { findErrorCode as findErrorCode4 } from "@basou/core";
2986
+ function refuseDashInputFile(flag, value, alternative) {
2987
+ if (value !== "-") return;
2988
+ if (alternative === "stdin") {
2989
+ throw new Error(
2990
+ `${flag} - is refused: - is reserved for standard input. Omit ${flag} to read stdin, or pass ${flag} ./- to read a file named -.`
2991
+ );
2992
+ }
2993
+ const toFile = "textFlag" in alternative ? `Write the text to a file and pass ${flag} <path>, or pass it with ${alternative.textFlag}` : `Write ${alternative.fileOnly} to a file and pass its path with ${flag}`;
2994
+ throw new Error(
2995
+ `${flag} - is refused: - is reserved for standard input, which this command does not read. ${toFile}; a file named - is read with ${flag} ./-.`
2996
+ );
2997
+ }
2998
+ async function readInputFileText(flag, path) {
2999
+ try {
3000
+ return await readFile3(path, "utf8");
3001
+ } catch (error) {
3002
+ if (findErrorCode4(error, "ENOENT")) {
3003
+ throw new Error(`${flag} names a file that does not exist`, { cause: error });
3004
+ }
3005
+ if (findErrorCode4(error, "EISDIR")) {
3006
+ throw new Error(`${flag} names a directory, not a file`, { cause: error });
3007
+ }
3008
+ throw new Error(`Could not read the file ${flag} names`, { cause: error });
3009
+ }
3010
+ }
3011
+
2984
3012
  // src/commands/decision-gaps.ts
2985
3013
  import {
2986
3014
  basouPaths as basouPaths5,
@@ -3348,6 +3376,7 @@ async function runDecisionCapture(options, ctx = {}) {
3348
3376
  }
3349
3377
  }
3350
3378
  async function doRunDecisionCapture(options, ctx) {
3379
+ refuseDashInputFile("--file", options.file, "stdin");
3351
3380
  const cwd = ctx.cwd ?? process.cwd();
3352
3381
  const repositoryRoot = await resolveBasouRootForCommand(cwd, "decision capture");
3353
3382
  const paths = basouPaths6(repositoryRoot);
@@ -3563,14 +3592,7 @@ function parseReason(raw) {
3563
3592
  }
3564
3593
  async function readCaptureInput(options, ctx) {
3565
3594
  if (options.file !== void 0) {
3566
- try {
3567
- return await readFile3(options.file, "utf8");
3568
- } catch (error) {
3569
- if (findErrorCode4(error, "ENOENT")) {
3570
- throw new Error(`Input file not found: ${options.file}`);
3571
- }
3572
- throw error;
3573
- }
3595
+ return await readInputFileText("--file", options.file);
3574
3596
  }
3575
3597
  if (ctx.readInput !== void 0) {
3576
3598
  return await ctx.readInput();
@@ -3909,7 +3931,7 @@ async function assertWorkspaceInitialized4(basouRoot) {
3909
3931
  try {
3910
3932
  await assertBasouRootSafe4(basouRoot);
3911
3933
  } catch (error) {
3912
- if (findErrorCode4(error, "ENOENT")) {
3934
+ if (findErrorCode5(error, "ENOENT")) {
3913
3935
  throw new Error("Workspace not initialized. Run 'basou init' first.");
3914
3936
  }
3915
3937
  throw error;
@@ -3920,7 +3942,7 @@ async function assertWorkspaceInitialized4(basouRoot) {
3920
3942
  import {
3921
3943
  assertBasouRootSafe as assertBasouRootSafe5,
3922
3944
  basouPaths as basouPaths7,
3923
- findErrorCode as findErrorCode5,
3945
+ findErrorCode as findErrorCode6,
3924
3946
  readMarkdownFile as readMarkdownFile4,
3925
3947
  renderDecisions as renderDecisions2,
3926
3948
  renderWithMarkers as renderWithMarkers2,
@@ -3962,7 +3984,7 @@ async function assertWorkspaceInitialized5(basouRoot) {
3962
3984
  try {
3963
3985
  await assertBasouRootSafe5(basouRoot);
3964
3986
  } catch (error) {
3965
- if (findErrorCode5(error, "ENOENT")) {
3987
+ if (findErrorCode6(error, "ENOENT")) {
3966
3988
  throw new Error("Workspace not initialized. Run 'basou init' first.");
3967
3989
  }
3968
3990
  throw error;
@@ -3994,6 +4016,24 @@ import {
3994
4016
  writeObservedDuration,
3995
4017
  writeYamlFile
3996
4018
  } from "@basou/core";
4019
+
4020
+ // src/lib/signal-exit-code.ts
4021
+ import { constants } from "os";
4022
+ var PROMISED_SIGNAL_NUMBERS = {
4023
+ SIGHUP: 1,
4024
+ SIGINT: 2,
4025
+ SIGQUIT: 3,
4026
+ SIGKILL: 9,
4027
+ SIGTERM: 15
4028
+ };
4029
+ var UNNUMBERED_SIGNAL_EXIT_CODE = 255;
4030
+ function signalToExitCode(sig) {
4031
+ if (sig === null) return 1;
4032
+ const num = PROMISED_SIGNAL_NUMBERS[sig] ?? constants.signals[sig];
4033
+ return num === void 0 ? UNNUMBERED_SIGNAL_EXIT_CODE : 128 + num;
4034
+ }
4035
+
4036
+ // src/commands/exec.ts
3997
4037
  function registerExecCommand(program) {
3998
4038
  program.command("exec <command> [args...]").description("Execute a command and record it as a Basou session").passThroughOptions().option("--timeout <duration>", "Kill the child after this duration (e.g. 30s, 5m, 1h)").option("--no-snapshot", "Skip git_snapshot before/after the command").option("--cwd <path>", "Run from a Basou root other than process.cwd()").option("-v, --verbose", "Show error causes").action(async (command, args, options) => {
3999
4039
  try {
@@ -4190,18 +4230,6 @@ function decideFinalStatus(result, signalReceived) {
4190
4230
  if (result.exit_code === 0) return "completed";
4191
4231
  return "failed";
4192
4232
  }
4193
- var SIGNUM_MAP = {
4194
- SIGHUP: 1,
4195
- SIGINT: 2,
4196
- SIGQUIT: 3,
4197
- SIGKILL: 9,
4198
- SIGTERM: 15
4199
- };
4200
- function signalToExitCode(sig) {
4201
- if (sig === null) return 1;
4202
- const num = SIGNUM_MAP[sig] ?? 1;
4203
- return 128 + num;
4204
- }
4205
4233
  async function tryAppendGitSnapshot(sessionDir, sessionId, repoRoot, now, appendEvent) {
4206
4234
  let snapshot;
4207
4235
  try {
@@ -4313,7 +4341,7 @@ async function finalizeSessionAsFailed(paths, sessionDir, sessionId, appendEvent
4313
4341
  import {
4314
4342
  assertBasouRootSafe as assertBasouRootSafe7,
4315
4343
  basouPaths as basouPaths9,
4316
- findErrorCode as findErrorCode6,
4344
+ findErrorCode as findErrorCode7,
4317
4345
  readMarkdownFile as readMarkdownFile5,
4318
4346
  renderHandoff as renderHandoff2,
4319
4347
  renderWithMarkers as renderWithMarkers3,
@@ -4371,7 +4399,7 @@ async function assertWorkspaceInitialized6(basouRoot) {
4371
4399
  try {
4372
4400
  await assertBasouRootSafe7(basouRoot);
4373
4401
  } catch (error) {
4374
- if (findErrorCode6(error, "ENOENT")) {
4402
+ if (findErrorCode7(error, "ENOENT")) {
4375
4403
  throw new Error("Workspace not initialized. Run 'basou init' first.");
4376
4404
  }
4377
4405
  throw error;
@@ -4622,7 +4650,7 @@ async function loadProtocolsConfig(configPath = DEFAULT_PROTOCOLS_CONFIG_PATH) {
4622
4650
  import {
4623
4651
  assertBasouRootSafe as assertBasouRootSafe8,
4624
4652
  basouPaths as basouPaths10,
4625
- findErrorCode as findErrorCode7,
4653
+ findErrorCode as findErrorCode8,
4626
4654
  renderOrientation as renderOrientation2,
4627
4655
  writeMarkdownFile as writeMarkdownFile4
4628
4656
  } from "@basou/core";
@@ -4779,7 +4807,7 @@ async function assertWorkspaceInitialized7(basouRoot) {
4779
4807
  try {
4780
4808
  await assertBasouRootSafe8(basouRoot);
4781
4809
  } catch (error) {
4782
- if (findErrorCode7(error, "ENOENT")) {
4810
+ if (findErrorCode8(error, "ENOENT")) {
4783
4811
  throw new Error("Workspace not initialized. Run 'basou init' first.");
4784
4812
  }
4785
4813
  throw error;
@@ -5834,7 +5862,6 @@ function renderGitignoreWarning(error, verbose) {
5834
5862
  }
5835
5863
 
5836
5864
  // src/commands/note.ts
5837
- import { readFile as readFile5 } from "fs/promises";
5838
5865
  import { homedir as homedir8 } from "os";
5839
5866
  import { resolve as resolve8 } from "path";
5840
5867
  import {
@@ -5844,7 +5871,7 @@ import {
5844
5871
  basouPaths as basouPaths12,
5845
5872
  createAdHocSessionWithEvent as createAdHocSessionWithEvent2,
5846
5873
  EVENT_SCHEMA_VERSION as EVENT_SCHEMA_VERSION4,
5847
- findErrorCode as findErrorCode8,
5874
+ findErrorCode as findErrorCode9,
5848
5875
  LOCAL_CLI_EVENT_SOURCE as LOCAL_CLI_EVENT_SOURCE3,
5849
5876
  readManifest as readManifest8,
5850
5877
  resolveSessionId as resolveSessionId2,
@@ -6005,22 +6032,12 @@ async function readNoteBody(bodyArgument, options, ctx, cwd) {
6005
6032
  if (bodyArgument !== void 0 && options.file !== void 0) {
6006
6033
  throw new Error("Pass the note text either as an argument or with --file, not both.");
6007
6034
  }
6035
+ refuseDashInputFile("--file", options.file, "stdin");
6008
6036
  if (bodyArgument !== void 0) {
6009
6037
  return { body: bodyArgument, source: "argument" };
6010
6038
  }
6011
6039
  if (options.file !== void 0) {
6012
- let raw;
6013
- try {
6014
- raw = await readFile5(resolve8(cwd, options.file), "utf8");
6015
- } catch (error) {
6016
- if (findErrorCode8(error, "ENOENT")) {
6017
- throw new Error("--file names a file that does not exist", { cause: error });
6018
- }
6019
- if (findErrorCode8(error, "EISDIR")) {
6020
- throw new Error("--file names a directory, not a file", { cause: error });
6021
- }
6022
- throw new Error("Could not read the file --file names", { cause: error });
6023
- }
6040
+ const raw = await readInputFileText("--file", resolve8(cwd, options.file));
6024
6041
  return { body: dropTrailingNewlines(raw), source: "file" };
6025
6042
  }
6026
6043
  if (ctx.readInput !== void 0) {
@@ -6089,7 +6106,7 @@ async function assertWorkspaceInitialized8(basouRoot) {
6089
6106
  try {
6090
6107
  await assertBasouRootSafe9(basouRoot);
6091
6108
  } catch (error) {
6092
- if (findErrorCode8(error, "ENOENT")) {
6109
+ if (findErrorCode9(error, "ENOENT")) {
6093
6110
  throw new Error("Workspace not initialized. Run 'basou init' first.");
6094
6111
  }
6095
6112
  throw error;
@@ -9418,7 +9435,7 @@ function renderProjectRetrofit(result) {
9418
9435
  }
9419
9436
 
9420
9437
  // src/commands/protocol.ts
9421
- import { readFile as readFile6, stat as stat5 } from "fs/promises";
9438
+ import { readFile as readFile5, stat as stat5 } from "fs/promises";
9422
9439
  import {
9423
9440
  carryForwardProtocolStamp,
9424
9441
  PROTOCOL_END as PROTOCOL_END2,
@@ -9475,7 +9492,7 @@ async function readProtocolSources(entries) {
9475
9492
  for (const entry of entries) {
9476
9493
  let content;
9477
9494
  try {
9478
- content = await readFile6(entry.source, "utf8");
9495
+ content = await readFile5(entry.source, "utf8");
9479
9496
  } catch (error) {
9480
9497
  if (error instanceof Error && error.code === "ENOENT") {
9481
9498
  throw new Error(
@@ -9601,7 +9618,7 @@ async function doRunProtocolUnsync(options) {
9601
9618
  import {
9602
9619
  assertBasouRootSafe as assertBasouRootSafe10,
9603
9620
  basouPaths as basouPaths14,
9604
- findErrorCode as findErrorCode10,
9621
+ findErrorCode as findErrorCode11,
9605
9622
  loadPortfolioConfig as loadPortfolioConfig5,
9606
9623
  readManifest as readManifest10
9607
9624
  } from "@basou/core";
@@ -9615,7 +9632,7 @@ import {
9615
9632
  assertApprovalStoreSafe as assertApprovalStoreSafe2,
9616
9633
  assertLockStoreSafe as assertLockStoreSafe4,
9617
9634
  assertTaskStoreSafe as assertTaskStoreSafe2,
9618
- findErrorCode as findErrorCode9
9635
+ findErrorCode as findErrorCode10
9619
9636
  } from "@basou/core";
9620
9637
  var DEFAULT_WATCH_INTERVAL_SEC = 30;
9621
9638
  var MIN_WATCH_INTERVAL_SEC = 5;
@@ -9633,7 +9650,7 @@ async function scanSourceLogs(roots) {
9633
9650
  try {
9634
9651
  entries = await readdir3(dir, { withFileTypes: true });
9635
9652
  } catch (error) {
9636
- if (findErrorCode9(error, "ENOENT") || findErrorCode9(error, "ENOTDIR")) return;
9653
+ if (findErrorCode10(error, "ENOENT") || findErrorCode10(error, "ENOTDIR")) return;
9637
9654
  throw new Error("Failed to read a source log directory", { cause: error });
9638
9655
  }
9639
9656
  for (const entry of entries) {
@@ -9645,7 +9662,7 @@ async function scanSourceLogs(roots) {
9645
9662
  const info = await stat6(full);
9646
9663
  out.set(full, { mtimeMs: info.mtimeMs, size: info.size });
9647
9664
  } catch (error) {
9648
- if (findErrorCode9(error, "ENOENT")) continue;
9665
+ if (findErrorCode10(error, "ENOENT")) continue;
9649
9666
  throw new Error("Failed to stat a source log file", { cause: error });
9650
9667
  }
9651
9668
  }
@@ -9979,7 +9996,7 @@ async function assertWorkspaceInitialized9(basouRoot) {
9979
9996
  try {
9980
9997
  await assertBasouRootSafe10(basouRoot);
9981
9998
  } catch (error) {
9982
- if (findErrorCode10(error, "ENOENT")) {
9999
+ if (findErrorCode11(error, "ENOENT")) {
9983
10000
  throw new Error("Workspace not initialized. Run 'basou init' first.");
9984
10001
  }
9985
10002
  throw error;
@@ -9991,7 +10008,7 @@ import { isAbsolute as isAbsolute4, resolve as resolve10 } from "path";
9991
10008
  import {
9992
10009
  assertBasouRootSafe as assertBasouRootSafe11,
9993
10010
  basouPaths as basouPaths15,
9994
- findErrorCode as findErrorCode11,
10011
+ findErrorCode as findErrorCode12,
9995
10012
  renderReport,
9996
10013
  writeMarkdownFile as writeMarkdownFile6
9997
10014
  } from "@basou/core";
@@ -10043,7 +10060,7 @@ async function assertWorkspaceInitialized10(basouRoot) {
10043
10060
  try {
10044
10061
  await assertBasouRootSafe11(basouRoot);
10045
10062
  } catch (error) {
10046
- if (findErrorCode11(error, "ENOENT")) {
10063
+ if (findErrorCode12(error, "ENOENT")) {
10047
10064
  throw new Error("Workspace not initialized. Run 'basou init' first.");
10048
10065
  }
10049
10066
  throw error;
@@ -10051,7 +10068,6 @@ async function assertWorkspaceInitialized10(basouRoot) {
10051
10068
  }
10052
10069
 
10053
10070
  // src/commands/review.ts
10054
- import { readFile as readFile7 } from "fs/promises";
10055
10071
  import { homedir as homedir10 } from "os";
10056
10072
  import { resolve as resolve11 } from "path";
10057
10073
  import {
@@ -10060,7 +10076,7 @@ import {
10060
10076
  buildReviewRecordedEvent,
10061
10077
  buildReviewRecordLabel,
10062
10078
  createAdHocSessionWithEvent as createAdHocSessionWithEvent3,
10063
- findErrorCode as findErrorCode12,
10079
+ findErrorCode as findErrorCode13,
10064
10080
  findUnbindableRepos,
10065
10081
  parseReviewRecordInput,
10066
10082
  readManifest as readManifest11,
@@ -10136,6 +10152,7 @@ async function runReviewRecord(options, ctx = {}) {
10136
10152
  }
10137
10153
  }
10138
10154
  async function doRunReviewRecord(options, ctx) {
10155
+ refuseDashInputFile("--file", options.file, "stdin");
10139
10156
  const cwd = ctx.cwd ?? process.cwd();
10140
10157
  const repositoryRoot = await resolveBasouRootForCommand(cwd, "review record");
10141
10158
  const paths = basouPaths16(repositoryRoot);
@@ -10194,14 +10211,7 @@ ${detail}
10194
10211
  }
10195
10212
  async function readReviewInput(options, ctx) {
10196
10213
  if (options.file !== void 0) {
10197
- try {
10198
- return await readFile7(options.file, "utf8");
10199
- } catch (error) {
10200
- if (findErrorCode12(error, "ENOENT")) {
10201
- throw new Error(`Input file not found: ${options.file}`);
10202
- }
10203
- throw error;
10204
- }
10214
+ return await readInputFileText("--file", options.file);
10205
10215
  }
10206
10216
  if (ctx.readInput !== void 0) {
10207
10217
  return await ctx.readInput();
@@ -10276,7 +10286,7 @@ async function assertWorkspaceInitialized11(basouRoot) {
10276
10286
  try {
10277
10287
  await assertBasouRootSafe12(basouRoot);
10278
10288
  } catch (error) {
10279
- if (findErrorCode12(error, "ENOENT")) {
10289
+ if (findErrorCode13(error, "ENOENT")) {
10280
10290
  throw new Error("Workspace not initialized. Run 'basou init' first.");
10281
10291
  }
10282
10292
  throw error;
@@ -10488,7 +10498,7 @@ function unattachedLines(u) {
10488
10498
  }
10489
10499
 
10490
10500
  // src/commands/run.ts
10491
- import { mkdir as mkdir3, readFile as readFile8, rm as rm3 } from "fs/promises";
10501
+ import { mkdir as mkdir3, readFile as readFile6, rm as rm3 } from "fs/promises";
10492
10502
  import { homedir as homedir11 } from "os";
10493
10503
  import { join as join14 } from "path";
10494
10504
  import {
@@ -10759,7 +10769,7 @@ async function runTrackedTool(args, options, ctx, adapter) {
10759
10769
  s.session.related_files = relatedFiles;
10760
10770
  });
10761
10771
  if (result.exit_code !== null) return result.exit_code;
10762
- return signalToExitCode2(signalReceived ?? result.signal);
10772
+ return signalToExitCode(signalReceived ?? result.signal);
10763
10773
  }
10764
10774
  function decideFinalStatus2(result, signalReceived) {
10765
10775
  if (signalReceived === "SIGINT" || signalReceived === "SIGTERM") return "interrupted";
@@ -10769,18 +10779,6 @@ function decideFinalStatus2(result, signalReceived) {
10769
10779
  if (result.exit_code === 0) return "completed";
10770
10780
  return "failed";
10771
10781
  }
10772
- var SIGNUM_MAP2 = {
10773
- SIGHUP: 1,
10774
- SIGINT: 2,
10775
- SIGQUIT: 3,
10776
- SIGKILL: 9,
10777
- SIGTERM: 15
10778
- };
10779
- function signalToExitCode2(sig) {
10780
- if (sig === null) return 1;
10781
- const num = SIGNUM_MAP2[sig] ?? 1;
10782
- return 128 + num;
10783
- }
10784
10782
  async function tryAppendGitSnapshot2(sessionDir, sessionId, repoRoot, now, appendEvent) {
10785
10783
  let snapshot;
10786
10784
  try {
@@ -10938,7 +10936,7 @@ async function noteCodexHookStatusPreSpawn(_cwd, ctx) {
10938
10936
  const hooksPath = ctx.codexHooksPath ?? DEFAULT_CODEX_HOOKS_PATH;
10939
10937
  let location;
10940
10938
  try {
10941
- location = findBasouSessionStartHook2(JSON.parse(await readFile8(hooksPath, "utf8")));
10939
+ location = findBasouSessionStartHook2(JSON.parse(await readFile6(hooksPath, "utf8")));
10942
10940
  } catch (error) {
10943
10941
  if (!(error instanceof Error && error.code === "ENOENT")) return null;
10944
10942
  location = null;
@@ -10952,7 +10950,7 @@ async function noteCodexHookStatusPreSpawn(_cwd, ctx) {
10952
10950
  }
10953
10951
 
10954
10952
  // src/commands/session.ts
10955
- import { readFile as readFile9 } from "fs/promises";
10953
+ import { readFile as readFile7 } from "fs/promises";
10956
10954
  import { basename as basename8, isAbsolute as isAbsolute5, join as join15, relative as relative4, sep as sep3 } from "path";
10957
10955
  import {
10958
10956
  acquireLock as acquireLock6,
@@ -10963,7 +10961,7 @@ import {
10963
10961
  displayPath as displayPath5,
10964
10962
  EVENT_SCHEMA_VERSION as EVENT_SCHEMA_VERSION6,
10965
10963
  enumerateSessionEntries as enumerateSessionEntries2,
10966
- findErrorCode as findErrorCode13,
10964
+ findErrorCode as findErrorCode14,
10967
10965
  importSessionFromJson as importSessionFromJson2,
10968
10966
  LOCAL_CLI_EVENT_SOURCE as LOCAL_CLI_EVENT_SOURCE4,
10969
10967
  loadSessionEntries as loadSessionEntries2,
@@ -11092,7 +11090,7 @@ async function doRunSessionShow(idInput, options, ctx) {
11092
11090
  const raw = await readYamlFile6(sessionYamlPath);
11093
11091
  session = SessionSchema3.parse(normalizeSessionTimestamps(raw));
11094
11092
  } catch (error) {
11095
- if (findErrorCode13(error, "ENOENT")) {
11093
+ if (findErrorCode14(error, "ENOENT")) {
11096
11094
  throw new Error(`Session not found: ${idInput}`);
11097
11095
  }
11098
11096
  throw new Error("Failed to read session", { cause: error });
@@ -11356,7 +11354,7 @@ async function assertWorkspaceInitialized12(basouRoot) {
11356
11354
  try {
11357
11355
  await assertBasouRootSafe14(basouRoot);
11358
11356
  } catch (error) {
11359
- if (findErrorCode13(error, "ENOENT")) {
11357
+ if (findErrorCode14(error, "ENOENT")) {
11360
11358
  throw new Error("Workspace not initialized. Run 'basou init' first.");
11361
11359
  }
11362
11360
  throw error;
@@ -11392,6 +11390,7 @@ async function runSessionImport(options, ctx = {}) {
11392
11390
  }
11393
11391
  }
11394
11392
  async function doRunSessionImport(options, ctx) {
11393
+ refuseDashInputFile("--from", options.from, { fileOnly: "the JSON" });
11395
11394
  const cwd = ctx.cwd ?? process.cwd();
11396
11395
  const repositoryRoot = await resolveRepositoryRootForSession(cwd, "import");
11397
11396
  const paths = basouPaths19(repositoryRoot);
@@ -11425,12 +11424,12 @@ async function doRunSessionImport(options, ctx) {
11425
11424
  }
11426
11425
  async function readInputFile(path) {
11427
11426
  try {
11428
- return await readFile9(path, "utf8");
11427
+ return await readFile7(path, "utf8");
11429
11428
  } catch (error) {
11430
- if (findErrorCode13(error, "ENOENT")) {
11429
+ if (findErrorCode14(error, "ENOENT")) {
11431
11430
  throw new Error("Import source not found", { cause: error });
11432
11431
  }
11433
- if (findErrorCode13(error, "EISDIR")) {
11432
+ if (findErrorCode14(error, "EISDIR")) {
11434
11433
  throw new Error("Import source is not a file", { cause: error });
11435
11434
  }
11436
11435
  throw new Error("Failed to read import source", { cause: error });
@@ -11505,9 +11504,7 @@ async function doRunSessionNote(sessionIdInput, options, ctx) {
11505
11504
  if (hasBody && hasFromFile) {
11506
11505
  throw new Error("--body and --from-file are mutually exclusive");
11507
11506
  }
11508
- if (hasFromFile && options.fromFile === "-") {
11509
- throw new Error("--from-file - (stdin) is not supported in v0.1");
11510
- }
11507
+ refuseDashInputFile("--from-file", options.fromFile, { textFlag: "--body" });
11511
11508
  const cwd = ctx.cwd ?? process.cwd();
11512
11509
  const repositoryRoot = await resolveRepositoryRootForSession(cwd, "note");
11513
11510
  const paths = basouPaths19(repositoryRoot);
@@ -11542,12 +11539,12 @@ async function doRunSessionNote(sessionIdInput, options, ctx) {
11542
11539
  }
11543
11540
  async function readNoteFile(path) {
11544
11541
  try {
11545
- return await readFile9(path, "utf8");
11542
+ return await readFile7(path, "utf8");
11546
11543
  } catch (error) {
11547
- if (findErrorCode13(error, "ENOENT")) {
11544
+ if (findErrorCode14(error, "ENOENT")) {
11548
11545
  throw new Error("Note source not found", { cause: error });
11549
11546
  }
11550
- if (findErrorCode13(error, "EISDIR")) {
11547
+ if (findErrorCode14(error, "EISDIR")) {
11551
11548
  throw new Error("Note source is not a file", { cause: error });
11552
11549
  }
11553
11550
  throw new Error("Failed to read note source", { cause: error });
@@ -11660,7 +11657,7 @@ import {
11660
11657
  assertBasouRootSafe as assertBasouRootSafe15,
11661
11658
  basouPaths as basouPaths20,
11662
11659
  computeWorkStats,
11663
- findErrorCode as findErrorCode14
11660
+ findErrorCode as findErrorCode15
11664
11661
  } from "@basou/core";
11665
11662
  function registerStatsCommand(program) {
11666
11663
  program.command("stats").description("Report how much the AI worked (output volume + time proxies) across sessions").option("--by-source", "Break the totals down by session source kind").option("--by-day", "Break billable time and volume down by calendar day").option("--json", "Output the full stats as JSON").option("-v, --verbose", "Show error causes").action(async (options) => {
@@ -11769,7 +11766,7 @@ async function assertWorkspaceInitialized13(basouRoot) {
11769
11766
  try {
11770
11767
  await assertBasouRootSafe15(basouRoot);
11771
11768
  } catch (error) {
11772
- if (findErrorCode14(error, "ENOENT")) {
11769
+ if (findErrorCode15(error, "ENOENT")) {
11773
11770
  throw new Error("Workspace not initialized. Run 'basou init' first.");
11774
11771
  }
11775
11772
  throw error;
@@ -11781,7 +11778,7 @@ import {
11781
11778
  assertBasouRootSafe as assertBasouRootSafe16,
11782
11779
  basouPaths as basouPaths21,
11783
11780
  buildStatusSnapshot,
11784
- findErrorCode as findErrorCode15,
11781
+ findErrorCode as findErrorCode16,
11785
11782
  readManifest as readManifest14,
11786
11783
  writeStatus
11787
11784
  } from "@basou/core";
@@ -11805,7 +11802,7 @@ async function doRunStatus(options, ctx) {
11805
11802
  try {
11806
11803
  await assertBasouRootSafe16(paths.root);
11807
11804
  } catch (error) {
11808
- if (findErrorCode15(error, "ENOENT")) {
11805
+ if (findErrorCode16(error, "ENOENT")) {
11809
11806
  throw new Error("Workspace not initialized. Run 'basou init' first.");
11810
11807
  }
11811
11808
  throw error;
@@ -11814,7 +11811,7 @@ async function doRunStatus(options, ctx) {
11814
11811
  try {
11815
11812
  manifest = await readManifest14(paths);
11816
11813
  } catch (error) {
11817
- if (findErrorCode15(error, "ENOENT")) {
11814
+ if (findErrorCode16(error, "ENOENT")) {
11818
11815
  throw new Error("Workspace not initialized. Run 'basou init' first.");
11819
11816
  }
11820
11817
  const gateMessage = formatVersionGateMessage(error);
@@ -11852,7 +11849,7 @@ function formatVersionGateMessage(error) {
11852
11849
  }
11853
11850
 
11854
11851
  // src/commands/task.ts
11855
- import { readFile as readFile10 } from "fs/promises";
11852
+ import { readFile as readFile8 } from "fs/promises";
11856
11853
  import { join as join16 } from "path";
11857
11854
  import {
11858
11855
  archiveTask,
@@ -11863,7 +11860,7 @@ import {
11863
11860
  deleteTask,
11864
11861
  editTask,
11865
11862
  enumerateArchivedTaskIds,
11866
- findErrorCode as findErrorCode16,
11863
+ findErrorCode as findErrorCode17,
11867
11864
  loadSessionEntries as loadSessionEntries3,
11868
11865
  loadTaskEntries,
11869
11866
  prefixedUlid as prefixedUlid5,
@@ -11950,9 +11947,7 @@ async function doRunTaskNew(options, ctx) {
11950
11947
  if (options.description !== void 0 && options.fromFile !== void 0) {
11951
11948
  throw new Error("--description and --from-file are mutually exclusive");
11952
11949
  }
11953
- if (options.fromFile === "-") {
11954
- throw new Error("--from-file - (stdin) is not supported in v0.1");
11955
- }
11950
+ refuseDashInputFile("--from-file", options.fromFile, { textFlag: "--description" });
11956
11951
  const initialStatus = options.status ?? "planned";
11957
11952
  if (options.completedAt !== void 0 && !isTerminalStatusForCli(initialStatus)) {
11958
11953
  throw new Error("--completed-at requires --status done or cancelled");
@@ -12869,12 +12864,12 @@ function parsePositiveInt2(raw) {
12869
12864
  }
12870
12865
  async function readDescriptionFile(path) {
12871
12866
  try {
12872
- return await readFile10(path, "utf8");
12867
+ return await readFile8(path, "utf8");
12873
12868
  } catch (error) {
12874
- if (findErrorCode16(error, "ENOENT")) {
12869
+ if (findErrorCode17(error, "ENOENT")) {
12875
12870
  throw new Error("Description source not found", { cause: error });
12876
12871
  }
12877
- if (findErrorCode16(error, "EISDIR")) {
12872
+ if (findErrorCode17(error, "EISDIR")) {
12878
12873
  throw new Error("Description source is not a file", { cause: error });
12879
12874
  }
12880
12875
  throw new Error("Failed to read description source", { cause: error });
@@ -12887,7 +12882,7 @@ async function assertWorkspaceInitialized14(basouRoot) {
12887
12882
  try {
12888
12883
  await assertBasouRootSafe17(basouRoot);
12889
12884
  } catch (error) {
12890
- if (findErrorCode16(error, "ENOENT")) {
12885
+ if (findErrorCode17(error, "ENOENT")) {
12891
12886
  throw new Error("Workspace not initialized. Run 'basou init' first.");
12892
12887
  }
12893
12888
  throw error;
@@ -12978,7 +12973,7 @@ import {
12978
12973
  assertBasouRootSafe as assertBasouRootSafe18,
12979
12974
  basouPaths as basouPaths23,
12980
12975
  enumerateSessionEntries as enumerateSessionEntries3,
12981
- findErrorCode as findErrorCode17,
12976
+ findErrorCode as findErrorCode18,
12982
12977
  resolveSessionId as resolveSessionId5,
12983
12978
  verifyEventsChain
12984
12979
  } from "@basou/core";
@@ -13065,7 +13060,7 @@ async function assertWorkspaceInitialized15(basouRoot) {
13065
13060
  try {
13066
13061
  await assertBasouRootSafe18(basouRoot);
13067
13062
  } catch (error) {
13068
- if (findErrorCode17(error, "ENOENT")) {
13063
+ if (findErrorCode18(error, "ENOENT")) {
13069
13064
  throw new Error("Workspace not initialized. Run 'basou init' first.");
13070
13065
  }
13071
13066
  throw error;
@@ -13079,7 +13074,7 @@ import { basename as basename11, dirname as dirname9, join as join20, resolve as
13079
13074
  import {
13080
13075
  assertBasouRootSafe as assertBasouRootSafe19,
13081
13076
  basouPaths as basouPaths25,
13082
- findErrorCode as findErrorCode19,
13077
+ findErrorCode as findErrorCode20,
13083
13078
  loadPortfolioConfig as loadPortfolioConfig6,
13084
13079
  readManifest as readManifest19
13085
13080
  } from "@basou/core";
@@ -13595,7 +13590,7 @@ import {
13595
13590
  boardPageUnavailable,
13596
13591
  computeWorkStats as computeWorkStats2,
13597
13592
  enumerateApprovals as enumerateApprovals2,
13598
- findErrorCode as findErrorCode18,
13593
+ findErrorCode as findErrorCode19,
13599
13594
  inspectSessionEntry as inspectSessionEntry2,
13600
13595
  isLazyExpired as isLazyExpired2,
13601
13596
  loadApproval as loadApproval2,
@@ -15544,7 +15539,7 @@ async function overview(ws, nowProvider, resolveRemoteUrl) {
15544
15539
  try {
15545
15540
  manifest = await readManifest18(ws.paths);
15546
15541
  } catch (error) {
15547
- if (findErrorCode18(error, "ENOENT")) {
15542
+ if (findErrorCode19(error, "ENOENT")) {
15548
15543
  return { initialized: false, repoRoot: ws.repoRoot };
15549
15544
  }
15550
15545
  throw error;
@@ -15954,7 +15949,7 @@ async function startListening(port, deps) {
15954
15949
  try {
15955
15950
  return await startViewServer({ port, deps });
15956
15951
  } catch (error) {
15957
- if (findErrorCode19(error, "EADDRINUSE")) {
15952
+ if (findErrorCode20(error, "EADDRINUSE")) {
15958
15953
  throw new Error(`Port ${port} is already in use. Pass --port <n> to choose another.`, {
15959
15954
  cause: error
15960
15955
  });
@@ -16007,7 +16002,7 @@ async function assertWorkspaceInitialized16(basouRoot) {
16007
16002
  try {
16008
16003
  await assertBasouRootSafe19(basouRoot);
16009
16004
  } catch (error) {
16010
- if (findErrorCode19(error, "ENOENT")) {
16005
+ if (findErrorCode20(error, "ENOENT")) {
16011
16006
  throw new Error("Workspace not initialized. Run 'basou init' first.");
16012
16007
  }
16013
16008
  throw error;
@@ -16046,7 +16041,7 @@ function installExperimentalNotice(program, names = EXPERIMENTAL_COMMANDS, write
16046
16041
  function readBuildStamp() {
16047
16042
  if (false) return void 0;
16048
16043
  try {
16049
- return JSON.parse('{"version":"0.68.4","commit":"89725f6","committedAt":"2026-10-15T20:46:14+09:00"}');
16044
+ return JSON.parse('{"version":"0.69.0","commit":"bffcfee","committedAt":"2026-10-16T08:07:08+09:00"}');
16050
16045
  } catch {
16051
16046
  return void 0;
16052
16047
  }