devcoach 2.8.0-next.667.gacec817 → 2.8.0-next.669.g6698ed3

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <p align="center">
4
4
  <a href="https://ultimaphoenix.github.io/dev-coach/">
5
- <img src="https://ultimaphoenix.github.io/dev-coach/img/og-card.jpg" alt="devcoach — progressive technical coaching, right inside your AI agent" width="760">
5
+ <img src="https://ultimaphoenix.github.io/dev-coach/img/og-card.jpg" alt="devcoach — stay sharp while your AI does the work" width="760">
6
6
  </a>
7
7
  </p>
8
8
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a as a$3,c as c$1}from'./chunk-QU6UQJWC.js';import {p,q,h as h$1,m,a as a$1,e,g,j as j$1,l,n}from'./chunk-MBQ2MDBS.js';import {z,E as E$1,A,y,G,X as X$1,Ba,Fa,Ca,R,V as V$1,S,W as W$1,Da,T,U,L,Ga,ra,va,N,M,P as P$1,H,K as K$1,Ea,J as J$1,O,Y as Y$1,w,Aa,za,b as b$1,c,a as a$2,oa,qa,r,ta,sa,ua,xa,wa}from'./chunk-W3MCE3EH.js';import {a}from'./chunk-CQ7BCKWT.js';import {existsSync,readFileSync,mkdirSync,writeFileSync}from'fs';import {dirname,join,extname}from'path';import {fileURLToPath}from'url';import {serve}from'@hono/node-server';import {Hono}from'hono';import {html,raw}from'hono/html';function j(r){return JSON.stringify(r??"").replace(/[<>&\u2028\u2029]/g,e=>String.raw`\u`+(e.codePointAt(0)??0).toString(16).padStart(4,"0"))}function We(r,e){return r+e.replace(/[^A-Za-z0-9_-]/g,g=>`_${(g.codePointAt(0)??0).toString(16)}`)}var lt=html`<svg class="w-4 h-4" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><circle cx="4" cy="10" r="1.75"/><circle cx="10" cy="10" r="1.75"/><circle cx="16" cy="10" r="1.75"/></svg>`;function Y(r,e="",g=""){return html`<div class="relative ${e}" ${raw(g)} x-data="{ open: false }" @click.outside="open = false" @keydown.escape="open = false">
2
+ import {a as a$3,c as c$1}from'./chunk-QU6UQJWC.js';import {p,q,h as h$1,m,a as a$1,e,g,j as j$1,l,n}from'./chunk-DZKBVY27.js';import {z,E as E$1,A,y,G,X as X$1,Ba,Fa,Ca,R,V as V$1,S,W as W$1,Da,T,U,L,Ga,ra,va,N,M,P as P$1,H,K as K$1,Ea,J as J$1,O,Y as Y$1,w,Aa,za,b as b$1,c,a as a$2,oa,qa,r,ta,sa,ua,xa,wa}from'./chunk-KDWNHPMS.js';import {a}from'./chunk-2AJDMNVE.js';import {existsSync,readFileSync,mkdirSync,writeFileSync}from'fs';import {dirname,join,extname}from'path';import {fileURLToPath}from'url';import {serve}from'@hono/node-server';import {Hono}from'hono';import {html,raw}from'hono/html';function j(r){return JSON.stringify(r??"").replace(/[<>&\u2028\u2029]/g,e=>String.raw`\u`+(e.codePointAt(0)??0).toString(16).padStart(4,"0"))}function We(r,e){return r+e.replace(/[^A-Za-z0-9_-]/g,g=>`_${(g.codePointAt(0)??0).toString(16)}`)}var lt=html`<svg class="w-4 h-4" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><circle cx="4" cy="10" r="1.75"/><circle cx="10" cy="10" r="1.75"/><circle cx="16" cy="10" r="1.75"/></svg>`;function Y(r,e="",g=""){return html`<div class="relative ${e}" ${raw(g)} x-data="{ open: false }" @click.outside="open = false" @keydown.escape="open = false">
3
3
  <button type="button" @click="open = !open" :aria-expanded="open" aria-label="More actions" title="More actions" class="w-8 h-8 inline-flex items-center justify-center rounded-lg border transition bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:border-accent-400 hover:text-gray-800 dark:hover:text-gray-100">${lt}</button>
4
4
  <div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="opacity-0 scale-95" x-transition:enter-end="opacity-100 scale-100" class="absolute right-0 top-full mt-1 z-50 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-xl shadow-lg w-56 p-1" style="display:none">
5
5
  ${r}
package/dist/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {c as c$1,e as e$1,f}from'./chunk-TIINFPAX.js';import'./chunk-CQ7BCKWT.js';var e=process.argv[2]??"",i=new Set(["stop-hook","prompt-hook","gemini-stop-hook","gemini-prompt-hook","codex-stop-hook","codex-prompt-hook","onboard-hook","lesson-ready"]);function c(){let o=e$1();return `devcoach ${o.version} (${f(o.where)}): `}var n=c$1(process.versions.node);n&&(i.has(e)&&process.exit(0),console.error(`${n} at ${process.execPath}. Upgrade Node, then restart.`),process.exit(1));try{if(i.has(e)){let{runHook:o}=await import('./hooks-DDA4J25S.js');o(e);}else {let{runCli:o}=await import('./commands-UNJ2FEBM.js');await o();}}catch(o){o?.name==="SchemaTooNewError"&&(console.error(o.message),process.exit(3)),console.error(c(),o),process.exit(1);}
2
+ import {c as c$1,e as e$1,f}from'./chunk-JWDQGP6O.js';import'./chunk-2AJDMNVE.js';var e=process.argv[2]??"",i=new Set(["stop-hook","prompt-hook","gemini-stop-hook","gemini-prompt-hook","codex-stop-hook","codex-prompt-hook","onboard-hook","lesson-ready"]);function c(){let o=e$1();return `devcoach ${o.version} (${f(o.where)}): `}var n=c$1(process.versions.node);n&&(i.has(e)&&process.exit(0),console.error(`${n} at ${process.execPath}. Upgrade Node, then restart.`),process.exit(1));try{if(i.has(e)){let{runHook:o}=await import('./hooks-XBVKLAJ7.js');o(e);}else {let{runCli:o}=await import('./commands-RYASSJO3.js');await o();}}catch(o){o?.name==="SchemaTooNewError"&&(console.error(o.message),process.exit(3)),console.error(c(),o),process.exit(1);}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ var e={version:"2.8.0-next.669.g6698ed3"};var s=e.version;export{s as a};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {s,t,pa,da,ea,ga,fa,D,ha,ia,la,ja,ka,ma,ra,ya,d}from'./chunk-W3MCE3EH.js';import {a}from'./chunk-CQ7BCKWT.js';import {lstatSync,mkdirSync,readFileSync,rmSync,existsSync,writeFileSync}from'fs';import {join,sep,basename}from'path';import {execFileSync}from'child_process';import st from'dns';import it from'http';import at from'https';import {isIP}from'net';var w=/^[a-z0-9-]+$/,I=t,h=class extends Error{};function tt(e){if(!w.test(e))throw new h(`Invalid course id '${e}'`)}function y(e){return tt(e),join(s,e)}function W(e){return join(y(e),I)}function B(e){let t=W(e);if(!t.startsWith(y(e)+sep))return null;try{let r=lstatSync(t);return !r.isFile()||r.size>pa?null:t}catch{return null}}function H(e){try{let t=B(e);if(t===null)return !1;let r=d(readFileSync(t,"utf8"));return r===null||Buffer.byteLength(r)>pa?!1:(writeFileSync(t,r),!0)}catch{return false}}function et(e,t){let r=ya(t,"course"),n=r;for(let o=2;ea(e,n)!==null||existsSync(join(s,n));o++)n=`${r}-${o}`;return n}function Ct(e,t){let r=new Date().toISOString(),n={id:et(e,t.title),lesson_id:t.lesson_id??null,topic_id:t.topic_id,title:t.title,goal:t.goal??null,prerequisites:t.prerequisites??[],status:"active",created_at:r,updated_at:r,completed_at:null};return da(e,n),mkdirSync(y(n.id),{recursive:true}),{...n,steps:[]}}function E(e,t){if(!w.test(t))return null;let r=ea(e,t);return r?{...r,steps:ga(e,t)}:null}function bt(e,t={}){return fa(e,t).map(r=>({...r,steps:ga(e,r.id)}))}function xt(e,t,r){return D(e,()=>{let n=E(e,t);if(!n)throw new h(`Course '${t}' not found`);let o=n.steps.length,i=r.after??o;if(!Number.isInteger(i)||i<0||i>o)throw new h(`'after' must be between 0 and ${o} (the course has ${o} steps)`);let a=B(t);if(!a)throw new h(`Course '${t}' has no document yet \u2014 write ${W(t)} first`);let f=readFileSync(a,"utf8");if(!new RegExp(`\\sid=["']${r.anchor}["']`).test(f))throw new h(`No element with id="${r.anchor}" in ${a}`);if(n.steps.some(s=>s.anchor===r.anchor))throw new h(`Step anchor '${r.anchor}' is already registered`);let l={course_id:t,position:i+1,title:r.title,kind:r.kind,anchor:r.anchor,status:"todo",done_at:null};return i<o&&ha(e,t,i+1),ia(e,l),la(e,t,new Date().toISOString()),H(t),l})}function Rt(e,t,r,n){let o=new Date().toISOString();return H(t),D(e,()=>{if(!ja(e,t,r,n,n==="done"?o:null))return null;let a=ga(e,t),f=a.length>0&&a.every(s=>s.status!=="todo"),l=ea(e,t);return l&&f&&l.status==="active"?ka(e,t,"completed",o):l&&!f&&l.status==="completed"?ka(e,t,"active",o):la(e,t,o),E(e,t)})}function _t(e,t,r){return w.test(t)&&ka(e,t,r,new Date().toISOString())?E(e,t):null}function Lt(e,t){if(!w.test(t))return false;let r=ma(e,t);return rmSync(y(t),{recursive:true,force:true}),r}function Dt(e){return {done:e.steps.filter(t=>t.status!=="todo").length,total:e.steps.length}}function C(...e){try{return execFileSync("git",e,{encoding:"utf8",timeout:3e3,stdio:["ignore","pipe","ignore"]}).trim()||null}catch{return null}}var G={"github.com":"github","gitlab.com":"gitlab","bitbucket.org":"bitbucket"};function ot(e){if(!e)return [null,null];let t=/^git@([^:]+):(.+?)(?:\.git)?$/.exec(e);if(t){let n=(t[1]??"").toLowerCase();return [t[2]??e,G[n]??"local"]}let r=/^https?:\/\/([^/]+)\/(.+?)(?:\.git)?$/.exec(e);if(r){let n=(r[1]??"").toLowerCase();return [r[2]??e,G[n]??"local"]}return [e,"local"]}function Tt(){return C("config","user.name")}function vt(){let e=process.cwd(),t=C("rev-parse","--abbrev-ref","HEAD"),r=C("rev-parse","HEAD"),n=C("remote","get-url","origin"),[o,i]=ot(n),a;return o?a=o.replace(/\/+$/,"").split("/").pop()??null:a=basename(e)||null,t==="HEAD"&&(t=null),{project:a,repository:o,branch:t,commit_hash:r,folder:e,repository_platform:i}}var j="That URL is too large to be a lesson.",b="Only public http(s) URLs can be imported.",ut=new Set([301,302,303,307,308]);function lt(e){return /^https?:\/\/\S+$/i.test(e.trim())}function z(e){let[t=0,r=0]=e.split(".").map(Number);return t===0||t===10||t===127||t===169&&r===254||t===172&&r>=16&&r<=31||t===192&&r===168||t===100&&r>=64&&r<=127||t>=224}function K(e){let t=e.replace(/^\[|\]$/g,"").replace(/%.*$/,"").toLowerCase();if(isIP(t)===4)return z(t);if(isIP(t)!==6)return true;let r=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/.exec(t);if(r?.[1])return z(r[1]);if(t==="::"||t==="::1")return true;let n=t.split(":")[0]??"";return !!(/^f[cd]/.test(n)||/^fe[89ab]/.test(n))}async function ct(e){return (await st.promises.lookup(e,{all:true})).map(r=>r.address)}async function pt(e,t){let r=e.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(r==="localhost"||r.endsWith(".localhost"))throw new ra(b);if(isIP(r)){if(K(r))throw new ra(b);return r}let n;try{n=await t(r);}catch{throw new ra("The URL could not be reached \u2014 copy the lesson text instead.")}let o=n[0];if(!o||n.some(i=>K(i)))throw new ra(b);return o}var ft=(e,t,r)=>new Promise((n,o)=>{let i=isIP(t)===6?6:4,a$1=(s,c,m)=>{c.all?m(null,[{address:t,family:i}]):m(null,t,i);},l=(e.protocol==="https:"?at:it).request(e,{method:"GET",lookup:a$1,signal:r,headers:{accept:"text/plain, text/markdown, application/json;q=0.9, */*;q=0.5","user-agent":`devcoach/${a}`}},s=>{let c=s.headers["content-length"];n({status:s.statusCode??0,location:s.headers.location??null,contentLength:c===void 0?null:Number(c),body:s,abort:()=>s.destroy()});});l.on("error",o),l.end();});async function ht(e,t){if(e.contentLength!==null&&e.contentLength>t)throw e.abort(),new ra(j);let r=[],n=0;for await(let o of e.body){if(n+=o.byteLength,n>t)throw e.abort(),new ra(j);r.push(o);}return Buffer.concat(r).toString("utf8")}async function Ft(e,t={}){let r=t.timeoutMs??5e3,n=t.maxBytes??256*1024,o=t.maxRedirects??3,i=t.lookup??ct,a=t.transport??ft;if(!lt(e))throw new ra("Only http(s) URLs can be imported.");let f=new AbortController,l=setTimeout(()=>f.abort(),r);try{let s=new URL(e.trim());for(let c=0;;c++){let m=await pt(s,i),p=await a(s,m,f.signal);if(ut.has(p.status)){if(p.abort(),!p.location||c>=o)throw new ra("The URL redirects too many times \u2014 copy the lesson text instead.");if(s=new URL(p.location,s),!/^https?:$/.test(s.protocol))throw new ra(b);continue}if(p.status<200||p.status>=300)throw p.abort(),new ra(`The URL answered ${p.status} \u2014 nothing to import there.`);return await ht(p,n)}}catch(s){if(s instanceof ra)throw s;let c=s?.name==="AbortError"?"timed out":"could not be reached";throw new ra(`The URL ${c} \u2014 copy the lesson text instead.`)}finally{clearTimeout(l);}}export{w as a,h as b,y as c,W as d,B as e,Ct as f,E as g,bt as h,xt as i,Rt as j,_t as k,Lt as l,Dt as m,Tt as n,vt as o,lt as p,Ft as q};
2
+ import {s,t,pa,da,ea,ga,fa,D,ha,ia,la,ja,ka,ma,ra,ya,d}from'./chunk-KDWNHPMS.js';import {a}from'./chunk-2AJDMNVE.js';import {lstatSync,mkdirSync,readFileSync,rmSync,existsSync,writeFileSync}from'fs';import {join,sep,basename}from'path';import {execFileSync}from'child_process';import st from'dns';import it from'http';import at from'https';import {isIP}from'net';var w=/^[a-z0-9-]+$/,I=t,h=class extends Error{};function tt(e){if(!w.test(e))throw new h(`Invalid course id '${e}'`)}function y(e){return tt(e),join(s,e)}function W(e){return join(y(e),I)}function B(e){let t=W(e);if(!t.startsWith(y(e)+sep))return null;try{let r=lstatSync(t);return !r.isFile()||r.size>pa?null:t}catch{return null}}function H(e){try{let t=B(e);if(t===null)return !1;let r=d(readFileSync(t,"utf8"));return r===null||Buffer.byteLength(r)>pa?!1:(writeFileSync(t,r),!0)}catch{return false}}function et(e,t){let r=ya(t,"course"),n=r;for(let o=2;ea(e,n)!==null||existsSync(join(s,n));o++)n=`${r}-${o}`;return n}function Ct(e,t){let r=new Date().toISOString(),n={id:et(e,t.title),lesson_id:t.lesson_id??null,topic_id:t.topic_id,title:t.title,goal:t.goal??null,prerequisites:t.prerequisites??[],status:"active",created_at:r,updated_at:r,completed_at:null};return da(e,n),mkdirSync(y(n.id),{recursive:true}),{...n,steps:[]}}function E(e,t){if(!w.test(t))return null;let r=ea(e,t);return r?{...r,steps:ga(e,t)}:null}function bt(e,t={}){return fa(e,t).map(r=>({...r,steps:ga(e,r.id)}))}function xt(e,t,r){return D(e,()=>{let n=E(e,t);if(!n)throw new h(`Course '${t}' not found`);let o=n.steps.length,i=r.after??o;if(!Number.isInteger(i)||i<0||i>o)throw new h(`'after' must be between 0 and ${o} (the course has ${o} steps)`);let a=B(t);if(!a)throw new h(`Course '${t}' has no document yet \u2014 write ${W(t)} first`);let f=readFileSync(a,"utf8");if(!new RegExp(`\\sid=["']${r.anchor}["']`).test(f))throw new h(`No element with id="${r.anchor}" in ${a}`);if(n.steps.some(s=>s.anchor===r.anchor))throw new h(`Step anchor '${r.anchor}' is already registered`);let l={course_id:t,position:i+1,title:r.title,kind:r.kind,anchor:r.anchor,status:"todo",done_at:null};return i<o&&ha(e,t,i+1),ia(e,l),la(e,t,new Date().toISOString()),H(t),l})}function Rt(e,t,r,n){let o=new Date().toISOString();return H(t),D(e,()=>{if(!ja(e,t,r,n,n==="done"?o:null))return null;let a=ga(e,t),f=a.length>0&&a.every(s=>s.status!=="todo"),l=ea(e,t);return l&&f&&l.status==="active"?ka(e,t,"completed",o):l&&!f&&l.status==="completed"?ka(e,t,"active",o):la(e,t,o),E(e,t)})}function _t(e,t,r){return w.test(t)&&ka(e,t,r,new Date().toISOString())?E(e,t):null}function Lt(e,t){if(!w.test(t))return false;let r=ma(e,t);return rmSync(y(t),{recursive:true,force:true}),r}function Dt(e){return {done:e.steps.filter(t=>t.status!=="todo").length,total:e.steps.length}}function C(...e){try{return execFileSync("git",e,{encoding:"utf8",timeout:3e3,stdio:["ignore","pipe","ignore"]}).trim()||null}catch{return null}}var G={"github.com":"github","gitlab.com":"gitlab","bitbucket.org":"bitbucket"};function ot(e){if(!e)return [null,null];let t=/^git@([^:]+):(.+?)(?:\.git)?$/.exec(e);if(t){let n=(t[1]??"").toLowerCase();return [t[2]??e,G[n]??"local"]}let r=/^https?:\/\/([^/]+)\/(.+?)(?:\.git)?$/.exec(e);if(r){let n=(r[1]??"").toLowerCase();return [r[2]??e,G[n]??"local"]}return [e,"local"]}function Tt(){return C("config","user.name")}function vt(){let e=process.cwd(),t=C("rev-parse","--abbrev-ref","HEAD"),r=C("rev-parse","HEAD"),n=C("remote","get-url","origin"),[o,i]=ot(n),a;return o?a=o.replace(/\/+$/,"").split("/").pop()??null:a=basename(e)||null,t==="HEAD"&&(t=null),{project:a,repository:o,branch:t,commit_hash:r,folder:e,repository_platform:i}}var j="That URL is too large to be a lesson.",b="Only public http(s) URLs can be imported.",ut=new Set([301,302,303,307,308]);function lt(e){return /^https?:\/\/\S+$/i.test(e.trim())}function z(e){let[t=0,r=0]=e.split(".").map(Number);return t===0||t===10||t===127||t===169&&r===254||t===172&&r>=16&&r<=31||t===192&&r===168||t===100&&r>=64&&r<=127||t>=224}function K(e){let t=e.replace(/^\[|\]$/g,"").replace(/%.*$/,"").toLowerCase();if(isIP(t)===4)return z(t);if(isIP(t)!==6)return true;let r=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/.exec(t);if(r?.[1])return z(r[1]);if(t==="::"||t==="::1")return true;let n=t.split(":")[0]??"";return !!(/^f[cd]/.test(n)||/^fe[89ab]/.test(n))}async function ct(e){return (await st.promises.lookup(e,{all:true})).map(r=>r.address)}async function pt(e,t){let r=e.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(r==="localhost"||r.endsWith(".localhost"))throw new ra(b);if(isIP(r)){if(K(r))throw new ra(b);return r}let n;try{n=await t(r);}catch{throw new ra("The URL could not be reached \u2014 copy the lesson text instead.")}let o=n[0];if(!o||n.some(i=>K(i)))throw new ra(b);return o}var ft=(e,t,r)=>new Promise((n,o)=>{let i=isIP(t)===6?6:4,a$1=(s,c,m)=>{c.all?m(null,[{address:t,family:i}]):m(null,t,i);},l=(e.protocol==="https:"?at:it).request(e,{method:"GET",lookup:a$1,signal:r,headers:{accept:"text/plain, text/markdown, application/json;q=0.9, */*;q=0.5","user-agent":`devcoach/${a}`}},s=>{let c=s.headers["content-length"];n({status:s.statusCode??0,location:s.headers.location??null,contentLength:c===void 0?null:Number(c),body:s,abort:()=>s.destroy()});});l.on("error",o),l.end();});async function ht(e,t){if(e.contentLength!==null&&e.contentLength>t)throw e.abort(),new ra(j);let r=[],n=0;for await(let o of e.body){if(n+=o.byteLength,n>t)throw e.abort(),new ra(j);r.push(o);}return Buffer.concat(r).toString("utf8")}async function Ft(e,t={}){let r=t.timeoutMs??5e3,n=t.maxBytes??256*1024,o=t.maxRedirects??3,i=t.lookup??ct,a=t.transport??ft;if(!lt(e))throw new ra("Only http(s) URLs can be imported.");let f=new AbortController,l=setTimeout(()=>f.abort(),r);try{let s=new URL(e.trim());for(let c=0;;c++){let m=await pt(s,i),p=await a(s,m,f.signal);if(ut.has(p.status)){if(p.abort(),!p.location||c>=o)throw new ra("The URL redirects too many times \u2014 copy the lesson text instead.");if(s=new URL(p.location,s),!/^https?:$/.test(s.protocol))throw new ra(b);continue}if(p.status<200||p.status>=300)throw p.abort(),new ra(`The URL answered ${p.status} \u2014 nothing to import there.`);return await ht(p,n)}}catch(s){if(s instanceof ra)throw s;let c=s?.name==="AbortError"?"timed out":"could not be reached";throw new ra(`The URL ${c} \u2014 copy the lesson text instead.`)}finally{clearTimeout(l);}}export{w as a,h as b,y as c,W as d,B as e,Ct as f,E as g,bt as h,xt as i,Rt as j,_t as k,Lt as l,Dt as m,Tt as n,vt as o,lt as p,Ft as q};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import {a as a$1}from'./chunk-CQ7BCKWT.js';import {realpathSync}from'fs';import {homedir}from'os';import {fileURLToPath}from'url';var a=24;function c(n,e=process.platform){let t=n.replace(/\\/g,"/");return e==="win32"?t.toLowerCase():t}var g=[["nvm",/\/\.nvm\/versions\/node\/(v?[\d.]+[^/]*)\//],["nvm-windows",/\/appdata\/roaming\/nvm\/(v?[\d.]+[^/]*)\//],["fnm",/\/fnm\/node-versions\/(v?[\d.]+[^/]*)\//],["volta",/\/\.volta\/tools\/image\/node\/(v?[\d.]+[^/]*)\//],["volta",/\/volta\/tools\/image\/node\/(v?[\d.]+[^/]*)\//],["asdf",/\/\.asdf\/installs\/nodejs\/(v?[\d.]+[^/]*)\//],["mise",/\/mise\/installs\/node\/(v?[\d.]+[^/]*)\//],["n",/\/n\/versions\/node\/(v?[\d.]+[^/]*)\//]];function u(n){for(let[e,t]of g){let r=t.exec(n);if(r?.[1])return {manager:e,boundTo:r[1].startsWith("v")?r[1]:`v${r[1]}`}}return null}function p(n){let e=n.toLowerCase();return e.includes("/.claude/plugins/data/")||e.includes("/.claude/plugins/cache/")?"claude-plugin":e.includes("/.devcoach/gemini-ext/")?"gemini-extension":e.includes("/claude extensions/")?"claude-desktop-extension":e.includes("/_npx/")?"npx":e.includes("/cellar/devcoach/")?"homebrew":e.includes("/node_modules/devcoach/")?"npm-global":/\/(src\/core\/runtime\.ts|src\/bin\.ts|dist\/[^/]+\.js)$/.test(e)?"source":"unknown"}function h(n,e=process.platform){let t=c(n,e),r=u(t),o=t.toLowerCase();return {channel:p(t),manager:r?.manager??(o.includes("/fnm_multishells/")?"fnm":null),boundTo:r?.boundTo??null,ephemeral:o.includes("/_npx/")||o.includes("/fnm_multishells/")}}function v(n,e=process.platform){let t=c(n,e),r=t.toLowerCase(),o=u(t);return o?o.manager:r.includes("/fnm_multishells/")?"fnm":r.includes("/.volta/")||r.includes("/volta/")?"volta":r.includes("/cellar/node")||r.includes("/opt/homebrew/")||r.includes("/linuxbrew/")||r.startsWith("/usr/local/opt/node")?"homebrew":r.startsWith("/usr/bin/")||r.startsWith("/usr/local/bin/")||r.includes("/program files/nodejs/")||r.startsWith("/snap/")?"system":"unknown"}function R(n){return Number.parseInt(n.split(".")[0]??"0",10)>=a?null:`devcoach ${a$1} needs Node ${a} or newer (it uses the built-in node:sqlite); this is Node ${n}`}function x(n,e=homedir(),t=process.platform){if(!e)return n;let r=t==="win32"?"\\":"/",o=t==="win32"?"%USERPROFILE%":"~";return t==="win32"?n.toLowerCase()===e.toLowerCase()?o:n.toLowerCase().startsWith(`${e.toLowerCase()}${r}`)?o+n.slice(e.length):n:n===e?o:n.startsWith(`${e}${r}`)?o+n.slice(e.length):n}function w(n){try{return realpathSync(n)}catch{return n}}function y(n={}){let e=n.platform??process.platform,t=n.execPath??process.execPath,r=n.codePath??w(fileURLToPath(import.meta.url)),o=/^(.*)[/\\](?:dist[/\\][^/\\]+\.js|src[/\\]core[/\\]runtime\.ts)$/.exec(r)?.[1];return {version:a$1,node:n.nodeVersion??process.versions.node,execPath:t,nodeManager:v(t,e),entry:o??r,where:h(r,e)}}function b(n){let e=[n.channel];return n.boundTo&&e.push(`bound to Node ${n.boundTo} (${n.manager})`),n.ephemeral&&e.push("temporary location"),e.join(", ")}function M(n,e,t=[],r=homedir(),o=process.platform){let i=d=>x(d,r,o);return [`devcoach ${e.version} ${n}`,`node ${e.node} via ${e.nodeManager} (${i(e.execPath)})`,`${b(e.where)} (${i(e.entry)})`,...t].join(" \xB7 ")}
2
+ import {a as a$1}from'./chunk-2AJDMNVE.js';import {realpathSync}from'fs';import {homedir}from'os';import {fileURLToPath}from'url';var a=24;function c(n,e=process.platform){let t=n.replace(/\\/g,"/");return e==="win32"?t.toLowerCase():t}var g=[["nvm",/\/\.nvm\/versions\/node\/(v?[\d.]+[^/]*)\//],["nvm-windows",/\/appdata\/roaming\/nvm\/(v?[\d.]+[^/]*)\//],["fnm",/\/fnm\/node-versions\/(v?[\d.]+[^/]*)\//],["volta",/\/\.volta\/tools\/image\/node\/(v?[\d.]+[^/]*)\//],["volta",/\/volta\/tools\/image\/node\/(v?[\d.]+[^/]*)\//],["asdf",/\/\.asdf\/installs\/nodejs\/(v?[\d.]+[^/]*)\//],["mise",/\/mise\/installs\/node\/(v?[\d.]+[^/]*)\//],["n",/\/n\/versions\/node\/(v?[\d.]+[^/]*)\//]];function u(n){for(let[e,t]of g){let r=t.exec(n);if(r?.[1])return {manager:e,boundTo:r[1].startsWith("v")?r[1]:`v${r[1]}`}}return null}function p(n){let e=n.toLowerCase();return e.includes("/.claude/plugins/data/")||e.includes("/.claude/plugins/cache/")?"claude-plugin":e.includes("/.devcoach/gemini-ext/")?"gemini-extension":e.includes("/claude extensions/")?"claude-desktop-extension":e.includes("/_npx/")?"npx":e.includes("/cellar/devcoach/")?"homebrew":e.includes("/node_modules/devcoach/")?"npm-global":/\/(src\/core\/runtime\.ts|src\/bin\.ts|dist\/[^/]+\.js)$/.test(e)?"source":"unknown"}function h(n,e=process.platform){let t=c(n,e),r=u(t),o=t.toLowerCase();return {channel:p(t),manager:r?.manager??(o.includes("/fnm_multishells/")?"fnm":null),boundTo:r?.boundTo??null,ephemeral:o.includes("/_npx/")||o.includes("/fnm_multishells/")}}function v(n,e=process.platform){let t=c(n,e),r=t.toLowerCase(),o=u(t);return o?o.manager:r.includes("/fnm_multishells/")?"fnm":r.includes("/.volta/")||r.includes("/volta/")?"volta":r.includes("/cellar/node")||r.includes("/opt/homebrew/")||r.includes("/linuxbrew/")||r.startsWith("/usr/local/opt/node")?"homebrew":r.startsWith("/usr/bin/")||r.startsWith("/usr/local/bin/")||r.includes("/program files/nodejs/")||r.startsWith("/snap/")?"system":"unknown"}function R(n){return Number.parseInt(n.split(".")[0]??"0",10)>=a?null:`devcoach ${a$1} needs Node ${a} or newer (it uses the built-in node:sqlite); this is Node ${n}`}function x(n,e=homedir(),t=process.platform){if(!e)return n;let r=t==="win32"?"\\":"/",o=t==="win32"?"%USERPROFILE%":"~";return t==="win32"?n.toLowerCase()===e.toLowerCase()?o:n.toLowerCase().startsWith(`${e.toLowerCase()}${r}`)?o+n.slice(e.length):n:n===e?o:n.startsWith(`${e}${r}`)?o+n.slice(e.length):n}function w(n){try{return realpathSync(n)}catch{return n}}function y(n={}){let e=n.platform??process.platform,t=n.execPath??process.execPath,r=n.codePath??w(fileURLToPath(import.meta.url)),o=/^(.*)[/\\](?:dist[/\\][^/\\]+\.js|src[/\\]core[/\\]runtime\.ts)$/.exec(r)?.[1];return {version:a$1,node:n.nodeVersion??process.versions.node,execPath:t,nodeManager:v(t,e),entry:o??r,where:h(r,e)}}function b(n){let e=[n.channel];return n.boundTo&&e.push(`bound to Node ${n.boundTo} (${n.manager})`),n.ephemeral&&e.push("temporary location"),e.join(", ")}function M(n,e,t=[],r=homedir(),o=process.platform){let i=d=>x(d,r,o);return [`devcoach ${e.version} ${n}`,`node ${e.node} via ${e.nodeManager} (${i(e.execPath)})`,`${b(e.where)} (${i(e.entry)})`,...t].join(" \xB7 ")}
3
3
  export{a,h as b,R as c,x as d,y as e,b as f,M as g};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a}from'./chunk-CQ7BCKWT.js';import {readFileSync,existsSync,lstatSync,mkdirSync,writeFileSync}from'fs';import {dirname,join}from'path';import {fileURLToPath}from'url';import {z as z$1}from'zod';import {createRequire}from'module';import {homedir}from'os';import {strToU8,zipSync,unzipSync,deflateSync,strFromU8,Inflate}from'fflate';var lt=dirname(fileURLToPath(import.meta.url)),ut='<script data-devcoach="highlighter"></script>',Ee=/<script data-devcoach="highlighter">\s*<\/script>/,pt=/<script data-devcoach="highlighter">\s*(?!<\/script>)\S/;function dt(){for(let e of ["../assets","../../assets"]){let t=join(lt,e,"static","vendor");if(existsSync(join(t,"highlight.min.js")))return t}return null}var _e={light:{keyword:"#0033b3",string:"#067d17",comment:"#5f6672",number:"#1750eb",title:"#00627a",type:"#871094",attr:"#374151",meta:"#7a6a00"},dark:{keyword:"#cf8e6d",string:"#6aab73",comment:"#8b8f96",number:"#2aacb8",title:"#56a8f5",type:"#c77dbb",attr:"#bcbec4",meta:"#b3ae60"}};function Se(e){return Object.entries(e).map(([t,n])=>`--syn-${t}:${n}`).join(";")}function mt(){let e=Se(_e.light),t=Se(_e.dark);return [`:where(:root){${e}}`,`@media (prefers-color-scheme: dark){:where(:root:not([data-theme="light"])){${t}}}`,`:where(:root[data-theme="dark"]){${t}}`,"pre code.hljs{display:block;background:transparent;color:inherit;padding:0}",".hljs-comment,.hljs-quote{color:var(--syn-comment);font-style:italic}",".hljs-keyword,.hljs-selector-tag,.hljs-literal,.hljs-doctag{color:var(--syn-keyword)}",".hljs-string,.hljs-regexp,.hljs-addition,.hljs-selector-attr,.hljs-selector-pseudo{color:var(--syn-string)}",".hljs-number,.hljs-symbol,.hljs-bullet,.hljs-link{color:var(--syn-number)}",".hljs-title,.hljs-section,.hljs-name,.hljs-selector-id,.hljs-selector-class{color:var(--syn-title)}",".hljs-type,.hljs-built_in,.hljs-title.class_,.hljs-tag{color:var(--syn-type)}",".hljs-attr,.hljs-attribute,.hljs-variable,.hljs-template-variable,.hljs-property,.hljs-params{color:var(--syn-attr)}",".hljs-meta,.hljs-deletion,.hljs-subst{color:var(--syn-meta)}",".hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold}"].join("")}var gt=';(function(){function run(){hljs.configure({ignoreUnescapedHTML:true});document.querySelectorAll("pre code").forEach(function(el){if(el.dataset.highlighted||el.classList.contains("nohighlight"))return;hljs.highlightElement(el);});}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",run);else run();})();',T;function ye(){if(T!==void 0)return T;T=null;try{let e=dt();if(e===null)return T;let t=readFileSync(join(e,"highlight.min.js"),"utf8"),n=readFileSync(join(e,"highlight.LICENSE.txt"),"utf8").trim();if(/<\/script/i.test(t)||n.includes("*/"))return T;T=`<style data-devcoach="highlighter">${mt()}</style>
2
+ import {a}from'./chunk-2AJDMNVE.js';import {readFileSync,existsSync,lstatSync,mkdirSync,writeFileSync}from'fs';import {dirname,join}from'path';import {fileURLToPath}from'url';import {z as z$1}from'zod';import {createRequire}from'module';import {homedir}from'os';import {strToU8,zipSync,unzipSync,deflateSync,strFromU8,Inflate}from'fflate';var lt=dirname(fileURLToPath(import.meta.url)),ut='<script data-devcoach="highlighter"></script>',Ee=/<script data-devcoach="highlighter">\s*<\/script>/,pt=/<script data-devcoach="highlighter">\s*(?!<\/script>)\S/;function dt(){for(let e of ["../assets","../../assets"]){let t=join(lt,e,"static","vendor");if(existsSync(join(t,"highlight.min.js")))return t}return null}var _e={light:{keyword:"#0033b3",string:"#067d17",comment:"#5f6672",number:"#1750eb",title:"#00627a",type:"#871094",attr:"#374151",meta:"#7a6a00"},dark:{keyword:"#cf8e6d",string:"#6aab73",comment:"#8b8f96",number:"#2aacb8",title:"#56a8f5",type:"#c77dbb",attr:"#bcbec4",meta:"#b3ae60"}};function Se(e){return Object.entries(e).map(([t,n])=>`--syn-${t}:${n}`).join(";")}function mt(){let e=Se(_e.light),t=Se(_e.dark);return [`:where(:root){${e}}`,`@media (prefers-color-scheme: dark){:where(:root:not([data-theme="light"])){${t}}}`,`:where(:root[data-theme="dark"]){${t}}`,"pre code.hljs{display:block;background:transparent;color:inherit;padding:0}",".hljs-comment,.hljs-quote{color:var(--syn-comment);font-style:italic}",".hljs-keyword,.hljs-selector-tag,.hljs-literal,.hljs-doctag{color:var(--syn-keyword)}",".hljs-string,.hljs-regexp,.hljs-addition,.hljs-selector-attr,.hljs-selector-pseudo{color:var(--syn-string)}",".hljs-number,.hljs-symbol,.hljs-bullet,.hljs-link{color:var(--syn-number)}",".hljs-title,.hljs-section,.hljs-name,.hljs-selector-id,.hljs-selector-class{color:var(--syn-title)}",".hljs-type,.hljs-built_in,.hljs-title.class_,.hljs-tag{color:var(--syn-type)}",".hljs-attr,.hljs-attribute,.hljs-variable,.hljs-template-variable,.hljs-property,.hljs-params{color:var(--syn-attr)}",".hljs-meta,.hljs-deletion,.hljs-subst{color:var(--syn-meta)}",".hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold}"].join("")}var gt=';(function(){function run(){hljs.configure({ignoreUnescapedHTML:true});document.querySelectorAll("pre code").forEach(function(el){if(el.dataset.highlighted||el.classList.contains("nohighlight"))return;hljs.highlightElement(el);});}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",run);else run();})();',T;function ye(){if(T!==void 0)return T;T=null;try{let e=dt();if(e===null)return T;let t=readFileSync(join(e,"highlight.min.js"),"utf8"),n=readFileSync(join(e,"highlight.LICENSE.txt"),"utf8").trim();if(/<\/script/i.test(t)||n.includes("*/"))return T;T=`<style data-devcoach="highlighter">${mt()}</style>
3
3
  <script data-devcoach="highlighter">/*
4
4
  Syntax highlighting by highlight.js, inlined by devcoach.
5
5
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {q,E as E$1,A,ba,na,Ja,p,D,Ia}from'./chunk-W3MCE3EH.js';import {existsSync,mkdirSync,statSync,writeFileSync,appendFileSync,fstatSync,readFileSync}from'fs';import {join}from'path';function N(e){try{let o=JSON.parse(e);return {stop_hook_active:o?.stop_hook_active===!0,permission_mode:typeof o?.permission_mode=="string"?o.permission_mode:null,session_id:typeof o?.session_id=="string"?o.session_id:null}}catch{return {stop_hook_active:false,permission_mode:null,session_id:null}}}function l(){let e={stop_hook_active:false,permission_mode:null,session_id:null};try{let o=fstatSync(0);return !o.isFIFO()&&!o.isFile()&&!o.isSocket()?e:N(readFileSync(0,"utf8"))}catch{return e}}function $(e){return e.stop_hook_active||e.permission_mode==="plan"}function s(e,o,t){if(process.env.DEVCOACH_HOOK_DEBUG==="1")try{mkdirSync(p,{recursive:!0});let n=join(p,"hook.log");existsSync(n)&&statSync(n).size>256*1024&&writeFileSync(n,""),appendFileSync(n,`${new Date().toISOString()} ${e} ${(o??"-").slice(0,8)} ${t}
2
+ import {q,E as E$1,A,ba,na,Ja,p,D,Ia}from'./chunk-KDWNHPMS.js';import {existsSync,mkdirSync,statSync,writeFileSync,appendFileSync,fstatSync,readFileSync}from'fs';import {join}from'path';function N(e){try{let o=JSON.parse(e);return {stop_hook_active:o?.stop_hook_active===!0,permission_mode:typeof o?.permission_mode=="string"?o.permission_mode:null,session_id:typeof o?.session_id=="string"?o.session_id:null}}catch{return {stop_hook_active:false,permission_mode:null,session_id:null}}}function l(){let e={stop_hook_active:false,permission_mode:null,session_id:null};try{let o=fstatSync(0);return !o.isFIFO()&&!o.isFile()&&!o.isSocket()?e:N(readFileSync(0,"utf8"))}catch{return e}}function $(e){return e.stop_hook_active||e.permission_mode==="plan"}function s(e,o,t){if(process.env.DEVCOACH_HOOK_DEBUG==="1")try{mkdirSync(p,{recursive:!0});let n=join(p,"hook.log");existsSync(n)&&statSync(n).size>256*1024&&writeFileSync(n,""),appendFileSync(n,`${new Date().toISOString()} ${e} ${(o??"-").slice(0,8)} ${t}
3
3
  `);}catch{}}var E={claude:"block",gemini:"deny",codex:"block"};function u(e,o,t){let n={decision:E[e],reason:o};t&&(n.systemMessage=t),process.stdout.write(`${JSON.stringify(n)}
4
4
  `),process.exit(0);}var g="devcoach: the user has no coaching profile yet. Ask them how they want to set it up and STRONGLY recommend Automatic \u2014 devcoach scans their full Claude Code history across all their projects (call get_onboarding for the detected stack and per-project evidence) so the profile reflects what they actually build. Also offer Guided (a short conversation to map topics and confidence levels) and Import (restore from a backup), but lead with Automatic; do not pick for them. After they choose, build the profile and save it by calling the devcoach `complete_onboarding` MCP tool (not a shell command) before ending your turn.";function I(e=l()){if($(e)&&process.exit(0),existsSync(q)){let o;try{o=E$1(t=>A(t)!==null||ba(t).knowledge_ready);}catch(t){s("onboard-hook",e.session_id,`error: ${t}`),process.exit(0);}o&&process.exit(0);}s("onboard-hook",e.session_id,"onboarding cue"),u("claude",g);}var a=10,w={claude:{cue:"Invoke the `devcoach` skill (Skill tool)",prime:"invoke the `devcoach` skill (Skill tool)"},gemini:{cue:"Activate the `devcoach` skill (activate_skill tool)",prime:"activate the `devcoach` skill (activate_skill tool)"},codex:{cue:"Activate the `devcoach` skill",prime:"activate the `devcoach` skill"}};function T(e,o="claude"){let t=e%a===0,n=Math.ceil(e/a)*a,i=t?`This is lesson #${e} \u2014 a notebook checkpoint (every ${a} lessons): after log_lesson returns the feedback, also read references/calibration.md in the devcoach skill and run its notebook-update step (a direct file write), recording "(updated after ${e} lessons)".`:`Skip the notebook update this time \u2014 it is refreshed only every ${a} lessons (next checkpoint at lesson #${n}).`;return `devcoach: a lesson is due for the technical work just completed. Do it now \u2014 do not acknowledge this message and do not explain what you are about to do.
5
5
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {e,g,b,d as d$1}from'./chunk-R7QSRQIE.js';export{c as buildLessonCue,d as cmdLessonReady,b as cmdOnboardHook,g as cmdPromptHook,e as cmdStopHook,a as parseHookPayload}from'./chunk-R7QSRQIE.js';import {a as a$1,d as d$2,e as e$1,g as g$2,b as b$2,f as f$1}from'./chunk-QU6UQJWC.js';import {c as c$1,b as b$1,a as a$2,e as e$4,f as f$2}from'./chunk-MRABMPXO.js';import {e as e$3,f,b as b$3,a as a$3}from'./chunk-TIINFPAX.js';import {h,m,g as g$1,e as e$2,d as d$3,n,o,p as p$1,q as q$1}from'./chunk-MBQ2MDBS.js';import {E,A as A$1,Ca,H as H$1,O,K,I as I$1,Ea,X,ta,Y,w,sa,za,Aa,xa,wa,ua,Ga,ra,Ba,Fa,v,R,V as V$1,S,T,U as U$1,W,oa,Q,L,r,qa,p,q,y,B as B$1,x,ba,Z,$,Ja}from'./chunk-W3MCE3EH.js';import {a}from'./chunk-CQ7BCKWT.js';import {spawn,spawnSync,execFileSync}from'child_process';import {writeFileSync,existsSync,readFileSync,rmSync,mkdirSync,realpathSync,openSync,readSync,closeSync,statSync,accessSync,constants}from'fs';import {createInterface}from'readline/promises';import {text}from'stream/consumers';import {Command}from'commander';import {homedir,platform}from'os';import {join,dirname}from'path';var j=e=>e==="win32",oe=e=>e.includes("/")||e.includes("\\");function pt(e,o){return e.endsWith("/")||e.endsWith("\\")?e+o:`${e}${e.includes("\\")&&!e.includes("/")?"\\":"/"}${o}`}function Ao(e,o){try{return statSync(e).isFile()?(j(o)||accessSync(e,constants.X_OK),!0):!1}catch{return false}}function B(e,o={}){let n=o.platform??process.platform,r=j(n)?/\.[a-z0-9]+$/i.test(e)?[""]:(o.pathext??process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean).map(i=>i.toLowerCase()):[""];if(oe(e)){for(let i of r)if(Ao(e+i,n))return e+i;return null}let s=o.path??process.env.PATH??"";for(let i of s.split(j(n)?";":":"))if(i)for(let l of r){let a=pt(i,e+l);if(Ao(a,n))return a}return null}function gt(e){let o=null;try{o=openSync(e,"r");let n=Buffer.alloc(256),r=readSync(o,n,0,n.length,0),s=n.subarray(0,r).toString("utf8");return s.startsWith("#!")&&s.slice(2).split(/\r?\n/)[0]?.trim()||null}catch{return null}finally{o!==null&&closeSync(o);}}var Ho={command:"npx",args:["-y","devcoach","mcp"]};function Ro(e){let{hit:o,entry:n,execPath:r,platform:s}=e;if(!o)return Ho;let i=b$3(j(s)?n:o,s);if(i.ephemeral||b$3(n,s).ephemeral)return Ho;let l=i.boundTo?`bound to Node ${i.boundTo} (${i.manager}) \u2014 after removing or switching that version, run \`devcoach install --force\` again`:void 0;return j(s)?{command:r,args:[n,"mcp"],note:l}:{command:o,args:["mcp"],note:l}}function Mo(e=process.platform,o=process.env,n=homedir()){if(e==="darwin")return join(n,"Library","Logs","Claude","mcp-server-devcoach.log");if(e==="win32"){let r=o.APPDATA??join(n,"AppData","Roaming");return join(r,"Claude","logs","mcp-server-devcoach.log")}return join(o.XDG_CONFIG_HOME??join(n,".config"),"Claude","logs","mcp-server-devcoach.log")}function To(e,o=process.platform){let n=e.split(/\r?\n/),r=null;for(let i=n.length-1;i>=0&&r===null;i--){if(!/Using MCP server command:/.test(n[i]??""))continue;let l=[];for(let a=i+1;a<n.length&&a<i+80;a++){let u=n[a]??"";if(/\[length\]:/.test(u)||/^\S/.test(u))break;let g=/^\s*'(.+)',?\s*$/.exec(u);g?.[1]&&l.push(g[1].replace(/\\\\/g,"\\"));}l.length&&(r=l.join(j(o)?";":":"));}let s=null;for(let i=n.length-1;i>=0&&s===null;i--){let l=n[i]??"";if(/^Failed to spawn process/.test(l))s=l.trim();else if(/\[error\]/.test(l)){let a=(n[i-1]??"").trim();s=/^Failed to spawn process/.test(a)?a:l.replace(/\s*\{ metadata:.*$/,"").replace(/^\S+Z \[devcoach\] \[error\] /,"").trim();}}return {path:r,lastError:s}}function ft(e,o){let n=spawnSync(e,o,{encoding:"utf8",timeout:5e3,shell:process.platform==="win32"&&/\.(cmd|bat)$/i.test(e)});return n.status===0?(n.stdout??"").trim():null}var ye="`Failed to spawn process: No such file or directory`";function we(e,o){let n=o.platform??process.platform,r=o.run??ft,s=[],{command:i}=e,l=e.args??[];if(i==="npx")return s.push({level:"warn",text:"starts via `npx -y devcoach` \u2014 needs the npx cache (or the network) at every start"}),s;let a$1=B(i,{...o,platform:n});if(!a$1)return s.push({level:"bad",text:`\`${i}\` is not found ${oe(i)?"":`on ${o.pathSource} `}\u2014 the host fails with ${ye}. Reinstall devcoach, then run \`devcoach install --force\``}),s;s.push({level:"ok",text:`command resolves to ${a$1}${oe(i)?"":` on ${o.pathSource}`}`}),oe(i)||s.push({level:"warn",text:"bare name \u2014 the host resolves it on its own PATH, which can differ from your shell's; `devcoach install --force` writes an absolute path"});let u=/(^|[/\\])node(\.exe)?$/i.test(a$1),g=u?l[0]:a$1;if(u&&(!g||!existsSync(g)))return s.push({level:"bad",text:`devcoach's script ${g??"(missing)"} does not exist`}),s;let p=b$3(g??a$1,n);p.ephemeral?s.push({level:"bad",text:"lives in a temporary location (npx cache or an fnm shell) \u2014 it will disappear; run `devcoach install --force`"}):p.boundTo&&s.push({level:"warn",text:`bound to Node ${p.boundTo} (${p.manager}) \u2014 removing or switching that version breaks it with ${ye}; run \`devcoach install --force\` after`});let m=u?a$1:null;if(!u&&/\.(cmd|bat)$/i.test(a$1)){if(m=B("node",{...o,platform:n}),!m)return s.push({level:"bad",text:`the \`${a$1}\` shim needs \`node\`, not found on ${o.pathSource}`}),s}else if(!u){let f=gt(a$1);if(f){let[k,...y]=f.split(/\s+/),S=/(^|\/)env$/.test(k??""),O=S?y.find(K=>!K.startsWith("-")):k;if(m=O?S?B(O,{...o,platform:n}):O:null,!m||!S&&!existsSync(m))return s.push({level:"bad",text:S?`its \`#!${f}\` finds no \`${O}\` on ${o.pathSource} \u2014 the host fails before devcoach starts`:`its interpreter ${O} does not exist \u2014 the host fails with ${ye}. Reinstall that Node (e.g. \`brew install node\`) or devcoach`}),s}}if(m){let f=r(m,["--version"]),k=f?Number.parseInt(f.replace(/^v/,"").split(".")[0]??"0",10):null;k!==null&&k<a$3?s.push({level:"bad",text:`runs on Node ${f} (${m}) \u2014 devcoach needs Node ${a$3} or newer`}):f&&s.push({level:"ok",text:`runs on Node ${f.replace(/^v/,"")} (${m})`});}let $=(u?r(a$1,[g,"--version"]):r(a$1,["--version"]))?.match(/(\d+\.\d+\.\d+[^\s]*)/)?.[1]??null;return $?$!==a?s.push({level:"warn",text:`it runs devcoach ${$}; this doctor is ${a}`}):s.push({level:"ok",text:`it runs devcoach ${$}`}):s.push({level:"warn",text:"could not run it to read its version"}),s}var c=(e="")=>{console.log(e);};function se(){let e=platform();if(e==="darwin")return join(homedir(),"Library","Application Support","Claude","claude_desktop_config.json");if(e==="win32"){let n=process.env.APPDATA??join(homedir(),"AppData","Roaming");return join(n,"Claude","claude_desktop_config.json")}let o=process.env.XDG_CONFIG_HOME??join(homedir(),".config");return join(o,"Claude","claude_desktop_config.json")}var N=join(homedir(),".claude","settings.json"),ie=join(homedir(),".claude","skills","devcoach"),De=join(homedir(),".gemini"),I=join(De,"settings.json"),yt=join(De,"extensions","devcoach","gemini-extension.json"),Ie=join(homedir(),".codex"),A=join(Ie,"hooks.json"),ne=join(Ie,"config.toml"),H=join(homedir(),".agents","skills","devcoach"),Oe=e=>B(e),Ne=e=>Oe(e)!==null;function wt(){try{return realpathSync(process.argv[1]??"")}catch{return process.argv[1]??""}}function Uo(){return Ro({hit:Oe("devcoach"),entry:wt(),execPath:process.execPath,platform:process.platform})}function Ee(){let e=Oe("devcoach");return !e||e.includes("/_npx/")||e.includes("\\_npx\\")?"npx -y devcoach":e.includes("fnm_multishells")?"devcoach":e.includes(" ")?`"${e}"`:e}function jo(e,o,n){if(!Ne(e))return "";n&&spawnSync(e,n,{encoding:"utf8"});let r=spawnSync(e,o,{encoding:"utf8"});return r.status===0?`${a$1.green("\u2713")} Registered via \`${e} mcp add\``:`${r.stderr??""}${r.stdout??""}`.toLowerCase().includes("already")?`${a$1.yellow("Already registered")} in ${e} (use --force to overwrite)`:`${a$1.red(`${e} mcp add failed:`)} ${(r.stderr||r.stdout||"").trim()}`}function Ct(e,o){if(!Ne("claude"))return "";o&&spawnSync("claude",["mcp","remove","--scope",e,"devcoach"],{encoding:"utf8"});let n=Uo(),r=spawnSync("claude",["mcp","add","--scope",e,"devcoach",n.command,"--",...n.args],{encoding:"utf8"});return r.status===0?`${a$1.green("\u2713")} Registered via \`claude mcp add\` (scope: ${e})`:`${r.stderr??""}${r.stdout??""}`.toLowerCase().includes("already")?`${a$1.yellow("Already registered")} in Claude Code (use --force to overwrite)`:`${a$1.red("claude mcp add failed:")} ${(r.stderr||r.stdout||"").trim()}`}function C(e){if(!existsSync(e))return {ok:true,data:{}};try{return {ok:!0,data:JSON.parse(readFileSync(e,"utf8"))??{}}}catch{return {ok:false,error:`${a$1.red("\u2717")} ${e} is not valid JSON \u2014 fix it and re-run (left unchanged)`}}}function Ce(e,o,n){let r=C(e);if(!r.ok)return r.error;let s=r.data;s.mcpServers??={};let i=s.mcpServers;return i.devcoach&&!n?`${a$1.yellow("Already registered")} in ${e} (use --force to overwrite)`:(i.devcoach=o,mkdirSync(dirname(e),{recursive:true}),writeFileSync(e,`${JSON.stringify(s,null,2)}
2
+ import {e,g,b,d as d$1}from'./chunk-Z2O2ZD6C.js';export{c as buildLessonCue,d as cmdLessonReady,b as cmdOnboardHook,g as cmdPromptHook,e as cmdStopHook,a as parseHookPayload}from'./chunk-Z2O2ZD6C.js';import {a as a$1,d as d$2,e as e$1,g as g$2,b as b$2,f as f$1}from'./chunk-QU6UQJWC.js';import {c as c$1,b as b$1,a as a$2,e as e$4,f as f$2}from'./chunk-MRABMPXO.js';import {e as e$3,f,b as b$3,a as a$3}from'./chunk-JWDQGP6O.js';import {h,m,g as g$1,e as e$2,d as d$3,n,o,p as p$1,q as q$1}from'./chunk-DZKBVY27.js';import {E,A as A$1,Ca,H as H$1,O,K,I as I$1,Ea,X,ta,Y,w,sa,za,Aa,xa,wa,ua,Ga,ra,Ba,Fa,v,R,V as V$1,S,T,U as U$1,W,oa,Q,L,r,qa,p,q,y,B as B$1,x,ba,Z,$,Ja}from'./chunk-KDWNHPMS.js';import {a}from'./chunk-2AJDMNVE.js';import {spawn,spawnSync,execFileSync}from'child_process';import {writeFileSync,existsSync,readFileSync,rmSync,mkdirSync,realpathSync,openSync,readSync,closeSync,statSync,accessSync,constants}from'fs';import {createInterface}from'readline/promises';import {text}from'stream/consumers';import {Command}from'commander';import {homedir,platform}from'os';import {join,dirname}from'path';var j=e=>e==="win32",oe=e=>e.includes("/")||e.includes("\\");function pt(e,o){return e.endsWith("/")||e.endsWith("\\")?e+o:`${e}${e.includes("\\")&&!e.includes("/")?"\\":"/"}${o}`}function Ao(e,o){try{return statSync(e).isFile()?(j(o)||accessSync(e,constants.X_OK),!0):!1}catch{return false}}function B(e,o={}){let n=o.platform??process.platform,r=j(n)?/\.[a-z0-9]+$/i.test(e)?[""]:(o.pathext??process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean).map(i=>i.toLowerCase()):[""];if(oe(e)){for(let i of r)if(Ao(e+i,n))return e+i;return null}let s=o.path??process.env.PATH??"";for(let i of s.split(j(n)?";":":"))if(i)for(let l of r){let a=pt(i,e+l);if(Ao(a,n))return a}return null}function gt(e){let o=null;try{o=openSync(e,"r");let n=Buffer.alloc(256),r=readSync(o,n,0,n.length,0),s=n.subarray(0,r).toString("utf8");return s.startsWith("#!")&&s.slice(2).split(/\r?\n/)[0]?.trim()||null}catch{return null}finally{o!==null&&closeSync(o);}}var Ho={command:"npx",args:["-y","devcoach","mcp"]};function Ro(e){let{hit:o,entry:n,execPath:r,platform:s}=e;if(!o)return Ho;let i=b$3(j(s)?n:o,s);if(i.ephemeral||b$3(n,s).ephemeral)return Ho;let l=i.boundTo?`bound to Node ${i.boundTo} (${i.manager}) \u2014 after removing or switching that version, run \`devcoach install --force\` again`:void 0;return j(s)?{command:r,args:[n,"mcp"],note:l}:{command:o,args:["mcp"],note:l}}function Mo(e=process.platform,o=process.env,n=homedir()){if(e==="darwin")return join(n,"Library","Logs","Claude","mcp-server-devcoach.log");if(e==="win32"){let r=o.APPDATA??join(n,"AppData","Roaming");return join(r,"Claude","logs","mcp-server-devcoach.log")}return join(o.XDG_CONFIG_HOME??join(n,".config"),"Claude","logs","mcp-server-devcoach.log")}function To(e,o=process.platform){let n=e.split(/\r?\n/),r=null;for(let i=n.length-1;i>=0&&r===null;i--){if(!/Using MCP server command:/.test(n[i]??""))continue;let l=[];for(let a=i+1;a<n.length&&a<i+80;a++){let u=n[a]??"";if(/\[length\]:/.test(u)||/^\S/.test(u))break;let g=/^\s*'(.+)',?\s*$/.exec(u);g?.[1]&&l.push(g[1].replace(/\\\\/g,"\\"));}l.length&&(r=l.join(j(o)?";":":"));}let s=null;for(let i=n.length-1;i>=0&&s===null;i--){let l=n[i]??"";if(/^Failed to spawn process/.test(l))s=l.trim();else if(/\[error\]/.test(l)){let a=(n[i-1]??"").trim();s=/^Failed to spawn process/.test(a)?a:l.replace(/\s*\{ metadata:.*$/,"").replace(/^\S+Z \[devcoach\] \[error\] /,"").trim();}}return {path:r,lastError:s}}function ft(e,o){let n=spawnSync(e,o,{encoding:"utf8",timeout:5e3,shell:process.platform==="win32"&&/\.(cmd|bat)$/i.test(e)});return n.status===0?(n.stdout??"").trim():null}var ye="`Failed to spawn process: No such file or directory`";function we(e,o){let n=o.platform??process.platform,r=o.run??ft,s=[],{command:i}=e,l=e.args??[];if(i==="npx")return s.push({level:"warn",text:"starts via `npx -y devcoach` \u2014 needs the npx cache (or the network) at every start"}),s;let a$1=B(i,{...o,platform:n});if(!a$1)return s.push({level:"bad",text:`\`${i}\` is not found ${oe(i)?"":`on ${o.pathSource} `}\u2014 the host fails with ${ye}. Reinstall devcoach, then run \`devcoach install --force\``}),s;s.push({level:"ok",text:`command resolves to ${a$1}${oe(i)?"":` on ${o.pathSource}`}`}),oe(i)||s.push({level:"warn",text:"bare name \u2014 the host resolves it on its own PATH, which can differ from your shell's; `devcoach install --force` writes an absolute path"});let u=/(^|[/\\])node(\.exe)?$/i.test(a$1),g=u?l[0]:a$1;if(u&&(!g||!existsSync(g)))return s.push({level:"bad",text:`devcoach's script ${g??"(missing)"} does not exist`}),s;let p=b$3(g??a$1,n);p.ephemeral?s.push({level:"bad",text:"lives in a temporary location (npx cache or an fnm shell) \u2014 it will disappear; run `devcoach install --force`"}):p.boundTo&&s.push({level:"warn",text:`bound to Node ${p.boundTo} (${p.manager}) \u2014 removing or switching that version breaks it with ${ye}; run \`devcoach install --force\` after`});let m=u?a$1:null;if(!u&&/\.(cmd|bat)$/i.test(a$1)){if(m=B("node",{...o,platform:n}),!m)return s.push({level:"bad",text:`the \`${a$1}\` shim needs \`node\`, not found on ${o.pathSource}`}),s}else if(!u){let f=gt(a$1);if(f){let[k,...y]=f.split(/\s+/),S=/(^|\/)env$/.test(k??""),O=S?y.find(K=>!K.startsWith("-")):k;if(m=O?S?B(O,{...o,platform:n}):O:null,!m||!S&&!existsSync(m))return s.push({level:"bad",text:S?`its \`#!${f}\` finds no \`${O}\` on ${o.pathSource} \u2014 the host fails before devcoach starts`:`its interpreter ${O} does not exist \u2014 the host fails with ${ye}. Reinstall that Node (e.g. \`brew install node\`) or devcoach`}),s}}if(m){let f=r(m,["--version"]),k=f?Number.parseInt(f.replace(/^v/,"").split(".")[0]??"0",10):null;k!==null&&k<a$3?s.push({level:"bad",text:`runs on Node ${f} (${m}) \u2014 devcoach needs Node ${a$3} or newer`}):f&&s.push({level:"ok",text:`runs on Node ${f.replace(/^v/,"")} (${m})`});}let $=(u?r(a$1,[g,"--version"]):r(a$1,["--version"]))?.match(/(\d+\.\d+\.\d+[^\s]*)/)?.[1]??null;return $?$!==a?s.push({level:"warn",text:`it runs devcoach ${$}; this doctor is ${a}`}):s.push({level:"ok",text:`it runs devcoach ${$}`}):s.push({level:"warn",text:"could not run it to read its version"}),s}var c=(e="")=>{console.log(e);};function se(){let e=platform();if(e==="darwin")return join(homedir(),"Library","Application Support","Claude","claude_desktop_config.json");if(e==="win32"){let n=process.env.APPDATA??join(homedir(),"AppData","Roaming");return join(n,"Claude","claude_desktop_config.json")}let o=process.env.XDG_CONFIG_HOME??join(homedir(),".config");return join(o,"Claude","claude_desktop_config.json")}var N=join(homedir(),".claude","settings.json"),ie=join(homedir(),".claude","skills","devcoach"),De=join(homedir(),".gemini"),I=join(De,"settings.json"),yt=join(De,"extensions","devcoach","gemini-extension.json"),Ie=join(homedir(),".codex"),A=join(Ie,"hooks.json"),ne=join(Ie,"config.toml"),H=join(homedir(),".agents","skills","devcoach"),Oe=e=>B(e),Ne=e=>Oe(e)!==null;function wt(){try{return realpathSync(process.argv[1]??"")}catch{return process.argv[1]??""}}function Uo(){return Ro({hit:Oe("devcoach"),entry:wt(),execPath:process.execPath,platform:process.platform})}function Ee(){let e=Oe("devcoach");return !e||e.includes("/_npx/")||e.includes("\\_npx\\")?"npx -y devcoach":e.includes("fnm_multishells")?"devcoach":e.includes(" ")?`"${e}"`:e}function jo(e,o,n){if(!Ne(e))return "";n&&spawnSync(e,n,{encoding:"utf8"});let r=spawnSync(e,o,{encoding:"utf8"});return r.status===0?`${a$1.green("\u2713")} Registered via \`${e} mcp add\``:`${r.stderr??""}${r.stdout??""}`.toLowerCase().includes("already")?`${a$1.yellow("Already registered")} in ${e} (use --force to overwrite)`:`${a$1.red(`${e} mcp add failed:`)} ${(r.stderr||r.stdout||"").trim()}`}function Ct(e,o){if(!Ne("claude"))return "";o&&spawnSync("claude",["mcp","remove","--scope",e,"devcoach"],{encoding:"utf8"});let n=Uo(),r=spawnSync("claude",["mcp","add","--scope",e,"devcoach",n.command,"--",...n.args],{encoding:"utf8"});return r.status===0?`${a$1.green("\u2713")} Registered via \`claude mcp add\` (scope: ${e})`:`${r.stderr??""}${r.stdout??""}`.toLowerCase().includes("already")?`${a$1.yellow("Already registered")} in Claude Code (use --force to overwrite)`:`${a$1.red("claude mcp add failed:")} ${(r.stderr||r.stdout||"").trim()}`}function C(e){if(!existsSync(e))return {ok:true,data:{}};try{return {ok:!0,data:JSON.parse(readFileSync(e,"utf8"))??{}}}catch{return {ok:false,error:`${a$1.red("\u2717")} ${e} is not valid JSON \u2014 fix it and re-run (left unchanged)`}}}function Ce(e,o,n){let r=C(e);if(!r.ok)return r.error;let s=r.data;s.mcpServers??={};let i=s.mcpServers;return i.devcoach&&!n?`${a$1.yellow("Already registered")} in ${e} (use --force to overwrite)`:(i.devcoach=o,mkdirSync(dirname(e),{recursive:true}),writeFileSync(e,`${JSON.stringify(s,null,2)}
3
3
  `),`${a$1.green("\u2713")} Installed into ${e}`)}function St(){let e=Ee();return {Stop:{hooks:[{type:"command",command:`${e} stop-hook`,timeout:60}]},UserPromptSubmit:{hooks:[{type:"command",command:`${e} prompt-hook`,timeout:30}]}}}function xt(){let e=Ee();return {AfterAgent:{hooks:[{type:"command",command:`${e} gemini-stop-hook`,timeout:6e4}]},BeforeAgent:{hooks:[{type:"command",command:`${e} gemini-prompt-hook`,timeout:3e4}]}}}function _t(){let e=Ee();return {Stop:{hooks:[{type:"command",command:`${e} codex-stop-hook`,timeout:60}]},UserPromptSubmit:{hooks:[{type:"command",command:`${e} codex-prompt-hook`,timeout:30}]}}}function Jo(e){return Object.entries(e.enabledPlugins??{}).filter(([o,n])=>n&&o.startsWith("devcoach@")).map(([o])=>o)}function Pe(e){return Jo(e).length>0}function ae(){return existsSync(yt)}function de(e){return /dev-?coach/i.test(e)&&/\b(?:stop-hook|prompt-hook|onboard-hook|lesson-ready)\b/.test(e)}function Ae(e,o){let n=C(e);if(!n.ok)return n.error;let r=n.data;r.hooks??={};let s=r.hooks,i=false;for(let[l,a]of Object.entries(o)){s[l]??=[];let u=s[l],g=u.map((m,h)=>[m,h]).filter(([m])=>(m.hooks??[]).some(h=>de(h.command??""))).map(([,m])=>m),[p]=g;if(!(g.length===1&&p!==void 0&&JSON.stringify(u[p])===JSON.stringify(a))){for(let m of g.toReversed())u.splice(m,1);u.push(a),i=true;}}return i?(mkdirSync(dirname(e),{recursive:true}),writeFileSync(e,`${JSON.stringify(r,null,2)}
4
4
  `),`${a$1.green("\u2713")} Hooks installed into ${e} (${Object.keys(o).join(" + ")})`):`${a$1.yellow("Already installed")} in ${e} (current layout)`}function Lt(){let e=C(N);return e.ok?Pe(e.data)?`${a$1.yellow("Skipped")} \u2014 the devcoach plugin already provides the hooks (installing both would double-count interactions)`:Ae(N,St()):e.error}function Dt(){return ae()?`${a$1.yellow("Skipped")} \u2014 the devcoach Gemini extension already provides the hooks (installing both would double-count interactions)`:Ae(I,xt())}function V(e){if(!existsSync(join(e,"SKILL.md")))return "missing";try{if(readFileSync(join(e,".devcoach-version"),"utf8").trim()===a)return "current"}catch{}return "outdated"}function Le(e,o){if(!o&&V(e)==="current")return `${a$1.yellow("Already installed")} in ${e} (current version)`;mkdirSync(e,{recursive:true}),writeFileSync(join(e,"SKILL.md"),e$4());let n=f$2();if(n.length){let r=join(e,"references");mkdirSync(r,{recursive:true});for(let s of n)writeFileSync(join(r,s.name),s.content);}return writeFileSync(join(e,".devcoach-version"),`${a}
5
5
  `),`${a$1.green("\u2713")} Installed into ${e}`}function It(e){return ae()?`${a$1.yellow("Skipped")} \u2014 bundled with the devcoach Gemini extension`:Le(H,e)}function U(e,o){let n=C(e);return n.ok&&(n.data.hooks?.[o]??[]).some(r=>(r.hooks??[]).some(s=>de(s.command??"")))}function He(){let e=[{name:"Claude Code",dir:ie,cmd:"devcoach install",hooked:()=>U(N,"Stop")},{name:"Gemini/Codex",dir:H,cmd:"devcoach install --gemini (or --codex)",hooked:()=>U(I,"AfterAgent")||U(A,"Stop")}];for(let o of e){let n=V(o.dir);if(n==="outdated")return `${a$1.yellow("\u2192")} The devcoach ${o.name} skill is out of date \u2014 run ${a$1.bold(o.cmd)} to refresh it.`;if(n==="missing"&&o.hooked())return `${a$1.yellow("\u2192")} The devcoach ${o.name} skill is not installed \u2014 run ${a$1.bold(o.cmd)} to add it.`}return ""}function Vo(e){let o=e.claudeCode||e.claudeDesktop||e.gemini||e.codex,n=e.claudeCode||!o,r=e.claudeDesktop||!o,s=Uo(),i={command:s.command,args:s.args},l=false;if(c(a$1.bold("Setting up devcoach")+a$1.dim(` (${i.command} ${i.args.join(" ")})`)),s.note&&c(a$1.yellow(` ${s.note}`)),c(),n){c(a$1.bold("Claude Code"));let a=Ct("user",e.force);if(!a){let u=join(homedir(),".claude.json");a=Ce(u,{type:"stdio",env:{},...i},e.force),l=true;}c(` MCP server\u2026 ${a}`),e.skipHook||c(` Hooks\u2026 ${Lt()}`),c(` Skill\u2026 ${Le(ie,e.force)}`),c();}if(r&&(c(a$1.bold("Claude Desktop")),c(` MCP server\u2026 ${Ce(se(),i,e.force)}`),l=true,c()),e.gemini){c(a$1.bold("Gemini CLI (beta)"));let a=jo("gemini",["mcp","add","-s","user","devcoach",i.command,...i.args],e.force?["mcp","remove","-s","user","devcoach"]:null);a||(a=Ce(I,i,e.force)),c(` MCP server\u2026 ${a}`),e.skipHook||c(` Hooks\u2026 ${Dt()}`),c(` Skill\u2026 ${It(e.force)}`),c();}if(e.codex){c(a$1.bold("Codex CLI (beta)"));let a=jo("codex",["mcp","add","devcoach","--",i.command,...i.args],e.force?["mcp","remove","devcoach"]:null);a||(a=`${a$1.yellow("Manual step")} \u2014 codex CLI not found. Add to ${ne}:
@@ -34,4 +34,4 @@ ${a$1.green("Setup complete!")} ${Object.keys(i).length} topics saved.`);}finall
34
34
  ${a$1.bold(`devcoach ${a$1.dim(`v${a}`)}`)}`);for(let[n,r]of e)d(` ${a$1.cyan(`devcoach ${n}`.padEnd(32))} ${a$1.dim(r)}`);d(`
35
35
  ${a$1.dim("Run")} ${a$1.bold("devcoach <command> --help")} ${a$1.dim("for per-command options.")}
36
36
  `);let o=He();o&&d(`${o}
37
- `);}function _(e){return e??null}function mn(){let e$1=new Command;return e$1.exitOverride(),e$1.name("devcoach").description("devcoach \u2014 progressive technical coaching").version(`devcoach ${a}`,"-v, --version","output the version number").allowExcessArguments(false).showHelpAfterError("(add --help for usage)").action(()=>un()),e$1.command("mcp").description("Start the MCP server (stdio transport)").action(async()=>{let{runStdio:o}=await import('./server-Q6P4AZVD.js');await o();}),e$1.command("profile").description("Show the knowledge map").action(Bt),e$1.command("lessons").description("List past lessons").option("--period <period>","today | week | month | year | all","all").option("--category <category>","Filter by category tag").option("--project <project>","Filter by project (fuzzy)").option("--repository <repository>","Filter by repository (fuzzy)").option("--branch <branch>","Filter by branch (fuzzy)").option("--commit <commit>","Filter by commit hash prefix (fuzzy)").option("--starred","Show only starred lessons").option("--imported","Show only lessons shared with you").option("--from <name>","Show only lessons shared by this person").option("--feedback <feedback>","know | understood | dont_know | none").option("--level <level>","junior | mid | senior").option("--date-from <date>","Show lessons on or after this date (YYYY-MM-DD[THH:MM])").option("--date-to <date>","Show lessons on or before this date (YYYY-MM-DD[THH:MM])").option("--sort <column>","timestamp | level | topic_id | title | feedback","timestamp").option("--order <order>","asc | desc","desc").action(o=>Ut({period:o.period??"all",category:_(o.category),project:_(o.project),repository:_(o.repository),branch:_(o.branch),commit:_(o.commit),starred:!!o.starred,imported:!!o.imported,sharedBy:_(o.from),feedback:_(o.feedback),level:_(o.level),dateFrom:_(o.dateFrom),dateTo:_(o.dateTo),sort:o.sort??"timestamp",order:o.order??"desc"})),e$1.command("lesson").description("Show a single lesson in detail").argument("<id>","Lesson ID").action(o=>Jt(o)),e$1.command("courses").description("List your step-by-step courses").action(()=>Kt()),e$1.command("course").description("Show a course: steps, progress, document path").argument("<id>","Course ID").action(o=>zt(o)),e$1.command("star").description("Mark a lesson as starred").argument("<id>","Lesson ID").action(o=>Zo(o,true)),e$1.command("unstar").description("Remove the starred mark from a lesson").argument("<id>","Lesson ID").action(o=>Zo(o,false)),e$1.command("delete").description("Permanently delete a lesson").argument("<id>","Lesson ID").action(o=>Vt(o)),e$1.command("feedback").description("Record your answer under a lesson: know / understood / dont_know").argument("<id>","Lesson ID").argument("<value>","know | understood | dont_know | clear").action((o,n)=>Wt(o,n)),e$1.command("share").description("Share a lesson: copyable text (default), --link, or a .devcoach.md file").argument("[id]","Lesson ID (or use --last)").option("--last","Share the most recent lesson").option("--link","Print the share link only").option("--file [path]","Write a .devcoach.md file (default: <lesson-id>.devcoach.md)").option("--with-context","Include project/branch/commit/task context (off by default)").option("--by <name>","Sender name (remembered as share_name when unset)").option("--anonymous","Share without a sender name").action((o,n)=>sn(o,n)),e$1.command("import").description("Import a shared lesson: a devcoach:lesson code, a share link, a URL, a .devcoach.md or lessons .json file, - for stdin \u2014 or the clipboard when omitted").argument("[source]","Code, link, URL, file path, or - (stdin); omit to read the clipboard").action(o=>cn(o)),e$1.command("settings").description("Show current settings").action(Xt),e$1.command("stats").description("Coaching statistics and rate-limit status").action(Yt),e$1.command("set").description("Update a setting (max_per_day | min_gap_minutes | nudge_every | nudge_scope | share_name)").argument("<key>","Setting key").argument("<value>","New value").action((o,n)=>Zt(o,n)),e$1.command("knowledge-add").description("Add or update a topic in the knowledge map").argument("<topic>","Topic ID").option("--confidence <n>","Initial confidence 0-10","5").option("--group <group>","Assign to a named group").action((o,n)=>qt(o,Math.max(0,Math.min(10,Number.parseInt(n.confidence??"5",10)||5)),_(n.group))),e$1.command("knowledge-remove").description("Remove a topic from the knowledge map").argument("<topic>","Topic ID").action(o=>Qt(o)),e$1.command("group-add").description("Register a new knowledge group").argument("<name>","Group name").action(o=>en(o)),e$1.command("group-remove").description("Delete a knowledge group (topics move to Other)").argument("<name>","Group name").action(o=>on(o)),e$1.command("group-assign").description("Move a topic to a group").argument("<topic>","Topic ID").argument("<group>","Group name (use 'Other' to ungroup)").action((o,n)=>tn(o,n)),e$1.command("backup").description("Export a full backup (settings + knowledge + lessons) as zip").argument("[file]","Output zip path","devcoach-backup.zip").action(o=>nn(o)),e$1.command("restore").description("Restore from a backup zip file").argument("<file>","Path to backup zip").action(o=>rn(o)),e$1.command("install").description("Register the MCP server + hooks + skill in Claude Code / Claude Desktop (default), Gemini CLI (--gemini, beta), or Codex CLI (--codex, beta)").option("--claude-code","Target Claude Code only").option("--claude-desktop","Target Claude Desktop only").option("--gemini","Target Google Gemini CLI (beta)").option("--codex","Target OpenAI Codex CLI (beta)").option("--force","Overwrite existing devcoach entry").option("--skip-hook","Register MCP server only \u2014 skip the hooks").action(o=>Vo({claudeCode:!!o.claudeCode,claudeDesktop:!!o.claudeDesktop,gemini:!!o.gemini,codex:!!o.codex,force:!!o.force,skipHook:!!o.skipHook})),e$1.command("uninstall").description("Remove devcoach's MCP server, hooks and skill from Claude Code / Claude Desktop (default), Gemini CLI (--gemini), Codex CLI (--codex) or every agent (--all). Coaching data is kept unless --data is given. Run it before brew/npm uninstall.").option("--claude-code","Target Claude Code only").option("--claude-desktop","Target Claude Desktop only").option("--gemini","Also remove from Google Gemini CLI (beta)").option("--codex","Also remove from OpenAI Codex CLI (beta)").option("--all","Every agent: Claude Code, Claude Desktop, Gemini CLI, Codex CLI").option("--data","Also delete ~/.devcoach (lessons, profile, notebook) \u2014 asks first").option("--yes","Do not ask before deleting the data (with --data)").action(async o=>Xo({claudeCode:!!o.claudeCode,claudeDesktop:!!o.claudeDesktop,gemini:!!o.gemini,codex:!!o.codex,all:!!o.all,data:!!o.data,yes:!!o.yes})),e$1.command("doctor").description("Diagnose the devcoach \u21C4 agent wiring and the lesson pacing state").action(Wo),e$1.command("ui").description("Launch the web dashboard (Ctrl+C stops it gracefully; --stop stops a running one)").option("--port <port>","Port","7860").option("-o, --open","Open the dashboard in your default browser").option("--stop","Stop the dashboard running on --port (e.g. one started by your agent)").action(async o=>{let n=Number.parseInt(o.port??"7860",10)||7860,{startUi:r,stopUi:s}=await import('./app-3NVTCQS5.js');if(o.stop){d(await s(n)?a$1.green(`\u2713 devcoach UI on port ${n} stopped`):a$1.yellow(`No devcoach UI is running on port ${n}`));return}r(n,{onReady:i=>{o.open&&Te(i);},onListenError:i=>{console.error(i.message),o.open&&i.existingUrl&&Te(i.existingUrl),process.exit(i.exitCode);}});}),e$1.command("setup").description("First-run wizard: import backup or build your knowledge profile").action(ln),e$1.command("stop-hook",{hidden:true}).description("Claude Code Stop hook: onboarding check + lesson cue in one spawn").action(()=>e()),e$1.command("prompt-hook",{hidden:true}).description("Claude Code UserPromptSubmit hook: prime the model when a lesson is due").action(()=>g()),e$1.command("gemini-stop-hook",{hidden:true}).description("Gemini CLI AfterAgent hook: onboarding check + lesson cue in one spawn").action(()=>e(void 0,"gemini")),e$1.command("gemini-prompt-hook",{hidden:true}).description("Gemini CLI BeforeAgent hook: prime the model when a lesson is due").action(()=>g(void 0,"gemini")),e$1.command("codex-stop-hook",{hidden:true}).description("Codex CLI Stop hook: onboarding check + lesson cue in one spawn").action(()=>e(void 0,"codex")),e$1.command("codex-prompt-hook",{hidden:true}).description("Codex CLI UserPromptSubmit hook: prime the model when a lesson is due").action(()=>g(void 0,"codex")),e$1.command("onboard-hook",{hidden:true}).description("Claude Code Stop hook: cue onboarding (legacy two-entry layout)").action(()=>b()),e$1.command("lesson-ready",{hidden:true}).description("Claude Code Stop hook: signal a lesson is due (legacy two-entry layout)").action(()=>d$1()),e$1}async function Xn(){let e=mn();try{await e.parseAsync(process.argv);}catch(o){let n=o.code??"";if(!n.startsWith("commander."))throw o;if(n==="commander.helpDisplayed"||n==="commander.help"||n==="commander.version")return;process.exit(2);}}export{Xn as runCli};
37
+ `);}function _(e){return e??null}function mn(){let e$1=new Command;return e$1.exitOverride(),e$1.name("devcoach").description("devcoach \u2014 learn what you don't know yet from the code your AI agent writes").version(`devcoach ${a}`,"-v, --version","output the version number").allowExcessArguments(false).showHelpAfterError("(add --help for usage)").action(()=>un()),e$1.command("mcp").description("Start the MCP server (stdio transport)").action(async()=>{let{runStdio:o}=await import('./server-DIGNR32I.js');await o();}),e$1.command("profile").description("Show the knowledge map").action(Bt),e$1.command("lessons").description("List past lessons").option("--period <period>","today | week | month | year | all","all").option("--category <category>","Filter by category tag").option("--project <project>","Filter by project (fuzzy)").option("--repository <repository>","Filter by repository (fuzzy)").option("--branch <branch>","Filter by branch (fuzzy)").option("--commit <commit>","Filter by commit hash prefix (fuzzy)").option("--starred","Show only starred lessons").option("--imported","Show only lessons shared with you").option("--from <name>","Show only lessons shared by this person").option("--feedback <feedback>","know | understood | dont_know | none").option("--level <level>","junior | mid | senior").option("--date-from <date>","Show lessons on or after this date (YYYY-MM-DD[THH:MM])").option("--date-to <date>","Show lessons on or before this date (YYYY-MM-DD[THH:MM])").option("--sort <column>","timestamp | level | topic_id | title | feedback","timestamp").option("--order <order>","asc | desc","desc").action(o=>Ut({period:o.period??"all",category:_(o.category),project:_(o.project),repository:_(o.repository),branch:_(o.branch),commit:_(o.commit),starred:!!o.starred,imported:!!o.imported,sharedBy:_(o.from),feedback:_(o.feedback),level:_(o.level),dateFrom:_(o.dateFrom),dateTo:_(o.dateTo),sort:o.sort??"timestamp",order:o.order??"desc"})),e$1.command("lesson").description("Show a single lesson in detail").argument("<id>","Lesson ID").action(o=>Jt(o)),e$1.command("courses").description("List your step-by-step courses").action(()=>Kt()),e$1.command("course").description("Show a course: steps, progress, document path").argument("<id>","Course ID").action(o=>zt(o)),e$1.command("star").description("Mark a lesson as starred").argument("<id>","Lesson ID").action(o=>Zo(o,true)),e$1.command("unstar").description("Remove the starred mark from a lesson").argument("<id>","Lesson ID").action(o=>Zo(o,false)),e$1.command("delete").description("Permanently delete a lesson").argument("<id>","Lesson ID").action(o=>Vt(o)),e$1.command("feedback").description("Record your answer under a lesson: know / understood / dont_know").argument("<id>","Lesson ID").argument("<value>","know | understood | dont_know | clear").action((o,n)=>Wt(o,n)),e$1.command("share").description("Share a lesson: copyable text (default), --link, or a .devcoach.md file").argument("[id]","Lesson ID (or use --last)").option("--last","Share the most recent lesson").option("--link","Print the share link only").option("--file [path]","Write a .devcoach.md file (default: <lesson-id>.devcoach.md)").option("--with-context","Include project/branch/commit/task context (off by default)").option("--by <name>","Sender name (remembered as share_name when unset)").option("--anonymous","Share without a sender name").action((o,n)=>sn(o,n)),e$1.command("import").description("Import a shared lesson: a devcoach:lesson code, a share link, a URL, a .devcoach.md or lessons .json file, - for stdin \u2014 or the clipboard when omitted").argument("[source]","Code, link, URL, file path, or - (stdin); omit to read the clipboard").action(o=>cn(o)),e$1.command("settings").description("Show current settings").action(Xt),e$1.command("stats").description("Coaching statistics and rate-limit status").action(Yt),e$1.command("set").description("Update a setting (max_per_day | min_gap_minutes | nudge_every | nudge_scope | share_name)").argument("<key>","Setting key").argument("<value>","New value").action((o,n)=>Zt(o,n)),e$1.command("knowledge-add").description("Add or update a topic in the knowledge map").argument("<topic>","Topic ID").option("--confidence <n>","Initial confidence 0-10","5").option("--group <group>","Assign to a named group").action((o,n)=>qt(o,Math.max(0,Math.min(10,Number.parseInt(n.confidence??"5",10)||5)),_(n.group))),e$1.command("knowledge-remove").description("Remove a topic from the knowledge map").argument("<topic>","Topic ID").action(o=>Qt(o)),e$1.command("group-add").description("Register a new knowledge group").argument("<name>","Group name").action(o=>en(o)),e$1.command("group-remove").description("Delete a knowledge group (topics move to Other)").argument("<name>","Group name").action(o=>on(o)),e$1.command("group-assign").description("Move a topic to a group").argument("<topic>","Topic ID").argument("<group>","Group name (use 'Other' to ungroup)").action((o,n)=>tn(o,n)),e$1.command("backup").description("Export a full backup (settings + knowledge + lessons) as zip").argument("[file]","Output zip path","devcoach-backup.zip").action(o=>nn(o)),e$1.command("restore").description("Restore from a backup zip file").argument("<file>","Path to backup zip").action(o=>rn(o)),e$1.command("install").description("Register the MCP server + hooks + skill in Claude Code / Claude Desktop (default), Gemini CLI (--gemini, beta), or Codex CLI (--codex, beta)").option("--claude-code","Target Claude Code only").option("--claude-desktop","Target Claude Desktop only").option("--gemini","Target Google Gemini CLI (beta)").option("--codex","Target OpenAI Codex CLI (beta)").option("--force","Overwrite existing devcoach entry").option("--skip-hook","Register MCP server only \u2014 skip the hooks").action(o=>Vo({claudeCode:!!o.claudeCode,claudeDesktop:!!o.claudeDesktop,gemini:!!o.gemini,codex:!!o.codex,force:!!o.force,skipHook:!!o.skipHook})),e$1.command("uninstall").description("Remove devcoach's MCP server, hooks and skill from Claude Code / Claude Desktop (default), Gemini CLI (--gemini), Codex CLI (--codex) or every agent (--all). Coaching data is kept unless --data is given. Run it before brew/npm uninstall.").option("--claude-code","Target Claude Code only").option("--claude-desktop","Target Claude Desktop only").option("--gemini","Also remove from Google Gemini CLI (beta)").option("--codex","Also remove from OpenAI Codex CLI (beta)").option("--all","Every agent: Claude Code, Claude Desktop, Gemini CLI, Codex CLI").option("--data","Also delete ~/.devcoach (lessons, profile, notebook) \u2014 asks first").option("--yes","Do not ask before deleting the data (with --data)").action(async o=>Xo({claudeCode:!!o.claudeCode,claudeDesktop:!!o.claudeDesktop,gemini:!!o.gemini,codex:!!o.codex,all:!!o.all,data:!!o.data,yes:!!o.yes})),e$1.command("doctor").description("Diagnose the devcoach \u21C4 agent wiring and the lesson pacing state").action(Wo),e$1.command("ui").description("Launch the web dashboard (Ctrl+C stops it gracefully; --stop stops a running one)").option("--port <port>","Port","7860").option("-o, --open","Open the dashboard in your default browser").option("--stop","Stop the dashboard running on --port (e.g. one started by your agent)").action(async o=>{let n=Number.parseInt(o.port??"7860",10)||7860,{startUi:r,stopUi:s}=await import('./app-EJJDIS3X.js');if(o.stop){d(await s(n)?a$1.green(`\u2713 devcoach UI on port ${n} stopped`):a$1.yellow(`No devcoach UI is running on port ${n}`));return}r(n,{onReady:i=>{o.open&&Te(i);},onListenError:i=>{console.error(i.message),o.open&&i.existingUrl&&Te(i.existingUrl),process.exit(i.exitCode);}});}),e$1.command("setup").description("First-run wizard: import backup or build your knowledge profile").action(ln),e$1.command("stop-hook",{hidden:true}).description("Claude Code Stop hook: onboarding check + lesson cue in one spawn").action(()=>e()),e$1.command("prompt-hook",{hidden:true}).description("Claude Code UserPromptSubmit hook: prime the model when a lesson is due").action(()=>g()),e$1.command("gemini-stop-hook",{hidden:true}).description("Gemini CLI AfterAgent hook: onboarding check + lesson cue in one spawn").action(()=>e(void 0,"gemini")),e$1.command("gemini-prompt-hook",{hidden:true}).description("Gemini CLI BeforeAgent hook: prime the model when a lesson is due").action(()=>g(void 0,"gemini")),e$1.command("codex-stop-hook",{hidden:true}).description("Codex CLI Stop hook: onboarding check + lesson cue in one spawn").action(()=>e(void 0,"codex")),e$1.command("codex-prompt-hook",{hidden:true}).description("Codex CLI UserPromptSubmit hook: prime the model when a lesson is due").action(()=>g(void 0,"codex")),e$1.command("onboard-hook",{hidden:true}).description("Claude Code Stop hook: cue onboarding (legacy two-entry layout)").action(()=>b()),e$1.command("lesson-ready",{hidden:true}).description("Claude Code Stop hook: signal a lesson is due (legacy two-entry layout)").action(()=>d$1()),e$1}async function Xn(){let e=mn();try{await e.parseAsync(process.argv);}catch(o){let n=o.code??"";if(!n.startsWith("commander."))throw o;if(n==="commander.helpDisplayed"||n==="commander.help"||n==="commander.version")return;process.exit(2);}}export{Xn as runCli};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{c as buildLessonCue,f as buildPromptPrime,d as cmdLessonReady,b as cmdOnboardHook,g as cmdPromptHook,e as cmdStopHook,a as parseHookPayload,h as runHook}from'./chunk-R7QSRQIE.js';import'./chunk-W3MCE3EH.js';import'./chunk-CQ7BCKWT.js';
2
+ export{c as buildLessonCue,f as buildPromptPrime,d as cmdLessonReady,b as cmdOnboardHook,g as cmdPromptHook,e as cmdStopHook,a as parseHookPayload,h as runHook}from'./chunk-Z2O2ZD6C.js';import'./chunk-KDWNHPMS.js';import'./chunk-2AJDMNVE.js';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {d,f as f$2,e as e$1,c as c$1,b as b$1,a as a$2}from'./chunk-MRABMPXO.js';import {g as g$3,e as e$2,d as d$2}from'./chunk-TIINFPAX.js';import {o,n,p,q,b,f as f$1,d as d$1,c,i as i$1,g as g$2,j as j$1,k as k$1,h as h$2}from'./chunk-MBQ2MDBS.js';import {e,g as g$1,f,k,j,i,E,ca,o as o$1,F,_,Da,H,K,I,Ea,aa,h as h$1,R,V,S,T,U,v,w,Ca,r,O,ta,X,sa,za,Aa,xa,wa,ua,Ga,ra,n as n$1,m,l,Fa,Ha,G,Ba,C,x,p as p$1,Y,ba,A,u as u$1}from'./chunk-W3MCE3EH.js';import {a as a$1}from'./chunk-CQ7BCKWT.js';import {spawn}from'child_process';import {mkdirSync,existsSync,statSync,writeFileSync,readFileSync}from'fs';import {dirname}from'path';import {McpServer,ResourceTemplate}from'@modelcontextprotocol/server';import {StdioServerTransport}from'@modelcontextprotocol/server/stdio';import {z}from'zod';var u=n=>({type:"text",text:n}),We=n=>({content:[u(JSON.stringify(n))]}),a=n=>({isError:true,content:[u(n)]}),g=n=>({content:[u(JSON.stringify(n))],structuredContent:n}),Je=z.object({id:z.string(),timestamp:z.string(),topic_id:z.string(),categories:z.array(z.string()),title:z.string(),level:e,summary:z.string(),body:z.string().nullable(),task_context:z.string().nullable(),project:z.string().nullable(),repository:z.string().nullable(),branch:z.string().nullable(),commit_hash:z.string().nullable(),folder:z.string().nullable(),repository_platform:f.nullable(),starred:z.boolean(),feedback:g$1.nullable(),imported:z.boolean(),shared_by:z.string().nullable()}),ot=Je.extend({reply_check:z.string()}),Fe="Saved \u2014 but saving does NOT display anything. The user sees ONLY plain text you write in your reply; the title/body inside this tool call's ARGUMENTS are invisible to them, and having composed them does not count as having shown the card. Did you already write the full card (both ### band headings + title line + body + tip) as plain reply text, outside any tool call? If yes: output nothing. If no: write the card now, as the final text of your reply. Never write it twice.",nt=z.object({readOnly:z.literal(true),dbSchema:z.number().int(),appSchema:z.number().int(),upgradedBy:z.string().nullable(),minApp:z.string().nullable()}).nullable().optional(),De=z.object({knowledge:z.array(z.object({topic:z.string(),confidence:z.number().int()})),groups:z.array(z.object({name:z.string(),topics:z.array(z.string())})),compat:nt}),rt=z.object({max_per_day:z.number().int(),min_gap_minutes:z.number().int(),ui_theme:i,ui_home:j,nudge_every:z.number().int(),nudge_scope:k,share_name:z.string().nullable()}),it=z.object({transport:z.enum(["text","link","file"]),code:z.string(),text:z.string().nullable(),link:z.string().nullable(),markdown:z.string().nullable(),filename:z.string().nullable(),shared_by:z.string().nullable(),include_context:z.boolean(),reply_check:z.string()}),st=z.object({kind:z.enum(["shared","lessons"]),inserted:z.number().int(),duplicated:z.number().int(),invalid:z.number().int(),lesson:Je.nullable(),topic_tracked:z.boolean().nullable(),reply_check:z.string()}),at={text:"Reply with `text` verbatim as the final message: the card as markdown, then the last line (devcoach:lesson:1:\u2026) inside a fenced code block, character for character \u2014 never paraphrase, wrap, truncate or split it.",link:"Reply with `link` on its own line, unchanged.",file:"Write `markdown` to `filename` (in the workspace unless the user named a path) with your file tool, then confirm the path in one line; do not print the markdown."},ct="Confirm in one line: the title, who shared it, and that it joined the coaching log (feedback works as usual; it does not count against the daily limit). If topic_tracked is false, offer to track the topic with add_topic \u2014 only on confirmation.",dt=z.object({window_months:z.number().int(),cutoff:z.string(),candidate_count:z.number().int(),over_soft_limit:z.boolean(),candidates:z.array(z.object({name:z.string(),path:z.string(),last_activity:z.string().nullable(),prompt_count:z.number().int()}))});function h(n,c){return {contents:[{uri:n.href,mimeType:"application/json",text:JSON.stringify(c)}]}}function Me(){try{return E(n=>({...Ca(n),compat:A(n)}))}catch(n){return {error:String(n)}}}function ze(){try{let n="";try{existsSync(r)&&(n=readFileSync(r,"utf8"));}catch{}return {...E(d=>{let b=ba(d).knowledge_ready,f=n.length>0,p=Ba(d),t={allowed:p.allowed,total_lessons:G(d)};return p.reason!=null&&(t.reason=p.reason),{onboarding:{knowledge_ready:b,notebook_ready:f,needs_onboarding:!(b&&f)},rate_limit:t,taught_topics:Ha(d),profile:Ca(d),compat:A(d)}}),notebook:n,notebook_path:r}}catch(n){return {error:String(n)}}}function lt(n,c,d){return n&&c?null:n?"The profile exists; only the notebook is missing. Compose it and write it to notebook_path \u2014 do not rebuild the topics.":`Let the user choose how to set up (lead with Automatic, never pick for them). ${d?"Automatic = build the topic map yourself, in one pass, from detected_stack enriched with default_topics.":"No Claude Code history was found on this machine (detected_stack is empty). That does NOT block Automatic: use default_topics exactly as returned as the starting map \u2014 it is devcoach's general developer baseline, not a guess of yours \u2014 and tell the user it is a starting point that corrects itself as they work. Do not stop, do not ask again, do not switch to Guided unless they ask."} Then save with complete_onboarding and write the notebook to notebook_path, in the same turn. The devcoach skill's references/onboarding.md has the full flow when the skill is available.`}function Ke(){try{let{status:n,compat:c}=E(o=>({status:ba(o),compat:A(o)})),d=n.knowledge_ready,b=existsSync(r)&&statSync(r).size>0,f=o(),p=c$1(),t=b$1(a$2(f.folder??process.cwd()),p.detected_stack);return {compat:c,knowledge_ready:d,notebook_ready:b,needs_onboarding:!(d&&b),detected_stack:t,detected_projects:p.projects,scanned_projects:p.scanned_projects,default_topics:u$1,context_ready:f.branch!==null,notebook_path:r,next_step:lt(d,b,Object.keys(t).length>0)}}catch(n){return {error:String(n)}}}var D=(n,c)=>typeof c.error=="string"?a(`${n} failed: ${c.error}`):g(c);function ut(){let n$2=new McpServer({name:"devcoach",version:a$1},{instructions:"Progressive technical coaching server. Use the devcoach_instructions prompt for full coaching behaviour guidelines. Read coaching state with the get_briefing / get_onboarding / get_profile tools; the devcoach:// resources expose the same data for clients that browse resources. share_lesson hands a lesson to another person (text, link or file); import_lesson stores one they were given."});n$2.registerTool("log_lesson",{title:"Log Lesson",description:"Save a delivered lesson to the coaching log. Git metadata (project, repository, branch, commit_hash, folder, repository_platform) is auto-detected from the workspace when omitted. timestamp is always stamped server-side with the current time \u2014 there is no argument for it. Returns the saved Lesson with all resolved fields.",inputSchema:z.object({id:z.string().describe("Unique lesson id (uuid or random string)"),topic_id:z.string().describe("Primary topic id, e.g. 'python'"),categories:z.array(z.string()).describe("Category tags, e.g. ['python','performance']"),title:z.string().describe("Short lesson title"),level:e.describe("Difficulty level: junior | mid | senior"),summary:z.string().describe("1-3 sentence summary shown in the lesson card"),body:z.string().min(1).describe("Clean lesson markdown: the prose + \u{1F4A1} Senior tip only \u2014 NO card bands, NO '>' blockquote, and do not repeat title/category/level (those are their own fields). Required, non-empty."),task_context:z.string().nullish().describe("What the user was doing when taught"),project:z.string().nullish().describe("Project name (auto-detected from git if omitted)"),repository:z.string().nullish().describe("org/repo or path (auto-detected if omitted)"),branch:z.string().nullish().describe("git branch (auto-detected if omitted)"),commit_hash:z.string().nullish().describe("git commit hash (auto-detected if omitted)"),folder:z.string().nullish().describe("workspace folder (auto-detected if omitted)"),repository_platform:f.nullish().describe("github | gitlab | bitbucket | local (auto-detected if omitted)")}),outputSchema:ot,annotations:{title:"Log Lesson",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{let o$2=o(),r={};try{r=E(l=>ca(l));}catch{r={};}let i=o$1({id:t.id,timestamp:new Date,topic_id:t.topic_id,categories:t.categories,title:t.title,level:t.level,summary:t.summary,body:t.body,task_context:t.task_context??null,project:t.project??o$2.project??r.project??null,repository:t.repository??o$2.repository??r.repository??null,branch:t.branch??o$2.branch??r.branch??null,commit_hash:t.commit_hash??o$2.commit_hash??null,folder:t.folder??o$2.folder??null,repository_platform:t.repository_platform??o$2.repository_platform??r.repository_platform??null});return E(l=>{F(l,i),_(l);}),{content:[u(`Lesson saved. ${Fe}`),u(JSON.stringify(i))],structuredContent:{...i,reply_check:Fe}}}catch(o){return a(`log_lesson failed: ${o}`)}}),n$2.registerTool("update_knowledge",{title:"Update Knowledge",description:"Adjust the confidence score for a topic by delta (e.g. +1 or -1). Returns the new confidence (0-10). Creates the topic at confidence 5 if it does not exist.",inputSchema:z.object({topic:z.string().describe("Topic id, e.g. 'python'"),delta:z.number().int().describe("Signed change to apply, e.g. +1 or -1")}),annotations:{title:"Update Knowledge",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>Da(r,t.topic,t.delta));return {content:[u(String(o))]}}catch(o){return a(`update_knowledge failed for '${t.topic}': ${o}`)}}),n$2.registerTool("get_lessons",{title:"Get Lessons",description:"Query the coaching lesson history. All filters combine. period defaults to all; date_from/date_to override period; limit caps results newest-first (0 = all).",inputSchema:z.object({period:z.enum(["today","week","month","year","all"]).nullish().describe("Time window"),category:z.string().nullish().describe("Filter by a category tag, e.g. 'python'"),level:z.enum(["junior","mid","senior"]).nullish().describe("Filter by difficulty level"),project:z.string().nullish().describe("Fuzzy match on git project"),repository:z.string().nullish().describe("Fuzzy match on git repository"),branch:z.string().nullish().describe("Fuzzy match on git branch"),commit:z.string().nullish().describe("Fuzzy match on commit hash"),starred:z.boolean().nullish().describe("True to return only starred lessons"),imported:z.boolean().nullish().describe("True = only lessons shared with you, false = only your own"),shared_by:z.string().nullish().describe("Only lessons shared by this person (exact sender name; implies imported)"),feedback:z.enum(["know","understood","dont_know","none"]).nullish().describe("Filter by feedback: know (already knew), understood (new, now clear), dont_know (couldn't follow \u2014 a course seed), none (no response)"),search:z.string().nullish().describe("Full-text search over title, topic_id, summary, body and the sender's name"),date_from:z.string().nullish().describe("ISO date/datetime lower bound"),date_to:z.string().nullish().describe("ISO date/datetime upper bound (date-only = end-of-day)"),limit:z.number().int().default(10).describe("Max lessons, newest first. Pass 0 for all.")}),annotations:{title:"Get Lessons",readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false}},t=>{try{let o=E(r=>H(r,{period:t.period,category:t.category,level:t.level,project:t.project,repository:t.repository,branch:t.branch,commit:t.commit,starred:t.starred,imported:t.imported,shared_by:t.shared_by,feedback:t.feedback,search:t.search,date_from:t.date_from,date_to:t.date_to,page:t.limit>0?1:null,per_page:t.limit}));return We(o)}catch{return We([])}}),n$2.registerTool("star_lesson",{title:"Star Lesson",description:"Set the starred (favourite) flag on a lesson. Returns true if found and updated. Idempotent.",inputSchema:z.object({lesson_id:z.string().describe("Lesson id"),starred:z.boolean().describe("true to favourite, false to unmark")}),annotations:{title:"Star Lesson",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>K(r,t.lesson_id,t.starred));return {content:[u(String(o))]}}catch(o){return a(`star_lesson failed for '${t.lesson_id}': ${o}`)}}),n$2.registerTool("delete_lesson",{title:"Delete Lesson",description:"Permanently delete a lesson by id. Returns true if found and deleted.",inputSchema:z.object({lesson_id:z.string().describe("Lesson id to delete")}),annotations:{title:"Delete Lesson",destructiveHint:true,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>I(r,t.lesson_id));return {content:[u(String(o))]}}catch(o){return a(`delete_lesson failed for '${t.lesson_id}': ${o}`)}}),n$2.registerTool("submit_feedback",{title:"Submit Feedback",description:"Record the user's answer under a lesson card. know = already knew it (confidence +1); understood = new and now clear (no confidence change); dont_know = couldn't follow this session (no confidence change; the lesson becomes a course seed); clear = remove the answer. Idempotent \u2014 repeating the stored answer changes nothing.",inputSchema:z.object({lesson_id:z.string().describe("Lesson id"),feedback:z.enum(["know","understood","dont_know","clear"]).describe("know | understood | dont_know | clear")}),annotations:{title:"Submit Feedback",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=t.feedback==="clear"?null:t.feedback,r=E(i=>Ea(i,t.lesson_id,o));return {content:[u(String(r!==null))]}}catch(o){return a(`submit_feedback failed for '${t.lesson_id}': ${o}`)}}),n$2.registerTool("skip_lesson",{title:"Skip Lesson",description:"Decline a lesson cue: call this when the coaching hook asked for a lesson but the completed work does not warrant one (pure questions, chat, nothing technical). Re-arms the pacing counter so the cue is not repeated immediately. Never call it after delivering a lesson \u2014 log_lesson already resolves the cue.",inputSchema:z.object({reason:z.string().min(1).describe("One line: why no lesson was warranted (shown in `devcoach doctor`)")}),annotations:{title:"Skip Lesson",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{return E(o=>aa(o,t.reason)),{content:[u("Cue skipped \u2014 pacing re-armed. Output nothing to the user.")]}}catch(o){return a(`skip_lesson failed: ${o}`)}}),n$2.registerTool("add_topic",{title:"Add Topic",description:"Add a topic to the knowledge map, or update its confidence if it exists. Optionally assign to a group (auto-created). Prefer a single-word topic id. Idempotent.",inputSchema:z.object({topic:z.string().describe("Topic id \u2014 prefer a single word, max 3 words"),confidence:h$1.default(5).describe("Initial confidence 0-10 (default 5)"),group:z.string().nullish().describe("Optional group name; 'Other' if omitted")}),annotations:{title:"Add Topic",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{return E(o=>{R(o,t.topic,t.confidence),t.group&&t.group!=="Other"&&V(o,t.topic,t.group);}),{content:[u("true")]}}catch(o){return a(`add_topic failed for '${t.topic}': ${o}`)}}),n$2.registerTool("remove_topic",{title:"Remove Topic",description:"Remove a topic from the knowledge map entirely. Returns true if it existed.",inputSchema:z.object({topic:z.string().describe("Topic id to remove")}),annotations:{title:"Remove Topic",destructiveHint:true,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>S(r,t.topic));return {content:[u(String(o))]}}catch(o){return a(`remove_topic failed for '${t.topic}': ${o}`)}}),n$2.registerTool("add_group",{title:"Add Group",description:"Create a new (initially empty) knowledge group. Idempotent \u2014 returns true either way.",inputSchema:z.object({name:z.string().describe("Group name, e.g. 'Machine Learning'")}),annotations:{title:"Add Group",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{return E(o=>T(o,t.name.trim())),{content:[u("true")]}}catch(o){return a(`add_group failed for '${t.name}': ${o}`)}}),n$2.registerTool("remove_group",{title:"Remove Group",description:"Delete a knowledge group. Its topics move to Other. Returns true if it existed.",inputSchema:z.object({name:z.string().describe("Group name to delete")}),annotations:{title:"Remove Group",destructiveHint:true,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>U(r,t.name));return {content:[u(String(o))]}}catch(o){return a(`remove_group failed for '${t.name}': ${o}`)}}),n$2.registerTool("update_settings",{title:"Update Settings",description:"Update a coaching setting. max_per_day: integer 1-20. min_gap_minutes: integer 0-1440 (0 = no cooldown). nudge_every: integer 0-1000 interactions between lesson cues (0 = cue every turn). nudge_scope: 'session' | 'global'. share_name: the sender name proposed when sharing a lesson (max 80 chars, empty clears). Returns the full updated Settings.",inputSchema:z.object({key:z.enum(["max_per_day","min_gap_minutes","nudge_every","nudge_scope","share_name"]).describe("Setting key"),value:z.string().describe("New value (integer string; 'session'|'global' for nudge_scope; free text for share_name)")}),outputSchema:rt,annotations:{title:"Update Settings",destructiveHint:false,idempotentHint:true,openWorldHint:false}},t=>{let o=i=>g(E(l=>(Y(l,t.key,i),X(l))));if(t.key==="share_name")return t.value.trim().length>v?a(`share_name must be at most ${v} characters`):o(w(t.value));if(t.key==="nudge_scope")return t.value!=="session"&&t.value!=="global"?a("nudge_scope must be 'session' or 'global'"):o(t.value);let r=Number.parseInt(t.value,10);return Number.isNaN(r)?a(`Value must be an integer, got '${t.value}'`):t.key==="max_per_day"&&!(r>=1&&r<=20)?a("max_per_day must be between 1 and 20"):t.key==="min_gap_minutes"&&!(r>=0&&r<=1440)?a("min_gap_minutes must be between 0 and 1440"):t.key==="nudge_every"&&!(r>=0&&r<=1e3)?a("nudge_every must be between 0 and 1000"):o(String(r))}),n$2.registerTool("open_ui",{title:"Open UI",description:"Launch the devcoach web dashboard in the background. port must be 1024-65535.",inputSchema:z.object({port:z.number().int().default(7860).describe("Port (default 7860)")}),annotations:{title:"Open UI",destructiveHint:false,idempotentHint:false,openWorldHint:true}},async t=>{let o=t.port;if(!(o>=1024&&o<=65535))return {content:[u(`error: port ${o} is out of valid range (1024-65535)`)]};let{pingUi:r}=await import('./app-3NVTCQS5.js');return await r(o)?{content:[u(`devcoach UI is already running at http://localhost:${o}`)]}:(spawn(process.execPath,[process.argv[1]??"","ui","--port",String(o)],{detached:true,stdio:"ignore"}).unref(),{content:[u(`devcoach UI starting at http://localhost:${o}`)]})}),n$2.registerTool("stop_ui",{title:"Stop UI",description:"Stop the devcoach web dashboard listening on port (whoever started it \u2014 open_ui or a terminal). Graceful: in-flight requests finish first. Reports stopped=false when nothing is running there. port must be 1024-65535.",inputSchema:z.object({port:z.number().int().default(7860).describe("Port (default 7860)")}),annotations:{title:"Stop UI",destructiveHint:false,idempotentHint:true,openWorldHint:true}},async t=>{let o=t.port;if(!(o>=1024&&o<=65535))return {content:[u(`error: port ${o} is out of valid range (1024-65535)`)]};let{stopUi:r}=await import('./app-3NVTCQS5.js'),i=await r(o);return {content:[u(i?`devcoach UI on port ${o} stopped`:`No devcoach UI is running on port ${o}`)],structuredContent:{stopped:i,port:o}}}),n$2.registerTool("complete_onboarding",{title:"Complete Onboarding",description:"Save the user's initial knowledge profile and mark onboarding complete. Wipes any default-seeded profile. topics: {topic_id: confidence_0_to_10}. groups: {group_name: [topic_id,...]} (topics not in any group go to 'Other'). Ensures learning-state.md exists and is non-empty (a placeholder if needed) \u2014 there is no notebook argument here. Write the real personalized notebook yourself right after, directly to the path in devcoach://onboarding's notebook_path field. Returns the updated Profile.",inputSchema:z.object({topics:z.record(z.string(),h$1).describe("{topic_id: confidence 0-10}"),groups:z.record(z.string(),z.array(z.string())).optional().describe("{group_name: [topic_id, ...]}")}),outputSchema:De,annotations:{title:"Complete Onboarding",destructiveHint:true,idempotentHint:false,openWorldHint:false}},async t=>{try{let o=E(r=>{r.exec("DELETE FROM knowledge; DELETE FROM knowledge_groups; DELETE FROM knowledge_group_names;");for(let[i,l]of Object.entries(t.topics))R(r,i,Math.max(0,Math.min(10,l)));if(t.groups)for(let[i,l]of Object.entries(t.groups))for(let M of l)M in t.topics&&V(r,M,i);return Ca(r)});return mkdirSync(dirname(r),{recursive:!0}),(!existsSync(r)||statSync(r).size===0)&&writeFileSync(r,`# devcoach \u2014 Coaching Notebook
2
+ import {d,f as f$2,e as e$1,c as c$1,b as b$1,a as a$2}from'./chunk-MRABMPXO.js';import {g as g$3,e as e$2,d as d$2}from'./chunk-JWDQGP6O.js';import {o,n,p,q,b,f as f$1,d as d$1,c,i as i$1,g as g$2,j as j$1,k as k$1,h as h$2}from'./chunk-DZKBVY27.js';import {e,g as g$1,f,k,j,i,E,ca,o as o$1,F,_,Da,H,K,I,Ea,aa,h as h$1,R,V,S,T,U,v,w,Ca,r,O,ta,X,sa,za,Aa,xa,wa,ua,Ga,ra,n as n$1,m,l,Fa,Ha,G,Ba,C,x,p as p$1,Y,ba,A,u as u$1}from'./chunk-KDWNHPMS.js';import {a as a$1}from'./chunk-2AJDMNVE.js';import {spawn}from'child_process';import {mkdirSync,existsSync,statSync,writeFileSync,readFileSync}from'fs';import {dirname}from'path';import {McpServer,ResourceTemplate}from'@modelcontextprotocol/server';import {StdioServerTransport}from'@modelcontextprotocol/server/stdio';import {z}from'zod';var u=n=>({type:"text",text:n}),We=n=>({content:[u(JSON.stringify(n))]}),a=n=>({isError:true,content:[u(n)]}),g=n=>({content:[u(JSON.stringify(n))],structuredContent:n}),Je=z.object({id:z.string(),timestamp:z.string(),topic_id:z.string(),categories:z.array(z.string()),title:z.string(),level:e,summary:z.string(),body:z.string().nullable(),task_context:z.string().nullable(),project:z.string().nullable(),repository:z.string().nullable(),branch:z.string().nullable(),commit_hash:z.string().nullable(),folder:z.string().nullable(),repository_platform:f.nullable(),starred:z.boolean(),feedback:g$1.nullable(),imported:z.boolean(),shared_by:z.string().nullable()}),ot=Je.extend({reply_check:z.string()}),Fe="Saved \u2014 but saving does NOT display anything. The user sees ONLY plain text you write in your reply; the title/body inside this tool call's ARGUMENTS are invisible to them, and having composed them does not count as having shown the card. Did you already write the full card (both ### band headings + title line + body + tip) as plain reply text, outside any tool call? If yes: output nothing. If no: write the card now, as the final text of your reply. Never write it twice.",nt=z.object({readOnly:z.literal(true),dbSchema:z.number().int(),appSchema:z.number().int(),upgradedBy:z.string().nullable(),minApp:z.string().nullable()}).nullable().optional(),De=z.object({knowledge:z.array(z.object({topic:z.string(),confidence:z.number().int()})),groups:z.array(z.object({name:z.string(),topics:z.array(z.string())})),compat:nt}),rt=z.object({max_per_day:z.number().int(),min_gap_minutes:z.number().int(),ui_theme:i,ui_home:j,nudge_every:z.number().int(),nudge_scope:k,share_name:z.string().nullable()}),it=z.object({transport:z.enum(["text","link","file"]),code:z.string(),text:z.string().nullable(),link:z.string().nullable(),markdown:z.string().nullable(),filename:z.string().nullable(),shared_by:z.string().nullable(),include_context:z.boolean(),reply_check:z.string()}),st=z.object({kind:z.enum(["shared","lessons"]),inserted:z.number().int(),duplicated:z.number().int(),invalid:z.number().int(),lesson:Je.nullable(),topic_tracked:z.boolean().nullable(),reply_check:z.string()}),at={text:"Reply with `text` verbatim as the final message: the card as markdown, then the last line (devcoach:lesson:1:\u2026) inside a fenced code block, character for character \u2014 never paraphrase, wrap, truncate or split it.",link:"Reply with `link` on its own line, unchanged.",file:"Write `markdown` to `filename` (in the workspace unless the user named a path) with your file tool, then confirm the path in one line; do not print the markdown."},ct="Confirm in one line: the title, who shared it, and that it joined the coaching log (feedback works as usual; it does not count against the daily limit). If topic_tracked is false, offer to track the topic with add_topic \u2014 only on confirmation.",dt=z.object({window_months:z.number().int(),cutoff:z.string(),candidate_count:z.number().int(),over_soft_limit:z.boolean(),candidates:z.array(z.object({name:z.string(),path:z.string(),last_activity:z.string().nullable(),prompt_count:z.number().int()}))});function h(n,c){return {contents:[{uri:n.href,mimeType:"application/json",text:JSON.stringify(c)}]}}function Me(){try{return E(n=>({...Ca(n),compat:A(n)}))}catch(n){return {error:String(n)}}}function ze(){try{let n="";try{existsSync(r)&&(n=readFileSync(r,"utf8"));}catch{}return {...E(d=>{let b=ba(d).knowledge_ready,f=n.length>0,p=Ba(d),t={allowed:p.allowed,total_lessons:G(d)};return p.reason!=null&&(t.reason=p.reason),{onboarding:{knowledge_ready:b,notebook_ready:f,needs_onboarding:!(b&&f)},rate_limit:t,taught_topics:Ha(d),profile:Ca(d),compat:A(d)}}),notebook:n,notebook_path:r}}catch(n){return {error:String(n)}}}function lt(n,c,d){return n&&c?null:n?"The profile exists; only the notebook is missing. Compose it and write it to notebook_path \u2014 do not rebuild the topics.":`Let the user choose how to set up (lead with Automatic, never pick for them). ${d?"Automatic = build the topic map yourself, in one pass, from detected_stack enriched with default_topics.":"No Claude Code history was found on this machine (detected_stack is empty). That does NOT block Automatic: use default_topics exactly as returned as the starting map \u2014 it is devcoach's general developer baseline, not a guess of yours \u2014 and tell the user it is a starting point that corrects itself as they work. Do not stop, do not ask again, do not switch to Guided unless they ask."} Then save with complete_onboarding and write the notebook to notebook_path, in the same turn. The devcoach skill's references/onboarding.md has the full flow when the skill is available.`}function Ke(){try{let{status:n,compat:c}=E(o=>({status:ba(o),compat:A(o)})),d=n.knowledge_ready,b=existsSync(r)&&statSync(r).size>0,f=o(),p=c$1(),t=b$1(a$2(f.folder??process.cwd()),p.detected_stack);return {compat:c,knowledge_ready:d,notebook_ready:b,needs_onboarding:!(d&&b),detected_stack:t,detected_projects:p.projects,scanned_projects:p.scanned_projects,default_topics:u$1,context_ready:f.branch!==null,notebook_path:r,next_step:lt(d,b,Object.keys(t).length>0)}}catch(n){return {error:String(n)}}}var D=(n,c)=>typeof c.error=="string"?a(`${n} failed: ${c.error}`):g(c);function ut(){let n$2=new McpServer({name:"devcoach",version:a$1},{instructions:"Progressive technical coaching server. Use the devcoach_instructions prompt for full coaching behaviour guidelines. Read coaching state with the get_briefing / get_onboarding / get_profile tools; the devcoach:// resources expose the same data for clients that browse resources. share_lesson hands a lesson to another person (text, link or file); import_lesson stores one they were given."});n$2.registerTool("log_lesson",{title:"Log Lesson",description:"Save a delivered lesson to the coaching log. Git metadata (project, repository, branch, commit_hash, folder, repository_platform) is auto-detected from the workspace when omitted. timestamp is always stamped server-side with the current time \u2014 there is no argument for it. Returns the saved Lesson with all resolved fields.",inputSchema:z.object({id:z.string().describe("Unique lesson id (uuid or random string)"),topic_id:z.string().describe("Primary topic id, e.g. 'python'"),categories:z.array(z.string()).describe("Category tags, e.g. ['python','performance']"),title:z.string().describe("Short lesson title"),level:e.describe("Difficulty level: junior | mid | senior"),summary:z.string().describe("1-3 sentence summary shown in the lesson card"),body:z.string().min(1).describe("Clean lesson markdown: the prose + \u{1F4A1} Senior tip only \u2014 NO card bands, NO '>' blockquote, and do not repeat title/category/level (those are their own fields). Required, non-empty."),task_context:z.string().nullish().describe("What the user was doing when taught"),project:z.string().nullish().describe("Project name (auto-detected from git if omitted)"),repository:z.string().nullish().describe("org/repo or path (auto-detected if omitted)"),branch:z.string().nullish().describe("git branch (auto-detected if omitted)"),commit_hash:z.string().nullish().describe("git commit hash (auto-detected if omitted)"),folder:z.string().nullish().describe("workspace folder (auto-detected if omitted)"),repository_platform:f.nullish().describe("github | gitlab | bitbucket | local (auto-detected if omitted)")}),outputSchema:ot,annotations:{title:"Log Lesson",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{let o$2=o(),r={};try{r=E(l=>ca(l));}catch{r={};}let i=o$1({id:t.id,timestamp:new Date,topic_id:t.topic_id,categories:t.categories,title:t.title,level:t.level,summary:t.summary,body:t.body,task_context:t.task_context??null,project:t.project??o$2.project??r.project??null,repository:t.repository??o$2.repository??r.repository??null,branch:t.branch??o$2.branch??r.branch??null,commit_hash:t.commit_hash??o$2.commit_hash??null,folder:t.folder??o$2.folder??null,repository_platform:t.repository_platform??o$2.repository_platform??r.repository_platform??null});return E(l=>{F(l,i),_(l);}),{content:[u(`Lesson saved. ${Fe}`),u(JSON.stringify(i))],structuredContent:{...i,reply_check:Fe}}}catch(o){return a(`log_lesson failed: ${o}`)}}),n$2.registerTool("update_knowledge",{title:"Update Knowledge",description:"Adjust the confidence score for a topic by delta (e.g. +1 or -1). Returns the new confidence (0-10). Creates the topic at confidence 5 if it does not exist.",inputSchema:z.object({topic:z.string().describe("Topic id, e.g. 'python'"),delta:z.number().int().describe("Signed change to apply, e.g. +1 or -1")}),annotations:{title:"Update Knowledge",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>Da(r,t.topic,t.delta));return {content:[u(String(o))]}}catch(o){return a(`update_knowledge failed for '${t.topic}': ${o}`)}}),n$2.registerTool("get_lessons",{title:"Get Lessons",description:"Query the coaching lesson history. All filters combine. period defaults to all; date_from/date_to override period; limit caps results newest-first (0 = all).",inputSchema:z.object({period:z.enum(["today","week","month","year","all"]).nullish().describe("Time window"),category:z.string().nullish().describe("Filter by a category tag, e.g. 'python'"),level:z.enum(["junior","mid","senior"]).nullish().describe("Filter by difficulty level"),project:z.string().nullish().describe("Fuzzy match on git project"),repository:z.string().nullish().describe("Fuzzy match on git repository"),branch:z.string().nullish().describe("Fuzzy match on git branch"),commit:z.string().nullish().describe("Fuzzy match on commit hash"),starred:z.boolean().nullish().describe("True to return only starred lessons"),imported:z.boolean().nullish().describe("True = only lessons shared with you, false = only your own"),shared_by:z.string().nullish().describe("Only lessons shared by this person (exact sender name; implies imported)"),feedback:z.enum(["know","understood","dont_know","none"]).nullish().describe("Filter by feedback: know (already knew), understood (new, now clear), dont_know (couldn't follow \u2014 a course seed), none (no response)"),search:z.string().nullish().describe("Full-text search over title, topic_id, summary, body and the sender's name"),date_from:z.string().nullish().describe("ISO date/datetime lower bound"),date_to:z.string().nullish().describe("ISO date/datetime upper bound (date-only = end-of-day)"),limit:z.number().int().default(10).describe("Max lessons, newest first. Pass 0 for all.")}),annotations:{title:"Get Lessons",readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false}},t=>{try{let o=E(r=>H(r,{period:t.period,category:t.category,level:t.level,project:t.project,repository:t.repository,branch:t.branch,commit:t.commit,starred:t.starred,imported:t.imported,shared_by:t.shared_by,feedback:t.feedback,search:t.search,date_from:t.date_from,date_to:t.date_to,page:t.limit>0?1:null,per_page:t.limit}));return We(o)}catch{return We([])}}),n$2.registerTool("star_lesson",{title:"Star Lesson",description:"Set the starred (favourite) flag on a lesson. Returns true if found and updated. Idempotent.",inputSchema:z.object({lesson_id:z.string().describe("Lesson id"),starred:z.boolean().describe("true to favourite, false to unmark")}),annotations:{title:"Star Lesson",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>K(r,t.lesson_id,t.starred));return {content:[u(String(o))]}}catch(o){return a(`star_lesson failed for '${t.lesson_id}': ${o}`)}}),n$2.registerTool("delete_lesson",{title:"Delete Lesson",description:"Permanently delete a lesson by id. Returns true if found and deleted.",inputSchema:z.object({lesson_id:z.string().describe("Lesson id to delete")}),annotations:{title:"Delete Lesson",destructiveHint:true,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>I(r,t.lesson_id));return {content:[u(String(o))]}}catch(o){return a(`delete_lesson failed for '${t.lesson_id}': ${o}`)}}),n$2.registerTool("submit_feedback",{title:"Submit Feedback",description:"Record the user's answer under a lesson card. know = already knew it (confidence +1); understood = new and now clear (no confidence change); dont_know = couldn't follow this session (no confidence change; the lesson becomes a course seed); clear = remove the answer. Idempotent \u2014 repeating the stored answer changes nothing.",inputSchema:z.object({lesson_id:z.string().describe("Lesson id"),feedback:z.enum(["know","understood","dont_know","clear"]).describe("know | understood | dont_know | clear")}),annotations:{title:"Submit Feedback",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=t.feedback==="clear"?null:t.feedback,r=E(i=>Ea(i,t.lesson_id,o));return {content:[u(String(r!==null))]}}catch(o){return a(`submit_feedback failed for '${t.lesson_id}': ${o}`)}}),n$2.registerTool("skip_lesson",{title:"Skip Lesson",description:"Decline a lesson cue: call this when the coaching hook asked for a lesson but the completed work does not warrant one (pure questions, chat, nothing technical). Re-arms the pacing counter so the cue is not repeated immediately. Never call it after delivering a lesson \u2014 log_lesson already resolves the cue.",inputSchema:z.object({reason:z.string().min(1).describe("One line: why no lesson was warranted (shown in `devcoach doctor`)")}),annotations:{title:"Skip Lesson",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{return E(o=>aa(o,t.reason)),{content:[u("Cue skipped \u2014 pacing re-armed. Output nothing to the user.")]}}catch(o){return a(`skip_lesson failed: ${o}`)}}),n$2.registerTool("add_topic",{title:"Add Topic",description:"Add a topic to the knowledge map, or update its confidence if it exists. Optionally assign to a group (auto-created). Prefer a single-word topic id. Idempotent.",inputSchema:z.object({topic:z.string().describe("Topic id \u2014 prefer a single word, max 3 words"),confidence:h$1.default(5).describe("Initial confidence 0-10 (default 5)"),group:z.string().nullish().describe("Optional group name; 'Other' if omitted")}),annotations:{title:"Add Topic",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{return E(o=>{R(o,t.topic,t.confidence),t.group&&t.group!=="Other"&&V(o,t.topic,t.group);}),{content:[u("true")]}}catch(o){return a(`add_topic failed for '${t.topic}': ${o}`)}}),n$2.registerTool("remove_topic",{title:"Remove Topic",description:"Remove a topic from the knowledge map entirely. Returns true if it existed.",inputSchema:z.object({topic:z.string().describe("Topic id to remove")}),annotations:{title:"Remove Topic",destructiveHint:true,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>S(r,t.topic));return {content:[u(String(o))]}}catch(o){return a(`remove_topic failed for '${t.topic}': ${o}`)}}),n$2.registerTool("add_group",{title:"Add Group",description:"Create a new (initially empty) knowledge group. Idempotent \u2014 returns true either way.",inputSchema:z.object({name:z.string().describe("Group name, e.g. 'Machine Learning'")}),annotations:{title:"Add Group",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{return E(o=>T(o,t.name.trim())),{content:[u("true")]}}catch(o){return a(`add_group failed for '${t.name}': ${o}`)}}),n$2.registerTool("remove_group",{title:"Remove Group",description:"Delete a knowledge group. Its topics move to Other. Returns true if it existed.",inputSchema:z.object({name:z.string().describe("Group name to delete")}),annotations:{title:"Remove Group",destructiveHint:true,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>U(r,t.name));return {content:[u(String(o))]}}catch(o){return a(`remove_group failed for '${t.name}': ${o}`)}}),n$2.registerTool("update_settings",{title:"Update Settings",description:"Update a coaching setting. max_per_day: integer 1-20. min_gap_minutes: integer 0-1440 (0 = no cooldown). nudge_every: integer 0-1000 interactions between lesson cues (0 = cue every turn). nudge_scope: 'session' | 'global'. share_name: the sender name proposed when sharing a lesson (max 80 chars, empty clears). Returns the full updated Settings.",inputSchema:z.object({key:z.enum(["max_per_day","min_gap_minutes","nudge_every","nudge_scope","share_name"]).describe("Setting key"),value:z.string().describe("New value (integer string; 'session'|'global' for nudge_scope; free text for share_name)")}),outputSchema:rt,annotations:{title:"Update Settings",destructiveHint:false,idempotentHint:true,openWorldHint:false}},t=>{let o=i=>g(E(l=>(Y(l,t.key,i),X(l))));if(t.key==="share_name")return t.value.trim().length>v?a(`share_name must be at most ${v} characters`):o(w(t.value));if(t.key==="nudge_scope")return t.value!=="session"&&t.value!=="global"?a("nudge_scope must be 'session' or 'global'"):o(t.value);let r=Number.parseInt(t.value,10);return Number.isNaN(r)?a(`Value must be an integer, got '${t.value}'`):t.key==="max_per_day"&&!(r>=1&&r<=20)?a("max_per_day must be between 1 and 20"):t.key==="min_gap_minutes"&&!(r>=0&&r<=1440)?a("min_gap_minutes must be between 0 and 1440"):t.key==="nudge_every"&&!(r>=0&&r<=1e3)?a("nudge_every must be between 0 and 1000"):o(String(r))}),n$2.registerTool("open_ui",{title:"Open UI",description:"Launch the devcoach web dashboard in the background. port must be 1024-65535.",inputSchema:z.object({port:z.number().int().default(7860).describe("Port (default 7860)")}),annotations:{title:"Open UI",destructiveHint:false,idempotentHint:false,openWorldHint:true}},async t=>{let o=t.port;if(!(o>=1024&&o<=65535))return {content:[u(`error: port ${o} is out of valid range (1024-65535)`)]};let{pingUi:r}=await import('./app-EJJDIS3X.js');return await r(o)?{content:[u(`devcoach UI is already running at http://localhost:${o}`)]}:(spawn(process.execPath,[process.argv[1]??"","ui","--port",String(o)],{detached:true,stdio:"ignore"}).unref(),{content:[u(`devcoach UI starting at http://localhost:${o}`)]})}),n$2.registerTool("stop_ui",{title:"Stop UI",description:"Stop the devcoach web dashboard listening on port (whoever started it \u2014 open_ui or a terminal). Graceful: in-flight requests finish first. Reports stopped=false when nothing is running there. port must be 1024-65535.",inputSchema:z.object({port:z.number().int().default(7860).describe("Port (default 7860)")}),annotations:{title:"Stop UI",destructiveHint:false,idempotentHint:true,openWorldHint:true}},async t=>{let o=t.port;if(!(o>=1024&&o<=65535))return {content:[u(`error: port ${o} is out of valid range (1024-65535)`)]};let{stopUi:r}=await import('./app-EJJDIS3X.js'),i=await r(o);return {content:[u(i?`devcoach UI on port ${o} stopped`:`No devcoach UI is running on port ${o}`)],structuredContent:{stopped:i,port:o}}}),n$2.registerTool("complete_onboarding",{title:"Complete Onboarding",description:"Save the user's initial knowledge profile and mark onboarding complete. Wipes any default-seeded profile. topics: {topic_id: confidence_0_to_10}. groups: {group_name: [topic_id,...]} (topics not in any group go to 'Other'). Ensures learning-state.md exists and is non-empty (a placeholder if needed) \u2014 there is no notebook argument here. Write the real personalized notebook yourself right after, directly to the path in devcoach://onboarding's notebook_path field. Returns the updated Profile.",inputSchema:z.object({topics:z.record(z.string(),h$1).describe("{topic_id: confidence 0-10}"),groups:z.record(z.string(),z.array(z.string())).optional().describe("{group_name: [topic_id, ...]}")}),outputSchema:De,annotations:{title:"Complete Onboarding",destructiveHint:true,idempotentHint:false,openWorldHint:false}},async t=>{try{let o=E(r=>{r.exec("DELETE FROM knowledge; DELETE FROM knowledge_groups; DELETE FROM knowledge_group_names;");for(let[i,l]of Object.entries(t.topics))R(r,i,Math.max(0,Math.min(10,l)));if(t.groups)for(let[i,l]of Object.entries(t.groups))for(let M of l)M in t.topics&&V(r,M,i);return Ca(r)});return mkdirSync(dirname(r),{recursive:!0}),(!existsSync(r)||statSync(r).size===0)&&writeFileSync(r,`# devcoach \u2014 Coaching Notebook
3
3
  `),g(o)}catch(o){return a(`complete_onboarding failed: ${o}`)}}),n$2.registerTool("preview_deep_scan",{title:"Preview Deep Scan",description:"Cheap, metadata-only pre-check for 'Automatic (Deep)' onboarding. Counts and lists Claude Code projects whose last recorded activity falls within a rolling window (months back from now) \u2014 a real date window, not a fixed top-N. Reads no prompt/conversation text, only project paths and activity timestamps. Call this BEFORE spawning the deep-read subagent: over_soft_limit true means there are enough candidates that the user should be asked whether to narrow the window, proceed anyway, or pick specific projects.",inputSchema:z.object({months:z.number().int().min(1).max(24).default(3).describe("Rolling window size in months, counting back from now")}),outputSchema:dt,annotations:{title:"Preview Deep Scan",readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false}},t=>{try{return g({...d(t.months)})}catch(o){return a(`preview_deep_scan failed: ${o}`)}});let c$1=t=>({title:t,readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false});n$2.registerTool("get_briefing",{title:"Lesson Briefing",description:"Everything needed before delivering a lesson, in ONE call: onboarding status, rate limit, taught topics, knowledge profile, the coaching notebook text and its notebook_path. Same data as the devcoach://briefing resource \u2014 call the tool, it needs no server name.",inputSchema:z.object({}),annotations:c$1("Lesson Briefing")},()=>D("get_briefing",ze())),n$2.registerTool("get_onboarding",{title:"Onboarding Status & Detected Stack",description:"Onboarding status (knowledge_ready, notebook_ready, needs_onboarding), the stack detected across the full Claude Code history with per-project provenance, the default topics and the notebook_path. Same data as the devcoach://onboarding resource.",inputSchema:z.object({}),annotations:c$1("Onboarding Status & Detected Stack")},()=>D("get_onboarding",Ke())),n$2.registerTool("get_profile",{title:"Knowledge Profile",description:"Current knowledge map: topics with confidence 0\u201310 and their groups. Same data as the devcoach://profile resource.",inputSchema:z.object({}),outputSchema:De,annotations:c$1("Knowledge Profile")},()=>D("get_profile",Me())),n$2.registerTool("share_lesson",{title:"Share Lesson",description:"Hand a lesson to another person. transport 'text' (default) returns the card plus a one-line code to paste anywhere; 'link' a server-less URL that previews the lesson and imports it into their dashboard; 'file' the contents of a .devcoach.md file. Only title, summary, body, topic, categories and level travel unless include_context is true; local paths never do. Pick the lesson with get_lessons first.",inputSchema:z.object({lesson_id:z.string().describe("Lesson id (from get_lessons)"),transport:z.enum(["text","link","file"]).default("text").describe("text = card + code to paste; link = share URL; file = .devcoach.md contents"),include_context:z.boolean().default(false).describe("Include project/branch/commit/task context (off by default \u2014 privacy). Local paths are never included."),shared_by:z.string().nullish().describe("Sender name. Omit \u2192 the share_name setting, then git user.name. Empty string \u2192 anonymous.")}),outputSchema:it,annotations:c$1("Share Lesson")},t=>{try{let o=E(r=>{let i=O(r,t.lesson_id);if(!i)return null;let l=ta({explicit:t.shared_by??null,setting:X(r).share_name,gitUserName:n()});return sa(i,{includeContext:t.include_context,sharedBy:l})});return o?g({transport:t.transport,code:ua(o),text:t.transport==="text"?wa(o):null,link:t.transport==="link"?xa(o):null,markdown:t.transport==="file"?Aa(o):null,filename:t.transport==="file"?za(o):null,shared_by:o.shared_by,include_context:t.include_context,reply_check:at[t.transport]}):a(`share_lesson: lesson '${t.lesson_id}' not found \u2014 call get_lessons to pick one`)}catch(o){return a(`share_lesson failed: ${o}`)}}),n$2.registerTool("import_lesson",{title:"Import Lesson",description:"Store a lesson someone shared. Pass whatever the user handed you, verbatim: the devcoach:lesson:1:\u2026 code, the whole copied card, the share link, a URL to the lesson text, the contents of a .devcoach.md file, or a lessons JSON export. The lesson joins the coaching log as their own (feedback works as usual) but never counts against the daily limit; re-importing the same share is reported as a duplicate, not an error.",inputSchema:z.object({payload:z.string().min(1).describe("The code, link, URL, card text, file text or JSON \u2014 verbatim")}),outputSchema:st,annotations:{title:"Import Lesson",destructiveHint:false,idempotentHint:true,openWorldHint:true}},async t=>{try{let o=p(t.payload)&&!t.payload.includes("#devcoach:lesson:")?await q(t.payload):t.payload,r=E(i=>Ga(i,o));return g({...r,reply_check:ct})}catch(o){return o instanceof ra?a(`import_lesson: ${o.message}`):a(`import_lesson failed: ${o}`)}});let d$2=z.object({course_id:z.string(),position:z.number().int(),title:z.string(),kind:m,anchor:z.string(),status:n$1,done_at:z.string().nullable()}),b$1=z.object({id:z.string(),lesson_id:z.string().nullable(),topic_id:z.string(),title:z.string(),goal:z.string().nullable(),prerequisites:z.array(z.object({concept:z.string(),known:z.boolean()})),status:l,created_at:z.string(),updated_at:z.string(),completed_at:z.string().nullable(),steps:z.array(d$2)}),f$3='Write ONE self-contained HTML document at document_path (inline CSS + JS, no external URLs, no fetch, no <form>, no alert/confirm/prompt) with one <section id="step-N"> per step, using your file tools \u2014 never paste HTML into the chat. Code goes in <pre><code class="language-\u2026"> and the document carries ONE <script data-devcoach="highlighter"></script> placeholder: devcoach fills it with the highlighter when you register steps (never write one yourself, never re-read the whole file afterwards). Then register every section with add_course_step (position order, anchor = the section id). Teach one step per message and tell the user the course is on the dashboard under Courses (/devcoach:ui).';n$2.registerTool("create_course",{title:"Create Course",description:"Start a step-by-step course, usually from a lesson the user couldn't follow. Pass the prerequisite chain you explored ([{concept, known}], top-down). Returns the course row, course_dir and document_path \u2014 write the document there yourself, then call add_course_step for each section.",inputSchema:z.object({title:z.string().min(1).describe("Course title, e.g. 'From sums to logarithms'"),topic_id:z.string().min(1).describe("The lesson-style topic id the course belongs to"),goal:z.string().nullish().describe("One sentence: what the user will be able to do"),lesson_id:z.string().nullish().describe("The seed lesson's id, when the course grows from one"),prerequisites:z.array(z.object({concept:z.string().min(1),known:z.boolean()})).default([]).describe("The explored chain, top-down: [{concept, known}]")}),outputSchema:b$1.extend({course_dir:z.string(),document_path:z.string(),seed_context:z.object({task_context:z.string().nullable(),project:z.string().nullable(),repository:z.string().nullable(),branch:z.string().nullable()}).nullable(),reply_check:z.string()}),annotations:{title:"Create Course",destructiveHint:false,idempotentHint:false,openWorldHint:false}},async t=>{try{let o=E(r=>{let i=t.lesson_id?O(r,t.lesson_id):null;if(t.lesson_id&&!i)throw new b(`lesson '${t.lesson_id}' not found \u2014 call get_lessons to pick one`);return {course:f$1(r,{title:t.title,topic_id:t.topic_id,goal:t.goal??null,lesson_id:t.lesson_id??null,prerequisites:t.prerequisites}),seed:i}});return g({...o.course,course_dir:c(o.course.id),document_path:d$1(o.course.id),seed_context:o.seed?{task_context:o.seed.task_context,project:o.seed.project,repository:o.seed.repository,branch:o.seed.branch}:null,reply_check:f$3})}catch(o){return a(`create_course failed: ${o}`)}}),n$2.registerTool("add_course_step",{title:"Add Course Step",description:"Register a step of a course: the section with id=<anchor> must already exist in the course document. Appended by default; pass `after` to insert it after that step (0 = first) \u2014 the following steps are renumbered.",inputSchema:z.object({course_id:z.string().describe("Course id (from create_course)"),title:z.string().min(1).describe("Step title"),kind:m.describe("concept | example | practice | check"),anchor:z.string().regex(/^[a-z0-9][a-z0-9-]*$/).describe("The section's id in the document, e.g. step-1"),after:z.number().int().min(0).nullish().describe("Insert after this step number (0 = first); omit to append")}),outputSchema:b$1.extend({step:d$2}),annotations:{title:"Add Course Step",destructiveHint:false,idempotentHint:false,openWorldHint:false}},async t=>{try{let o=E(r=>{let i=i$1(r,t.course_id,{title:t.title,kind:t.kind,anchor:t.anchor,after:t.after});return {...g$2(r,t.course_id),step:i}});return g(o)}catch(o){return a(`add_course_step failed: ${o}`)}}),n$2.registerTool("update_course_progress",{title:"Update Course Progress",description:"With position: set that step to todo | done | skipped (the course completes itself once every step is done or skipped). Without position: set the course to active | completed | abandoned.",inputSchema:z.object({course_id:z.string().describe("Course id"),position:z.number().int().min(1).nullish().describe("Step number (1-based); omit for the course"),status:z.string().describe("Step: todo | done | skipped \u2014 course: active | completed | abandoned")}),outputSchema:b$1,annotations:{title:"Update Course Progress",destructiveHint:false,idempotentHint:true,openWorldHint:false}},async t=>{try{let o=E(r=>{if(t.position!=null){let i=n$1.parse(t.status);return j$1(r,t.course_id,t.position,i)}return k$1(r,t.course_id,l.parse(t.status))});return o?g(o):a(`update_course_progress: course '${t.course_id}'${t.position!=null?` step ${t.position}`:""} not found \u2014 call get_courses`)}catch(o){return a(`update_course_progress failed: ${o}`)}}),n$2.registerTool("get_courses",{title:"Get Courses",description:"List courses with their steps and progress; filter by id, seed lesson or status. 'continue the course' = status active.",inputSchema:z.object({course_id:z.string().nullish().describe("One course"),lesson_id:z.string().nullish().describe("Courses seeded by this lesson"),status:l.nullish().describe("active | completed | abandoned")}),outputSchema:z.object({courses:z.array(b$1.extend({course_dir:z.string()}))}),annotations:c$1("Get Courses")},t=>{try{let o=E(r=>{if(t.course_id){let i=g$2(r,t.course_id);return i?[i]:[]}return h$2(r,{lesson_id:t.lesson_id,status:t.status})});return g({courses:o.map(r=>({...r,course_dir:c(r.id)}))})}catch{return g({courses:[]})}});let p$1=(t,o)=>({title:t,description:o,mimeType:"application/json"});return n$2.registerResource("profile","devcoach://profile",p$1("Knowledge Profile","Current knowledge map \u2014 topics, confidence scores, and groups."),t=>h(t,Me())),n$2.registerResource("notebook","devcoach://notebook",{title:"Coaching Notebook",description:"The coaching notebook (learning-state.md): observations, recurring patterns, recommended focus, and open hypotheses about the user. Read it to decide what to teach.",mimeType:"text/markdown"},t=>{let o="";try{existsSync(r)&&(o=readFileSync(r,"utf8"));}catch{}return {contents:[{uri:t.href,mimeType:"text/markdown",text:o}]}}),n$2.registerResource("settings","devcoach://settings",p$1("Settings","Current coaching settings (rate limits, UI theme)."),t=>{try{return h(t,E(o=>X(o)))}catch(o){return h(t,{error:String(o)})}}),n$2.registerResource("recent-lessons","devcoach://lessons/recent",p$1("Recent Lessons","Last 10 lessons from the current week."),t=>{try{return h(t,E(o=>H(o,{period:"week",page:1,per_page:10})))}catch(o){return h(t,[{error:String(o)}])}}),n$2.registerResource("stats","devcoach://stats",p$1("Stats","Aggregate coaching statistics: counts and weakest/strongest topics."),t=>{try{return h(t,E(o=>Fa(o)))}catch(o){return h(t,{error:String(o)})}}),n$2.registerResource("taught-topics","devcoach://taught-topics",p$1("Taught Topics","All topic_ids already taught \u2014 read before selecting a new lesson topic."),t=>{try{return h(t,E(o=>Ha(o)))}catch{return h(t,[])}}),n$2.registerResource("rate-limit","devcoach://rate-limit",p$1("Rate Limit","Current rate-limit status and running lesson total."),t=>{try{let{r:o,total:r}=E(l=>({r:Ba(l),total:G(l)})),i={allowed:o.allowed,total_lessons:r};return o.reason!=null&&(i.reason=o.reason),h(t,i)}catch(o){return h(t,{allowed:false,reason:`Rate limit check unavailable: ${o}`})}}),n$2.registerResource("briefing","devcoach://briefing",p$1("Lesson Briefing","Everything needed before delivering a lesson in ONE read: onboarding status, rate limit, taught topics, knowledge profile, and the coaching notebook."),t=>h(t,ze())),n$2.registerResource("context","devcoach://context",p$1("Workspace Context","Auto-detected git context and most-used lesson metadata defaults."),t=>{try{let o$1=o(),r=E(i=>ca(i));return h(t,{git:o$1,usage_defaults:r})}catch(o){return h(t,{error:String(o)})}}),n$2.registerResource("onboarding","devcoach://onboarding",p$1("Onboarding","Onboarding status, the stack detected across the full Claude Code history (with per-project provenance), and project topic defaults."),t=>h(t,Ke())),n$2.registerResource("lesson",new ResourceTemplate("devcoach://lessons/{lesson_id}",{list:void 0}),p$1("Lesson","A single lesson by id."),(t,o)=>{try{let r=String(o.lesson_id),i=E(l=>O(l,r));return i?h(t,i):h(t,{error:`Lesson '${r}' not found`})}catch(r){return h(t,{error:String(r)})}}),n$2.registerPrompt("devcoach_instructions",{title:"devcoach coaching instructions",description:"Full coaching instructions for the devcoach skill (SKILL.md plus its reference files)."},()=>{let t=f$2().map(o=>`
4
4
 
5
5
  ---
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "devcoach",
3
- "version": "2.8.0-next.667.gacec817",
3
+ "version": "2.8.0-next.669.g6698ed3",
4
4
  "mcpName": "io.github.UltimaPhoenix/devcoach",
5
- "description": "Stay sharp while your AI does the work — learn what you don't know yet from the tasks your agent completes, with in-context coaching, all local, all free",
5
+ "description": "Stay sharp while your AI does the work: learn what you don't know yet from the code your AI agent writes, one short lesson at a time. Free and 100% local.",
6
6
  "license": "AGPL-3.0-only",
7
7
  "keywords": [
8
8
  "mcp",
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- var e={version:"2.8.0-next.667.gacec817"};var s=e.version;export{s as a};