open-research 0.1.5 → 0.1.7

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.
Files changed (2) hide show
  1. package/dist/cli.js +23 -24
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -810,6 +810,12 @@ function formatDateTime(value) {
810
810
  return new Date(value).toLocaleString();
811
811
  }
812
812
 
813
+ // src/lib/cli/version.ts
814
+ var PACKAGE_VERSION = "0.1.7";
815
+ function getPackageVersion() {
816
+ return PACKAGE_VERSION;
817
+ }
818
+
813
819
  // src/lib/config/store.ts
814
820
  import { z } from "zod";
815
821
  var themeValues = ["dark", "light"];
@@ -1440,7 +1446,7 @@ function TextInput({
1440
1446
  onTab?.();
1441
1447
  return;
1442
1448
  }
1443
- if (key.return && key.shift) {
1449
+ if (key.return && key.shift || key.return && key.meta) {
1444
1450
  const inserted = originalValue.slice(0, cursorOffset) + "\n" + originalValue.slice(cursorOffset);
1445
1451
  setCursorOffset(cursorOffset + 1);
1446
1452
  onChange(inserted);
@@ -1705,7 +1711,7 @@ function createOpenAIAuthProvider(credentials, onTokenRefresh, onValidationChang
1705
1711
  Authorization: `Bearer ${token}`,
1706
1712
  "Content-Type": "application/json",
1707
1713
  originator: "open-research",
1708
- "User-Agent": `open-research/${process.env.npm_package_version ?? "0.1.0"} (${process.platform} ${process.arch})`,
1714
+ "User-Agent": `open-research/${getPackageVersion()} (${process.platform} ${process.arch})`,
1709
1715
  session_id: sessionId
1710
1716
  };
1711
1717
  if (creds.accountId) {
@@ -5355,9 +5361,14 @@ var STATE_FILE = path16.join(os4.homedir(), ".open-research", "update-check.json
5355
5361
  async function readState() {
5356
5362
  try {
5357
5363
  const raw = await fs17.readFile(STATE_FILE, "utf8");
5358
- return JSON.parse(raw);
5364
+ const parsed = JSON.parse(raw);
5365
+ return {
5366
+ lastCheck: typeof parsed.lastCheck === "number" ? parsed.lastCheck : 0,
5367
+ latestVersion: typeof parsed.latestVersion === "string" ? parsed.latestVersion : null,
5368
+ checkedFromVersion: typeof parsed.checkedFromVersion === "string" ? parsed.checkedFromVersion : null
5369
+ };
5359
5370
  } catch {
5360
- return { lastCheck: 0, latestVersion: null };
5371
+ return { lastCheck: 0, latestVersion: null, checkedFromVersion: null };
5361
5372
  }
5362
5373
  }
5363
5374
  async function writeState(state) {
@@ -5365,12 +5376,7 @@ async function writeState(state) {
5365
5376
  await fs17.writeFile(STATE_FILE, JSON.stringify(state), "utf8");
5366
5377
  }
5367
5378
  function getCurrentVersion() {
5368
- try {
5369
- const pkgPath = new URL("../../../package.json", import.meta.url);
5370
- return process.env.npm_package_version ?? "0.0.0";
5371
- } catch {
5372
- return "0.0.0";
5373
- }
5379
+ return getPackageVersion();
5374
5380
  }
5375
5381
  async function fetchLatestVersion() {
5376
5382
  try {
@@ -5400,17 +5406,16 @@ async function checkForUpdate() {
5400
5406
  try {
5401
5407
  const state = await readState();
5402
5408
  const now = Date.now();
5403
- if (now - state.lastCheck < CHECK_INTERVAL_MS && state.latestVersion) {
5404
- const current2 = getCurrentVersion();
5405
- if (isNewer(state.latestVersion, current2)) {
5406
- return `Update available: ${current2} \u2192 ${state.latestVersion}. Run: npm update -g open-research`;
5409
+ const current = getCurrentVersion();
5410
+ if (now - state.lastCheck < CHECK_INTERVAL_MS && state.latestVersion && state.checkedFromVersion === current) {
5411
+ if (isNewer(state.latestVersion, current)) {
5412
+ return `Update available: ${current} \u2192 ${state.latestVersion}. Run: npm update -g open-research`;
5407
5413
  }
5408
5414
  return null;
5409
5415
  }
5410
5416
  const latest = await fetchLatestVersion();
5411
- await writeState({ lastCheck: now, latestVersion: latest });
5417
+ await writeState({ lastCheck: now, latestVersion: latest, checkedFromVersion: current });
5412
5418
  if (!latest) return null;
5413
- const current = getCurrentVersion();
5414
5419
  if (isNewer(latest, current)) {
5415
5420
  return `Update available: ${current} \u2192 ${latest}. Run: npm update -g open-research`;
5416
5421
  }
@@ -7465,7 +7470,7 @@ ${msg.text}
7465
7470
 
7466
7471
  // src/cli.ts
7467
7472
  var program = new Command();
7468
- program.name("open-research").description("Local-first research CLI powered by ChatGPT/Codex auth.").argument("[workspacePath]", "Optional workspace path to open").action(async (workspacePath) => {
7473
+ program.name("open-research").version(getPackageVersion()).description("Local-first research CLI powered by ChatGPT/Codex auth.").argument("[workspacePath]", "Optional workspace path to open").action(async (workspacePath) => {
7469
7474
  await ensureOpenResearchConfig();
7470
7475
  const target = workspacePath ? path19.resolve(workspacePath) : process.cwd();
7471
7476
  const project = await loadWorkspaceProject(target);
@@ -7478,13 +7483,7 @@ program.name("open-research").description("Local-first research CLI powered by C
7478
7483
  screen: "home",
7479
7484
  pendingUpdates: []
7480
7485
  }
7481
- }),
7482
- {
7483
- kittyKeyboard: {
7484
- mode: "enabled",
7485
- flags: ["disambiguateEscapeCodes", "reportAlternateKeys"]
7486
- }
7487
- }
7486
+ })
7488
7487
  );
7489
7488
  });
7490
7489
  program.command("init").argument("[workspacePath]").description("Initialize an Open Research workspace.").action(async (workspacePath) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-research",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Local-first research CLI agent — discover papers, synthesize notes, run analysis, and draft artifacts from your terminal.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "scripts": {
15
15
  "dev": "tsx src/cli.ts",
16
- "build": "tsup src/cli.ts --format esm --clean --out-dir dist",
16
+ "build": "tsup --config tsup.config.ts",
17
17
  "test": "vitest run",
18
18
  "test:watch": "vitest",
19
19
  "prepublishOnly": "npm run build"