MCPcopy Create free account
hub / github.com/ChinaSiro/claude-code-sourcemap / wRK

Function wRK

package/cli.js:6164–6168  ·  view source on GitHub ↗
(q)

Source from the content-addressed store, hash-verified

6162
6163${q?"Additional user input: "+q:""}
6164`}]}})});import{mkdir as qRK,readFile as FfY,writeFile as KRK}from"fs/promises";import{dirname as _RK,join as UfY}from"path";function rK7(){return UfY(c1(),"cache","changelog.md")}async function YRK(){let q=j8();if(!q.cachedChangelog)return;let K=rK7();try{await qRK(_RK(K),{recursive:!0}),await KRK(K,q.cachedChangelog,{encoding:"utf-8",flag:"wx"})}catch{}b8(({cachedChangelog:_,...z})=>z)}async function oK7(){if(i7())return;if(iA())return;let q=await $1.get(dfY);if(q.status===200){let K=q.data;if(K===tH6)return;let _=rK7();await qRK(_RK(_),{recursive:!0}),await KRK(_,K,{encoding:"utf-8"}),tH6=K;let z=Date.now();b8((Y)=>({...Y,changelogLastFetched:z}))}}async function hF8(){if(tH6!==null)return tH6;let q=rK7();try{let K=await FfY(q,"utf-8");return tH6=K,K}catch{return tH6="",""}}function SF8(){return tH6??""}function CF8(q){try{if(!q)return{};let K={},_=q.split(/^## /gm).slice(1);for(let z of _){let Y=z.trim().split(`
6165`);if(Y.length===0)continue;let $=Y[0];if(!$)continue;let A=$.split(" - ")[0]?.trim()||"";if(!A)continue;let O=Y.slice(1).filter((w)=>w.trim().startsWith("- ")).map((w)=>w.trim().substring(2).trim()).filter(Boolean);if(O.length>0)K[A]=O}return K}catch(K){return H6(x1(K)),{}}}function $RK(q,K,_=SF8()){try{let z=CF8(_),Y=iK7.coerce(q),$=K?iK7.coerce(K):null;if(!$||Y&&Vv(Y.version,$.version))return Object.entries(z).filter(([A])=>!$||Vv(A,$.version)).sort(([A],[O])=>Vv(A,O)?-1:1).flatMap(([A,O])=>O).filter(Boolean).slice(0,QfY)}catch(z){return H6(x1(z)),[]}return[]}function aK7(q=SF8()){try{let K=CF8(q);return Object.keys(K).sort((z,Y)=>Vv(z,Y)?1:-1).map((z)=>{let Y=K[z];if(!Y||Y.length===0)return null;let $=Y.filter(Boolean);if($.length===0)return null;return[z,$]}).filter((z)=>z!==null)}catch(K){return H6(x1(K)),[]}}async function ARK(q,K={ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.88",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-30T21:59:52Z"}.VERSION){let _=await hF8();if(q!==K||!_)oK7().catch(($)=>H6(x1($)));let z=$RK(K,q,_);return{hasReleaseNotes:z.length>0,releaseNotes:z}}function ORK(q,K={ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.88",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-30T21:59:52Z"}.VERSION){let _=$RK(K,q);return{hasReleaseNotes:_.length>0,releaseNotes:_}}var iK7,QfY=5,zRK="https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md",dfY="https://raw.githubusercontent.com/anthropics/claude-code/refs/heads/main/CHANGELOG.md",tH6=null;var XS6=y(()=>{CK();v8();V1();m8();y8();E8();iK7=O6(RT6(),1)});var jRK={};T8(jRK,{call:()=>cfY});function wRK(q){return q.map(([K,_])=>{let z=`Version ${K}:`,Y=_.map(($)=>`· ${$}`).join(`
6166`);return`${z}
6167${Y}`}).join(`
6168
6169`)}async function cfY(){let q=[];try{let _=new Promise((z,Y)=>{setTimeout(($)=>$(Error("Timeout")),500,Y)});await Promise.race([oK7(),_]),q=aK7(await hF8())}catch{}if(q.length>0)return{type:"text",value:wRK(q)};let K=aK7(await hF8());if(K.length>0)return{type:"text",value:wRK(K)};return{type:"text",value:`See the full changelog at: ${zRK}`}}var HRK=y(()=>{XS6()});var lfY,sK7;var JRK=y(()=>{lfY={description:"View release notes",name:"release-notes",type:"local",supportsNonInteractive:!0,load:()=>Promise.resolve().then(() => (HRK(),jRK))},sK7=lfY});function bF8(q){let K=[];for(let z of q){if(z.type!=="user"&&z.type!=="assistant")continue;if("isMeta"in z&&z.isMeta)continue;if("origin"in z&&z.origin&&z.origin.kind!=="human")continue;let Y=z.message.content;if(typeof Y==="string")K.push(Y);else if(Array.isArray(Y)){for(let $ of Y)if("type"in $&&$.type==="text"&&"text"in $)K.push($.text)}}let _=K.join(`
6170`);return _.length>MRK?_.slice(-MRK):_}async function h56(q,K){let _=q.trim();if(!_)return null;try{let z=await RG({systemPrompt:iK([nfY]),userPrompt:_,outputFormat:{type:"json_schema",schema:{type:"object",properties:{title:{type:"string"}},required:["title"],additionalProperties:!1}},signal:K,options:{querySource:"generate_session_title",agents:[],isNonInteractiveSession:i7(),hasAppendSystemPrompt:!1,mcpTools:[]}}),Y=L3(z.message.content),$=ifY().safeParse(m5(Y)),A=$.success?$.data.title.trim()||null:null;return d("tengu_session_title_generated",{success:A!==null}),A}catch(z){return N(`generateSessionTitle failed: ${z}`,{level:"error"}),d("tengu_session_title_generated",{success:!1}),null}}var MRK=1000,nfY=`Generate a concise, sentence-case title (3-7 words) that captures the main topic or goal of this coding session. The title should be clear enough that the user recognizes the session in a list. Use sentence case: capitalize only the first word and proper nouns.
6171

Callers 1

cfYFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected