Open-source, local-first social media research agent for Instagram, TikTok, and LinkedIn. Jev routes read-only steps; socai CLI captures cited browser evidence.
JavaScript agent-skillsai-agentsbrowser-agentbrowser-automationdecision-modeldeep-researchinstagramjevlinkedinlocal-firstopen-sourceosintresearch-agentsocaisocial-listeningsocial-mediasocial-media-researchsocmintsystem-onetiktok
feat(cli): report installed Jev Social version (#115)
Asklv988987e1766e
diff --git a/bin/jev-social.js b/bin/jev-social.jsindex c80574b..8a07153 100755--- a/bin/jev-social.js+++ b/bin/jev-social.js@@ -1,7 +1,8 @@#!/usr/bin/env node-import readline from "node:readline/promises";+import { readFileSync } from "node:fs";import { stdin, stdout } from "node:process";+import readline from "node:readline/promises";import { runSearch } from "../src/app.js";import { getConfigPath, readConfig, resolveApiKey } from "../src/config.js";import { resolveDecisionProvider } from "../src/decision-provider.js";@@ -14,6 +15,7 @@ const HELP = `jev-social — Jev-directed social research through socai CLIUsage:jev-social Start local preview+ jev-social --version Show installed versionjev-social onboard [options] Optional manual configurationjev-social status Show local readinessjev-social search <query> [options] Run one search@@ -38,14 +40,25 @@ Local decision provider (environment only):`;try {- await loadLocalEnv();const [command = "serve", ...rest] = process.argv.slice(2);if (["help", "--help", "-h"].includes(command)) {console.log(HELP);+ } else if (["version", "--version", "-v"].includes(command)) {+ let packageJson;+ try {+ packageJson = JSON.parse(+ readFileSync(new URL("../package.json", import.meta.url), "utf8"),+ );+ } catch {+ throw new Error("Could not read Jev Social version.");+ }+ console.log(packageJson.version);} else if (command === "serve") {+ await loadLocalEnv();const flags = parseArgs(rest);await startServer({ port: flags.port || 8766, open: !flags.noOpen });} else if (command === "status") {+ await loadLocalEnv();const config = await readConfig();const provider = resolveDecisionProvider();console.log(@@ -62,8 +75,10 @@ try {),);} else if (command === "onboard") {+ await loadLocalEnv();await onboard(parseArgs(rest));} else if (command === "search") {+ await loadLocalEnv();const flags = parseArgs(rest);const query = flags._.join(" ").trim();const run = await runSearch(diff --git a/test-support/version-read-failure.js b/test-support/version-read-failure.jsnew file mode 100644index 0000000..8b9a7e6--- /dev/null+++ b/test-support/version-read-failure.js@@ -0,0 +1,14 @@+import fs from "node:fs";+import { syncBuiltinESMExports } from "node:module";++const originalReadFileSync = fs.readFileSync;++fs.readFileSync = (target, ...args) => {+ const value = target instanceof URL ? target.pathname : String(target);+ if (value.endsWith("/package.json")) {+ throw new Error("simulated failure from /private/should-not-leak/package.json");+ }+ return originalReadFileSync(target, ...args);+};++syncBuiltinESMExports();diff --git a/test/cli-version.test.js b/test/cli-version.test.jsnew file mode 100644index 0000000..1e65c70--- /dev/null+++ b/test/cli-version.test.js@@ -0,0 +1,46 @@+import assert from "node:assert/strict";+import { spawnSync } from "node:child_process";+import { mkdtempSync, rmSync } from "node:fs";+import { readFile } from "node:fs/promises";+import { tmpdir } from "node:os";+import { join } from "node:path";+import test from "node:test";++const root = new URL("../", import.meta.url);+const packageJson = JSON.parse(await readFile(new URL("package.json", root), "utf8"));+const readFailureHook = new URL("../test-support/version-read-failure.js", import.meta.url);++for (const flag of ["--version", "-v"]) {+ test(`${flag} prints the package version without reading local configuration`, () => {+ const unreadableAsFile = mkdtempSync(join(tmpdir(), "jev-social-version-"));+ try {+ const result = spawnSync(process.execPath, ["bin/jev-social.js", flag], {+ cwd: root,+ encoding: "utf8",+ env: {+ ...process.env,+ JEV_SOCIAL_ENV_FILE: unreadableAsFile,+ },+ });++ assert.equal(result.status, 0);+ assert.equal(result.stdout, `${packageJson.version}\n`);+ assert.equal(result.stderr, "");+ } finally {+ rmSync(unreadableAsFile, { recursive: true, force: true });+ }+ });+}++test("version metadata failures do not expose an installation path", () => {+ const result = spawnSync(+ process.execPath,+ ["--import", readFailureHook.href, "bin/jev-social.js", "--version"],+ { cwd: root, encoding: "utf8" },+ );++ assert.equal(result.status, 1);+ assert.equal(result.stdout, "");+ assert.equal(result.stderr, "jev-social: Could not read Jev Social version.\n");+ assert.doesNotMatch(result.stderr, /private|package\.json|node:fs/u);+});