🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@paperscope/cli

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paperscope/cli - npm Package Compare versions

Comparing version
1.2.0
to
1.2.1
+1
-1
package.json
{
"name": "@paperscope/cli",
"version": "1.2.0",
"version": "1.2.1",
"description": "PaperScope CLI - Search and explore academic papers from your terminal",

@@ -5,0 +5,0 @@ "type": "module",

import { getApiKey } from "./utils/config.js";
import { readFileSync } from "fs";
import { join, dirname } from "path";
import { fileURLToPath } from "url";
const BASE_URL = "https://api.paperscope.ai/v1";
// CLI version — read from package.json at startup
let _cliVersion: string | undefined;
function getCliVersion(): string {
if (_cliVersion) return _cliVersion;
try {
// Walk up from current file to find package.json
const __filename = fileURLToPath(import.meta.url);
let dir = dirname(__filename);
for (let i = 0; i < 5; i++) {
try {
const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
if (pkg.name === "@paperscope/cli") {
_cliVersion = pkg.version;
return _cliVersion!;
}
} catch { /* not found, go up */ }
dir = dirname(dir);
}
} catch { /* fallback */ }
_cliVersion = "unknown";
return _cliVersion;
}
// Current CLI command — set by each command handler before making API calls
let _currentCommand = "";
/**
* Set the current CLI command name for usage tracking.
* Call this at the start of each command handler.
*/
export function setCliCommand(command: string): void {
_currentCommand = command;
}
interface RequestOptions {

@@ -40,4 +77,9 @@ params?: Record<string, string | number | undefined>;

"Accept": "application/json",
"User-Agent": `paperscope-cli/${getCliVersion()}`,
};
if (_currentCommand) {
headers["X-CLI-Command"] = _currentCommand;
}
const apiKey = getApiKey();

@@ -44,0 +86,0 @@ if (apiKey) {

import chalk from "chalk";
import ora from "ora";
import { getConferencePapers, ApiError } from "../api.js";
import { getConferencePapers, ApiError, setCliCommand } from "../api.js";
import { formatPaperList } from "../utils/format.js";

@@ -11,2 +11,3 @@

export async function confCommand(name: string, options: ConfOptions): Promise<void> {
setCliCommand("conf");
const limit = options.limit ? parseInt(options.limit, 10) : 10;

@@ -13,0 +14,0 @@ if (isNaN(limit) || limit <= 0 || limit > 100) {

import chalk from "chalk";
import ora from "ora";
import { getPaperQuiz, ApiError } from "../api.js";
import { getPaperQuiz, ApiError, setCliCommand } from "../api.js";
import { formatQuiz } from "../utils/format.js";
export async function quizCommand(paperId: string): Promise<void> {
setCliCommand("quiz");
const spinner = ora({

@@ -8,0 +9,0 @@ text: `Fetching quiz for ${paperId}...`,

import chalk from "chalk";
import ora from "ora";
import { getPaper, getPaperBlog, getPaperSummary, getPaperTags, ApiError } from "../api.js";
import { getPaper, getPaperBlog, getPaperSummary, getPaperTags, ApiError, setCliCommand } from "../api.js";
import { formatPaperDetail, formatBlog, formatSummary, formatTags } from "../utils/format.js";

@@ -13,2 +13,3 @@

export async function readCommand(paperId: string, options: ReadOptions): Promise<void> {
setCliCommand("read");
const flagCount = [options.blog, options.summary, options.tags].filter(Boolean).length;

@@ -15,0 +16,0 @@ if (flagCount > 1) {

import chalk from "chalk";
import ora from "ora";
import { searchPapers, ApiError } from "../api.js";
import { searchPapers, ApiError, setCliCommand } from "../api.js";
import { formatPaperList } from "../utils/format.js";

@@ -13,2 +13,3 @@

export async function searchCommand(query: string, options: SearchOptions): Promise<void> {
setCliCommand("search");
if (!query.trim()) {

@@ -15,0 +16,0 @@ console.error(chalk.red("\n Error: Search query cannot be empty.\n"));

import chalk from "chalk";
import ora from "ora";
import { getTrendingPapers, ApiError } from "../api.js";
import { getTrendingPapers, ApiError, setCliCommand } from "../api.js";
import { formatPaperList } from "../utils/format.js";

@@ -12,2 +12,3 @@

export async function trendingCommand(options: TrendingOptions): Promise<void> {
setCliCommand("trending");
const limit = options.limit ? parseInt(options.limit, 10) : 10;

@@ -14,0 +15,0 @@ if (isNaN(limit) || limit <= 0 || limit > 100) {

@@ -16,3 +16,3 @@ #!/usr/bin/env bun

.description("PaperScope CLI - Search and explore academic papers from your terminal")
.version("1.2.0");
.version("1.2.1");

@@ -19,0 +19,0 @@ // ── search ───────────────────────────────────────────────