@thinkingpatterns/cli 0.1.0 → 0.2.0

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/index.js CHANGED
@@ -216,13 +216,13 @@ function resolveProjectId(explicit) {
216
216
  // src/commands/findings.ts
217
217
  function registerFindingCommands(program2) {
218
218
  const findings = program2.command("findings").description("Manage security findings");
219
- findings.command("list").description("List findings for a project").option("-p, --project <id>", "Project ID").option("--severity <severity>", "Filter by severity (critical|high|medium|low|info)").option("--status <status>", "Filter by status (open|triaged|completed|dismissed)").option("--category <category>", "Filter by category").option("--source-tool <tool>", "Filter by source tool").option("--module-path <path>", "Filter by module path prefix").option("--branch <branch>", "Filter by branch").option("--limit <n>", "Max results", parseInt).option("--offset <n>", "Result offset", parseInt).action(async (opts) => {
219
+ findings.command("list").description("List findings for a project").option("-p, --project <id>", "Project ID").option("--severity <severity>", "Filter by severity, comma-separated (critical,high,medium,low,info)").option("--status <status>", "Filter by status, comma-separated (open,triaged,completed,dismissed)").option("--category <category>", "Filter by category").option("--source-tool <tool>", "Filter by source tool").option("--module-path <path>", "Filter by module path prefix").option("--branch <branch>", "Filter by branch").option("--limit <n>", "Max results", parseInt).option("--offset <n>", "Result offset", parseInt).action(async (opts) => {
220
220
  try {
221
221
  const projectId = resolveProjectId(opts.project);
222
222
  const result = await getClient().listFindings({
223
223
  project_id: projectId,
224
- severity: opts.severity,
225
- status: opts.status,
224
+ severity: opts.severity?.includes(",") ? opts.severity.split(",").map((s) => s.trim()) : opts.severity,
225
+ status: opts.status?.includes(",") ? opts.status.split(",").map((s) => s.trim()) : opts.status,
226
226
  category: opts.category,
227
227
  source_tool: opts.sourceTool,
228
228
  module_path: opts.modulePath,
@@ -326,11 +326,15 @@ function registerRunCommands(program2) {
326
326
  import { readFileSync as readFileSync3 } from "fs";
327
327
  function registerIngestCommands(program2) {
328
328
  const ingest = program2.command("ingest").description("Ingest scan results");
329
- ingest.command("sarif").description("Ingest a SARIF file").option("-p, --project <id>", "Project ID").requiredOption("--file <path>", "Path to SARIF file").action(async (opts) => {
329
+ ingest.command("sarif").description("Ingest a SARIF file").option("-p, --project <id>", "Project ID").option("-b, --branch <name>", "Branch name for scoping findings").requiredOption("--file <path>", "Path to SARIF file").action(async (opts) => {
330
330
  try {
331
331
  const projectId = resolveProjectId(opts.project);
332
332
  const content = readFileSync3(opts.file, "utf-8");
333
- const result = await getClient().ingestSarif(projectId, content);
333
+ const result = await getClient().ingestSarifChunked(
334
+ projectId,
335
+ content,
336
+ opts.branch
337
+ );
334
338
  printJson(result);
335
339
  } catch (err) {
336
340
  printError(err);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/lib/client.ts","../src/lib/credentials.ts","../src/commands/login.ts","../src/lib/output.ts","../src/commands/auth.ts","../src/commands/projects.ts","../src/lib/config.ts","../src/commands/findings.ts","../src/commands/metrics.ts","../src/commands/risk-modules.ts","../src/commands/runs.ts","../src/commands/ingest.ts","../src/commands/agents.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { setGlobalOpts, resolveApiKey } from \"./lib/client.js\";\nimport { registerLoginCommands } from \"./commands/login.js\";\nimport { registerAuthCommands } from \"./commands/auth.js\";\nimport { registerProjectCommands } from \"./commands/projects.js\";\nimport { registerFindingCommands } from \"./commands/findings.js\";\nimport { registerMetricsCommands } from \"./commands/metrics.js\";\nimport { registerRiskModulesCommands } from \"./commands/risk-modules.js\";\nimport { registerRunCommands } from \"./commands/runs.js\";\nimport { registerIngestCommands } from \"./commands/ingest.js\";\nimport { registerAgentCommands } from \"./commands/agents.js\";\n\n/** Commands that work without authentication. */\nconst NO_AUTH_COMMANDS = new Set([\"login\", \"logout\", \"help\"]);\n\nconst program = new Command();\n\nprogram\n .name(\"tp\")\n .description(\"ThinkingPatterns CLI — security findings management\")\n .version(\"0.1.0\")\n .option(\"--api-key <key>\", \"API key (overrides TP_API_KEY env)\")\n .option(\"--api-url <url>\", \"API URL (overrides TP_API_URL env)\")\n .option(\"--quiet\", \"Suppress non-data output\")\n .hook(\"preAction\", (thisCommand) => {\n const commandName = thisCommand.args?.[0] ?? thisCommand.name();\n if (NO_AUTH_COMMANDS.has(commandName)) return;\n\n const opts = program.opts();\n setGlobalOpts({ apiKey: opts.apiKey, apiUrl: opts.apiUrl });\n\n if (!resolveApiKey()) {\n process.stderr.write(\n \"Error: Not authenticated. Run `tp login` or set TP_API_KEY.\\n\"\n );\n process.exit(2);\n }\n });\n\nregisterLoginCommands(program);\nregisterAuthCommands(program);\nregisterProjectCommands(program);\nregisterFindingCommands(program);\nregisterMetricsCommands(program);\nregisterRiskModulesCommands(program);\nregisterRunCommands(program);\nregisterIngestCommands(program);\nregisterAgentCommands(program);\n\nprogram.parse();\n","import { ThinkingPatternsClient } from \"@thinkingpatterns/core\";\nimport { loadCredentials } from \"./credentials.js\";\n\nconst DEFAULT_API_URL = \"https://thinkingpatterns.ai\";\n\nlet _client: ThinkingPatternsClient | null = null;\nlet _opts: { apiKey?: string; apiUrl?: string } = {};\n\n/** Call once from index.ts to pass through global CLI options. */\nexport function setGlobalOpts(opts: { apiKey?: string; apiUrl?: string }): void {\n _opts = opts;\n _client = null; // reset if options change\n}\n\n/**\n * Resolve the API key from (in priority order):\n * 1. --api-key flag\n * 2. TP_API_KEY env var\n * 3. ~/.thinkingpatterns/credentials.json (saved by `tp login`)\n */\nexport function resolveApiKey(): string | undefined {\n if (_opts.apiKey) return _opts.apiKey;\n if (process.env.TP_API_KEY) return process.env.TP_API_KEY;\n return loadCredentials()?.api_key;\n}\n\n/** Resolve the API URL from flag, env, saved credentials, or default. */\nfunction resolveApiUrl(): string {\n return _opts.apiUrl || process.env.TP_API_URL || loadCredentials()?.api_url || DEFAULT_API_URL;\n}\n\n/** Get the shared client instance (created lazily). */\nexport function getClient(): ThinkingPatternsClient {\n if (!_client) {\n const apiKey = resolveApiKey() || \"\";\n const apiUrl = resolveApiUrl();\n _client = new ThinkingPatternsClient({ apiKey, apiUrl });\n }\n return _client;\n}\n","import { readFileSync, writeFileSync, mkdirSync, rmSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\n\nconst CONFIG_DIR = join(homedir(), \".thinkingpatterns\");\nconst CREDENTIALS_FILE = join(CONFIG_DIR, \"credentials.json\");\n\ninterface StoredCredentials {\n api_key: string;\n api_url?: string;\n}\n\n/** Read persisted credentials, or null if none saved. */\nexport function loadCredentials(): StoredCredentials | null {\n if (!existsSync(CREDENTIALS_FILE)) return null;\n try {\n const content = readFileSync(CREDENTIALS_FILE, \"utf-8\");\n return JSON.parse(content) as StoredCredentials;\n } catch {\n return null;\n }\n}\n\n/** Persist credentials to ~/.thinkingpatterns/credentials.json. */\nexport function saveCredentials(apiKey: string, apiUrl?: string): void {\n mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });\n const data: StoredCredentials = { api_key: apiKey };\n if (apiUrl) data.api_url = apiUrl;\n writeFileSync(CREDENTIALS_FILE, JSON.stringify(data, null, 2) + \"\\n\", {\n mode: 0o600,\n });\n}\n\n/** Remove persisted credentials. Returns true if a file was deleted. */\nexport function clearCredentials(): boolean {\n if (!existsSync(CREDENTIALS_FILE)) return false;\n rmSync(CREDENTIALS_FILE);\n return true;\n}\n","import type { Command } from \"commander\";\nimport { createInterface } from \"node:readline\";\nimport { ThinkingPatternsClient } from \"@thinkingpatterns/core\";\nimport { saveCredentials, clearCredentials, loadCredentials } from \"../lib/credentials.js\";\n\nconst DEFAULT_API_URL = \"https://thinkingpatterns.ai\";\n\nfunction prompt(question: string): Promise<string> {\n const rl = createInterface({ input: process.stdin, output: process.stderr });\n return new Promise((resolve) => {\n rl.question(question, (answer) => {\n rl.close();\n resolve(answer.trim());\n });\n });\n}\n\nexport function registerLoginCommands(program: Command): void {\n program\n .command(\"login\")\n .description(\"Authenticate and save credentials\")\n .option(\"--api-url <url>\", \"API URL (default: https://thinkingpatterns.ai)\")\n .action(async (opts) => {\n const apiUrl = opts.apiUrl || DEFAULT_API_URL;\n\n process.stderr.write(\n `\\nPaste your API key from ${apiUrl}/settings/api-keys\\n\\n`\n );\n\n const apiKey = await prompt(\"API key: \");\n if (!apiKey) {\n process.stderr.write(\"Aborted — no key provided.\\n\");\n process.exit(1);\n }\n\n // Validate the key\n process.stderr.write(\"Verifying...\");\n try {\n const client = new ThinkingPatternsClient({ apiKey, apiUrl });\n const me = await client.whoami();\n saveCredentials(apiKey, apiUrl !== DEFAULT_API_URL ? apiUrl : undefined);\n const identity = me.profile?.email ?? me.profile?.display_name ?? me.org?.name ?? \"authenticated user\";\n process.stderr.write(\n ` logged in as ${identity}.\\n\\n` +\n `Credentials saved to ~/.thinkingpatterns/credentials.json\\n`\n );\n } catch {\n process.stderr.write(\" failed.\\n\\nError: Invalid API key.\\n\");\n process.exit(2);\n }\n });\n\n program\n .command(\"logout\")\n .description(\"Remove saved credentials\")\n .action(() => {\n const had = loadCredentials();\n clearCredentials();\n if (had) {\n process.stderr.write(\"Credentials removed.\\n\");\n } else {\n process.stderr.write(\"No saved credentials found.\\n\");\n }\n });\n}\n","import { TPError, TPAuthError, TPNotFoundError } from \"@thinkingpatterns/core\";\n\n/* ─── Exit codes ─── */\n\nexport const EXIT_OK = 0;\nexport const EXIT_CLIENT_ERROR = 1;\nexport const EXIT_AUTH_ERROR = 2;\nexport const EXIT_NOT_FOUND = 3;\nexport const EXIT_UNEXPECTED = 10;\n\n/* ─── Output helpers ─── */\n\nexport function printJson(data: unknown): void {\n process.stdout.write(JSON.stringify(data, null, 2) + \"\\n\");\n}\n\nexport function printError(err: unknown): never {\n if (err instanceof TPAuthError) {\n process.stderr.write(`Error: ${err.message}\\nHint: Run \\`tp login\\` or check your --api-key value.\\n`);\n process.exit(EXIT_AUTH_ERROR);\n }\n if (err instanceof TPNotFoundError) {\n process.stderr.write(`Error: ${err.message}\\n`);\n process.exit(EXIT_NOT_FOUND);\n }\n if (err instanceof TPError) {\n process.stderr.write(`Error: ${err.message}\\n`);\n if (err.details) {\n process.stderr.write(`Details: ${JSON.stringify(err.details, null, 2)}\\n`);\n }\n process.exit(EXIT_CLIENT_ERROR);\n }\n if (err instanceof Error) {\n process.stderr.write(`Error: ${err.message}\\n`);\n } else {\n process.stderr.write(`Error: ${String(err)}\\n`);\n }\n process.exit(EXIT_UNEXPECTED);\n}\n","import type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\n\nexport function registerAuthCommands(program: Command): void {\n program\n .command(\"whoami\")\n .description(\"Show current authentication context\")\n .action(async () => {\n try {\n const result = await getClient().whoami();\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\n\nexport function registerProjectCommands(program: Command): void {\n const projects = program\n .command(\"projects\")\n .description(\"Manage projects\");\n\n projects\n .command(\"list\")\n .description(\"List all projects\")\n .action(async () => {\n try {\n const result = await getClient().listProjects();\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import { readFileSync, existsSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\n\nconst CONFIG_FILE = \".thinkingpatterns.json\";\n\ninterface ProjectConfig {\n project_id?: string;\n}\n\n/**\n * Walk up from cwd looking for .thinkingpatterns.json.\n * Returns the parsed config or null if not found.\n */\nexport function loadProjectConfig(): ProjectConfig | null {\n let dir = process.cwd();\n const root = dirname(dir) === dir ? dir : \"/\";\n\n while (true) {\n const filePath = join(dir, CONFIG_FILE);\n if (existsSync(filePath)) {\n try {\n const content = readFileSync(filePath, \"utf-8\");\n return JSON.parse(content) as ProjectConfig;\n } catch {\n return null;\n }\n }\n const parent = dirname(dir);\n if (parent === dir || dir === root) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Resolve project ID from explicit option, falling back to config file.\n * Exits with error if neither is available.\n */\nexport function resolveProjectId(explicit?: string): string {\n if (explicit) return explicit;\n const config = loadProjectConfig();\n if (config?.project_id) return config.project_id;\n process.stderr.write(\n \"Error: --project is required (or set project_id in .thinkingpatterns.json)\\n\"\n );\n process.exit(1);\n}\n","import type { Command } from \"commander\";\nimport type { TriageAction } from \"@thinkingpatterns/core\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerFindingCommands(program: Command): void {\n const findings = program\n .command(\"findings\")\n .description(\"Manage security findings\");\n\n findings\n .command(\"list\")\n .description(\"List findings for a project\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .option(\"--severity <severity>\", \"Filter by severity (critical|high|medium|low|info)\")\n .option(\"--status <status>\", \"Filter by status (open|triaged|completed|dismissed)\")\n .option(\"--category <category>\", \"Filter by category\")\n .option(\"--source-tool <tool>\", \"Filter by source tool\")\n .option(\"--module-path <path>\", \"Filter by module path prefix\")\n .option(\"--branch <branch>\", \"Filter by branch\")\n .option(\"--limit <n>\", \"Max results\", parseInt)\n .option(\"--offset <n>\", \"Result offset\", parseInt)\n .action(async (opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const result = await getClient().listFindings({\n project_id: projectId,\n severity: opts.severity,\n status: opts.status,\n category: opts.category,\n source_tool: opts.sourceTool,\n module_path: opts.modulePath,\n branch: opts.branch,\n limit: opts.limit,\n offset: opts.offset,\n });\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n findings\n .command(\"get <id>\")\n .description(\"Get finding details\")\n .action(async (id: string) => {\n try {\n const result = await getClient().getFinding(id);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n findings\n .command(\"triage <id>\")\n .description(\"Triage a finding\")\n .requiredOption(\"--action <action>\", \"Triage action (accept|dismiss|defer|complete|reopen)\")\n .option(\"--reason <reason>\", \"Reason for the triage decision\")\n .action(async (id: string, opts) => {\n try {\n const result = await getClient().triageFinding(\n id,\n opts.action as TriageAction,\n opts.reason\n );\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n findings\n .command(\"bulk-triage\")\n .description(\"Triage multiple findings at once\")\n .requiredOption(\"--ids <ids>\", \"Comma-separated finding IDs\")\n .requiredOption(\"--action <action>\", \"Triage action (accept|dismiss|defer|complete|reopen)\")\n .option(\"--reason <reason>\", \"Reason for the triage decision\")\n .action(async (opts) => {\n try {\n const findingIds = opts.ids.split(\",\").map((s: string) => s.trim());\n const result = await getClient().bulkTriage({\n finding_ids: findingIds,\n action: opts.action as TriageAction,\n reason: opts.reason,\n });\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n findings\n .command(\"comment <id>\")\n .description(\"Add a comment to a finding\")\n .requiredOption(\"--body <text>\", \"Comment text\")\n .action(async (id: string, opts) => {\n try {\n const result = await getClient().addComment(id, opts.body);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerMetricsCommands(program: Command): void {\n program\n .command(\"metrics\")\n .description(\"Get project metrics (MTTR, fix rate, open count)\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .action(async (opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const result = await getClient().getProjectMetrics(projectId);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerRiskModulesCommands(program: Command): void {\n program\n .command(\"risk-modules\")\n .description(\"Get top risk modules for a project\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .option(\"--limit <n>\", \"Max results\", parseInt)\n .action(async (opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const result = await getClient().getTopRiskModules(projectId, opts.limit);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerRunCommands(program: Command): void {\n const runs = program\n .command(\"runs\")\n .description(\"Manage scan runs\");\n\n runs\n .command(\"list\")\n .description(\"List runs for a project\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .option(\"--status <status>\", \"Filter by status\")\n .option(\"--limit <n>\", \"Max results\", parseInt)\n .option(\"--offset <n>\", \"Result offset\", parseInt)\n .action(async (opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const result = await getClient().listRuns(projectId, {\n status: opts.status,\n limit: opts.limit,\n offset: opts.offset,\n });\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import { readFileSync } from \"node:fs\";\nimport type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerIngestCommands(program: Command): void {\n const ingest = program\n .command(\"ingest\")\n .description(\"Ingest scan results\");\n\n ingest\n .command(\"sarif\")\n .description(\"Ingest a SARIF file\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .requiredOption(\"--file <path>\", \"Path to SARIF file\")\n .action(async (opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const content = readFileSync(opts.file, \"utf-8\");\n const result = await getClient().ingestSarif(projectId, content);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import { readFileSync } from \"node:fs\";\nimport type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerAgentCommands(program: Command): void {\n const agents = program\n .command(\"agents\")\n .description(\"Manage analysis agents\");\n\n agents\n .command(\"list\")\n .description(\"List available agents\")\n .option(\"--category <category>\", \"Filter by category\")\n .option(\"--status <status>\", \"Filter by status (draft|active|archived)\")\n .option(\"--limit <n>\", \"Max results\", parseInt)\n .option(\"--offset <n>\", \"Result offset\", parseInt)\n .action(async (opts) => {\n try {\n const result = await getClient().listAgents({\n category: opts.category,\n status: opts.status,\n limit: opts.limit,\n offset: opts.offset,\n });\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n agents\n .command(\"get <id>\")\n .description(\"Get agent details\")\n .action(async (id: string) => {\n try {\n const result = await getClient().getAgent(id);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n agents\n .command(\"create\")\n .description(\"Create a new agent\")\n .requiredOption(\"--name <name>\", \"Agent name\")\n .requiredOption(\"--slug <slug>\", \"Agent slug (URL-safe identifier)\")\n .requiredOption(\"--skill-md <path>\", \"Path to SKILL.md file\")\n .option(\"--description <desc>\", \"Agent description\")\n .option(\"--category <category>\", \"Agent category\")\n .action(async (opts) => {\n try {\n const skillMd = readFileSync(opts.skillMd, \"utf-8\");\n const result = await getClient().createAgent({\n name: opts.name,\n slug: opts.slug,\n skill_md: skillMd,\n description: opts.description,\n category: opts.category,\n });\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n agents\n .command(\"run <id>\")\n .description(\"Run an agent against a project\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .action(async (id: string, opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const client = getClient();\n const [agent, projects] = await Promise.all([\n client.getAgent(id),\n client.listProjects(),\n ]);\n const project = projects.find((p) => p.id === projectId);\n if (!project) {\n process.stderr.write(`Error: Project ${projectId} not found\\n`);\n process.exit(3);\n }\n printJson({\n agent: { id: agent.id, name: agent.name, slug: agent.slug },\n project: { id: project.id, name: project.name },\n skill_md: agent.skill_md,\n instruction:\n \"Follow the SKILL.md workflow above. When done, ingest results with: tp ingest sarif --project \" +\n projectId +\n \" --file results.sarif\",\n });\n } catch (err) {\n printError(err);\n }\n });\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;;;ACAxB,SAAS,8BAA8B;;;ACAvC,SAAS,cAAc,eAAe,WAAW,QAAQ,kBAAkB;AAC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AAW,0BAA0B,EAC5C,KAAK,aAAa,CAAC,gBAAgB;AAClC,QAAM,cAAc,YAAY,OAAO,CAAC,KAAK,YAAY,KAAK;AAC9D,MAAI,iBAAiB,IAAI,WAAW,EAAG;AAEvC,QAAM,OAAO,QAAQ,KAAK;AAC1B,gBAAc,EAAE,QAAQ,KAAK,QAAQ,QAAQ,KAAK,OAAO,CAAC;AAE1D,MAAI,CAAC,cAAc,GAAG;AACpB,YAAQ,OAAO;AAAA,MACb;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;AAEH,sBAAsB,OAAO;AAC7B,qBAAqB,OAAO;AAC5B,wBAAwB,OAAO;AAC/B,wBAAwB,OAAO;AAC/B,wBAAwB,OAAO;AAC/B,4BAA4B,OAAO;AACnC,oBAAoB,OAAO;AAC3B,uBAAuB,OAAO;AAC9B,sBAAsB,OAAO;AAE7B,QAAQ,MAAM;","names":["ThinkingPatternsClient","DEFAULT_API_URL","program","ThinkingPatternsClient","program","program","readFileSync","existsSync","join","program","program","program","program","readFileSync","program","readFileSync","readFileSync","program","readFileSync"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/lib/client.ts","../src/lib/credentials.ts","../src/commands/login.ts","../src/lib/output.ts","../src/commands/auth.ts","../src/commands/projects.ts","../src/lib/config.ts","../src/commands/findings.ts","../src/commands/metrics.ts","../src/commands/risk-modules.ts","../src/commands/runs.ts","../src/commands/ingest.ts","../src/commands/agents.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { setGlobalOpts, resolveApiKey } from \"./lib/client.js\";\nimport { registerLoginCommands } from \"./commands/login.js\";\nimport { registerAuthCommands } from \"./commands/auth.js\";\nimport { registerProjectCommands } from \"./commands/projects.js\";\nimport { registerFindingCommands } from \"./commands/findings.js\";\nimport { registerMetricsCommands } from \"./commands/metrics.js\";\nimport { registerRiskModulesCommands } from \"./commands/risk-modules.js\";\nimport { registerRunCommands } from \"./commands/runs.js\";\nimport { registerIngestCommands } from \"./commands/ingest.js\";\nimport { registerAgentCommands } from \"./commands/agents.js\";\n\n/** Commands that work without authentication. */\nconst NO_AUTH_COMMANDS = new Set([\"login\", \"logout\", \"help\"]);\n\nconst program = new Command();\n\nprogram\n .name(\"tp\")\n .description(\"ThinkingPatterns CLI — security findings management\")\n .version(\"0.1.0\")\n .option(\"--api-key <key>\", \"API key (overrides TP_API_KEY env)\")\n .option(\"--api-url <url>\", \"API URL (overrides TP_API_URL env)\")\n .option(\"--quiet\", \"Suppress non-data output\")\n .hook(\"preAction\", (thisCommand) => {\n const commandName = thisCommand.args?.[0] ?? thisCommand.name();\n if (NO_AUTH_COMMANDS.has(commandName)) return;\n\n const opts = program.opts();\n setGlobalOpts({ apiKey: opts.apiKey, apiUrl: opts.apiUrl });\n\n if (!resolveApiKey()) {\n process.stderr.write(\n \"Error: Not authenticated. Run `tp login` or set TP_API_KEY.\\n\"\n );\n process.exit(2);\n }\n });\n\nregisterLoginCommands(program);\nregisterAuthCommands(program);\nregisterProjectCommands(program);\nregisterFindingCommands(program);\nregisterMetricsCommands(program);\nregisterRiskModulesCommands(program);\nregisterRunCommands(program);\nregisterIngestCommands(program);\nregisterAgentCommands(program);\n\nprogram.parse();\n","import { ThinkingPatternsClient } from \"@thinkingpatterns/core\";\nimport { loadCredentials } from \"./credentials.js\";\n\nconst DEFAULT_API_URL = \"https://thinkingpatterns.ai\";\n\nlet _client: ThinkingPatternsClient | null = null;\nlet _opts: { apiKey?: string; apiUrl?: string } = {};\n\n/** Call once from index.ts to pass through global CLI options. */\nexport function setGlobalOpts(opts: { apiKey?: string; apiUrl?: string }): void {\n _opts = opts;\n _client = null; // reset if options change\n}\n\n/**\n * Resolve the API key from (in priority order):\n * 1. --api-key flag\n * 2. TP_API_KEY env var\n * 3. ~/.thinkingpatterns/credentials.json (saved by `tp login`)\n */\nexport function resolveApiKey(): string | undefined {\n if (_opts.apiKey) return _opts.apiKey;\n if (process.env.TP_API_KEY) return process.env.TP_API_KEY;\n return loadCredentials()?.api_key;\n}\n\n/** Resolve the API URL from flag, env, saved credentials, or default. */\nfunction resolveApiUrl(): string {\n return _opts.apiUrl || process.env.TP_API_URL || loadCredentials()?.api_url || DEFAULT_API_URL;\n}\n\n/** Get the shared client instance (created lazily). */\nexport function getClient(): ThinkingPatternsClient {\n if (!_client) {\n const apiKey = resolveApiKey() || \"\";\n const apiUrl = resolveApiUrl();\n _client = new ThinkingPatternsClient({ apiKey, apiUrl });\n }\n return _client;\n}\n","import { readFileSync, writeFileSync, mkdirSync, rmSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\n\nconst CONFIG_DIR = join(homedir(), \".thinkingpatterns\");\nconst CREDENTIALS_FILE = join(CONFIG_DIR, \"credentials.json\");\n\ninterface StoredCredentials {\n api_key: string;\n api_url?: string;\n}\n\n/** Read persisted credentials, or null if none saved. */\nexport function loadCredentials(): StoredCredentials | null {\n if (!existsSync(CREDENTIALS_FILE)) return null;\n try {\n const content = readFileSync(CREDENTIALS_FILE, \"utf-8\");\n return JSON.parse(content) as StoredCredentials;\n } catch {\n return null;\n }\n}\n\n/** Persist credentials to ~/.thinkingpatterns/credentials.json. */\nexport function saveCredentials(apiKey: string, apiUrl?: string): void {\n mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });\n const data: StoredCredentials = { api_key: apiKey };\n if (apiUrl) data.api_url = apiUrl;\n writeFileSync(CREDENTIALS_FILE, JSON.stringify(data, null, 2) + \"\\n\", {\n mode: 0o600,\n });\n}\n\n/** Remove persisted credentials. Returns true if a file was deleted. */\nexport function clearCredentials(): boolean {\n if (!existsSync(CREDENTIALS_FILE)) return false;\n rmSync(CREDENTIALS_FILE);\n return true;\n}\n","import type { Command } from \"commander\";\nimport { createInterface } from \"node:readline\";\nimport { ThinkingPatternsClient } from \"@thinkingpatterns/core\";\nimport { saveCredentials, clearCredentials, loadCredentials } from \"../lib/credentials.js\";\n\nconst DEFAULT_API_URL = \"https://thinkingpatterns.ai\";\n\nfunction prompt(question: string): Promise<string> {\n const rl = createInterface({ input: process.stdin, output: process.stderr });\n return new Promise((resolve) => {\n rl.question(question, (answer) => {\n rl.close();\n resolve(answer.trim());\n });\n });\n}\n\nexport function registerLoginCommands(program: Command): void {\n program\n .command(\"login\")\n .description(\"Authenticate and save credentials\")\n .option(\"--api-url <url>\", \"API URL (default: https://thinkingpatterns.ai)\")\n .action(async (opts) => {\n const apiUrl = opts.apiUrl || DEFAULT_API_URL;\n\n process.stderr.write(\n `\\nPaste your API key from ${apiUrl}/settings/api-keys\\n\\n`\n );\n\n const apiKey = await prompt(\"API key: \");\n if (!apiKey) {\n process.stderr.write(\"Aborted — no key provided.\\n\");\n process.exit(1);\n }\n\n // Validate the key\n process.stderr.write(\"Verifying...\");\n try {\n const client = new ThinkingPatternsClient({ apiKey, apiUrl });\n const me = await client.whoami();\n saveCredentials(apiKey, apiUrl !== DEFAULT_API_URL ? apiUrl : undefined);\n const identity = me.profile?.email ?? me.profile?.display_name ?? me.org?.name ?? \"authenticated user\";\n process.stderr.write(\n ` logged in as ${identity}.\\n\\n` +\n `Credentials saved to ~/.thinkingpatterns/credentials.json\\n`\n );\n } catch {\n process.stderr.write(\" failed.\\n\\nError: Invalid API key.\\n\");\n process.exit(2);\n }\n });\n\n program\n .command(\"logout\")\n .description(\"Remove saved credentials\")\n .action(() => {\n const had = loadCredentials();\n clearCredentials();\n if (had) {\n process.stderr.write(\"Credentials removed.\\n\");\n } else {\n process.stderr.write(\"No saved credentials found.\\n\");\n }\n });\n}\n","import { TPError, TPAuthError, TPNotFoundError } from \"@thinkingpatterns/core\";\n\n/* ─── Exit codes ─── */\n\nexport const EXIT_OK = 0;\nexport const EXIT_CLIENT_ERROR = 1;\nexport const EXIT_AUTH_ERROR = 2;\nexport const EXIT_NOT_FOUND = 3;\nexport const EXIT_UNEXPECTED = 10;\n\n/* ─── Output helpers ─── */\n\nexport function printJson(data: unknown): void {\n process.stdout.write(JSON.stringify(data, null, 2) + \"\\n\");\n}\n\nexport function printError(err: unknown): never {\n if (err instanceof TPAuthError) {\n process.stderr.write(`Error: ${err.message}\\nHint: Run \\`tp login\\` or check your --api-key value.\\n`);\n process.exit(EXIT_AUTH_ERROR);\n }\n if (err instanceof TPNotFoundError) {\n process.stderr.write(`Error: ${err.message}\\n`);\n process.exit(EXIT_NOT_FOUND);\n }\n if (err instanceof TPError) {\n process.stderr.write(`Error: ${err.message}\\n`);\n if (err.details) {\n process.stderr.write(`Details: ${JSON.stringify(err.details, null, 2)}\\n`);\n }\n process.exit(EXIT_CLIENT_ERROR);\n }\n if (err instanceof Error) {\n process.stderr.write(`Error: ${err.message}\\n`);\n } else {\n process.stderr.write(`Error: ${String(err)}\\n`);\n }\n process.exit(EXIT_UNEXPECTED);\n}\n","import type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\n\nexport function registerAuthCommands(program: Command): void {\n program\n .command(\"whoami\")\n .description(\"Show current authentication context\")\n .action(async () => {\n try {\n const result = await getClient().whoami();\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\n\nexport function registerProjectCommands(program: Command): void {\n const projects = program\n .command(\"projects\")\n .description(\"Manage projects\");\n\n projects\n .command(\"list\")\n .description(\"List all projects\")\n .action(async () => {\n try {\n const result = await getClient().listProjects();\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import { readFileSync, existsSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\n\nconst CONFIG_FILE = \".thinkingpatterns.json\";\n\ninterface ProjectConfig {\n project_id?: string;\n}\n\n/**\n * Walk up from cwd looking for .thinkingpatterns.json.\n * Returns the parsed config or null if not found.\n */\nexport function loadProjectConfig(): ProjectConfig | null {\n let dir = process.cwd();\n const root = dirname(dir) === dir ? dir : \"/\";\n\n while (true) {\n const filePath = join(dir, CONFIG_FILE);\n if (existsSync(filePath)) {\n try {\n const content = readFileSync(filePath, \"utf-8\");\n return JSON.parse(content) as ProjectConfig;\n } catch {\n return null;\n }\n }\n const parent = dirname(dir);\n if (parent === dir || dir === root) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Resolve project ID from explicit option, falling back to config file.\n * Exits with error if neither is available.\n */\nexport function resolveProjectId(explicit?: string): string {\n if (explicit) return explicit;\n const config = loadProjectConfig();\n if (config?.project_id) return config.project_id;\n process.stderr.write(\n \"Error: --project is required (or set project_id in .thinkingpatterns.json)\\n\"\n );\n process.exit(1);\n}\n","import type { Command } from \"commander\";\nimport type { TriageAction } from \"@thinkingpatterns/core\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerFindingCommands(program: Command): void {\n const findings = program\n .command(\"findings\")\n .description(\"Manage security findings\");\n\n findings\n .command(\"list\")\n .description(\"List findings for a project\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .option(\"--severity <severity>\", \"Filter by severity, comma-separated (critical,high,medium,low,info)\")\n .option(\"--status <status>\", \"Filter by status, comma-separated (open,triaged,completed,dismissed)\")\n .option(\"--category <category>\", \"Filter by category\")\n .option(\"--source-tool <tool>\", \"Filter by source tool\")\n .option(\"--module-path <path>\", \"Filter by module path prefix\")\n .option(\"--branch <branch>\", \"Filter by branch\")\n .option(\"--limit <n>\", \"Max results\", parseInt)\n .option(\"--offset <n>\", \"Result offset\", parseInt)\n .action(async (opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const result = await getClient().listFindings({\n project_id: projectId,\n severity: opts.severity?.includes(\",\") ? opts.severity.split(\",\").map((s: string) => s.trim()) : opts.severity,\n status: opts.status?.includes(\",\") ? opts.status.split(\",\").map((s: string) => s.trim()) : opts.status,\n category: opts.category,\n source_tool: opts.sourceTool,\n module_path: opts.modulePath,\n branch: opts.branch,\n limit: opts.limit,\n offset: opts.offset,\n });\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n findings\n .command(\"get <id>\")\n .description(\"Get finding details\")\n .action(async (id: string) => {\n try {\n const result = await getClient().getFinding(id);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n findings\n .command(\"triage <id>\")\n .description(\"Triage a finding\")\n .requiredOption(\"--action <action>\", \"Triage action (accept|dismiss|defer|complete|reopen)\")\n .option(\"--reason <reason>\", \"Reason for the triage decision\")\n .action(async (id: string, opts) => {\n try {\n const result = await getClient().triageFinding(\n id,\n opts.action as TriageAction,\n opts.reason\n );\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n findings\n .command(\"bulk-triage\")\n .description(\"Triage multiple findings at once\")\n .requiredOption(\"--ids <ids>\", \"Comma-separated finding IDs\")\n .requiredOption(\"--action <action>\", \"Triage action (accept|dismiss|defer|complete|reopen)\")\n .option(\"--reason <reason>\", \"Reason for the triage decision\")\n .action(async (opts) => {\n try {\n const findingIds = opts.ids.split(\",\").map((s: string) => s.trim());\n const result = await getClient().bulkTriage({\n finding_ids: findingIds,\n action: opts.action as TriageAction,\n reason: opts.reason,\n });\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n findings\n .command(\"comment <id>\")\n .description(\"Add a comment to a finding\")\n .requiredOption(\"--body <text>\", \"Comment text\")\n .action(async (id: string, opts) => {\n try {\n const result = await getClient().addComment(id, opts.body);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerMetricsCommands(program: Command): void {\n program\n .command(\"metrics\")\n .description(\"Get project metrics (MTTR, fix rate, open count)\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .action(async (opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const result = await getClient().getProjectMetrics(projectId);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerRiskModulesCommands(program: Command): void {\n program\n .command(\"risk-modules\")\n .description(\"Get top risk modules for a project\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .option(\"--limit <n>\", \"Max results\", parseInt)\n .action(async (opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const result = await getClient().getTopRiskModules(projectId, opts.limit);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerRunCommands(program: Command): void {\n const runs = program\n .command(\"runs\")\n .description(\"Manage scan runs\");\n\n runs\n .command(\"list\")\n .description(\"List runs for a project\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .option(\"--status <status>\", \"Filter by status\")\n .option(\"--limit <n>\", \"Max results\", parseInt)\n .option(\"--offset <n>\", \"Result offset\", parseInt)\n .action(async (opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const result = await getClient().listRuns(projectId, {\n status: opts.status,\n limit: opts.limit,\n offset: opts.offset,\n });\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import { readFileSync } from \"node:fs\";\nimport type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerIngestCommands(program: Command): void {\n const ingest = program\n .command(\"ingest\")\n .description(\"Ingest scan results\");\n\n ingest\n .command(\"sarif\")\n .description(\"Ingest a SARIF file\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .option(\"-b, --branch <name>\", \"Branch name for scoping findings\")\n .requiredOption(\"--file <path>\", \"Path to SARIF file\")\n .action(async (opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const content = readFileSync(opts.file, \"utf-8\");\n const result = await getClient().ingestSarifChunked(\n projectId,\n content,\n opts.branch\n );\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n}\n","import { readFileSync } from \"node:fs\";\nimport type { Command } from \"commander\";\nimport { getClient } from \"../lib/client.js\";\nimport { printJson, printError } from \"../lib/output.js\";\nimport { resolveProjectId } from \"../lib/config.js\";\n\nexport function registerAgentCommands(program: Command): void {\n const agents = program\n .command(\"agents\")\n .description(\"Manage analysis agents\");\n\n agents\n .command(\"list\")\n .description(\"List available agents\")\n .option(\"--category <category>\", \"Filter by category\")\n .option(\"--status <status>\", \"Filter by status (draft|active|archived)\")\n .option(\"--limit <n>\", \"Max results\", parseInt)\n .option(\"--offset <n>\", \"Result offset\", parseInt)\n .action(async (opts) => {\n try {\n const result = await getClient().listAgents({\n category: opts.category,\n status: opts.status,\n limit: opts.limit,\n offset: opts.offset,\n });\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n agents\n .command(\"get <id>\")\n .description(\"Get agent details\")\n .action(async (id: string) => {\n try {\n const result = await getClient().getAgent(id);\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n agents\n .command(\"create\")\n .description(\"Create a new agent\")\n .requiredOption(\"--name <name>\", \"Agent name\")\n .requiredOption(\"--slug <slug>\", \"Agent slug (URL-safe identifier)\")\n .requiredOption(\"--skill-md <path>\", \"Path to SKILL.md file\")\n .option(\"--description <desc>\", \"Agent description\")\n .option(\"--category <category>\", \"Agent category\")\n .action(async (opts) => {\n try {\n const skillMd = readFileSync(opts.skillMd, \"utf-8\");\n const result = await getClient().createAgent({\n name: opts.name,\n slug: opts.slug,\n skill_md: skillMd,\n description: opts.description,\n category: opts.category,\n });\n printJson(result);\n } catch (err) {\n printError(err);\n }\n });\n\n agents\n .command(\"run <id>\")\n .description(\"Run an agent against a project\")\n .option(\"-p, --project <id>\", \"Project ID\")\n .action(async (id: string, opts) => {\n try {\n const projectId = resolveProjectId(opts.project);\n const client = getClient();\n const [agent, projects] = await Promise.all([\n client.getAgent(id),\n client.listProjects(),\n ]);\n const project = projects.find((p) => p.id === projectId);\n if (!project) {\n process.stderr.write(`Error: Project ${projectId} not found\\n`);\n process.exit(3);\n }\n printJson({\n agent: { id: agent.id, name: agent.name, slug: agent.slug },\n project: { id: project.id, name: project.name },\n skill_md: agent.skill_md,\n instruction:\n \"Follow the SKILL.md workflow above. When done, ingest results with: tp ingest sarif --project \" +\n projectId +\n \" --file results.sarif\",\n });\n } catch (err) {\n printError(err);\n }\n });\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;;;ACAxB,SAAS,8BAA8B;;;ACAvC,SAAS,cAAc,eAAe,WAAW,QAAQ,kBAAkB;AAC3E,SAAS,YAAY;AACrB,SAAS,eAAe;AAExB,IAAM,aAAa,KAAK,QAAQ,GAAG,mBAAmB;AACtD,IAAM,mBAAmB,KAAK,YAAY,kBAAkB;AAQrD,SAAS,kBAA4C;AAC1D,MAAI,CAAC,WAAW,gBAAgB,EAAG,QAAO;AAC1C,MAAI;AACF,UAAM,UAAU,aAAa,kBAAkB,OAAO;AACtD,WAAO,KAAK,MAAM,OAAO;AAAA,EAC3B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,gBAAgB,QAAgB,QAAuB;AACrE,YAAU,YAAY,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AACtD,QAAM,OAA0B,EAAE,SAAS,OAAO;AAClD,MAAI,OAAQ,MAAK,UAAU;AAC3B,gBAAc,kBAAkB,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI,MAAM;AAAA,IACpE,MAAM;AAAA,EACR,CAAC;AACH;AAGO,SAAS,mBAA4B;AAC1C,MAAI,CAAC,WAAW,gBAAgB,EAAG,QAAO;AAC1C,SAAO,gBAAgB;AACvB,SAAO;AACT;;;ADnCA,IAAM,kBAAkB;AAExB,IAAI,UAAyC;AAC7C,IAAI,QAA8C,CAAC;AAG5C,SAAS,cAAc,MAAkD;AAC9E,UAAQ;AACR,Y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AC9B,sBAAsB,OAAO;AAE7B,QAAQ,MAAM;","names":["ThinkingPatternsClient","DEFAULT_API_URL","program","ThinkingPatternsClient","program","program","readFileSync","existsSync","join","program","program","program","program","readFileSync","program","readFileSync","readFileSync","program","readFileSync"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkingpatterns/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "ThinkingPatterns CLI for security findings management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "start": "node dist/index.js"
17
17
  },
18
18
  "dependencies": {
19
- "@thinkingpatterns/core": "^0.1.0",
19
+ "@thinkingpatterns/core": "^0.2.0",
20
20
  "commander": "^13.0.0"
21
21
  },
22
22
  "devDependencies": {