chat-logbook 0.5.0 → 0.6.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/README.md CHANGED
@@ -100,8 +100,8 @@ You need to have Claude Code conversation history at `~/.claude/`.
100
100
  chat-logbook reads from this directory automatically.
101
101
 
102
102
  **"Port already in use."**
103
- chat-logbook runs on port 3100 by default. Use `PORT=8080 chat-log` to
104
- pick a different port.
103
+ chat-logbook runs on port 3100 by default. Use `chat-log --port 8080`
104
+ (or `PORT=8080 chat-log`) to pick a different port.
105
105
 
106
106
  **Updating to the latest version.**
107
107
  Run `npm install -g chat-logbook@latest`. If you use npx, the `@latest`
package/api/dist/index.js CHANGED
@@ -3062,12 +3062,12 @@ var ForeignKeyBuilder = class {
3062
3062
  this._onDelete = actions.onDelete;
3063
3063
  }
3064
3064
  }
3065
- onUpdate(action) {
3066
- this._onUpdate = action === void 0 ? "no action" : action;
3065
+ onUpdate(action2) {
3066
+ this._onUpdate = action2 === void 0 ? "no action" : action2;
3067
3067
  return this;
3068
3068
  }
3069
- onDelete(action) {
3070
- this._onDelete = action === void 0 ? "no action" : action;
3069
+ onDelete(action2) {
3070
+ this._onDelete = action2 === void 0 ? "no action" : action2;
3071
3071
  return this;
3072
3072
  }
3073
3073
  /** @internal */
@@ -4785,12 +4785,12 @@ var ForeignKeyBuilder2 = class {
4785
4785
  this._onDelete = actions.onDelete;
4786
4786
  }
4787
4787
  }
4788
- onUpdate(action) {
4789
- this._onUpdate = action;
4788
+ onUpdate(action2) {
4789
+ this._onUpdate = action2;
4790
4790
  return this;
4791
4791
  }
4792
- onDelete(action) {
4793
- this._onDelete = action;
4792
+ onDelete(action2) {
4793
+ this._onDelete = action2;
4794
4794
  return this;
4795
4795
  }
4796
4796
  /** @internal */
@@ -7629,13 +7629,13 @@ var SQLiteSyncRelationalQuery = class extends SQLiteRelationalQuery {
7629
7629
 
7630
7630
  // ../node_modules/.pnpm/drizzle-orm@0.45.2_@types+better-sqlite3@7.6.13_better-sqlite3@12.9.0/node_modules/drizzle-orm/sqlite-core/query-builders/raw.js
7631
7631
  var SQLiteRaw = class extends QueryPromise {
7632
- constructor(execute, getSQL, action, dialect, mapBatchResult) {
7632
+ constructor(execute, getSQL, action2, dialect, mapBatchResult) {
7633
7633
  super();
7634
7634
  this.execute = execute;
7635
7635
  this.getSQL = getSQL;
7636
7636
  this.dialect = dialect;
7637
7637
  this.mapBatchResult = mapBatchResult;
7638
- this.config = { action };
7638
+ this.config = { action: action2 };
7639
7639
  }
7640
7640
  static [entityKind] = "SQLiteRaw";
7641
7641
  /** @internal */
@@ -10456,19 +10456,19 @@ var FSWatcher = class extends EventEmitter {
10456
10456
  if (!this._throttled.has(actionType)) {
10457
10457
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
10458
10458
  }
10459
- const action = this._throttled.get(actionType);
10460
- if (!action)
10459
+ const action2 = this._throttled.get(actionType);
10460
+ if (!action2)
10461
10461
  throw new Error("invalid throttle");
10462
- const actionPath = action.get(path5);
10462
+ const actionPath = action2.get(path5);
10463
10463
  if (actionPath) {
10464
10464
  actionPath.count++;
10465
10465
  return false;
10466
10466
  }
10467
10467
  let timeoutObject;
10468
10468
  const clear = () => {
10469
- const item = action.get(path5);
10469
+ const item = action2.get(path5);
10470
10470
  const count = item ? item.count : 0;
10471
- action.delete(path5);
10471
+ action2.delete(path5);
10472
10472
  clearTimeout(timeoutObject);
10473
10473
  if (item)
10474
10474
  clearTimeout(item.timeoutObject);
@@ -10476,7 +10476,7 @@ var FSWatcher = class extends EventEmitter {
10476
10476
  };
10477
10477
  timeoutObject = setTimeout(clear, timeout);
10478
10478
  const thr = { timeoutObject, clear, count: 0 };
10479
- action.set(path5, thr);
10479
+ action2.set(path5, thr);
10480
10480
  return thr;
10481
10481
  }
10482
10482
  _incrReadyCount() {
@@ -10890,14 +10890,82 @@ function normalizeBlock(raw2) {
10890
10890
  // src/plugins/registry.ts
10891
10891
  var plugins = [new ClaudeCodePlugin()];
10892
10892
 
10893
+ // src/cli/argv.ts
10894
+ var DEFAULT_PORT = 3100;
10895
+ function parseCliArgs(argv, env = {}) {
10896
+ if (argv.includes("--version") || argv.includes("-v")) {
10897
+ return { kind: "version" };
10898
+ }
10899
+ if (argv.includes("--help") || argv.includes("-h")) {
10900
+ return { kind: "help" };
10901
+ }
10902
+ const portIdx = argv.findIndex((a) => a === "--port" || a === "-p");
10903
+ if (portIdx !== -1) {
10904
+ const raw2 = argv[portIdx + 1];
10905
+ if (raw2 === void 0) {
10906
+ return {
10907
+ kind: "error",
10908
+ message: `${argv[portIdx]} requires a value (e.g. --port 8080)`
10909
+ };
10910
+ }
10911
+ const port2 = Number(raw2);
10912
+ if (!Number.isInteger(port2)) {
10913
+ return {
10914
+ kind: "error",
10915
+ message: `Invalid port "${raw2}": must be an integer`
10916
+ };
10917
+ }
10918
+ if (port2 < 1 || port2 > 65535) {
10919
+ return {
10920
+ kind: "error",
10921
+ message: `Invalid port "${raw2}": must be between 1 and 65535`
10922
+ };
10923
+ }
10924
+ return { kind: "run", port: port2 };
10925
+ }
10926
+ if (env.PORT) {
10927
+ return { kind: "run", port: Number(env.PORT) };
10928
+ }
10929
+ return { kind: "run", port: DEFAULT_PORT };
10930
+ }
10931
+
10932
+ // src/cli/help.ts
10933
+ var helpText = `Usage: chat-log [options]
10934
+
10935
+ Start the chat-logbook server and open the web UI in your browser.
10936
+
10937
+ Options:
10938
+ -v, --version Print the version and exit
10939
+ -h, --help Show this help message and exit
10940
+ -p, --port <n> Set the HTTP port (default: 3100)
10941
+
10942
+ Environment:
10943
+ PORT=<n> Set the HTTP port (overridden by --port)
10944
+ `;
10945
+
10893
10946
  // src/index.ts
10894
10947
  var __dirname = path4.dirname(fileURLToPath3(import.meta.url));
10895
10948
  var pkgPath = path4.join(__dirname, "../../package.json");
10896
10949
  var pkg = JSON.parse(fs6.readFileSync(pkgPath, "utf-8"));
10950
+ var action = parseCliArgs(process.argv.slice(2), {
10951
+ PORT: process.env.PORT
10952
+ });
10953
+ if (action.kind === "version") {
10954
+ console.log(pkg.version);
10955
+ process.exit(0);
10956
+ }
10957
+ if (action.kind === "help") {
10958
+ process.stdout.write(helpText);
10959
+ process.exit(0);
10960
+ }
10961
+ if (action.kind === "error") {
10962
+ console.error(action.message);
10963
+ process.exit(1);
10964
+ }
10897
10965
  updateNotifier({ pkg }).notify({ defer: false, isGlobal: true });
10898
10966
  var dataDir = path4.join(os.homedir(), ".chat-logbook");
10899
10967
  var webDistDir = path4.join(__dirname, "../../web/dist");
10900
- var port = Number(process.env.PORT) || 3100;
10968
+ var port = action.port;
10901
10969
  var archive = createArchiveRepository({ dataDir });
10902
10970
  var metadata = createMetadataRepository({ dataDir });
10903
10971
  var app = createApp({ archive, metadata, webDistDir });
@@ -10932,6 +11000,7 @@ server.on("error", (err) => {
10932
11000
  console.error(
10933
11001
  `Port ${port} is already in use. Try a different port:
10934
11002
 
11003
+ chat-log --port 8080
10935
11004
  PORT=8080 chat-log
10936
11005
  `
10937
11006
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chat-logbook",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "A local-first conversation manager for Claude Code",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",