@neurynae/toolcairn-mcp 1.0.0 → 1.0.2

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.
@@ -0,0 +1,18 @@
1
+ import { createRequire as __nodeCreateRequire } from 'module'; const require = __nodeCreateRequire(import.meta.url);
2
+ import{J as g,d as u,j as h,l as m,m as d}from"../chunk-RCMWAY37.js";u();var _=process.env.TOOLPILOT_API_URL??"https://api.neurynae.com";function b(){console.error(`
3
+ \u274C Authentication required for \`scan\`.
4
+
5
+ ToolCairn tracks scan calls per-user for graph learning, so this command
6
+ needs the same sign-in as the MCP server.
7
+
8
+ First-time setup (one-shot):
9
+ 1. Add ToolCairn to your MCP client:
10
+ claude mcp add toolcairn -- npx @neurynae/toolcairn-mcp
11
+ 2. Restart your client. The \`toolcairn_auth login\` tool will open
12
+ a browser to sign in. Token is saved to ~/.toolcairn/credentials.json.
13
+ 3. Re-run \`npx @neurynae/toolcairn-mcp scan\`.
14
+ `)}function w(n,t){return n.length>=t?n:n+" ".repeat(t-n.length)}function T(n){if(n.length===0){console.log("No dependencies detected in this project.");return}let t=["name","ecosystem","inGraph","matchMethod","github"],i={name:"PACKAGE",ecosystem:"ECO",inGraph:"IN GRAPH",matchMethod:"MATCH",github:"GITHUB"},r=Object.fromEntries(t.map(o=>[o,Math.max(i[o].length,...n.map(a=>a[o].length))])),c=o=>t.map(a=>` ${w(o[a]??"",r[a])} `).join("\u2502"),s=t.map(o=>"\u2500".repeat(r[o]+2)).join("\u253C");console.log(""),console.log(c(i)),console.log(s);for(let o of n)console.log(c(o))}async function x(n){let t=n[0]&&!n[0].startsWith("--")?n[0]:process.cwd(),i=n.includes("--json"),r=await d();(!r||!r.access_token||!m(r))&&(b(),process.exit(1));let c=new h({baseUrl:_,apiKey:r.client_id,accessToken:r.access_token}),s;try{s=await g(t,{batchResolve:c.batchResolve.bind(c)})}catch(e){console.error(`
15
+ \u274C Scan failed: ${e instanceof Error?e.message:String(e)}
16
+ Make sure you have internet access or set TOOLPILOT_API_URL for self-hosted.
17
+ `),process.exit(1)}if(i){process.stdout.write(`${JSON.stringify(s,null,2)}
18
+ `);return}let o=s.tools.map(e=>{let f=e.source!=="non_oss",y=e.locations?.[0]?.ecosystem??"\u2014",R=e.github_url?e.github_url.replace(/^https?:\/\/github\.com\//,""):"\u2014";return{name:e.canonical_name&&e.canonical_name!==e.name?`${e.name} \u2192 ${e.canonical_name}`:e.name,ecosystem:y,inGraph:f?"\u2705 yes":"\u274C no",matchMethod:e.source==="toolcairn"||e.source==="toolpilot"?"graph":e.source==="manual"?"manual":"not_indexed",github:R}});T(o);let a=s.tools.filter(e=>e.source!=="non_oss").length,l=s.tools.length-a;console.log(""),console.log(`Summary: ${a} indexed \xB7 ${l} not indexed (of ${s.tools.length} dependencies)`);let p=Array.from(new Map(s.warnings.map(e=>[`${e.scope}|${e.message}`,e])).values());if(p.length>0){console.log("");for(let e of p)console.log(`\u26A0\uFE0F [${e.scope}] ${e.message}`)}console.log(""),process.exit(l>0?1:0)}export{x as runScan};