@pan-stack/cli 0.3.76 → 0.3.77

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/bin/pan.js CHANGED
@@ -1136,7 +1136,7 @@ end`},Kue=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r
1136
1136
  `))}let x=xs.default.join(d,aU),y=Ba.default.existsSync(x)?(0,D_.parse)(Ba.default.readFileSync(x,"utf8")):null,E=Array.isArray(y?.renames)?y.renames:[];return E.push({at:C0(),by:t.by??z0(i)??"unknown",module:o.module,base_commit:u,map:Object.fromEntries(l)}),Ba.default.writeFileSync(x,`# S\u1ED5 \u0111\u1ED5i m\xE3 (pan ba renumber): m\xE3 c\u0169 \u2192 m\xE3 m\u1EDBi theo t\u1EEBng l\u1EA7n BA Lead \u0111\xE1nh l\u1EA1i m\xE3. \u0110\u1ECDc n\u1ED9i dung \u1EDF b\u1EA3n \u0111\xE3 giao (git) d\u1EF1a v\xE0o \u0111\xE2y \u2014 kh\xF4ng s\u1EEDa tay.
1137
1137
  `+(0,D_.stringify)({renames:E},{lineWidth:0})),{ok:!0,plan:o,changed:l.size,files:f,renamed:p.length,baselineHashes:b}}function ppe(e,t){let n=t.indexOf(`${Er}/`);if(n<0)return[];let r=xs.default.join(e,t.slice(0,n+Er.length),aU);if(!Ba.default.existsSync(r))return[];let o=(0,D_.parse)(Ba.default.readFileSync(r,"utf8"));return Array.isArray(o?.renames)?o.renames:[]}function hpe(e,t,n){let r=t.confirm===void 0?OT(e,t):sU(e,t);if(t.json)return process.stdout.write(JSON.stringify(r)+`
1138
1138
  `),r.ok?0:1;let o=r.plan;if(o){console.log(n("BA_RENUMBER_PLAN__MODULE_COUNT",{module:o.module,count:o.changes.length}));for(let i of o.changes.slice(0,20))console.log(` ${i.from} \u2192 ${i.to} ${i.title}`);o.changes.length>20&&console.log(` \u2026 +${o.changes.length-20}`);for(let i of o.unreleased)console.log(n("BA_RENUMBER_UNRELEASED__DOC_VERSION_COUNT",{doc:i.doc,version:i.version,count:i.count}));o.outside.length&&console.log(n("BA_RENUMBER_OUTSIDE__COUNT_LIST",{count:o.outside.length,list:o.outside.slice(0,5).join(", ")}))}return r.ok?t.confirm===void 0?(console.log(n("BA_RENUMBER_HOW__TEXT",{text:o.confirm})),0):(console.log(n("BA_RENUMBER_DONE__COUNT_FILES_RENAMED",{count:r.changed??0,files:r.files??0,renamed:r.renamed??0})),0):(console.error(n(r.error.key,r.error.vars)),1)}var Ba,xs,D_,aU,fpe,rot,RT=Z(()=>{"use strict";Ba=Y(require("node:fs")),xs=Y(require("node:path")),D_=Y(ha());xi();P_();pd();Ma();aU="code-renames.yaml",fpe=/\.(md|ya?ml|csv)$/i,rot=e=>`DANH LAI MA ${e}`});function DT(e,t){try{return(0,lU.execFileSync)("git",["-C",e,...t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],maxBuffer:64*1024*1024})}catch{return null}}function zf(e,t=!1){let n=DT(e,["rev-parse",...t?["--short"]:[],"HEAD"]);return n?n.trim():null}function LT(e,t){let n=DT(e,["status","--porcelain","--untracked-files=all","--",t||"."]);return n?n.split(`
1139
- `).filter(Boolean).map(r=>r.slice(3)):[]}function oot(e,t,n){try{return(0,lU.execFileSync)("git",["-C",e,"merge-base","--is-ancestor",t,n],{stdio:"ignore"}),!0}catch{return!1}}function iot(e,t,n){return DT(e,["show",`${t}:${n}`])}function aot(e,t,n,r=[]){let o=DT(e,["log","--format=%an",...t?[`${t}..HEAD`]:[],"--",n]);if(!o)return[];let i=new Map(r.map(a=>[S0(a.ten),a.id]));return[...new Set(o.split(`
1139
+ `).filter(Boolean).map(r=>r.slice(3)):[]}function oot(e,t,n){try{return(0,lU.execFileSync)("git",["-C",e,"merge-base","--is-ancestor",t,n],{stdio:"ignore"}),!0}catch{return!1}}function iot(e,t,n){return DT(e,["show",`${t}:./${n}`])}function aot(e,t,n,r=[]){let o=DT(e,["log","--format=%an",...t?[`${t}..HEAD`]:[],"--",n]);if(!o)return[];let i=new Map(r.map(a=>[S0(a.ten),a.id]));return[...new Set(o.split(`
1140
1140
  `).map(a=>a.trim()).filter(Boolean).map(a=>i.get(S0(a))??a))]}function PT(e,t,n,r){let o=new Map;if(!t?.commitNoiDung)return o;let i=n.items.find(s=>s.tep)?.tep,a=i?ppe(e,i).filter(s=>s.base_commit&&s.map&&oot(e,t.commitNoiDung,s.base_commit)):[];for(let s of r){let l=n.items.find(f=>f.ma===s);if(!l?.tep)continue;let c=s;for(let f of[...a].reverse()){let h=Object.entries(f.map).find(([,p])=>p===c);h&&(c=h[0])}let u=c===s?l.tep:l.tep.slice(0,l.tep.lastIndexOf("/")+1)+l.tep.slice(l.tep.lastIndexOf("/")+1).replace(s,c),d=iot(e,t.commitNoiDung,u);if(d!=null){for(let f of a)d=Pc(d,new Map(Object.entries(f.map)));o.set(s,ns(l.tep,d,l.phanHe).item)}}return o}function MT(e,t,n,r,o){let i=new Map;for(let a of r){let s=n.items.find(c=>c.ma===a);if(!s?.tep)continue;let l=aot(e,t?.commitNoiDung??null,s.tep,o);l.length&&i.set(a,l)}return i}var lU,P_=Z(()=>{"use strict";lU=require("node:child_process");xi();RT()});function gpe(e){let t=new Map,n=e.lastIndexOf(Buffer.from([80,75,5,6]));if(n<0)throw new Error("Kh\xF4ng ph\u1EA3i t\u1EC7p zip/DOCX");let r=e.readUInt32LE(n+16),o=e.readUInt16LE(n+10);for(let i=0;i<o&&e.readUInt32LE(r)===33639248;i++){let a=e.readUInt16LE(r+10),s=e.readUInt32LE(r+20),l=e.readUInt16LE(r+28),c=e.readUInt16LE(r+30),u=e.readUInt16LE(r+32),d=e.readUInt32LE(r+42),f=e.toString("utf8",r+46,r+46+l),h=d+30+e.readUInt16LE(d+26)+e.readUInt16LE(d+28),p=e.subarray(h,h+s);t.set(f,a===8?cU.default.inflateRawSync(p):Buffer.from(p)),r+=46+l+c+u}return t}function sot(e){if(!BT){BT=new Int32Array(256);for(let n=0;n<256;n++){let r=n;for(let o=0;o<8;o++)r=r&1?3988292384^r>>>1:r>>>1;BT[n]=r}}let t=-1;for(let n=0;n<e.length;n++)t=BT[(t^e[n])&255]^t>>>8;return(t^-1)>>>0}function lot(e){let t=[],n=[],r=0;for(let[a,s]of e){let l=Buffer.from(a,"utf8"),c=cU.default.deflateRawSync(s),u=sot(s),d=Buffer.alloc(30);d.writeUInt32LE(67324752,0),d.writeUInt16LE(20,4),d.writeUInt16LE(2048,6),d.writeUInt16LE(8,8),d.writeUInt16LE(0,10),d.writeUInt16LE(33,12),d.writeUInt32LE(u,14),d.writeUInt32LE(c.length,18),d.writeUInt32LE(s.length,22),d.writeUInt16LE(l.length,26),d.writeUInt16LE(0,28);let f=Buffer.alloc(46);f.writeUInt32LE(33639248,0),f.writeUInt16LE(20,4),f.writeUInt16LE(20,6),f.writeUInt16LE(2048,8),f.writeUInt16LE(8,10),f.writeUInt16LE(0,12),f.writeUInt16LE(33,14),f.writeUInt32LE(u,16),f.writeUInt32LE(c.length,20),f.writeUInt32LE(s.length,24),f.writeUInt16LE(l.length,28),f.writeUInt32LE(r,42),t.push(d,l,c),n.push(f,l),r+=30+l.length+c.length}let o=Buffer.concat(n),i=Buffer.alloc(22);return i.writeUInt32LE(101010256,0),i.writeUInt16LE(e.size,8),i.writeUInt16LE(e.size,10),i.writeUInt32LE(o.length,12),i.writeUInt32LE(r,16),Buffer.concat([...t,o,i])}function bpe(e,t){let n=gpe(e),i=[...[...(n.get("docProps/custom.xml")?.toString("utf8")??"").matchAll(/<property\b[^>]*\bname="([^"]*)"[^>]*>([\s\S]*?)<\/property>/g)].filter(l=>!(l[1]in t)).map(l=>[l[1],l[2]]),...Object.entries(t).map(([l,c])=>[l,`<vt:lpwstr>${vpe(c)}</vt:lpwstr>`])];n.set("docProps/custom.xml",Buffer.from(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1141
1141
  <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">`+i.map(([l,c],u)=>`<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="${u+2}" name="${vpe(l)}">${c}</property>`).join("")+"</Properties>"));let a=n.get("[Content_Types].xml")?.toString("utf8")??"";a&&!a.includes("/docProps/custom.xml")&&n.set("[Content_Types].xml",Buffer.from(a.replace("</Types>",'<Override PartName="/docProps/custom.xml" ContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml"/></Types>')));let s=n.get("_rels/.rels")?.toString("utf8")??"";return s&&!s.includes("docProps/custom.xml")&&n.set("_rels/.rels",Buffer.from(s.replace("</Relationships>",'<Relationship Id="rIdPanBA1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties" Target="docProps/custom.xml"/></Relationships>'))),lot(n)}function m2(e){let t={name:"#root",attrs:{},children:[]},n=[t],r=0;for(;r<e.length;){let o=e.indexOf("<",r);if(o<0)break;if(o>r){let f=e.slice(r,o);f&&n.at(-1).children.push({name:"#text",attrs:{},children:[],text:mpe(f)})}if(e.startsWith("<?",o)){r=e.indexOf("?>",o)+2;continue}if(e.startsWith("<!--",o)){r=e.indexOf("-->",o)+3;continue}if(e.startsWith("<![CDATA[",o)){let f=e.indexOf("]]>",o);n.at(-1).children.push({name:"#text",attrs:{},children:[],text:e.slice(o+9,f)}),r=f+3;continue}if(e.startsWith("<!",o)){r=e.indexOf(">",o)+1;continue}let i=e.indexOf(">",o),a=e.slice(o+1,i);if(a.startsWith("/")){n.length>1&&n.pop(),r=i+1;continue}let s=a.endsWith("/");s&&(a=a.slice(0,-1));let l=/^([^\s/>]+)/.exec(a),c={name:l?l[1]:"",attrs:{},children:[]},u=/([^\s=]+)\s*=\s*("([^"]*)"|'([^']*)')/g,d;for(;d=u.exec(a);)c.attrs[d[1]]=mpe(d[3]??d[4]??"");n.at(-1).children.push(c),s||n.push(c),r=i+1}return t}function*Hf(e){yield e;for(let t of e.children)yield*Hf(t)}function uot(e){let t=new Map;if(!e)return t;for(let n of Hf(m2(e))){if(n.name!=="w:style")continue;let r=n.attrs["w:styleId"];if(!r)continue;let o=$i($i(n,"w:pPr"),"w:outlineLvl")?.attrs["w:val"],i=$i(n,"w:name")?.attrs["w:val"]??"",a=/^(?:heading|tiêu đề|tieu de)\s*(\d)$/i.exec(i.trim());o!==void 0&&Number(o)<9?t.set(r,Number(o)+1):a&&t.set(r,Number(a[1]))}return t}function g2(e){let t=gpe(e),n=v=>t.get(v)?.toString("utf8"),r=n("word/document.xml");if(!r)throw new Error("DOCX thi\u1EBFu word/document.xml");let o=uot(n("word/styles.xml")),i=new Map;for(let v of Hf(m2(n("word/_rels/document.xml.rels")??"")))v.name==="Relationship"&&i.set(v.attrs.Id??"",v.attrs.Target??"");let a=new Map,s=new Map;for(let v of Hf(m2(n("word/comments.xml")??""))){if(v.name!=="w:comment")continue;let m=[...Hf(v)].filter(g=>g.name==="w:t").map(g=>g.children.map(b=>b.text??"").join("")).join("");s.set(v.attrs["w:id"]??"",{id:v.attrs["w:id"]??"",author:v.attrs["w:author"]??"",date:v.attrs["w:date"]??"",text:m.trim()})}let l=v=>{let m=[],g=[],b=[],x=[],y=(E,_,k)=>{for(let S of E.children)if(S.name==="w:bookmarkStart"&&S.attrs["w:name"]&&!S.attrs["w:name"].startsWith("_"))g.push(S.attrs["w:name"]);else if(S.name==="w:commentRangeStart"||S.name==="w:commentReference"){let A=S.attrs["w:id"];A&&!b.includes(A)&&b.push(A)}else if(S.name==="w:ins"||S.name==="w:moveTo")y(S,{author:S.attrs["w:author"]??"",date:S.attrs["w:date"]??""},k);else if(S.name==="w:del"||S.name==="w:moveFrom")y(S,_,{author:S.attrs["w:author"]??"",date:S.attrs["w:date"]??""});else if(S.name==="w:r"){let A=$i(S,"w:rPr"),C=$i(A,"w:highlight")?.attrs["w:val"],O=($i(A,"w:color")?.attrs["w:val"]??"").toUpperCase(),D=!!$i(A,"w:strike")&&$i(A,"w:strike")?.attrs["w:val"]!=="0",U="";for(let L of S.children)if(L.name==="w:t"||L.name==="w:delText")U+=L.children.map(I=>I.text??"").join("");else if(L.name==="w:commentReference"){let I=L.attrs["w:id"];I&&!b.includes(I)&&b.push(I)}else if(L.name==="w:tab")U+=" ";else if(L.name==="w:br")U+=`
1142
1142
  `;else if(L.name==="w:drawing"||L.name==="w:pict")for(let I of Hf(L)){let j=I.attrs["r:embed"]??I.attrs["r:id"];if((I.name==="a:blip"||I.name==="v:imagedata")&&j&&i.get(j)){let P="word/"+i.get(j).replace(/^\.?\//,"");x.push(P);let q=t.get(P);q&&a.set(P,q)}}U&&m.push({text:U,...C&&C!=="none"?{highlight:!0}:{},.../^(FF0000|C00000|E00000|FF3333|CC0000)$/.test(O)?{red:!0}:{},...D?{strike:!0}:{},..._?{ins:_}:{},...k?{del:k}:{}})}else(S.name==="w:hyperlink"||S.name==="w:smartTag"||S.name==="w:sdt"||S.name==="w:sdtContent"||S.name==="w:fldSimple")&&y(S,_,k)};return y(v),{runs:m,bookmarks:g,comments:b,images:x}},c=v=>{let m=$i(v,"w:pPr"),g=$i(m,"w:pStyle")?.attrs["w:val"],b=$i(m,"w:outlineLvl")?.attrs["w:val"],x=b!==void 0&&Number(b)<9?Number(b)+1:g?o.get(g)??null:null,y=l(v);return{kind:"p",level:x,text:y.runs.filter(E=>!E.del).map(E=>E.text).join("").trim(),...y}},u=v=>{let m=[],g=[],b=[],x=[],y=[],E=[];for(let _ of jT(v,"w:tr")){let k=[],S=[],A=0;for(let C of jT(_,"w:tc")){let O=$i(C,"w:tcPr"),D=Number($i(O,"w:gridSpan")?.attrs["w:val"]??1),U=$i(O,"w:vMerge"),L=jT(C,"w:p").map(c);L.forEach(P=>{b.push(...P.bookmarks),x.push(...P.comments),y.push(...P.runs)});let I={runs:L.flatMap((P,q)=>q?[{text:`
@@ -1681,7 +1681,7 @@ tfoot td{font-weight:700;border-bottom:0;border-top:1px solid color-mix(in oklab
1681
1681
  `).trim()),p.push("```"),p.push("")}}return p.push("---"),p.push(""),p.push(w("STATS_REVIEW_MD_AI_H2")),p.push(""),p.push(w("STATS_REVIEW_MD_AI_INTRO")),p.push(""),p.push(w("STATS_REVIEW_MD_AI_CRITERIA")),p.push(""),p.push(w("STATS_REVIEW_MD_AI_OUTRO")),p.join(`
1682
1682
  `)}function Hge(e){try{return(0,Wge.execFileSync)("git",e,{encoding:"utf8",maxBuffer:512*1024*1024})}catch(t){let n=t instanceof Error?t.message:String(t);throw new Error(w("STATS_GIT_ERROR__MSG",{msg:n.split(`
1683
1683
  `)[0]??""}))}}function Jlt(e){let t=[],n=null;for(let r of e.split(`
1684
- `)){if(r.includes("")){n&&t.push(n);let[i,a,s,l,c]=r.split("");n={hash:i??"",date:a??"",name:s??"",email:l??"",subject:c||"",additions:0,deletions:0};continue}let o=r.match(/(\d+) insertion[s]?\(\+\)|(\d+) deletion[s]?\(-\)/g);if(o&&n)for(let i of o){let a=i.match(/(\d+) insertion/),s=i.match(/(\d+) deletion/);a?.[1]&&(n.additions+=parseInt(a[1],10)),s?.[1]&&(n.deletions+=parseInt(s[1],10))}}return n&&t.push(n),t}function Zlt(e){return String(e||"").replace(/\|/g,"\\|")}function Vge(e,t){return VH.default.mkdirSync(Kge.default.dirname(e),{recursive:!0}),VH.default.writeFileSync(e,t),e}var VH,Kge,Wge,Yge=Z(()=>{"use strict";VH=Y(require("fs")),Kge=Y(require("path")),Wge=require("child_process");n7();Rt()});var XH={};Ln(XH,{runStats:()=>nct});function ect(e){let t={_:[],open:!0,diff:!0};for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(r==="--since"?t.since=e[++n]:r==="--from"?t.from=e[++n]:r==="--to"?t.to=e[++n]:r==="--member"||r==="-m"?t.member=e[++n]:r==="--project"||r==="-p"?t.project=e[++n]:r==="--port"?t.port=parseInt(e[++n]??"",10):r==="--out"||r==="-o"?t.out=e[++n]:r==="--no-open"?t.open=!1:r==="--no-diff"?t.diff=!1:r==="--head-only"?t.headOnly=!0:r==="--max-diff-lines"?t.maxDiffLines=parseInt(e[++n]??"",10):r.startsWith("--since=")?t.since=r.slice(8):t._.push(r))}return t}function i7(){let e=z2.default.join(Xge.default.homedir(),".pan-code-graph");return a7.default.mkdirSync(e,{recursive:!0}),e}function YH(){let e=E2();if(e)return{repos:Nge(e),source:`.project.yaml (${e.project})`};let t=_2(process.cwd());if(!t.length)throw new Error(w("STATS_NO_REPOS__CWD",{cwd:process.cwd()}));return console.log(w("STATS_FALLBACK_SCAN__CWD",{cwd:process.cwd()})),{repos:t,source:w("STATS_SOURCE_FALLBACK")}}function tct(){console.log(w("STATS_USAGE"))}async function nct(e){let t=ect(e),n=t._[0],r=n!==void 0&&["report","people","review"].includes(n)?t._.shift():"report";return t._[0]==="help"||t.help?tct():r==="review"?act(t):r==="people"?ict(t):oct(t)}function rct(e){let{repos:t}=YH(),n=bE(e),r=!e.headOnly,o=r?w("STATS_SCOPE_ALL_BRANCHES"):w("STATS_SCOPE_HEAD_ONLY");console.log(w("STATS_SCAN_RANGE__N_SCOPE_LABEL",{n:t.length,scope:o,label:n.label}));let{commits:i,repoStatus:a}=KH(t,n,{allBranches:r}),s=WH(z2.default.join(i7(),"alias-map.json"));return{repos:t,range:n,commits:i,repoStatus:a,aliasMap:s}}function oct(e){let{repos:t}=YH(),n=bE({}),r=!e.headOnly,o=r?w("STATS_SCOPE_ALL_BRANCHES"):w("STATS_SCOPE_HEAD_ONLY");console.log(w("STATS_SCAN_FULL__N_SCOPE",{n:t.length,scope:o}));let{commits:i,repoStatus:a}=KH(t,n,{allBranches:r}),s=WH(z2.default.join(i7(),"alias-map.json")),l=i.map(h=>({e:o7(h.email,s),n:h.name||h.email,t:h.ts,r:h.repoName,a:h.additions,d:h.deletions})),c=a.filter(h=>!h.available).map(h=>({name:h.name,reason:h.reason}));bE(e);let u={reposTotal:a.length,reposAvailable:a.filter(h=>h.available).length,unavailable:c,initialSince:e.since!=null?Number(e.since):null,initialFrom:e.from||null,initialTo:e.to||null,initialMembers:e.member?[e.member]:[]},d=Bge(l,u),f=e.out||z2.default.join(i7(),"report.html");a7.default.writeFileSync(f,d),console.log(w("STATS_WROTE_REPORT__PATH_N",{path:f,n:l.length})),c.length&&console.log(w("STATS_UNAVAILABLE__N",{n:c.length})),Gge(d,{port:e.port||4321,open:e.open})}function ict(e){let{commits:t,aliasMap:n}=rct(e),{members:r}=Oge(t,n);console.log(w("STATS_PEOPLE_HEADER__N",{n:r.length}));for(let o of r)console.log(w("STATS_PEOPLE_ROW__N_NAME_EMAIL",{n:String(o.commits).padStart(5),name:o.name,email:o.email}))}function act(e){if(!e.member||!e.project)throw new Error(w("STATS_REVIEW_NEED_FLAGS"));let{repos:t}=YH(),n=t.find(s=>s.name===e.project);if(!n)throw new Error(w("STATS_REVIEW_NO_PROJECT__PROJECT_NAMES",{project:e.project,names:t.map(s=>s.name).join(", ")}));if(!a7.default.existsSync(n.dir))throw new Error(w("STATS_REVIEW_NOT_CLONED__PROJECT_DIR",{project:e.project,dir:n.dir}));let r=bE(e);console.log(w("STATS_REVIEW_BUILDING__MEMBER_PROJECT_LABEL",{member:e.member,project:e.project,label:r.label}));let o=qge(n,e.member,r,{withDiff:e.diff,maxDiffLines:e.maxDiffLines,allBranches:!e.headOnly}),i=`${e.project}_${e.member.replace(/[^a-z0-9]+/gi,"-")}`.toLowerCase(),a=e.out||z2.default.join(i7(),`review-${i}.md`);Vge(a,o),console.log(w("STATS_REVIEW_WROTE__PATH",{path:a})),console.log(w("STATS_REVIEW_HINT"))}var a7,z2,Xge,$H=Z(()=>{"use strict";a7=Y(require("fs")),z2=Y(require("path")),Xge=Y(require("os"));il();Cge();n7();qH();Rge();jge();zge();Yge();Rt()});var QH=F((oIt,sct)=>{sct.exports={name:"@pan-stack/cli",version:"0.3.76",description:"PAN Stack CLI \u2014 multi-repo git and project commands from .project.yaml",license:"SEE LICENSE IN LICENSE.txt",bin:{pan:"bin/pan.js"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},files:["bin","dist/agent-plugin"],scripts:{build:"node tools/pan-stack-cli/build.mjs","build:agent-plugin":"node tools/pan-stack-cli/build-agent-plugin.ts",prepare:"node tools/pan-stack-cli/build.mjs",prepublishOnly:"node tools/pan-stack-cli/build.mjs",test:'tsc --noEmit && tsc -p tsconfig.test.json --noEmit && tsc -p tools/pan-stack-plan/tsconfig.web.json --noEmit && tsc -p tools/pan-stack-plan/tsconfig.e2e.json --noEmit && tsc -p tools/pan-ba/tsconfig.e2e.json --noEmit && node --test "tools/pan-stack-plan/test/*.test.ts" "tools/pan-stack-cli/test/*.test.ts" "tools/pan-lineage/test/*.test.ts" "tools/pan-harness/test/*.test.ts" "tools/pan-program/test/*.test.ts" "tools/pan-handover/test/*.test.ts" "tools/pan-ba-core/test/*.test.ts" "tools/pan-ba/test/*.test.ts" "agent-plugin/plugins/pan/test/*.test.mjs" && node --test "tools/pan-cicd/test/*.test.mjs"',"test:pan-cicd":'node tools/pan-stack-cli/build.mjs && node --test "tools/pan-cicd/test/*.test.mjs"',"test:pan-stack-plan":'node --test "tools/pan-stack-plan/test/*.test.ts"',"test:pan-stack-cli":'node --test "tools/pan-stack-cli/test/*.test.ts"',typecheck:"tsc --noEmit && tsc -p tsconfig.test.json --noEmit && tsc -p tools/pan-stack-plan/tsconfig.web.json --noEmit && tsc -p tools/pan-stack-plan/tsconfig.e2e.json --noEmit && tsc -p tools/pan-ba/tsconfig.e2e.json --noEmit","build:web":"node tools/pan-stack-plan/build-web.mjs",pretest:"node tools/pan-stack-plan/build-web.mjs","test:e2e":"playwright test -c tools/pan-stack-plan/playwright.config.ts","test:e2e:ba":"node tools/pan-stack-cli/build.mjs && playwright test -c tools/pan-ba/playwright.config.ts","test:pan-lineage":'node --test "tools/pan-lineage/test/*.test.ts"'},engines:{node:">=18"},keywords:["pan-stack","monorepo","git","cli"],devDependencies:{"@inquirer/core":"^11.2.1","@inquirer/prompts":"^8.5.2","@inquirer/testing":"^3.3.9","@playwright/test":"1.62.1","@radix-ui/react-dialog":"^1.1.23","@radix-ui/react-popover":"1.1.23","@radix-ui/react-separator":"^1.1.15","@radix-ui/react-slot":"^1.3.3","@radix-ui/react-switch":"^1.3.7","@radix-ui/react-tabs":"^1.1.21","@radix-ui/react-tooltip":"^1.2.16","@tailwindcss/cli":"4.3.3","@tailwindcss/typography":"0.5.20","@types/node":"22.18.8","@types/picomatch":"3.0.1","@types/react":"^19.2.18","@types/react-dom":"^19.2.5","@types/sanitize-html":"2.16.0","class-variance-authority":"0.7.1",clsx:"2.1.1",cmdk:"1.1.1","csv-parse":"7.0.1","csv-stringify":"6.8.1",docx:"9.15.2",esbuild:"0.28.1",marked:"15.0.12","pdf-lib":"1.17.1",picomatch:"4.0.2",react:"19.2.8","react-dom":"19.2.8","react-markdown":"10.1.0","remark-gfm":"4.0.1","sanitize-html":"2.16.0",serve:"^14.2.4","tailwind-merge":"3.6.0",tailwindcss:"4.3.3",typescript:"5.9.3",yaml:"2.6.1"},optionalDependencies:{"@pan-stack/powerpoint":"^0.1.0"}}});var Qge={};Ln(Qge,{runInteractiveMenu:()=>cct});function lct(e){let t=e,n=String(t&&`${String(t.name)} ${String(t.message)}`||"");return/ExitPromptError|force closed|SIGINT|cancel/i.test(n)}async function JH({message:e,choices:t,hotkeys:n=[]}){try{return await W0({message:e,choices:t,hotkeys:n})}catch(r){if(String(r?.message)!=="no-core")throw r;let o=await ru();if(!o||typeof o.select!="function")return"__exit__";let i=n.map(s=>({name:`${s.key} ${s.label}`,value:s.value})),a=i.length?[...t,new o.Separator,...i]:t;return o.select({message:e,choices:a,pageSize:20,loop:!1,theme:ya(!1)})}}async function cct({printUsage:e,version:t}={}){let n=await bA(),r=await ru();if(!n&&(!r||typeof r.select!="function"))return!1;let o=ZT().filter(i=>q_(i).length>0).sort((i,a)=>Sd(i).localeCompare(Sd(a)));if(o.length===0)return console.log(w("NO_PAN_YAML_WITH_COMMANDS")),console.log(w("NO_PAN_YAML_BUT_GIT_STILL_WORKS")),!1;try{for(;;){let i=await JH({message:w("MENU_SELECT_PROJECT"),choices:o.map((f,h)=>({name:Sd(f),value:h,description:`${q_(f).length} ${w("COMMANDS_LABEL")} \xB7 ${f.root}`})),hotkeys:[{key:"h",label:w("HELP_LABEL"),value:"__help__"},{key:"v",label:w("VERSION_LABEL"),value:"__version__"},{key:"x",label:w("EXIT_LABEL"),value:"__exit__"}]});if(i==="__exit__")return!0;if(i==="__version__"){console.log(`@pan-stack/cli ${t||"?"}`);continue}if(i==="__help__"){typeof e=="function"&&e();continue}let a=typeof i=="number"?o[i]:void 0;if(!a)continue;let s=q_(a),l=await JH({message:`[${Sd(a)}] ${w("MENU_SELECT_COMMAND")}`,choices:s.map(f=>({name:f.name+(f.aliases&&f.aliases.length?` (${f.aliases.join(", ")})`:"")+(f.hasTargets?` [${f.targets.join("|")}]`:""),value:f.name,description:f.description||""})),hotkeys:[{key:"b",label:w("BACK_LABEL"),value:"__back__"},{key:"x",label:w("EXIT_LABEL"),value:"__exit__"}]});if(l==="__exit__")return!0;if(l==="__back__")continue;let c=a.commands[String(l)],u=[];if(c&&c.targets&&Object.keys(c.targets).length>0){let f=Object.keys(c.targets),h=await JH({message:w("SELECT_TARGET__CMD",{cmd:l}),choices:[...f.map(p=>({name:p,value:p})),{name:w("DEFAULT_LABEL"),value:"__default__"}],hotkeys:[{key:"b",label:w("BACK_LABEL"),value:"__back__"}]});if(h==="__back__")continue;h!=="__default__"&&u.push(String(h))}console.error(`
1684
+ `)){if(r.includes("")){n&&t.push(n);let[i,a,s,l,c]=r.split("");n={hash:i??"",date:a??"",name:s??"",email:l??"",subject:c||"",additions:0,deletions:0};continue}let o=r.match(/(\d+) insertion[s]?\(\+\)|(\d+) deletion[s]?\(-\)/g);if(o&&n)for(let i of o){let a=i.match(/(\d+) insertion/),s=i.match(/(\d+) deletion/);a?.[1]&&(n.additions+=parseInt(a[1],10)),s?.[1]&&(n.deletions+=parseInt(s[1],10))}}return n&&t.push(n),t}function Zlt(e){return String(e||"").replace(/\|/g,"\\|")}function Vge(e,t){return VH.default.mkdirSync(Kge.default.dirname(e),{recursive:!0}),VH.default.writeFileSync(e,t),e}var VH,Kge,Wge,Yge=Z(()=>{"use strict";VH=Y(require("fs")),Kge=Y(require("path")),Wge=require("child_process");n7();Rt()});var XH={};Ln(XH,{runStats:()=>nct});function ect(e){let t={_:[],open:!0,diff:!0};for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(r==="--since"?t.since=e[++n]:r==="--from"?t.from=e[++n]:r==="--to"?t.to=e[++n]:r==="--member"||r==="-m"?t.member=e[++n]:r==="--project"||r==="-p"?t.project=e[++n]:r==="--port"?t.port=parseInt(e[++n]??"",10):r==="--out"||r==="-o"?t.out=e[++n]:r==="--no-open"?t.open=!1:r==="--no-diff"?t.diff=!1:r==="--head-only"?t.headOnly=!0:r==="--max-diff-lines"?t.maxDiffLines=parseInt(e[++n]??"",10):r.startsWith("--since=")?t.since=r.slice(8):t._.push(r))}return t}function i7(){let e=z2.default.join(Xge.default.homedir(),".pan-code-graph");return a7.default.mkdirSync(e,{recursive:!0}),e}function YH(){let e=E2();if(e)return{repos:Nge(e),source:`.project.yaml (${e.project})`};let t=_2(process.cwd());if(!t.length)throw new Error(w("STATS_NO_REPOS__CWD",{cwd:process.cwd()}));return console.log(w("STATS_FALLBACK_SCAN__CWD",{cwd:process.cwd()})),{repos:t,source:w("STATS_SOURCE_FALLBACK")}}function tct(){console.log(w("STATS_USAGE"))}async function nct(e){let t=ect(e),n=t._[0],r=n!==void 0&&["report","people","review"].includes(n)?t._.shift():"report";return t._[0]==="help"||t.help?tct():r==="review"?act(t):r==="people"?ict(t):oct(t)}function rct(e){let{repos:t}=YH(),n=bE(e),r=!e.headOnly,o=r?w("STATS_SCOPE_ALL_BRANCHES"):w("STATS_SCOPE_HEAD_ONLY");console.log(w("STATS_SCAN_RANGE__N_SCOPE_LABEL",{n:t.length,scope:o,label:n.label}));let{commits:i,repoStatus:a}=KH(t,n,{allBranches:r}),s=WH(z2.default.join(i7(),"alias-map.json"));return{repos:t,range:n,commits:i,repoStatus:a,aliasMap:s}}function oct(e){let{repos:t}=YH(),n=bE({}),r=!e.headOnly,o=r?w("STATS_SCOPE_ALL_BRANCHES"):w("STATS_SCOPE_HEAD_ONLY");console.log(w("STATS_SCAN_FULL__N_SCOPE",{n:t.length,scope:o}));let{commits:i,repoStatus:a}=KH(t,n,{allBranches:r}),s=WH(z2.default.join(i7(),"alias-map.json")),l=i.map(h=>({e:o7(h.email,s),n:h.name||h.email,t:h.ts,r:h.repoName,a:h.additions,d:h.deletions})),c=a.filter(h=>!h.available).map(h=>({name:h.name,reason:h.reason}));bE(e);let u={reposTotal:a.length,reposAvailable:a.filter(h=>h.available).length,unavailable:c,initialSince:e.since!=null?Number(e.since):null,initialFrom:e.from||null,initialTo:e.to||null,initialMembers:e.member?[e.member]:[]},d=Bge(l,u),f=e.out||z2.default.join(i7(),"report.html");a7.default.writeFileSync(f,d),console.log(w("STATS_WROTE_REPORT__PATH_N",{path:f,n:l.length})),c.length&&console.log(w("STATS_UNAVAILABLE__N",{n:c.length})),Gge(d,{port:e.port||4321,open:e.open})}function ict(e){let{commits:t,aliasMap:n}=rct(e),{members:r}=Oge(t,n);console.log(w("STATS_PEOPLE_HEADER__N",{n:r.length}));for(let o of r)console.log(w("STATS_PEOPLE_ROW__N_NAME_EMAIL",{n:String(o.commits).padStart(5),name:o.name,email:o.email}))}function act(e){if(!e.member||!e.project)throw new Error(w("STATS_REVIEW_NEED_FLAGS"));let{repos:t}=YH(),n=t.find(s=>s.name===e.project);if(!n)throw new Error(w("STATS_REVIEW_NO_PROJECT__PROJECT_NAMES",{project:e.project,names:t.map(s=>s.name).join(", ")}));if(!a7.default.existsSync(n.dir))throw new Error(w("STATS_REVIEW_NOT_CLONED__PROJECT_DIR",{project:e.project,dir:n.dir}));let r=bE(e);console.log(w("STATS_REVIEW_BUILDING__MEMBER_PROJECT_LABEL",{member:e.member,project:e.project,label:r.label}));let o=qge(n,e.member,r,{withDiff:e.diff,maxDiffLines:e.maxDiffLines,allBranches:!e.headOnly}),i=`${e.project}_${e.member.replace(/[^a-z0-9]+/gi,"-")}`.toLowerCase(),a=e.out||z2.default.join(i7(),`review-${i}.md`);Vge(a,o),console.log(w("STATS_REVIEW_WROTE__PATH",{path:a})),console.log(w("STATS_REVIEW_HINT"))}var a7,z2,Xge,$H=Z(()=>{"use strict";a7=Y(require("fs")),z2=Y(require("path")),Xge=Y(require("os"));il();Cge();n7();qH();Rge();jge();zge();Yge();Rt()});var QH=F((oIt,sct)=>{sct.exports={name:"@pan-stack/cli",version:"0.3.77",description:"PAN Stack CLI \u2014 multi-repo git and project commands from .project.yaml",license:"SEE LICENSE IN LICENSE.txt",bin:{pan:"bin/pan.js"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},files:["bin","dist/agent-plugin"],scripts:{build:"node tools/pan-stack-cli/build.mjs","build:agent-plugin":"node tools/pan-stack-cli/build-agent-plugin.ts",prepare:"node tools/pan-stack-cli/build.mjs",prepublishOnly:"node tools/pan-stack-cli/build.mjs",test:'tsc --noEmit && tsc -p tsconfig.test.json --noEmit && tsc -p tools/pan-stack-plan/tsconfig.web.json --noEmit && tsc -p tools/pan-stack-plan/tsconfig.e2e.json --noEmit && tsc -p tools/pan-ba/tsconfig.e2e.json --noEmit && node --test "tools/pan-stack-plan/test/*.test.ts" "tools/pan-stack-cli/test/*.test.ts" "tools/pan-lineage/test/*.test.ts" "tools/pan-harness/test/*.test.ts" "tools/pan-program/test/*.test.ts" "tools/pan-handover/test/*.test.ts" "tools/pan-ba-core/test/*.test.ts" "tools/pan-ba/test/*.test.ts" "agent-plugin/plugins/pan/test/*.test.mjs" && node --test "tools/pan-cicd/test/*.test.mjs"',"test:pan-cicd":'node tools/pan-stack-cli/build.mjs && node --test "tools/pan-cicd/test/*.test.mjs"',"test:pan-stack-plan":'node --test "tools/pan-stack-plan/test/*.test.ts"',"test:pan-stack-cli":'node --test "tools/pan-stack-cli/test/*.test.ts"',typecheck:"tsc --noEmit && tsc -p tsconfig.test.json --noEmit && tsc -p tools/pan-stack-plan/tsconfig.web.json --noEmit && tsc -p tools/pan-stack-plan/tsconfig.e2e.json --noEmit && tsc -p tools/pan-ba/tsconfig.e2e.json --noEmit","build:web":"node tools/pan-stack-plan/build-web.mjs",pretest:"node tools/pan-stack-plan/build-web.mjs","test:e2e":"playwright test -c tools/pan-stack-plan/playwright.config.ts","test:e2e:ba":"node tools/pan-stack-cli/build.mjs && playwright test -c tools/pan-ba/playwright.config.ts","test:pan-lineage":'node --test "tools/pan-lineage/test/*.test.ts"'},engines:{node:">=18"},keywords:["pan-stack","monorepo","git","cli"],devDependencies:{"@inquirer/core":"^11.2.1","@inquirer/prompts":"^8.5.2","@inquirer/testing":"^3.3.9","@playwright/test":"1.62.1","@radix-ui/react-dialog":"^1.1.23","@radix-ui/react-popover":"1.1.23","@radix-ui/react-separator":"^1.1.15","@radix-ui/react-slot":"^1.3.3","@radix-ui/react-switch":"^1.3.7","@radix-ui/react-tabs":"^1.1.21","@radix-ui/react-tooltip":"^1.2.16","@tailwindcss/cli":"4.3.3","@tailwindcss/typography":"0.5.20","@types/node":"22.18.8","@types/picomatch":"3.0.1","@types/react":"^19.2.18","@types/react-dom":"^19.2.5","@types/sanitize-html":"2.16.0","class-variance-authority":"0.7.1",clsx:"2.1.1",cmdk:"1.1.1","csv-parse":"7.0.1","csv-stringify":"6.8.1",docx:"9.15.2",esbuild:"0.28.1",marked:"15.0.12","pdf-lib":"1.17.1",picomatch:"4.0.2",react:"19.2.8","react-dom":"19.2.8","react-markdown":"10.1.0","remark-gfm":"4.0.1","sanitize-html":"2.16.0",serve:"^14.2.4","tailwind-merge":"3.6.0",tailwindcss:"4.3.3",typescript:"5.9.3",yaml:"2.6.1"},optionalDependencies:{"@pan-stack/powerpoint":"^0.1.0"}}});var Qge={};Ln(Qge,{runInteractiveMenu:()=>cct});function lct(e){let t=e,n=String(t&&`${String(t.name)} ${String(t.message)}`||"");return/ExitPromptError|force closed|SIGINT|cancel/i.test(n)}async function JH({message:e,choices:t,hotkeys:n=[]}){try{return await W0({message:e,choices:t,hotkeys:n})}catch(r){if(String(r?.message)!=="no-core")throw r;let o=await ru();if(!o||typeof o.select!="function")return"__exit__";let i=n.map(s=>({name:`${s.key} ${s.label}`,value:s.value})),a=i.length?[...t,new o.Separator,...i]:t;return o.select({message:e,choices:a,pageSize:20,loop:!1,theme:ya(!1)})}}async function cct({printUsage:e,version:t}={}){let n=await bA(),r=await ru();if(!n&&(!r||typeof r.select!="function"))return!1;let o=ZT().filter(i=>q_(i).length>0).sort((i,a)=>Sd(i).localeCompare(Sd(a)));if(o.length===0)return console.log(w("NO_PAN_YAML_WITH_COMMANDS")),console.log(w("NO_PAN_YAML_BUT_GIT_STILL_WORKS")),!1;try{for(;;){let i=await JH({message:w("MENU_SELECT_PROJECT"),choices:o.map((f,h)=>({name:Sd(f),value:h,description:`${q_(f).length} ${w("COMMANDS_LABEL")} \xB7 ${f.root}`})),hotkeys:[{key:"h",label:w("HELP_LABEL"),value:"__help__"},{key:"v",label:w("VERSION_LABEL"),value:"__version__"},{key:"x",label:w("EXIT_LABEL"),value:"__exit__"}]});if(i==="__exit__")return!0;if(i==="__version__"){console.log(`@pan-stack/cli ${t||"?"}`);continue}if(i==="__help__"){typeof e=="function"&&e();continue}let a=typeof i=="number"?o[i]:void 0;if(!a)continue;let s=q_(a),l=await JH({message:`[${Sd(a)}] ${w("MENU_SELECT_COMMAND")}`,choices:s.map(f=>({name:f.name+(f.aliases&&f.aliases.length?` (${f.aliases.join(", ")})`:"")+(f.hasTargets?` [${f.targets.join("|")}]`:""),value:f.name,description:f.description||""})),hotkeys:[{key:"b",label:w("BACK_LABEL"),value:"__back__"},{key:"x",label:w("EXIT_LABEL"),value:"__exit__"}]});if(l==="__exit__")return!0;if(l==="__back__")continue;let c=a.commands[String(l)],u=[];if(c&&c.targets&&Object.keys(c.targets).length>0){let f=Object.keys(c.targets),h=await JH({message:w("SELECT_TARGET__CMD",{cmd:l}),choices:[...f.map(p=>({name:p,value:p})),{name:w("DEFAULT_LABEL"),value:"__default__"}],hotkeys:[{key:"b",label:w("BACK_LABEL"),value:"__back__"}]});if(h==="__back__")continue;h!=="__default__"&&u.push(String(h))}console.error(`
1685
1685
  \u25B6 pan ${l}${u.length?" "+u.join(" "):""} (${$ge.default.basename(a.root)})
1686
1686
  `);let d=await e7(a,String(l),u);if(!(d&&d.backed))return!0}}catch(i){if(lct(i))return console.error(`
1687
1687
  `+w("EXITED")),!0;throw i}}var $ge,Jge=Z(()=>{"use strict";$ge=Y(require("path"));il();am();LH();U1();Cs();hm();Rt()});function fct(e){return new Promise(t=>setTimeout(t,e))}async function H2(e,t,n={}){let r=Math.max(1,n.attempts??(ebe?8:3)),o=Math.max(1,n.baseDelayMs??25),i;for(let a=1;a<=r;a+=1)try{await Zge.default.rename(e,t);return}catch(s){i=s;let l=s.code??"";if(!uct.has(l)||a===r)throw s;await fct(o*a)}throw i}function z1(e){let t=String(e);if(ebe){(0,ZH.execFile)(process.env.ComSpec||"cmd.exe",["/s","/c","start",'""',t],{windowsVerbatimArguments:!0},()=>{});return}let n=process.platform==="darwin"?"open":"xdg-open";(0,ZH.execFile)(n,[t],()=>{})}function tbe(e){return!e||dct.has(e.code??"")}var ZH,Zge,ebe,uct,dct,H1=Z(()=>{"use strict";ZH=require("node:child_process"),Zge=Y(require("node:fs/promises")),ebe=process.platform==="win32",uct=new Set(["EBUSY","EPERM","EACCES","ENOTEMPTY"]),dct=new Set(["EINVAL","ENOTSUP","EPERM","EACCES","EISDIR","EBADF"])});function obe(e){return`# Quiz t\xE0i li\u1EC7u b\xE0n giao \u2014 ki\u1EC3m b\u1EB1ng \`pan handover check\` (ho\u1EB7c \`pan handover quiz check <t\u1EC7p>\`).
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pan",
3
3
  "displayName": "PAN",
4
- "version": "0.3.76",
4
+ "version": "0.3.77",
5
5
  "description": "Harness cho workspace PAN Stack: mọi commit của Claude mang danh tính AI + người chủ quản + máy; nguồn tài liệu (Pan Lineage) của tệp hiện ra trước khi sửa.",
6
6
  "author": {
7
7
  "name": "n46-labs"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pan",
3
- "version": "0.3.76",
3
+ "version": "0.3.77",
4
4
  "description": "PAN Stack harness for AI agents: every commit carries AI + owner + machine identity, document sources (Pan Lineage) show before edits, and PAN skills load on their own.",
5
5
  "author": {
6
6
  "name": "n46-labs"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pan",
3
3
  "displayName": "PAN",
4
- "version": "0.3.76",
4
+ "version": "0.3.77",
5
5
  "description": "PAN Stack harness for AI agents: every commit carries AI + owner + machine identity, document sources (Pan Lineage) show before edits, and PAN skills load on their own.",
6
6
  "author": {
7
7
  "name": "n46-labs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pan-stack/cli",
3
- "version": "0.3.76",
3
+ "version": "0.3.77",
4
4
  "description": "PAN Stack CLI — multi-repo git and project commands from .project.yaml",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "bin": {