open-research 0.1.6 → 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.
- package/dist/cli.js +21 -26
- 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"];
|
|
@@ -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/${
|
|
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
|
-
|
|
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,22 +5376,7 @@ async function writeState(state) {
|
|
|
5365
5376
|
await fs17.writeFile(STATE_FILE, JSON.stringify(state), "utf8");
|
|
5366
5377
|
}
|
|
5367
5378
|
function getCurrentVersion() {
|
|
5368
|
-
|
|
5369
|
-
try {
|
|
5370
|
-
const fs19 = __require("fs");
|
|
5371
|
-
const path20 = __require("path");
|
|
5372
|
-
let dir = __dirname || path20.dirname(new URL(import.meta.url).pathname);
|
|
5373
|
-
for (let i = 0; i < 5; i++) {
|
|
5374
|
-
const pkgFile = path20.join(dir, "package.json");
|
|
5375
|
-
if (fs19.existsSync(pkgFile)) {
|
|
5376
|
-
const pkg = JSON.parse(fs19.readFileSync(pkgFile, "utf8"));
|
|
5377
|
-
if (pkg.name === "open-research" && pkg.version) return pkg.version;
|
|
5378
|
-
}
|
|
5379
|
-
dir = path20.dirname(dir);
|
|
5380
|
-
}
|
|
5381
|
-
} catch {
|
|
5382
|
-
}
|
|
5383
|
-
return "0.0.0";
|
|
5379
|
+
return getPackageVersion();
|
|
5384
5380
|
}
|
|
5385
5381
|
async function fetchLatestVersion() {
|
|
5386
5382
|
try {
|
|
@@ -5410,17 +5406,16 @@ async function checkForUpdate() {
|
|
|
5410
5406
|
try {
|
|
5411
5407
|
const state = await readState();
|
|
5412
5408
|
const now = Date.now();
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
if (isNewer(state.latestVersion,
|
|
5416
|
-
return `Update available: ${
|
|
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`;
|
|
5417
5413
|
}
|
|
5418
5414
|
return null;
|
|
5419
5415
|
}
|
|
5420
5416
|
const latest = await fetchLatestVersion();
|
|
5421
|
-
await writeState({ lastCheck: now, latestVersion: latest });
|
|
5417
|
+
await writeState({ lastCheck: now, latestVersion: latest, checkedFromVersion: current });
|
|
5422
5418
|
if (!latest) return null;
|
|
5423
|
-
const current = getCurrentVersion();
|
|
5424
5419
|
if (isNewer(latest, current)) {
|
|
5425
5420
|
return `Update available: ${current} \u2192 ${latest}. Run: npm update -g open-research`;
|
|
5426
5421
|
}
|
|
@@ -7475,7 +7470,7 @@ ${msg.text}
|
|
|
7475
7470
|
|
|
7476
7471
|
// src/cli.ts
|
|
7477
7472
|
var program = new Command();
|
|
7478
|
-
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) => {
|
|
7479
7474
|
await ensureOpenResearchConfig();
|
|
7480
7475
|
const target = workspacePath ? path19.resolve(workspacePath) : process.cwd();
|
|
7481
7476
|
const project = await loadWorkspaceProject(target);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-research",
|
|
3
|
-
"version": "0.1.
|
|
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
|
|
16
|
+
"build": "tsup --config tsup.config.ts",
|
|
17
17
|
"test": "vitest run",
|
|
18
18
|
"test:watch": "vitest",
|
|
19
19
|
"prepublishOnly": "npm run build"
|