Skip to content

Commit 51de89e

Browse files
mlavaclaude
andcommitted
feat: send X-Scholar-Client trusted-client handshake header (0.1.1)
Every request now carries `X-Scholar-Client: scholar-sidekick-cli/<version>` in addition to User-Agent, so anonymous calls land on the recognised trusted-client tier of the Scholar Sidekick API (the server accepts any `scholar-sidekick-*` tag — no server change needed). Bump 0.1.0 -> 0.1.1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a673f96 commit 51de89e

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scholar-sidekick-cli",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Command-line client for Scholar Sidekick — resolve any scholarly identifier (DOI, PMID, PMCID, ISBN, arXiv, ISSN, ADS, WHO IRIS) into 10,000+ CSL citation styles or nine export formats, and run retraction, open-access, and citation-verification checks, straight from your terminal.",
55
"license": "MIT",
66
"author": "Scholar Sidekick",

src/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ export function resolveConfig(opts: GlobalOptions, env: NodeJS.ProcessEnv = proc
7373

7474
const headers: Record<string, string> = {
7575
"User-Agent": `scholar-sidekick-cli/${VERSION}`,
76+
// Trusted-client handshake: the API recognises any `scholar-sidekick-*` tag
77+
// and grants the anonymous tier without a key (see scholar-sidekick guard.ts).
78+
"X-Scholar-Client": `scholar-sidekick-cli/${VERSION}`,
7679
};
7780
if (mode === "rapidapi") {
7881
headers["X-RapidAPI-Key"] = rapidApiKey!;

test/config.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ describe("resolveConfig — auth modes", () => {
1414
expect(c.headers["User-Agent"]).toMatch(/^scholar-sidekick-cli\//);
1515
});
1616

17+
it("always sends the X-Scholar-Client trusted-client handshake header", () => {
18+
for (const over of [{}, { rapidapiKey: "rk" }, { apiKey: "sk" }]) {
19+
const c = resolveConfig(over, EMPTY);
20+
expect(c.headers["X-Scholar-Client"]).toMatch(/^scholar-sidekick-cli\/\d/);
21+
}
22+
});
23+
1724
it("uses RapidAPI mode + host when a rapidapi key is given (flag wins)", () => {
1825
const c = resolveConfig({ rapidapiKey: "rk" }, { RAPIDAPI_KEY: "envk" } as NodeJS.ProcessEnv);
1926
expect(c.mode).toBe("rapidapi");

0 commit comments

Comments
 (0)