auditreach-cli
Advanced tools
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "schemaVersion": "1.0", | ||
| "name": "auditreach", | ||
| "displayName": "AuditReach", | ||
| "package": "auditreach-cli", | ||
| "description": "Official-API-only, BYOK research CLI and MCP server for Reddit and YouTube, backed by a local, tamper-evident, hash-chained audit log. Every search records which platform, which endpoint, which auth scope, and the consent/ToS basis for that specific call -- built for AI agents and compliance teams that can't rely on cookie-based scraping or shared credential pools. Shipped as two independently maintained, feature-equivalent distributions: an npm package (TypeScript) and a PyPI package (Python).", | ||
| "homepage": "https://github.com/RudrenduPaul/auditreach", | ||
| "repository": "https://github.com/RudrenduPaul/auditreach", | ||
| "license": "Apache-2.0", | ||
| "auth": { | ||
| "type": "byok", | ||
| "description": "Bring your own API keys for each platform you want to search (a Reddit OAuth2 script-app client ID/secret/username/password, and/or a YouTube Data API v3 key). Credentials are never shared or proxied through a third-party service; they are stored locally (OS keychain by default) and used only for direct, official-API calls made by the caller's own process. Credentials must be configured locally, ahead of time, via the CLI's `auth` subcommand -- the MCP server exposes a read-only status check only and cannot set up or clear credentials itself.", | ||
| "setup_command": "auditreach auth --platform <reddit|youtube>", | ||
| "clear_command": "auditreach auth --platform <reddit|youtube> --clear", | ||
| "note": "Credential setup and clearing are local-CLI-only, human-driven actions on both distributions. Neither is exposed as an MCP tool -- an agent can check whether credentials are valid (auth_status) but cannot provision or wipe them." | ||
| }, | ||
| "protocol": "mcp", | ||
| "transport": "stdio", | ||
| "invocation": [ | ||
| { | ||
| "distribution": "npm", | ||
| "package": "auditreach-cli", | ||
| "command": "npx auditreach-cli mcp", | ||
| "description": "Run the MCP server once without a persistent install." | ||
| }, | ||
| { | ||
| "distribution": "npm", | ||
| "package": "auditreach-cli", | ||
| "command": "auditreach mcp", | ||
| "description": "Run the MCP server after `npm install -g auditreach-cli`." | ||
| }, | ||
| { | ||
| "distribution": "pypi", | ||
| "package": "auditreach-cli", | ||
| "command": "pipx run auditreach-cli mcp", | ||
| "description": "Run the MCP server once without a persistent install." | ||
| }, | ||
| { | ||
| "distribution": "pypi", | ||
| "package": "auditreach-cli", | ||
| "command": "auditreach mcp", | ||
| "description": "Run the MCP server after `pip install auditreach-cli` (or `uv add auditreach-cli`)." | ||
| } | ||
| ], | ||
| "tools": [ | ||
| { | ||
| "name": "search", | ||
| "description": "Search Reddit or YouTube using its official API only, with your own BYOK credentials. Writes a results file and appends a hash-chained audit-log entry on success, same as the CLI's `search` command.", | ||
| "note": "Parameter names follow each distribution's own language convention: camelCase (e.g. maxResults) on the npm/TypeScript build, snake_case (e.g. max_results) on the PyPI/Python build. Semantics are identical; run `auditreach mcp` and list tools, or see each package's README, for the exact parameter names on the distribution you're using.", | ||
| "inputSchema": { | ||
| "type": "object", | ||
| "properties": { | ||
| "platform": { | ||
| "type": "string", | ||
| "enum": ["reddit", "youtube"], | ||
| "description": "Which platform to search." | ||
| }, | ||
| "query": { | ||
| "type": ["string", "null"], | ||
| "description": "Search query. Required for Reddit; optional for YouTube if a channel is given." | ||
| }, | ||
| "subreddit": { | ||
| "type": ["string", "null"], | ||
| "description": "Restrict search to one subreddit (Reddit only)." | ||
| }, | ||
| "channel": { | ||
| "type": ["string", "null"], | ||
| "description": "Restrict search to one channel, e.g. \"@AnthropicAI\" (YouTube only)." | ||
| }, | ||
| "since": { | ||
| "type": ["string", "null"], | ||
| "description": "Only results published after this date, e.g. \"2026-06-01\" (YouTube only)." | ||
| }, | ||
| "maxResults": { | ||
| "type": ["integer", "null"], | ||
| "description": "Maximum results to return (max_results on the Python build). Platform-specific caps apply; see the CLI's --help for the current default and caps." | ||
| }, | ||
| "before": { | ||
| "type": ["string", "null"], | ||
| "description": "Page results before this Reddit fullname cursor, e.g. \"t3_abc123\" (Reddit only)." | ||
| }, | ||
| "after": { | ||
| "type": ["string", "null"], | ||
| "description": "Page results after this Reddit fullname cursor, e.g. \"t3_abc123\" (Reddit only)." | ||
| }, | ||
| "output": { | ||
| "type": ["string", "null"], | ||
| "description": "Path to write the full results JSON to. Defaults to ./auditreach-results-<date>.json." | ||
| } | ||
| }, | ||
| "required": ["platform"] | ||
| } | ||
| }, | ||
| { | ||
| "name": "auth_status", | ||
| "description": "Read-only check of whether BYOK credentials are already stored and valid for a platform. Equivalent to `auditreach auth --platform <platform> --verify --json`. Cannot set or clear credentials -- that stays a local-CLI-only, human-driven action.", | ||
| "inputSchema": { | ||
| "type": "object", | ||
| "properties": { | ||
| "platform": { | ||
| "type": "string", | ||
| "enum": ["reddit", "youtube"], | ||
| "description": "Which platform's stored credentials to check." | ||
| } | ||
| }, | ||
| "required": ["platform"] | ||
| } | ||
| }, | ||
| { | ||
| "name": "verify_log", | ||
| "description": "Verify the local hash-chained audit log has not been tampered with. Equivalent to `auditreach verify-log --json`.", | ||
| "inputSchema": { | ||
| "type": "object", | ||
| "properties": { | ||
| "path": { | ||
| "type": ["string", "null"], | ||
| "description": "Path to the audit log file. Defaults to ./auditreach.log.jsonl if omitted." | ||
| } | ||
| }, | ||
| "required": [] | ||
| } | ||
| } | ||
| ], | ||
| "rate_limits": { | ||
| "note": "Not set or enforced by auditreach itself, on either distribution. Every request goes through the underlying platform's own official API under the calling user's own credentials, so limits are whatever Reddit's and YouTube's own API rate limits and quotas are for that account -- see the platform's own documentation for current numbers." | ||
| }, | ||
| "cli": { | ||
| "commands": ["search", "auth", "verify-log", "mcp"], | ||
| "json_output_flag": "--json" | ||
| } | ||
| } |
| import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; | ||
| export interface McpCommandArgs { | ||
| /** The published package version, read once by the caller (src/cli.ts) so this module does not need its own package.json path resolution. */ | ||
| version: string; | ||
| } | ||
| /** | ||
| * Builds the MCP server exposing exactly 3 tools, each a thin wrapper | ||
| * around the same programmatic core the `search` / `auth` / `verify-log` | ||
| * CLI commands use -- no search/auth/audit-log logic is reimplemented here. | ||
| * | ||
| * `auth_status` is deliberately read-only: it wraps `checkAuthStatus`, the | ||
| * same check behind `auditreach auth --verify`, and has no counterpart for | ||
| * setting or clearing credentials. Setting/clearing BYOK credentials stays | ||
| * a local-CLI-only, human-driven action (`auditreach auth --platform <p>` / | ||
| * `--clear`) -- deliberately never reachable from an MCP tool call, since a | ||
| * calling agent should never be able to provision or wipe a user's stored | ||
| * API credentials on its own. | ||
| */ | ||
| export declare function buildMcpServer(args: McpCommandArgs): McpServer; | ||
| /** | ||
| * Runs the MCP server over stdio. This is the only place in the codebase | ||
| * that touches stdout for protocol framing rather than human/JSON CLI | ||
| * output, which is why `search` / `auth_status` / `verify_log` above call | ||
| * into the same executeSearch/checkAuthStatus/executeVerifyLog cores the | ||
| * CLI commands use, rather than the CLI commands themselves -- those write | ||
| * directly to console/stdout, which would corrupt the JSON-RPC stream. | ||
| */ | ||
| export declare function runMcpServerCommand(args: McpCommandArgs): Promise<void>; | ||
| //# sourceMappingURL=mcp.d.ts.map |
| {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAapE,MAAM,WAAW,cAAc;IAC7B,6IAA6I;IAC7I,OAAO,EAAE,MAAM,CAAC;CACjB;AAcD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAmH9D;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAI7E"} |
| import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; | ||
| import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; | ||
| import { z } from "zod"; | ||
| import { executeSearch } from "./search.js"; | ||
| import { checkAuthStatus } from "./auth.js"; | ||
| import { executeVerifyLog } from "./verify-log.js"; | ||
| import { DEFAULT_LIMIT as REDDIT_DEFAULT_LIMIT, MAX_LIMIT as REDDIT_MAX_LIMIT, } from "../clients/reddit-client.js"; | ||
| import { MAX_MAX_RESULTS as YOUTUBE_MAX_MAX_RESULTS } from "../clients/youtube-client.js"; | ||
| function jsonResult(value) { | ||
| return { content: [{ type: "text", text: JSON.stringify(value, null, 2) }] }; | ||
| } | ||
| function errorResult(error) { | ||
| const message = error instanceof Error ? error.message : String(error); | ||
| return { | ||
| content: [{ type: "text", text: JSON.stringify({ error: message }, null, 2) }], | ||
| isError: true, | ||
| }; | ||
| } | ||
| /** | ||
| * Builds the MCP server exposing exactly 3 tools, each a thin wrapper | ||
| * around the same programmatic core the `search` / `auth` / `verify-log` | ||
| * CLI commands use -- no search/auth/audit-log logic is reimplemented here. | ||
| * | ||
| * `auth_status` is deliberately read-only: it wraps `checkAuthStatus`, the | ||
| * same check behind `auditreach auth --verify`, and has no counterpart for | ||
| * setting or clearing credentials. Setting/clearing BYOK credentials stays | ||
| * a local-CLI-only, human-driven action (`auditreach auth --platform <p>` / | ||
| * `--clear`) -- deliberately never reachable from an MCP tool call, since a | ||
| * calling agent should never be able to provision or wipe a user's stored | ||
| * API credentials on its own. | ||
| */ | ||
| export function buildMcpServer(args) { | ||
| const server = new McpServer({ name: "auditreach", version: args.version }); | ||
| server.registerTool("search", { | ||
| title: "Search", | ||
| description: "Search Reddit or YouTube using the platform's official API only, with the caller's own BYOK credentials (no scraping, no shared credential pool). Writes the full results to a local JSON file and appends a hash-chained audit-log entry, exactly like `auditreach search`.", | ||
| inputSchema: { | ||
| platform: z.enum(["reddit", "youtube"]).describe("Platform to search: reddit | youtube"), | ||
| query: z.string().optional().describe("Search query"), | ||
| subreddit: z | ||
| .string() | ||
| .optional() | ||
| .describe("Restrict search to one subreddit, e.g. MachineLearning (reddit only)"), | ||
| channel: z | ||
| .string() | ||
| .optional() | ||
| .describe("Restrict search to one channel, e.g. @AnthropicAI (youtube only)"), | ||
| since: z | ||
| .string() | ||
| .optional() | ||
| .describe("Only results published after this date, e.g. 2026-06-01 (youtube only)"), | ||
| maxResults: z | ||
| .number() | ||
| .int() | ||
| .positive() | ||
| .optional() | ||
| .describe(`Maximum results to return (default ${REDDIT_DEFAULT_LIMIT}; platform caps: ${REDDIT_MAX_LIMIT} Reddit / ${YOUTUBE_MAX_MAX_RESULTS} YouTube)`), | ||
| before: z | ||
| .string() | ||
| .optional() | ||
| .describe("Page results before this Reddit fullname cursor, e.g. t3_abc123 (reddit only)"), | ||
| after: z | ||
| .string() | ||
| .optional() | ||
| .describe("Page results after this Reddit fullname cursor, e.g. t3_abc123 (reddit only)"), | ||
| }, | ||
| }, async (input) => { | ||
| try { | ||
| const result = await executeSearch({ | ||
| platform: input.platform, | ||
| query: input.query, | ||
| subreddit: input.subreddit, | ||
| channel: input.channel, | ||
| since: input.since, | ||
| maxResults: input.maxResults, | ||
| before: input.before, | ||
| after: input.after, | ||
| }); | ||
| return jsonResult({ | ||
| platform: result.outcome.platform, | ||
| endpoint: result.outcome.endpoint, | ||
| queryParams: result.outcome.queryParams, | ||
| authScope: result.outcome.authScope, | ||
| consentBasis: result.outcome.consentBasis, | ||
| items: result.outcome.items, | ||
| nextCursor: result.outcome.nextCursor ?? null, | ||
| truncated: result.truncated, | ||
| auditLogEntryId: result.auditLogEntryId, | ||
| resultsFile: result.resultsFile, | ||
| auditLogFile: result.auditLogFile, | ||
| }); | ||
| } | ||
| catch (error) { | ||
| return errorResult(error); | ||
| } | ||
| }); | ||
| server.registerTool("auth_status", { | ||
| title: "Auth status", | ||
| description: "Read-only check of whether stored BYOK credentials for a platform are currently valid, equivalent to `auditreach auth --platform <platform> --verify --json`. Cannot set or clear credentials -- run `auditreach auth --platform <platform>` locally to set them up, and `auditreach auth --platform <platform> --clear` to remove them.", | ||
| inputSchema: { | ||
| platform: z.enum(["reddit", "youtube"]).describe("Platform to check: reddit | youtube"), | ||
| }, | ||
| }, async (input) => { | ||
| const result = await checkAuthStatus(input.platform); | ||
| return jsonResult(result); | ||
| }); | ||
| server.registerTool("verify_log", { | ||
| title: "Verify audit log", | ||
| description: "Verify the local hash-chained audit log has not been tampered with, equivalent to `auditreach verify-log --json`.", | ||
| inputSchema: { | ||
| path: z | ||
| .string() | ||
| .optional() | ||
| .describe("Path to the audit log file (defaults to ./auditreach.log.jsonl)"), | ||
| }, | ||
| }, async (input) => { | ||
| try { | ||
| const result = await executeVerifyLog(input.path); | ||
| return jsonResult(result); | ||
| } | ||
| catch (error) { | ||
| return errorResult(error); | ||
| } | ||
| }); | ||
| return server; | ||
| } | ||
| /** | ||
| * Runs the MCP server over stdio. This is the only place in the codebase | ||
| * that touches stdout for protocol framing rather than human/JSON CLI | ||
| * output, which is why `search` / `auth_status` / `verify_log` above call | ||
| * into the same executeSearch/checkAuthStatus/executeVerifyLog cores the | ||
| * CLI commands use, rather than the CLI commands themselves -- those write | ||
| * directly to console/stdout, which would corrupt the JSON-RPC stream. | ||
| */ | ||
| export async function runMcpServerCommand(args) { | ||
| const server = buildMcpServer(args); | ||
| const transport = new StdioServerTransport(); | ||
| await server.connect(transport); | ||
| } | ||
| //# sourceMappingURL=mcp.js.map |
| {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACL,aAAa,IAAI,oBAAoB,EACrC,SAAS,IAAI,gBAAgB,GAC9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,IAAI,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAO1F,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,E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GAOG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAoB;IAC5D,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"} |
+8
-0
@@ -9,2 +9,3 @@ #!/usr/bin/env node | ||
| import { runVerifyLogCommand } from "./commands/verify-log.js"; | ||
| import { runMcpServerCommand } from "./commands/mcp.js"; | ||
| import { DEFAULT_LIMIT as REDDIT_DEFAULT_LIMIT, MAX_LIMIT as REDDIT_MAX_LIMIT, } from "./clients/reddit-client.js"; | ||
@@ -86,2 +87,9 @@ import { MAX_MAX_RESULTS as YOUTUBE_MAX_MAX_RESULTS } from "./clients/youtube-client.js"; | ||
| }); | ||
| program | ||
| .command("mcp") | ||
| .description("Run a Model Context Protocol server over stdio, exposing search, auth_status, and " + | ||
| "verify_log as tools for AI agents (see .well-known/agent.json for the full manifest)") | ||
| .action(async () => { | ||
| await runMcpServerCommand({ version: VERSION }); | ||
| }); | ||
| program.parseAsync(process.argv).catch((error) => { | ||
@@ -88,0 +96,0 @@ console.error(error instanceof Error ? error.message : String(error)); |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA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OAAO,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxD,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"reddit-client.d.ts","sourceRoot":"","sources":["../../src/clients/reddit-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAQxF,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,SAAS,MAAM,CAAC;AA0C7B;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,cAAc,CAAK;gBAEf,WAAW,EAAE,iBAAiB;YAI5B,cAAc;IAoC5B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAQ7B;;;;;;OAMG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMlC,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;CAsFnE"} | ||
| {"version":3,"file":"reddit-client.d.ts","sourceRoot":"","sources":["../../src/clients/reddit-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAQxF,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,SAAS,MAAM,CAAC;AAmD7B;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,cAAc,CAAK;gBAEf,WAAW,EAAE,iBAAiB;YAI5B,cAAc;IAoC5B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAS7B;;;;;;OAMG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMlC,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;CAsFnE"} |
@@ -17,2 +17,10 @@ const USER_AGENT = "auditreach-cli/0.1.0 (official-API-only compliance research tool)"; | ||
| const LEADING_SUBREDDIT_PREFIX = /^\/?r\//i; | ||
| // Strips ASCII control characters -- including the ESC byte (0x1B) that | ||
| // starts an ANSI escape sequence -- before a user-supplied CLI argument is | ||
| // echoed back into a message printed to the terminal. | ||
| // eslint-disable-next-line no-control-regex -- intentional: this IS the control-char check | ||
| const CONTROL_CHARS = /[\x00-\x1F\x7F]/g; | ||
| function stripControlChars(value) { | ||
| return value.replace(CONTROL_CHARS, ""); | ||
| } | ||
| /** | ||
@@ -65,4 +73,5 @@ * Talks to Reddit's official OAuth API only -- no cookie import, no session | ||
| if (status === 400 && subreddit && LEADING_SUBREDDIT_PREFIX.test(subreddit)) { | ||
| const cleaned = subreddit.replace(LEADING_SUBREDDIT_PREFIX, ""); | ||
| return ` Your --subreddit value "${subreddit}" has a leading "r/" or "/r/" prefix -- Reddit's API expects just the subreddit name (try "${cleaned}" instead).`; | ||
| const safeSubreddit = stripControlChars(subreddit); | ||
| const cleaned = stripControlChars(subreddit.replace(LEADING_SUBREDDIT_PREFIX, "")); | ||
| return ` Your --subreddit value "${safeSubreddit}" has a leading "r/" or "/r/" prefix -- Reddit's API expects just the subreddit name (try "${cleaned}" instead).`; | ||
| } | ||
@@ -69,0 +78,0 @@ return ""; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"reddit-client.js","sourceRoot":"","sources":["../../src/clients/reddit-client.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,GAAG,mEAAmE,CAAC;AACvF,uEAAuE;AACvE,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,6BAA6B;AAC7B,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAC7B,MAAM,SAAS,GAAG,4CAA4C,CAAC;AAC/D,MAAM,QAAQ,GAAG,0BAA0B,CAAC;AAE5C,uEAAuE;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,2EAA2E;AAC3E,iDAAiD;AACjD,MAAM,wBAAwB,GAAG,UAAU,CAAC;AAiC5C;;;;GAIG;AACH,MAAM,OAAO,YAAY;IACN,WAAW,CAAoB;IACxC,WAAW,GAAkB,IAAI,CAAC;IAClC,cAAc,GAAG,CAAC,CAAC;IAE3B,YAAY,WAA8B;QACxC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEO,KAAK,CAAC,cAAc;QAC1B,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YACzD,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAC3B,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAChE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAErB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE;YACtC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS,SAAS,EAAE;gBACn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,EAAE,IAAI,CAAC,uBAAuB;gBACvC,YAAY,EAAE,IAAI,CAAC,YAAY;aAChC;SACF,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,OAAO,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,aAAa;YAClF,WAAW,EAAE;gBACX,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,KAAK;gBACL,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB;YACD,SAAS,EAAE,2DAA2D;YACtE,YAAY,EACV,oFAAoF;YACtF,KAAK;YACL,mEAAmE;YACnE,iEAAiE;YACjE,+DAA+D;YAC/D,+DAA+D;YAC/D,kEAAkE;YAClE,8CAA8C;YAC9C,UAAU,EAAE;gBACV,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI;gBACjC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI;aACpC;SACF,CAAC;IACJ,CAAC;CACF"} |
@@ -9,2 +9,20 @@ import type { Platform } from "../types.js"; | ||
| export declare function runAuthCommand(args: AuthCommandArgs): Promise<void>; | ||
| export interface AuthStatusResult { | ||
| platform: Platform; | ||
| valid: boolean; | ||
| error: string | null; | ||
| } | ||
| /** | ||
| * The programmatic core behind `auditreach auth --verify`, and the only | ||
| * auth-related logic exposed over MCP (as the read-only `auth_status` | ||
| * tool). Reuses each client's token-fetch/auth-check logic (never | ||
| * duplicates it) and performs a single minimal authenticated request. | ||
| * Unlike `search`, this never requires --query, never writes a results | ||
| * file, and never appends an audit-log entry -- it only reports whether the | ||
| * stored credentials work. Deliberately has no counterpart for setting or | ||
| * clearing credentials: that stays a local-CLI-only, human-driven action | ||
| * (`auditreach auth --platform <p>` / `--clear`), never reachable from an | ||
| * MCP tool call. | ||
| */ | ||
| export declare function checkAuthStatus(platform: Platform): Promise<AuthStatusResult>; | ||
| //# sourceMappingURL=auth.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCzE"} | ||
| {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCzE;AAcD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAgCnF"} |
+38
-14
@@ -50,9 +50,14 @@ import { setCredential, deleteCredential, getRedditCredentials, getYoutubeCredentials, } from "../auth/credential-store.js"; | ||
| /** | ||
| * Standalone credential check for `auditreach auth --verify`. Reuses each | ||
| * client's token-fetch/auth-check logic (never duplicates it) and performs | ||
| * a single minimal authenticated request. Unlike `search`, this never | ||
| * requires --query, never writes a results file, and never appends an | ||
| * audit-log entry -- it only reports whether the stored credentials work. | ||
| * The programmatic core behind `auditreach auth --verify`, and the only | ||
| * auth-related logic exposed over MCP (as the read-only `auth_status` | ||
| * tool). Reuses each client's token-fetch/auth-check logic (never | ||
| * duplicates it) and performs a single minimal authenticated request. | ||
| * Unlike `search`, this never requires --query, never writes a results | ||
| * file, and never appends an audit-log entry -- it only reports whether the | ||
| * stored credentials work. Deliberately has no counterpart for setting or | ||
| * clearing credentials: that stays a local-CLI-only, human-driven action | ||
| * (`auditreach auth --platform <p>` / `--clear`), never reachable from an | ||
| * MCP tool call. | ||
| */ | ||
| async function verifyCredentials(platform, json) { | ||
| export async function checkAuthStatus(platform) { | ||
| try { | ||
@@ -62,5 +67,7 @@ if (platform === "reddit") { | ||
| if (!credentials) { | ||
| report(json, platform, false, 'No Reddit credentials found. Run "auditreach auth --platform reddit" first.'); | ||
| process.exitCode = 1; | ||
| return; | ||
| return { | ||
| platform, | ||
| valid: false, | ||
| error: 'No Reddit credentials found. Run "auditreach auth --platform reddit" first.', | ||
| }; | ||
| } | ||
@@ -72,13 +79,30 @@ await new RedditClient(credentials).verifyCredentials(); | ||
| if (!credentials) { | ||
| report(json, platform, false, 'No YouTube credentials found. Run "auditreach auth --platform youtube" first.'); | ||
| process.exitCode = 1; | ||
| return; | ||
| return { | ||
| platform, | ||
| valid: false, | ||
| error: 'No YouTube credentials found. Run "auditreach auth --platform youtube" first.', | ||
| }; | ||
| } | ||
| await new YoutubeClient(credentials).verifyCredentials(); | ||
| } | ||
| report(json, platform, true); | ||
| return { platform, valid: true, error: null }; | ||
| } | ||
| catch (error) { | ||
| const message = error instanceof Error ? error.message : String(error); | ||
| report(json, platform, false, `${capitalize(platform)} credential check failed: ${message}`); | ||
| return { | ||
| platform, | ||
| valid: false, | ||
| error: `${capitalize(platform)} credential check failed: ${message}`, | ||
| }; | ||
| } | ||
| } | ||
| /** | ||
| * CLI wrapper around `checkAuthStatus` for `auditreach auth --verify`: adds | ||
| * human-readable / `--json` printing and the exit-code convention the rest | ||
| * of the CLI uses. | ||
| */ | ||
| async function verifyCredentials(platform, json) { | ||
| const result = await checkAuthStatus(platform); | ||
| report(json, result.platform, result.valid, result.error ?? undefined); | ||
| if (!result.valid) { | ||
| process.exitCode = 1; | ||
@@ -85,0 +109,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAU7D,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAqB;IACxD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtC,OAAO;IACT,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,MAAM,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,OAAO;IACT,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,gFAAgF,CAAC,CAAC;QAC9F,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,aAAa,CAAC,CAAC;QAC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C;IACvB,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC"} |
@@ -1,2 +0,2 @@ | ||
| import type { Platform } from "../types.js"; | ||
| import type { Platform, SearchOutcome } from "../types.js"; | ||
| export interface SearchCommandArgs { | ||
@@ -14,3 +14,23 @@ platform: Platform; | ||
| } | ||
| /** Raised for expected, user-actionable failures (missing credentials, missing --query). Callers translate this into their own reporting: `runSearchCommand` prints to stderr and sets `process.exitCode`, the MCP `search` tool returns it as a structured tool error. */ | ||
| export declare class SearchCommandError extends Error { | ||
| } | ||
| export interface SearchExecutionResult { | ||
| outcome: SearchOutcome; | ||
| truncated: boolean; | ||
| auditLogEntryId: string; | ||
| resultsFile: string; | ||
| auditLogFile: string; | ||
| } | ||
| /** | ||
| * The programmatic core of `search`: runs the platform search, writes the | ||
| * full results file, and appends the hash-chained audit-log entry. Contains | ||
| * no console/stdout output of its own, so it is safe to call from contexts | ||
| * that must not write to stdout outside a controlled protocol -- notably | ||
| * the MCP `search` tool, which shares stdout with the JSON-RPC transport. | ||
| * `runSearchCommand` below is the CLI wrapper that adds human-readable and | ||
| * `--json` printing on top of this. | ||
| */ | ||
| export declare function executeSearch(args: Omit<SearchCommandArgs, "json">): Promise<SearchExecutionResult>; | ||
| export declare function runSearchCommand(args: SearchCommandArgs): Promise<void>; | ||
| //# sourceMappingURL=search.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,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AO,CAAC,qBAAqB,CAAC,CAgEhC;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C7E"} |
+49
-21
@@ -7,3 +7,15 @@ import { writeFile } from "node:fs/promises"; | ||
| import { credentialFingerprint, generateEntryId } from "../util/crypto.js"; | ||
| export async function runSearchCommand(args) { | ||
| /** Raised for expected, user-actionable failures (missing credentials, missing --query). Callers translate this into their own reporting: `runSearchCommand` prints to stderr and sets `process.exitCode`, the MCP `search` tool returns it as a structured tool error. */ | ||
| export class SearchCommandError extends Error { | ||
| } | ||
| /** | ||
| * The programmatic core of `search`: runs the platform search, writes the | ||
| * full results file, and appends the hash-chained audit-log entry. Contains | ||
| * no console/stdout output of its own, so it is safe to call from contexts | ||
| * that must not write to stdout outside a controlled protocol -- notably | ||
| * the MCP `search` tool, which shares stdout with the JSON-RPC transport. | ||
| * `runSearchCommand` below is the CLI wrapper that adds human-readable and | ||
| * `--json` printing on top of this. | ||
| */ | ||
| export async function executeSearch(args) { | ||
| let outcome; | ||
@@ -14,10 +26,6 @@ let fingerprintSource; | ||
| if (!credentials) { | ||
| console.error('No Reddit credentials found. Run "auditreach auth --platform reddit" first.'); | ||
| process.exitCode = 1; | ||
| return; | ||
| throw new SearchCommandError('No Reddit credentials found. Run "auditreach auth --platform reddit" first.'); | ||
| } | ||
| if (!args.query) { | ||
| console.error('Reddit search requires --query "<search terms>".'); | ||
| process.exitCode = 1; | ||
| return; | ||
| throw new SearchCommandError('Reddit search requires --query "<search terms>".'); | ||
| } | ||
@@ -37,5 +45,3 @@ const client = new RedditClient(credentials); | ||
| if (!credentials) { | ||
| console.error('No YouTube credentials found. Run "auditreach auth --platform youtube" first.'); | ||
| process.exitCode = 1; | ||
| return; | ||
| throw new SearchCommandError('No YouTube credentials found. Run "auditreach auth --platform youtube" first.'); | ||
| } | ||
@@ -51,5 +57,2 @@ const client = new YoutubeClient(credentials); | ||
| } | ||
| if (!args.json) { | ||
| printResults(outcome); | ||
| } | ||
| const outputPath = args.output ?? defaultOutputPath(); | ||
@@ -70,2 +73,27 @@ await writeFile(outputPath, JSON.stringify(outcome.items, null, 2), "utf8"); | ||
| }); | ||
| return { | ||
| outcome, | ||
| truncated: isTruncated(outcome), | ||
| auditLogEntryId: entry.entry_id, | ||
| resultsFile: outputPath, | ||
| auditLogFile: "./auditreach.log.jsonl", | ||
| }; | ||
| } | ||
| export async function runSearchCommand(args) { | ||
| let result; | ||
| try { | ||
| result = await executeSearch(args); | ||
| } | ||
| catch (error) { | ||
| if (error instanceof SearchCommandError) { | ||
| console.error(error.message); | ||
| process.exitCode = 1; | ||
| return; | ||
| } | ||
| throw error; | ||
| } | ||
| const { outcome, truncated, auditLogEntryId, resultsFile, auditLogFile } = result; | ||
| if (!args.json) { | ||
| printResults(outcome); | ||
| } | ||
| if (args.json) { | ||
@@ -80,13 +108,13 @@ process.stdout.write(`${JSON.stringify({ | ||
| nextCursor: outcome.nextCursor ?? null, | ||
| truncated: isTruncated(outcome), | ||
| auditLogEntryId: entry.entry_id, | ||
| resultsFile: outputPath, | ||
| auditLogFile: "./auditreach.log.jsonl", | ||
| truncated, | ||
| auditLogEntryId, | ||
| resultsFile, | ||
| auditLogFile, | ||
| }, null, 2)}\n`); | ||
| return; | ||
| } | ||
| console.log(`\nAudit log entry written: ${entry.entry_id}`); | ||
| console.log(`Consent basis: ${entry.consent_basis}`); | ||
| console.log(`Full results: ${outputPath}`); | ||
| console.log(`Full audit trail: ./auditreach.log.jsonl`); | ||
| console.log(`\nAudit log entry written: ${auditLogEntryId}`); | ||
| console.log(`Consent basis: ${outcome.consentBasis}`); | ||
| console.log(`Full results: ${resultsFile}`); | ||
| console.log(`Full audit trail: ${auditLogFile}`); | ||
| } | ||
@@ -93,0 +121,0 @@ function defaultOutputPath() { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,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AAG,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,uBAAuB,CAAC;IACvF,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClD,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,GAAG,GAAG,EAAE,CAAC;QAC3D,OAAO,CAAC,KAAK,CACX,+BAA+B,OAAO,CAAC,KAAK,CAAC,MAAM,wGAAwG,GAAG,QAAQ,YAAY,oBAAoB,CACvM,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CACX,+BAA+B,OAAO,CAAC,KAAK,CAAC,MAAM,aAAa,YAAY,+FAA+F,CAC5K,CAAC;IACJ,CAAC;AACH,CAAC;AAED,8OAA8O;AAC9O,SAAS,WAAW,CAAC,OAAsB;IACzC,MAAM,YAAY,GAChB,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC;IAC7F,OAAO,OAAO,YAAY,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,IAAI,YAAY,CAAC;AAClF,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC"} |
@@ -0,1 +1,2 @@ | ||
| import type { ChainVerificationResult } from "../types.js"; | ||
| export interface VerifyLogCommandArgs { | ||
@@ -5,3 +6,12 @@ path?: string; | ||
| } | ||
| export interface VerifyLogResult extends ChainVerificationResult { | ||
| logPath: string; | ||
| } | ||
| /** | ||
| * The programmatic core of `verify-log`: re-derives the chain and returns | ||
| * the structured result, with no console/stdout output of its own. Shared | ||
| * by the CLI's `--json` mode and the MCP `verify_log` tool. | ||
| */ | ||
| export declare function executeVerifyLog(path?: string): Promise<VerifyLogResult>; | ||
| export declare function runVerifyLogCommand(args: VerifyLogCommandArgs): Promise<void>; | ||
| //# sourceMappingURL=verify-log.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"verify-log.d.ts","sourceRoot":"","sources":["../../src/commands/verify-log.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BnF"} | ||
| {"version":3,"file":"verify-log.d.ts","sourceRoot":"","sources":["../../src/commands/verify-log.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,eAAgB,SAAQ,uBAAuB;IAC9D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAI9E;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BnF"} |
| import { verifyAuditLogChain } from "../audit-log/chain-verifier.js"; | ||
| import { DEFAULT_AUDIT_LOG_PATH } from "../audit-log/hash-chain-writer.js"; | ||
| /** | ||
| * The programmatic core of `verify-log`: re-derives the chain and returns | ||
| * the structured result, with no console/stdout output of its own. Shared | ||
| * by the CLI's `--json` mode and the MCP `verify_log` tool. | ||
| */ | ||
| export async function executeVerifyLog(path) { | ||
| const logPath = path ?? DEFAULT_AUDIT_LOG_PATH; | ||
| const result = await verifyAuditLogChain(logPath); | ||
| return { logPath, ...result }; | ||
| } | ||
| export async function runVerifyLogCommand(args) { | ||
@@ -8,3 +18,3 @@ const logPath = args.path ?? DEFAULT_AUDIT_LOG_PATH; | ||
| } | ||
| const result = await verifyAuditLogChain(logPath); | ||
| const result = await executeVerifyLog(args.path); | ||
| if (!result.valid) { | ||
@@ -14,3 +24,3 @@ process.exitCode = 1; | ||
| if (args.json) { | ||
| process.stdout.write(`${JSON.stringify({ logPath, ...result }, null, 2)}\n`); | ||
| process.stdout.write(`${JSON.stringify(result, null, 2)}\n`); | ||
| return; | ||
@@ -17,0 +27,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"verify-log.js","sourceRoot":"","sources":["../../src/commands/verify-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAO3E,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAA0B;IAClE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,sBAAsB,CAAC;IACpD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,aAAa,OAAO,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAElD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7E,OAAO;IACT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C,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;IAED,IAAI,MAAM,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACpD,OAAO;IACT,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,YAAY,2CAA2C,CAAC,CAAC;IACjG,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CACX,2BAA2B,MAAM,CAAC,aAAa,KAAK,MAAM,CAAC,eAAe,IAAI,SAAS,MAAM,MAAM,CAAC,MAAM,EAAE,CAC7G,CAAC;IACJ,CAAC;AACH,CAAC"} |
+8
-0
@@ -7,3 +7,11 @@ export { RedditClient } from "./clients/reddit-client.js"; | ||
| export { credentialFingerprint, canonicalJson, sha256Hex } from "./util/crypto.js"; | ||
| export { executeSearch, SearchCommandError } from "./commands/search.js"; | ||
| export { checkAuthStatus } from "./commands/auth.js"; | ||
| export { executeVerifyLog } from "./commands/verify-log.js"; | ||
| export { buildMcpServer, runMcpServerCommand } from "./commands/mcp.js"; | ||
| export type { Platform, AuditLogEntry, UnhashedAuditLogEntry, ChainVerificationResult, SearchResultItem, SearchOutcome, RedditSearchOptions, YoutubeSearchOptions, } from "./types.js"; | ||
| export type { SearchExecutionResult } from "./commands/search.js"; | ||
| export type { AuthStatusResult } from "./commands/auth.js"; | ||
| export type { VerifyLogResult } from "./commands/verify-log.js"; | ||
| export type { McpCommandArgs } from "./commands/mcp.js"; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnF,YAAY,EACV,QAAQ,EACR,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxE,YAAY,EACV,QAAQ,EACR,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"} |
+4
-0
@@ -7,2 +7,6 @@ export { RedditClient } from "./clients/reddit-client.js"; | ||
| export { credentialFingerprint, canonicalJson, sha256Hex } from "./util/crypto.js"; | ||
| export { executeSearch, SearchCommandError } from "./commands/search.js"; | ||
| export { checkAuthStatus } from "./commands/auth.js"; | ||
| export { executeVerifyLog } from "./commands/verify-log.js"; | ||
| export { buildMcpServer, runMcpServerCommand } from "./commands/mcp.js"; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC"} |
+8
-3
| { | ||
| "name": "auditreach-cli", | ||
| "version": "0.1.3", | ||
| "version": "0.2.0", | ||
| "description": "Official-API-only, BYOK CLI for researching Reddit and YouTube with your own API keys and a tamper-evident, hash-chained audit log -- built for AI agents and compliance teams that can't rely on cookie-based scraping or shared credential pools.", | ||
@@ -12,3 +12,4 @@ "type": "module", | ||
| "files": [ | ||
| "dist" | ||
| "dist", | ||
| ".well-known" | ||
| ], | ||
@@ -37,2 +38,4 @@ "engines": { | ||
| "ai-agents", | ||
| "mcp", | ||
| "model-context-protocol", | ||
| "research", | ||
@@ -56,5 +59,7 @@ "oauth2", | ||
| "dependencies": { | ||
| "@modelcontextprotocol/sdk": "^1.29.0", | ||
| "@napi-rs/keyring": "^1.3.0", | ||
| "commander": "^12.1.0", | ||
| "googleapis": "^173.0.0" | ||
| "googleapis": "^173.0.0", | ||
| "zod": "^4.4.3" | ||
| }, | ||
@@ -61,0 +66,0 @@ "devDependencies": { |
+73
-16
@@ -9,2 +9,3 @@ <div align="center"> | ||
| [](https://www.npmjs.com/package/auditreach-cli) | ||
| [](https://pypi.org/project/auditreach-cli/) | ||
| [](LICENSE) | ||
@@ -23,2 +24,11 @@ [](package.json) | ||
| auditreach ships as two independent, equally first-class packages: an npm | ||
| package (this repo, JavaScript/TypeScript) and a | ||
| [PyPI package](https://pypi.org/project/auditreach-cli/) (`python/`, | ||
| Python). Both implement the same hash-chain algorithm and BYOK model | ||
| against the same official Reddit/YouTube APIs. Pick whichever fits your | ||
| toolchain, or install both. | ||
| **npm:** | ||
| ```sh | ||
@@ -35,2 +45,14 @@ npx auditreach-cli search --platform reddit --query "your query" | ||
| **pip:** | ||
| ```sh | ||
| pip install auditreach-cli | ||
| auditreach search --platform reddit --query "your query" | ||
| ``` | ||
| See [python/README.md](python/README.md) for Python-specific usage, | ||
| including this distribution's added env-var BYOK credential path (useful | ||
| for headless CI/agent sandboxes) -- the npm package stores credentials in | ||
| the OS keychain only. | ||
| Building from source works the same way, if you want to read or modify the code first: | ||
@@ -123,4 +145,2 @@ | ||
| See `docs/security-review-2026-07-12.md` for how the tamper-detection path was verified. | ||
| ## Getting started | ||
@@ -153,3 +173,3 @@ | ||
| `auditreach` has three subcommands. Every flag below is pulled directly from the CLI's own `--help` output, not from memory of what it used to support. | ||
| `auditreach` has four subcommands. Every flag below is pulled directly from the CLI's own `--help` output, not from memory of what it used to support. | ||
@@ -160,13 +180,13 @@ ### `auditreach search` | ||
| | Flag | Description | | ||
| | ------------------------- | ------------------------------------------------------------------------------- | | ||
| | `--platform <platform>` | `reddit` \| `youtube` (required) | | ||
| | `--query <query>` | search query (required) | | ||
| | `--subreddit <subreddit>` | restrict search to one subreddit (Reddit only) | | ||
| | `--channel <handle>` | restrict search to one channel, e.g. `@AnthropicAI` (YouTube only) | | ||
| | `--since <date>` | only results published after this date, e.g. `2026-06-01` (YouTube only) | | ||
| | `--max-results <n>` | maximum results to return (default: 25; platform caps: 100 Reddit / 50 YouTube) | | ||
| | `--before <fullname>` | page results before this Reddit fullname cursor, e.g. `t3_abc123` (Reddit only) | | ||
| | `--after <fullname>` | page results after this Reddit fullname cursor, e.g. `t3_abc123` (Reddit only) | | ||
| | `--output <path>` | write full results JSON to this path | | ||
| | Flag | Description | | ||
| | ------------------------- | ----------------------------------------------------------------------------------------------- | | ||
| | `--platform <platform>` | `reddit` \| `youtube` (required) | | ||
| | `--query <query>` | search query (required) | | ||
| | `--subreddit <subreddit>` | restrict search to one subreddit (Reddit only) | | ||
| | `--channel <handle>` | restrict search to one channel, e.g. `@AnthropicAI` (YouTube only) | | ||
| | `--since <date>` | only results published after this date, e.g. `2026-06-01` (YouTube only) | | ||
| | `--max-results <n>` | maximum results to return (default: 25; platform caps: 100 Reddit / 50 YouTube) | | ||
| | `--before <fullname>` | page results before this Reddit fullname cursor, e.g. `t3_abc123` (Reddit only) | | ||
| | `--after <fullname>` | page results after this Reddit fullname cursor, e.g. `t3_abc123` (Reddit only) | | ||
| | `--output <path>` | write full results JSON to this path | | ||
| | `--json` | print structured JSON to stdout instead of human-readable output, for scripts and agent callers | | ||
@@ -200,2 +220,17 @@ | ||
| ### `auditreach mcp` | ||
| Run a [Model Context Protocol](https://modelcontextprotocol.io) server over stdio (built on the official `@modelcontextprotocol/sdk`), exposing exactly 3 tools so an AI agent can call this CLI directly instead of shelling out and parsing stdout: | ||
| | Tool | Equivalent to | Notes | | ||
| | ------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------- | | ||
| | `search` | `auditreach search --json` | Same parameters: platform, query, subreddit/channel, since, maxResults, before/after | | ||
| | `auth_status` | `auditreach auth --platform <p> --verify --json` | **Read-only.** Checks whether stored credentials are valid -- cannot set or clear them | | ||
| | `verify_log` | `auditreach verify-log --json` | Same parameters: path | | ||
| node dist/cli.js mcp | ||
| # or, once published: npx auditreach-cli mcp | ||
| Setting up or clearing BYOK credentials (`auditreach auth --platform <p>` / `--clear`) is deliberately **not** exposed over MCP -- that stays a local-CLI-only, human-driven action, so a calling agent can check whether credentials work but can never provision or wipe them itself. See [`.well-known/agent.json`](.well-known/agent.json) for the machine-readable manifest (auth requirements, tool schemas, invocation commands) that an agent or agent registry can read to discover this server without a human reading the README first. | ||
| Run `auditreach <command> --help` any time to see the exact flags your installed version supports. | ||
@@ -224,2 +259,7 @@ | ||
| DEFAULT_AUDIT_LOG_PATH, | ||
| executeSearch, | ||
| checkAuthStatus, | ||
| executeVerifyLog, | ||
| buildMcpServer, | ||
| runMcpServerCommand, | ||
| } from "auditreach-cli"; | ||
@@ -267,4 +307,12 @@ ``` | ||
| **Command cores and MCP** | ||
| - `executeSearch(args)`, `checkAuthStatus(platform)`, `executeVerifyLog(path?)` -- the same programmatic cores the `search` / `auth --verify` / `verify-log` CLI commands and the MCP tools both call into; none of them write to console/stdout, so they're safe to call from any host, including one sharing stdout with an MCP transport. | ||
| - `buildMcpServer({ version }): McpServer` -- constructs the MCP server (from `@modelcontextprotocol/sdk`) with the `search` / `auth_status` / `verify_log` tools registered, without starting a transport -- useful for testing or embedding in a larger MCP server. | ||
| - `runMcpServerCommand({ version })` -- what `auditreach mcp` runs: builds the server and connects it over stdio. Never returns while the server is running. | ||
| No generated API docs site exists yet (no TypeDoc build wired into CI) -- the exports above are the complete public surface. Check `dist/index.d.ts` in the published package for exact types. | ||
| The Python package (`auditreach-cli` on PyPI) exposes the same surface with `snake_case` names -- `from auditreach import RedditClient, YoutubeClient, get_reddit_credentials, verify_audit_log_chain, ...` -- see [python/README.md](python/README.md) for the full Python API reference. | ||
| ## Platform coverage | ||
@@ -325,2 +373,4 @@ | ||
| **TypeScript (this package):** | ||
| npm install | ||
@@ -332,7 +382,14 @@ npm run lint # ESLint | ||
| See `CONTRIBUTING.md` for the rules on adding a new platform client -- the short version: official API only, honest rate-limit disclosure, tests that mock the network boundary, never anything that reads or writes a raw credential outside `src/auth/credential-store.ts`. | ||
| **Python (`python/`):** | ||
| cd python | ||
| python3 -m venv .venv && source .venv/bin/activate | ||
| pip install -e ".[dev]" | ||
| pytest # 82 tests | ||
| See `CONTRIBUTING.md` for the rules on adding a new platform client -- the short version: official API only, honest rate-limit disclosure, tests that mock the network boundary, never anything that reads or writes a raw credential outside `src/auth/credential-store.ts` (or `python/src/auditreach/auth/credential_store.py` on the Python side). | ||
| ## Security | ||
| See `SECURITY.md` for the vulnerability disclosure policy and `docs/security-review-2026-07-12.md` for the pre-launch OWASP/STRIDE review (zero CRITICAL/HIGH findings; one moderate, non-directly-reachable supply-chain advisory that has since been resolved -- `npm audit` on this repo currently returns zero vulnerabilities). GitHub secret scanning and push protection are enabled on this repo. | ||
| See `SECURITY.md` for the vulnerability disclosure policy. A pre-launch OWASP/STRIDE review found zero CRITICAL/HIGH findings and one moderate, non-directly-reachable supply-chain advisory that has since been resolved -- `npm audit` on this repo currently returns zero vulnerabilities. GitHub secret scanning and push protection are enabled on this repo. | ||
@@ -339,0 +396,0 @@ ## Success stories |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
155203
26.54%60
9.09%1524
40.98%423
15.57%5
66.67%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added