@cldmv/fix-headers 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +11 -6
  2. package/dist/cli.mjs +57 -0
  3. package/dist/config/load.mjs +2 -0
  4. package/dist/constants.mjs +2 -0
  5. package/dist/core/declaration-sources.mjs +4 -0
  6. package/dist/core/file-discovery.mjs +2 -0
  7. package/dist/core/fix-headers.mjs +3 -0
  8. package/dist/core/ignore-rules.mjs +2 -0
  9. package/dist/detect/project.mjs +2 -0
  10. package/dist/detectors/c.mjs +6 -0
  11. package/dist/detectors/css.mjs +2 -0
  12. package/dist/detectors/go.mjs +2 -0
  13. package/dist/detectors/html.mjs +2 -0
  14. package/dist/detectors/index.mjs +3 -0
  15. package/dist/detectors/json.mjs +2 -0
  16. package/dist/detectors/markdown.mjs +2 -0
  17. package/dist/detectors/node.mjs +2 -0
  18. package/dist/detectors/php.mjs +2 -0
  19. package/dist/detectors/python.mjs +2 -0
  20. package/dist/detectors/rust.mjs +2 -0
  21. package/dist/detectors/top-lines.mjs +3 -0
  22. package/dist/detectors/yaml.mjs +2 -0
  23. package/dist/drivers/go.mjs +2 -0
  24. package/dist/drivers/index.mjs +2 -0
  25. package/dist/drivers/node.mjs +2 -0
  26. package/dist/drivers/php.mjs +2 -0
  27. package/dist/drivers/python.mjs +2 -0
  28. package/dist/drivers/rust.mjs +2 -0
  29. package/dist/drivers/shared.mjs +4 -0
  30. package/dist/header/dates.mjs +2 -0
  31. package/dist/header/fields.mjs +2 -0
  32. package/dist/header/parser.mjs +21 -0
  33. package/dist/header/syntax.mjs +4 -0
  34. package/dist/header/template.mjs +2 -0
  35. package/dist/index.cjs +16 -16
  36. package/dist/index.mjs +2 -37
  37. package/dist/utils/diff.mjs +5 -0
  38. package/dist/utils/fs.mjs +2 -0
  39. package/dist/utils/git.mjs +4 -0
  40. package/dist/utils/text.mjs +2 -0
  41. package/dist/utils/time.mjs +2 -0
  42. package/package.json +9 -12
  43. package/types/src/cli.d.mts +15 -0
  44. package/types/src/config/load.d.mts +15 -0
  45. package/types/src/constants.d.mts +15 -0
  46. package/types/src/core/declaration-sources.d.mts +58 -0
  47. package/types/src/core/file-discovery.d.mts +15 -0
  48. package/types/src/core/fix-headers.d.mts +16 -0
  49. package/types/src/core/ignore-rules.d.mts +15 -0
  50. package/types/src/detect/project.d.mts +15 -0
  51. package/types/src/detectors/c.d.mts +15 -0
  52. package/types/src/detectors/css.d.mts +15 -0
  53. package/types/src/detectors/go.d.mts +15 -0
  54. package/types/src/detectors/html.d.mts +15 -0
  55. package/types/src/detectors/index.d.mts +15 -0
  56. package/types/src/detectors/json.d.mts +15 -0
  57. package/types/src/detectors/markdown.d.mts +15 -0
  58. package/types/src/detectors/node.d.mts +15 -0
  59. package/types/src/detectors/php.d.mts +15 -0
  60. package/types/src/detectors/python.d.mts +15 -0
  61. package/types/src/detectors/rust.d.mts +15 -0
  62. package/types/src/detectors/top-lines.d.mts +15 -0
  63. package/types/src/detectors/yaml.d.mts +15 -0
  64. package/types/src/drivers/go.d.mts +15 -0
  65. package/types/src/drivers/index.d.mts +15 -0
  66. package/types/src/drivers/node.d.mts +15 -0
  67. package/types/src/drivers/php.d.mts +15 -0
  68. package/types/src/drivers/python.d.mts +15 -0
  69. package/types/src/drivers/rust.d.mts +15 -0
  70. package/types/src/drivers/shared.d.mts +15 -0
  71. package/types/src/header/dates.d.mts +15 -0
  72. package/types/src/header/fields.d.mts +15 -0
  73. package/types/src/header/parser.d.mts +15 -0
  74. package/types/src/header/syntax.d.mts +15 -0
  75. package/types/src/header/template.d.mts +15 -0
  76. package/types/src/index.d.mts +15 -0
  77. package/types/src/utils/diff.d.mts +2 -1
  78. package/types/src/utils/fs.d.mts +15 -0
  79. package/types/src/utils/git.d.mts +15 -0
  80. package/types/src/utils/text.d.mts +2 -1
  81. package/types/src/utils/time.d.mts +2 -1
  82. package/bin/fix-headers.mjs +0 -91
  83. package/types/devcheck.d.mts +0 -1
  84. package/types/index.d.mts +0 -2
package/dist/index.mjs CHANGED
@@ -1,37 +1,2 @@
1
- var br=Object.defineProperty;var i=(e,t)=>br(e,"name",{value:t,configurable:!0});import{readFile as $i,stat as Ci,writeFile as Di}from"node:fs/promises";import{relative as Ke,resolve as lr}from"node:path";import{readFile as Er}from"node:fs/promises";import{createRequire as kr}from"node:module";import{dirname as Sr,isAbsolute as $r,resolve as xt}from"node:path";var Cr=3e4,Dr=new Set(["localhost","127.0.0.1","[::1]"]);function be(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}i(be,"isPlainObject");function Ee(e,t){let n={...e};for(let[r,o]of Object.entries(t))r!=="__proto__"&&(n[r]=be(n[r])&&be(o)?Ee(n[r],o):o);return n}i(Ee,"mergeConfig");function wt(e){return e.kind==="file"?e.path:e.href}i(wt,"describeSource");async function Ar(e){if(e.kind==="file")return{text:await Er(e.path,"utf8"),source:e};let t;try{t=await fetch(e.href,{cache:"no-store",redirect:"follow",signal:AbortSignal.timeout(Cr)})}catch(n){let r=n.cause instanceof Error?n.cause.message:n.message;throw new Error(`Failed to fetch config ${e.href}: ${r}`,{cause:n})}if(!t.ok)throw new Error(`Failed to fetch config ${e.href}: HTTP ${t.status} ${t.statusText}`);return{text:await t.text(),source:{kind:"url",href:t.url}}}i(Ar,"readSource");function yt(e){if(e.protocol==="http:"&&!Dr.has(e.hostname))throw new Error(`Refusing to fetch config over plain http: ${e.href} (use https)`);return{kind:"url",href:e.href}}i(yt,"toUrlSource");function Fr(e,t){if(/^https?:\/\//i.test(e))return yt(new URL(e));if(/^[a-z][a-z\d+.-]+:\/\//i.test(e))throw new Error(`Unsupported extends URL "${e}" in ${wt(t)}; use https, a file path or a package path`);let n=/^\.{1,2}[\\/]/.test(e);if(t.kind==="url"){if(n||e.startsWith("/"))return yt(new URL(e,t.href));throw new Error(`Cannot extend package "${e}" from the remote config ${t.href}; use a URL or a relative path`)}if(n||$r(e))return{kind:"file",path:xt(Sr(t.path),e)};try{return{kind:"file",path:kr(t.path).resolve(e)}}catch(r){throw new Error(`Cannot resolve extends "${e}" from ${t.path}: ${r.message}`,{cause:r})}}i(Fr,"resolveReference");function Nr(e,t){if(e===void 0)return[];let n=Array.isArray(e)?e:[e];if(!n.every(r=>typeof r=="string"&&r.trim().length>0))throw new Error(`Config "extends" must be a string or an array of strings: ${t}`);return n.map(r=>r.trim())}i(Nr,"readExtends");async function bt(e,t){let n=wt(e);if(t.includes(n))throw new Error(`Config extends cycle: ${[...t,n].join(" -> ")}`);let{text:r,source:o}=await Ar(e),s;try{s=JSON.parse(r)}catch(u){throw new Error(`Config ${n} is not valid JSON: ${u.message}`,{cause:u})}if(!be(s))throw new Error(`Config file must contain a JSON object: ${n}`);let{extends:a,...c}=s,l={};for(let u of Nr(a,n))l=Ee(l,await bt(Fr(u,o),[...t,n]));return Ee(l,c)}i(bt,"loadSource");function vr(e,t=process.cwd()){return bt({kind:"file",path:xt(t,e)},[])}i(vr,"loadConfigFile");async function Et(e,t){let n=typeof e[t]=="string"?e[t].trim():"";if(n.length===0)return e;let r=typeof e.cwd=="string"&&e.cwd.length>0?e.cwd:process.cwd(),o={...await vr(n,r),...e};return delete o[t],o}i(Et,"applyConfigOption");import{extname as $e}from"node:path";import{extname as Lr}from"node:path";var St=[".c",".h",".cc",".cpp",".cxx",".hh",".hpp",".hxx"],Rr=400,Mr=/\bcopyright\b|\blicen[cs]e[ds]?\b|SPDX-License-Identifier|\bpublic domain\b/i,kt=/^[\s*/]*@(?:Project|Filename):/m;function jr(e){let t=Lr(e).toLowerCase();return St.includes(t)?{kind:"block",blockStart:"/*",blockLinePrefix:" * ",blockEnd:" */"}:null}i(jr,"resolveCCommentSyntax");function Pr(e){let t=e.replace(/^\uFEFF/,"").split(`
2
- `).slice(0,Rr),n=[],r=null,o=null,s=!1;for(let a of t){let c=a.replace(/\r$/,"");if(r){r.push(c),c.includes("*/")&&(n.push(r.join(`
3
- `)),r=null);continue}if(s){s=c.endsWith("\\");continue}let l=c.trim();if(o&&!l.startsWith("//")&&(n.push(o.join(`
4
- `)),o=null),l.length!==0){if(l.startsWith("//")){(o??=[]).push(l);continue}if(l.startsWith("/*")){let u=l.indexOf("*/",2);if(u===-1){r=[l];continue}if(n.push(l.slice(0,u+2)),l.slice(u+2).trim().length>0)break;continue}if(l.startsWith("#")){s=l.endsWith("\\");continue}break}}return o&&n.push(o.join(`
5
- `)),n}i(Pr,"prologueComments");var $t={id:"c",extensions:St,enabledByDefault:!0,resolveContentSkipReason(e){let t=Pr(e);return t.length>0&&kt.test(t[0])?null:t.some(n=>!kt.test(n)&&Mr.test(n))?"the file starts with a license or copyright notice that is not a fix-headers header (third-party code)":null},resolveCommentSyntax(e){return jr(e)}};import{extname as Ir}from"node:path";var Ct=[".css"];function Or(e){let t=Ir(e).toLowerCase();return Ct.includes(t)?{kind:"block",blockStart:"/*",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Or,"resolveCssCommentSyntax");var Dt={id:"css",extensions:Ct,enabledByDefault:!0,keepsAboveHeader:i((e,t)=>t===0&&/^@charset "[^"]*";/.test(e),"keepsAboveHeader"),resolveCommentSyntax(e){return Or(e)}};import{extname as Br}from"node:path";var Tr=/^(?:#|\/\/|\/\*+|<!--)[ \t]+(vi|vim(?:[<=>]?\d+)?|Vim|ex):(.*)$/,Hr=/^[a-z]+(?:[!&]|[+^-]?=(?:\\.|[^\s:\\])*)?$/,_r=new Set(["et","expandtab","ai","autoindent","si","smartindent","ro","readonly","bin","binary","noet","noexpandtab","noai","noautoindent","nosi","nosmartindent","noro","noreadonly","nobin","nobinary","nowrap","nolist","nospell","nofen","nofoldenable","noeol","nofixeol","nofixendofline"]);function oe(e){let t=e.match(Tr);if(!t)return!1;let n=t[2].trim();if(n.endsWith("-->"))n=n.slice(0,-3).trimEnd();else if(n.endsWith("*/")){let s=n.length-2;for(;s>0&&n[s-1]==="*";)s-=1;n=n.slice(0,s).trimEnd()}let r=n.match(/^se(?:t)?[ \t]((?:\\.|[^:\\])*):/);if(!r&&t[1]==="Vim")return!1;let o=r?r[1].match(/(?:\\.|[^\s\\])+/g):n.match(/(?:\\.|[^\s:\\])+/g);return o!==null&&o.every(s=>Hr.test(s))&&o.some(s=>s.includes("=")||_r.has(s))}i(oe,"isModeline");function ie(e,t){return t===0&&e.startsWith("#!")}i(ie,"isShebang");function se(e,t,n=0){let r=0,o=n;for(;r<e.length;){let s=e.indexOf(`
6
- `,r),a=s===-1?e.length:s+1;if(!t(e.slice(r,a).replace(/\r?\n$/,""),o))break;r=a,o+=1}return e.slice(0,r)}i(se,"takeTopLines");var Ft=[".go"];function Ur(e){let t=Br(e).toLowerCase();return Ft.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Ur,"resolveGoCommentSyntax");var At=/^\/\/(?:go:build|\s*\+build)\s/;function Wr(e,t){let n=se(t,o=>At.test(o)||oe(o));if(!n.split(/\r?\n/).some(o=>At.test(o)))return"";let r=t.slice(n.length);return`${n}${r.slice(0,r.length-r.replace(/^(?:[ \t]*\r?\n)*/,"").length)}`}i(Wr,"resolveGoPreservedPrefix");var Nt={id:"go",extensions:Ft,enabledByDefault:!0,resolvePreservedPrefix(e,t){return Wr(e,t)},resolveCommentSyntax(e){return Ur(e)}};import{extname as zr}from"node:path";var vt=[".html",".htm"];function Gr(e){let t=zr(e).toLowerCase();return vt.includes(t)?{kind:"html",blockStart:"<!--",blockLinePrefix:" ",blockEnd:"-->"}:null}i(Gr,"resolveHtmlCommentSyntax");var Lt={id:"html",extensions:vt,enabledByDefault:!0,resolveCommentSyntax(e){return Gr(e)}};import{extname as Yr}from"node:path";var Rt=[".jsonv",".jsonc",".json5"];function Vr(e){let t=Yr(e).toLowerCase();return Rt.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Vr,"resolveJsonCommentSyntax");var Mt={id:"json",extensions:Rt,enabledByDefault:!0,resolveCommentSyntax(e){return Vr(e)}};import{extname as Jr}from"node:path";var jt=[".md",".markdown"];function qr(e){let t=Jr(e).toLowerCase();return jt.includes(t)?{kind:"html",blockStart:"<!--",blockLinePrefix:" ",blockEnd:"-->"}:null}i(qr,"resolveMarkdownCommentSyntax");function Kr(e,t){let n=t.match(/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/);return n?n[0]:""}i(Kr,"resolveMarkdownPreservedPrefix");var Pt={id:"markdown",extensions:jt,enabledByDefault:!1,requiresForce:!0,resolvePreservedPrefix(e,t){return Kr(e,t)},resolveCommentSyntax(e){return qr(e)}};import{basename as ke,extname as Zr}from"node:path";var It=[".js",".mjs",".cjs",".ts",".mts",".cts",".tsx",".jsx"];function Xr(e){let t=Zr(e).toLowerCase();return It.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Xr,"resolveNodeCommentSyntax");var Ot=/^(.+)\.d\.(ts|mts|cts)$/i,Qr={ts:[".ts",".tsx",".js",".jsx"],mts:[".mts",".mjs"],cts:[".cts",".cjs"]};function eo(e){let t=/^\s*\/\*[\s\S]*?\*\//.exec(e.replace(/^\uFEFF/,""));if(!t)return null;let n=/^[\s*]*@Filename:[ \t]*(\S+)/m.exec(t[0]);return n?n[1]:null}i(eo,"leadingHeaderFilename");function Tt(e){return Ot.test(ke(e))}i(Tt,"isDeclarationFile");function Se(e,t){let n=Ot.exec(ke(t));if(!n)return null;let r=eo(e);if(r===null)return null;let o=ke(r),[,s,a]=n;return Qr[a.toLowerCase()].some(l=>o===`${s}${l}`)?`the file is a declaration generated from ${o} and carries its header (tsc copies it)`:null}i(Se,"declarationCopySkipReason");var Ht={id:"node",extensions:It,enabledByDefault:!0,keepsAboveHeader:ie,resolveContentSkipReason(e,t){return Se(e,t)},resolveCommentSyntax(e){return Xr(e)}};import{extname as to}from"node:path";var Bt=[".php"];function no(e){let t=to(e).toLowerCase();return Bt.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(no,"resolvePhpCommentSyntax");var _t=/^<\?php(?:\s|$)/i,Ut={id:"php",extensions:Bt,enabledByDefault:!0,keepsAboveHeader:i((e,t)=>t===0&&_t.test(e),"keepsAboveHeader"),resolveContentSkipReason(e){return _t.test(e.replace(/^\uFEFF/,""))?null:"the file does not start with <?php, so a comment at the top would be output as text"},resolveCommentSyntax(e){return no(e)}};import{extname as ro}from"node:path";var Wt=[".py"],oo=/^#.*?(?<![A-Za-z])coding[:=]\s*[-\w.]+/;function io(e,t){return ie(e,t)||t<=1&&oo.test(e)}i(io,"keepsAboveHeader");var zt={id:"python",extensions:Wt,enabledByDefault:!0,keepsAboveHeader:io,resolveCommentSyntax(e){let t=ro(e).toLowerCase();return Wt.includes(t)?{kind:"line",linePrefix:"#"}:null}};import{extname as so}from"node:path";var Gt=[".rs"];function ao(e){let t=so(e).toLowerCase();return Gt.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(ao,"resolveRustCommentSyntax");var Yt={id:"rust",extensions:Gt,enabledByDefault:!0,keepsAboveHeader:i((e,t)=>t===0&&e.startsWith("#!")&&!/^#!\s*\[/.test(e),"keepsAboveHeader"),resolveCommentSyntax(e){return ao(e)}};import{extname as co}from"node:path";var Vt=[".yaml",".yml"];function lo(e){let t=co(e).toLowerCase();return Vt.includes(t)?{kind:"line",linePrefix:"#"}:null}i(lo,"resolveYamlCommentSyntax");var Jt={id:"yaml",extensions:Vt,enabledByDefault:!0,keepsAboveHeader:i((e,t)=>t===0&&/^#cloud-config\s*$/.test(e),"keepsAboveHeader"),resolveCommentSyntax(e){return lo(e)}};var ae=[$t,Dt,Nt,Lt,Mt,Pt,Ht,Ut,zt,Yt,Jt],uo=new Map(ae.map(e=>[e.id,e]));function fo(e,t){return!t||typeof t!="object"?e:e.kind==="line"?{...e,linePrefix:typeof t.linePrefix=="string"&&t.linePrefix.length>0?t.linePrefix:e.linePrefix,lineSeparator:typeof t.lineSeparator=="string"?t.lineSeparator:e.lineSeparator}:{...e,blockStart:typeof t.blockStart=="string"&&t.blockStart.length>0?t.blockStart:e.blockStart,blockLinePrefix:typeof t.blockLinePrefix=="string"&&t.blockLinePrefix.length>0?t.blockLinePrefix:e.blockLinePrefix,blockEnd:typeof t.blockEnd=="string"&&t.blockEnd.length>0?t.blockEnd:e.blockEnd}}i(fo,"applySyntaxOverride");function qt(e){if(e==null)return[];if(!Array.isArray(e)||e.some(n=>typeof n!="string"))throw new Error(`forcedDetectors must be an array of detector ids, got ${JSON.stringify(e)}`);let t=ae.filter(n=>n.requiresForce===!0).map(n=>n.id);for(let n of e){if(!uo.has(n))throw new Error(`forcedDetectors: unknown detector "${n}" (force-only detectors: ${t.join(", ")})`);if(!t.includes(n))throw new Error(`forcedDetectors: "${n}" does not need forcing (force-only detectors: ${t.join(", ")})`)}return Array.from(new Set(e))}i(qt,"resolveForcedDetectors");function I(e={}){let t=new Set(Array.isArray(e.enabledDetectors)?e.enabledDetectors:[]),n=new Set(Array.isArray(e.disabledDetectors)?e.disabledDetectors:[]),r=new Set(Array.isArray(e.forcedDetectors)?e.forcedDetectors:[]);return ae.filter(o=>o.requiresForce===!0?r.has(o.id)&&!n.has(o.id):t.size>0?t.has(o.id):n.has(o.id)?!1:o.enabledByDefault)}i(I,"getEnabledDetectors");function Kt(e={}){if(Array.isArray(e.includeExtensions)&&e.includeExtensions.length>0)return new Set(e.includeExtensions.map(n=>n.toLowerCase()));let t=I(e);return new Set(t.flatMap(n=>n.extensions))}i(Kt,"getAllowedExtensions");function Zt(e,t={}){let n=$e(e).toLowerCase();if(I(t).some(a=>a.extensions.includes(n)&&a.resolveCommentSyntax(e)!==null))return null;if(n.length===0)return"the file has no extension, so its comment syntax is unknown";let o=new Set(Array.isArray(t.forcedDetectors)?t.forcedDetectors:[]),s=ae.find(a=>a.requiresForce===!0&&a.extensions.includes(n)&&!o.has(a.id));return s?`${n} files get a header only when forced (--force-detector ${s.id} / forcedDetectors: ["${s.id}"])`:`no enabled detector handles ${n} files`}i(Zt,"getHeaderSkipReason");function Xt(e,t={}){let n=$e(e).toLowerCase(),r=Array.isArray(t.detectors)?t.detectors:I(t);for(let o of r){if(!o.extensions.includes(n))continue;let s=o.resolveCommentSyntax(e);if(s){let a=t.detectorSyntaxOverrides&&typeof t.detectorSyntaxOverrides=="object"?t.detectorSyntaxOverrides:{};return fo(s,a[o.id])}}return{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}}i(Xt,"getCommentSyntaxForFile");function Qt(e,t){let n=$e(e).toLowerCase();return I(t).find(r=>r.extensions.includes(n))}i(Qt,"detectorForFile");function ce(e,t,n={}){let r=Qt(e,n);if(!r)return"";let o=typeof r.resolvePreservedPrefix=="function"?r.resolvePreservedPrefix(e,t):"",s=r.keepsAboveHeader,a=se(t.slice(o.length),(c,l)=>oe(c)||typeof s=="function"&&s(c,l),o.split(`
7
- `).length-1);return`${o}${a}`}i(ce,"getPreservedPrefixForFile");function en(e,t,n={}){let r=Qt(e,n);return r&&typeof r.resolveContentSkipReason=="function"?r.resolveContentSkipReason(t,e):null}i(en,"getContentSkipReason");var tn=200,Z=1,le=2;function O(e,t,n){if(e==null)return n;if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${t} must be a whole number of 0 or more, got ${JSON.stringify(e)}`);return e}i(O,"resolveLayoutCount");import{existsSync as $o}from"node:fs";import{join as Re,relative as hn,resolve as Me,sep as ve}from"node:path";import{realpath as Co,stat as Do}from"node:fs/promises";import{access as mo,readdir as po,readFile as zs,stat as ho}from"node:fs/promises";import{constants as go}from"node:fs";import{dirname as Vs,join as yo,resolve as Js}from"node:path";async function Ce(e){try{return await mo(e,go.F_OK),!0}catch{return!1}}i(Ce,"pathExists");async function De(e,t){let n=[],r=await po(e,{withFileTypes:!0});for(let o of r){let s=yo(e,o.name);if(o.isDirectory()&&t.recursive===!1||o.isDirectory()&&t.ignoreFolders.has(o.name)||o.isDirectory()&&await t.shouldSkipDirectory?.(s,o.name)===!0)continue;if(o.isDirectory()){let l=await De(s,t);n.push(...l);continue}if(!o.isFile())continue;let a=o.name.lastIndexOf(".");if(a===-1)continue;let c=o.name.slice(a).toLowerCase();t.allowedExtensions.has(c)&&n.push(s)}return n}i(De,"walkFiles");async function nn(e){let t=await ho(e);return{createdAt:t.birthtimeMs>0&&t.birthtime<t.mtime?t.birthtime:t.mtime,updatedAt:t.mtime}}i(nn,"readFileDates");function rn(e){let t=e.indexOf("<");for(;t!==-1;){let n=e.indexOf(">",t+1);if(n===-1)return!1;if(n>t+1)return!0;t=e.indexOf("<",n+1)}return!1}i(rn,"hasAngleTag");function on(e){let t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}i(on,"trimTrailingSlashes");import{execFile as xo}from"node:child_process";import{lstat as wo,readFile as bo}from"node:fs/promises";import{dirname as sn,isAbsolute as Eo,join as ln,relative as un,resolve as Ae,sep as dn}from"node:path";import ko from"ignore";function an(e,t){return new Promise(n=>{xo("git",t,{cwd:e,encoding:"utf8",maxBuffer:Number.POSITIVE_INFINITY},(r,o)=>{if(!r){n({code:0,stdout:o});return}n({code:typeof r.code=="number"?r.code:-1,stdout:""})})})}i(an,"runGitCommand");function Ne(e,t){return un(e,t).split(dn).join("/")}i(Ne,"toPosixRelative");async function fn(e){try{return ko().add(await bo(e,"utf8"))}catch{return null}}i(fn,"readIgnoreFile");async function So(e){return wo(ln(e,".git")).then(()=>!0,()=>!1)}i(So,"hasGitEntry");function cn(e,t,n){for(let r=e.length-1;r>=0;r--){let{base:o,rules:s}=e[r],a=s.test(`${Ne(o,t)}${n?"/":""}`);if(a.ignored||a.unignored)return a.ignored}return!1}i(cn,"matchesRules");async function mn(e,t){let n=await fn(ln(e,".gitignore"));return{kind:"rules",nested:!0,excluded:!1,matchers:n?[...t,{base:e,rules:n}]:t}}i(mn,"buildRulesContext");async function Fe(e){let[t,n]=await Promise.all([an(e,["check-ignore","-q","."]),an(e,["ls-files","--cached","--others","--exclude-standard","-z"])]);if(t.code!==1||n.code!==0)return mn(e,[]);let r=new Set,o=new Set;for(let s of n.stdout.split("\0")){let a=s.endsWith("/")?s.slice(0,-1):s;if(a.length!==0){r.add(a);for(let c=a.indexOf("/");c!==-1;c=a.indexOf("/",c+1))o.add(a.slice(0,c))}}return{kind:"git",root:e,entries:r,dirs:o}}i(Fe,"resolveScopeContext");function pn(e){let t=Ae(e.root),n=e.gitignore;if(n===!1)return{isIgnored:i(async()=>!1,"isIgnored")};let r=new Map,o=i(async()=>{if(typeof n!="string"&&!Array.isArray(n))return Fe(t);let c=typeof n=="string"?[n]:n.filter(u=>typeof u=="string"),l=[];for(let u of c){let f=await fn(Ae(t,u));f&&l.push({base:t,rules:f})}return{kind:"rules",nested:!1,excluded:!1,matchers:l}},"buildRootContext"),s=i(c=>{let l=r.get(c);return l||(l=c===t?o():a(c),r.set(c,l)),l},"contextFor"),a=i(async c=>{let l=await s(sn(c));return l.kind==="git"?l.entries.has(Ne(l.root,c))?Fe(c):l:!l.nested||l.excluded?l:cn(l.matchers,c,!0)?{...l,excluded:!0}:await So(c)?Fe(c):mn(c,l.matchers)},"deriveContext");return{async isIgnored(c,l){let u=Ae(c),f=un(t,u);if(f.length===0||f===".."||f.startsWith(`..${dn}`)||Eo(f))return!1;let p=await s(sn(u));if(p.kind==="git"){let x=Ne(p.root,u);return!(p.entries.has(x)||l&&p.dirs.has(x))}return p.excluded||cn(p.matchers,u,l)}}}i(pn,"createIgnoreFilter");function Ao(e){return Kt(e)}i(Ao,"resolveExtensions");var Fo=Object.freeze(["node_modules","bower_components","jspm_packages",".pnpm-store",".yarn"]),xn=new Set([".git",...Fo]),No=Object.freeze(["autoload.php","modules.txt"]);function gn(e,t){return xn.has(t)?!0:t==="vendor"&&No.some(n=>$o(Re(e,n)))}i(gn,"isNeverWalked");function Le(e){return on(e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,""))}i(Le,"normalizeFolderPath");function vo(e){return Array.isArray(e)?e.map(t=>{if(typeof t=="string")return{path:t,recursive:!0};if(t&&typeof t=="object"&&typeof t.path=="string")return{path:t.path,recursive:t.recursive!==!1};throw new TypeError(`Invalid includeFolders entry: ${JSON.stringify(t)} (expected a path string or { path, recursive? })`)}):[]}i(vo,"resolveIncludeFolders");function yn(e,t){let n=t instanceof Error?t.message:String(t);console.warn(`fix-headers: skipped include folder "${e}" (${n})`)}i(yn,"reportSkippedIncludeFolder");function Lo(e,t){if(!Array.isArray(t)||t.length===0)return()=>!1;let n=Me(e),r=[],o=new Set;for(let s of t){if(typeof s!="string")continue;let a=Le(s);if(a.length!==0){if(a.includes("/")){r.push(Me(n,a));continue}o.add(a)}}return(s,a)=>{if(o.has(a))return!0;for(let l of r)if(s===l||s.startsWith(`${l}/`))return!0;let c=Le(hn(n,s));return r.some(l=>{let u=Le(hn(n,l));return c===u||c.startsWith(`${u}/`)})}}i(Lo,"buildExclusionMatcher");async function je(e){let t=Ao(e),n=vo(e.includeFolders),r=Array.isArray(e.excludeFolders)?e.excludeFolders:[],o=Lo(e.projectRoot,r),s=pn({root:e.projectRoot,gitignore:e.gitignore}),a=i(async(d,m)=>gn(d,m)||o(d,m)||await s.isIgnored(d,!0),"shouldSkipDirectory"),c=n.length>0?n.map(d=>({includeFolder:d.path,rootPath:Re(e.projectRoot,d.path),recursive:d.recursive})):[{includeFolder:".",rootPath:e.projectRoot,recursive:!0}],l=[];for(let d of c){let m=await Do(d.rootPath).catch(b=>b);if(m instanceof Error){if(m.code==="ENOENT"){yn(d.includeFolder,m);continue}throw m}if(!m.isDirectory()){yn(d.includeFolder,`path is not a directory: ${d.rootPath}`);continue}let w=await Co(d.rootPath).catch(()=>Me(d.rootPath));l.push({...d,realRoot:w})}let u=i((d,m)=>{if(d.realRoot===m.realRoot)return d.recursive||!m.recursive;let w=d.realRoot.endsWith(ve)?d.realRoot:`${d.realRoot}${ve}`;if(!d.recursive||!m.realRoot.startsWith(w))return!1;let b=d.rootPath;for(let k of m.realRoot.slice(w.length).split(ve))if(b=Re(b,k),gn(b,k)||o(b,k))return!1;return!0},"covers"),f=[...l].sort((d,m)=>d.realRoot.length-m.realRoot.length||Number(m.recursive)-Number(d.recursive)),p=[];for(let d of f)p.some(m=>u(m,d))||p.push(d);let x=[];for(let d of l){if(!p.includes(d))continue;let m=await De(d.rootPath,{allowedExtensions:t,ignoreFolders:xn,shouldSkipDirectory:a,recursive:d.recursive});x.push(...m)}let g=[];for(let d of new Set(x))!o(d,d.split("/").at(-1)||"")&&!await s.isIgnored(d,!1)&&g.push(d);return g}i(je,"discoverFiles");import{basename as ri,dirname as oi,extname as ii,resolve as _e}from"node:path";import{dirname as vn,isAbsolute as Uo,join as Ln,relative as Wo,resolve as Rn,sep as zo}from"node:path";import{readFile as Ro}from"node:fs/promises";import{join as Mo}from"node:path";async function jo(e){try{return await Ro(e,"utf8")}catch{return null}}i(jo,"readManifest");async function M(e,t){let n=[];for(let r of t){let o=await jo(Mo(e,r));o!==null&&n.push({file:r,content:o})}return n.length>0?{dir:e,manifest:n[0].file,files:n}:null}i(M,"detectManifests");function T(e,t){return e.files.find(n=>n.file===t)?.content??null}i(T,"manifestContent");function C(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}i(C,"cleanName");function Pe(e){if(typeof e!="string")return;let t=e.search(/[<(]/);return C(t===-1?e:e.slice(0,t))}i(Pe,"personName");function ue(e){try{return JSON.parse(e)}catch{return}}i(ue,"parseJsonManifest");function*Ie(e,t){let n="";for(let r of e.split(/\r?\n/)){let o=r.trim();if(o.startsWith("[")){let s=o.match(/^\[([^[\]]+)\]/);n=s?s[1].split(".").map(a=>a.trim()).join("."):"";continue}n===t&&(yield o)}}i(Ie,"sectionLines");function X(e,t,n){let r=new RegExp(`^${n}\\s*=\\s*(?:"([^"\\\\]*)"|'([^']*)')`);for(let o of Ie(e,t)){let s=o.match(r);if(s)return C(s[1]??s[2])}}i(X,"readTomlString");function Oe(e,t,n){let r=new RegExp(`^${n}\\s*[=:](.*)$`);for(let o of Ie(e,t)){let s=o.match(r);if(s)return C(s[1])}}i(Oe,"readIniValue");function Po(e,t,n){let r=new RegExp(`^${n}\\s*=\\s*\\[`),o=null;for(let s of Ie(e,t)){if(o!==null){o.push(s);continue}let a=s.match(r);a&&(o=[s.slice(a[0].length)])}return o===null?null:o.join(`
8
- `)}i(Po,"tomlArrayText");function Io(e,t){let n=t;for(;n<e.length;)if(e[n]==="#"){let r=e.indexOf(`
9
- `,n);n=r===-1?e.length:r+1}else if(/\s/.test(e[n]))n+=1;else break;return n}i(Io,"skipTomlSpace");function Q(e,t){let n=Po(e,t,"authors");if(n===null)return;let r=n.slice(Io(n,0)),o=r.match(/^(?:"([^"\\\n]*)"|'([^'\n]*)')/);if(o)return Pe(o[1]??o[2]);let a=r.match(/^\{([^}\n]*)\}/)?.[1].match(/(?:^|,)\s*name\s*=\s*(?:"([^"\\\n]*)"|'([^'\n]*)')/);return a?C(a[1]??a[2]):void 0}i(Q,"readTomlAuthor");var wn=["go.mod"];function Oo(e){let t=e.match(/^\s*module\s+(.+)$/m);if(t)return C(t[1].replace(/\/\/.*$/,"").trim().replace(/^["`](.*)["`]$/,"$1"))}i(Oo,"readModulePath");var bn={id:"go",languages:["go"],manifests:wn,detect(e){return M(e,wn)},read(e){return{name:Oo(e.files[0].content)}}};var En=["package.json"];function To(e){let t=C(e?.name),n=C(e?.publisher),r=typeof e?.engines?.vscode=="string";return t&&n&&r?`${n}.${t}`:t}i(To,"readPublishedName");function Ho(e){if(e!==null&&typeof e=="object"){let t=e;return C(t.company)??C(t.name)}return Pe(e)}i(Ho,"readAuthorCompany");var kn={id:"node",languages:["node"],manifests:En,detect(e){return M(e,En)},read(e){let t=ue(e.files[0].content);return{name:To(t),company:Ho(t?.author)}}};var Sn=["composer.json"],$n={id:"php",languages:["php"],manifests:Sn,detect(e){return M(e,Sn)},read(e){let t=ue(e.files[0].content),n=t?.authors;return{name:C(t?.name),company:Array.isArray(n)?C(n[0]?.name):void 0}}};var Cn=["pyproject.toml","setup.cfg","setup.py"];function Dn(e,t){let n=e.indexOf("setup(");if(n===-1)return;let r=e.slice(n).match(new RegExp(`\\b${t}\\s*=\\s*(["'])([^"'\\n]+)\\1`));return r&&r[2].trim()||void 0}i(Dn,"readSetupPyArgument");function _o(e){let t=T(e,"pyproject.toml"),n=T(e,"setup.cfg"),r=T(e,"setup.py");return(t===null?void 0:X(t,"project","name")??X(t,"tool.poetry","name"))??(n===null?void 0:Oe(n,"metadata","name"))??(r===null?void 0:Dn(r,"name"))}i(_o,"readPythonName");function Bo(e){let t=T(e,"pyproject.toml"),n=T(e,"setup.cfg"),r=T(e,"setup.py");return(t===null?void 0:Q(t,"project")??Q(t,"tool.poetry"))??(n===null?void 0:Oe(n,"metadata","author"))??(r===null?void 0:Dn(r,"author"))}i(Bo,"readPythonCompany");var An={id:"python",languages:["python"],manifests:Cn,detect(e){return M(e,Cn)},read(e){return{name:_o(e),company:Bo(e)}}};var Fn=["Cargo.toml"],Nn={id:"rust",languages:["rust"],manifests:Fn,detect(e){return M(e,Fn)},read(e){let t=e.files[0].content;return{name:X(t,"package","name"),company:Q(t,"package")}}};var Go=[kn,An,$n,Nn,bn],Mn=["name","company"];async function Te(e,t,n){let o=(await Promise.all(t.map(async a=>({driver:a,detection:await a.detect(e)})))).filter(a=>a.detection!==null),s=o.filter(a=>typeof n=="string"&&a.driver.languages.includes(n));return[...s,...o.filter(a=>!s.includes(a))]}i(Te,"claimFolder");function Yo(e,t){let n=Wo(t,e);return n!==""&&n!==".."&&!n.startsWith(`..${zo}`)&&!Uo(n)}i(Yo,"isStrictlyInside");async function jn(e,t={}){let n=Array.isArray(t.drivers)?t.drivers:Go,r=typeof t.scanRoot=="string"?Rn(t.scanRoot):null,o=Rn(e),s=await Te(o,n,t.language);for(;s.length===0;){if(await Ce(Ln(o,".git")))return{root:o,marker:".git",drivers:[],fields:{},sources:{}};let f=vn(o);if(f===o)return null;o=f,s=await Te(o,n,t.language)}let a={},c={},l=o,u=s;for(;;){for(let{driver:p,detection:x}of u){let g=p.read(x);for(let d of Mn)a[d]===void 0&&g[d]!==void 0&&(a[d]=g[d],c[d]={driver:p.id,manifest:x.manifest,dir:l})}if(Mn.every(p=>a[p]!==void 0)||r===null||!Yo(l,r)||await Ce(Ln(l,".git")))break;l=vn(l),u=await Te(l,n,t.language)}return{root:o,marker:s[0].detection.manifest,drivers:s.map(f=>f.driver.id),fields:a,sources:c}}i(jn,"resolveManifestProject");import{execFile as Vo}from"node:child_process";import{basename as Jo,dirname as qo}from"node:path";import{promisify as Ko}from"node:util";var He=Ko(Vo);async function v(e,t){try{let{stdout:n}=await He("git",t,{cwd:e}),r=n.trim();return r.length>0?r:null}catch{return null}}i(v,"runGit");function Pn(e,t){let n=0;for(let r=t-1;r>=0&&e[r]==="\\";r--)n++;return n%2===1}i(Pn,"isEscaped");function Zo(e){let t=e.trim();if(!t.endsWith(")")||Pn(t,t.length-1))return t;let n=0;for(let r=t.length-1;r>=0;r--){let o=t[r];if(!(o!=="("&&o!==")"||Pn(t,r))&&(n+=o===")"?1:-1,n===0))return t.slice(0,r).trim()}return t}i(Zo,"stripUidComment");function Xo(e){let t=e.trim();if(t.length===0)return{authorName:null,authorEmail:null};let n=t.match(/<([^>\n]+)>\s*$/),r=n?.[1]?.trim()||null,o=(n?t.slice(0,n.index):t).trim();return{authorName:Zo(o)||o||null,authorEmail:r}}i(Xo,"parseSignerUid");async function Qo(e,t){try{let{stdout:n}=await He(e,t),r=n.trim();return r.length>0?r:null}catch{return null}}i(Qo,"runProgram");function ei(e){return e.replace(/\\x([0-9a-fA-F]{2})/g,(t,n)=>String.fromCharCode(Number.parseInt(n,16)))}i(ei,"decodeColonField");async function ti(e){let t=await v(e,["config","--get","gpg.format"]);if(t!==null&&t!=="openpgp")return null;let n=await v(e,["config","--get","user.signingkey"]);if(!n)return null;let r=await v(e,["config","--get","gpg.openpgp.program"])||await v(e,["config","--get","gpg.program"])||"gpg",o=await Qo(r,["--batch","--with-colons","--list-keys",n]);if(!o)return null;for(let s of o.split(`
10
- `)){let a=s.split(":");if(a[0]==="uid"&&a[1]!=="r"&&a[1]!=="e"&&a[9])return ei(a[9])}return null}i(ti,"readSigningKeyUid");async function In(e,t={}){let n=await v(e,["config","--get","user.name"]),r=await v(e,["config","--get","user.email"]);if(t.useGpgSignerAuthor===!0){let o=await ti(e)||await v(e,["log","-1","--format=%GS"]),s=Xo(o||"");n=s.authorName||n,r=r||s.authorEmail}if(!n||!r){let o=await v(e,["log","-1","--format=%an|%ae"]);if(o){let[s,a]=o.split("|");n=n||s||null,r=r||a||null}}return{authorName:n,authorEmail:r}}i(In,"detectGitAuthor");function On(e){return e.replace(/z$/i,"+00:00")}i(On,"canonicalGitDate");async function Tn(e,t){let n=await v(e,["log","--follow","--format=%aI|%at","--reverse","--",t]);if(!n)return null;let r=n.split(`
11
- `)[0],[o,s]=r.split("|");if(!o||!s)return null;let a=Number.parseInt(s,10);return Number.isNaN(a)?null:{date:On(o),timestamp:a}}i(Tn,"getGitCreationDate");async function Hn(e,t){let n=await v(e,["log","-1","--format=%aI|%at","--",t]);if(!n)return null;let[r,o]=n.split("|");if(!r||!o)return null;let s=Number.parseInt(o,10);return Number.isNaN(s)?null:{date:On(r),timestamp:s}}i(Hn,"getGitLastModifiedDate");var ni=256*1024*1024;async function _n(e){let t=qo(e);if(await v(t,["rev-parse","--is-inside-work-tree"])!=="true")return{state:"no-git",content:null};try{let{stdout:n}=await He("git",["show",`HEAD:./${Jo(e)}`],{cwd:t,encoding:"utf8",maxBuffer:ni});return{state:"tracked",content:n}}catch{return{state:"untracked",content:null}}}i(_n,"readGitHeadFile");function si(e){return ri(e)||"project"}i(si,"folderName");function ai(e,t){if(typeof t!="string")return e;let n=t.trim();return n.length===0||rn(e)?e:`${e} <${n}>`}i(ai,"formatAuthorNameWithCompany");async function ci(e,t={}){let n=Array.isArray(t.detectors)?t.detectors:I(t),r=typeof t.preferredExtension=="string"?t.preferredExtension.trim().toLowerCase():"",o=r.length>0?n.find(u=>u.extensions.includes(r)):void 0,s=await jn(e,{drivers:t.drivers,language:o?.id,scanRoot:t.scanRoot}),a=s?s.root:_e(e),c=s?.sources.name,l=s?.sources.company;return{language:o?.id??s?.drivers[0]??"unknown",rootDir:a,marker:s?s.marker:null,projectName:s?.fields.name??si(a),projectNameSource:c?{from:"manifest",...c}:{from:"folder",dir:a},companyName:s?.fields.company??null,companyNameSource:l?{from:"manifest",...l}:{from:"none"},drivers:s?s.drivers:[]}}i(ci,"detectProjectFromMarkers");async function Be(e={}){let t=e.targetFilePath||e.cwd||process.cwd(),n=_e(t),r=I(e),o=e.targetFilePath?oi(n):n,s=e.targetFilePath?ii(n).toLowerCase():"",a=_e(e.projectRoot||e.cwd||process.cwd()),c=await ci(o,{detectors:r,preferredExtension:s,scanRoot:a}),l=await In(c.rootDir,{useGpgSignerAuthor:e.useGpgSignerAuthor===!0}),u=e.authorName||l.authorName||"Unknown Author",f=typeof e.companyName=="string"?e.companyName.trim():"";return{projectName:e.projectName||c.projectName,projectNameSource:e.projectName?{from:"option"}:c.projectNameSource,language:e.language||c.language,projectRoot:e.projectRoot||c.rootDir,marker:e.marker===void 0?c.marker:e.marker,authorName:ai(u,e.company),authorEmail:e.authorEmail||l.authorEmail||"unknown@example.com",companyName:f||c.companyName,companyNameSource:f?{from:"option"}:c.companyNameSource,copyrightStartYear:Number.isInteger(e.copyrightStartYear)?Number(e.copyrightStartYear):null}}i(Be,"resolveProjectMetadata");function li(e){return Ue({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),offsetMinutes:-e.getTimezoneOffset()})}i(li,"formatDateWithTimezone");function Ue(e){return`${zn(e," ")} ${Gn(e.offsetMinutes)}`}i(Ue,"formatSpaceDate");function Un(e){if(typeof e!="string")throw new Error(`timezone must be an IANA time zone name string, such as "America/Los_Angeles" or "UTC" (got ${typeof e})`);try{Wn(e)}catch(t){throw new Error(`Unknown time zone "${e}": expected an IANA time zone name, such as "America/Los_Angeles" or "UTC"`,{cause:t})}return e}i(Un,"assertTimeZone");var Bn=new Map;function Wn(e){let t=Bn.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),Bn.set(e,t)),t}i(Wn,"getZoneFormatter");function We(e,t){let n={};for(let o of Wn(t).formatToParts(new Date(e*1e3)))n[o.type]=Number(o.value);let r=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)/1e3;return{year:n.year,month:n.month,day:n.day,hour:n.hour,minute:n.minute,second:n.second,offsetMinutes:(r-e)/60}}i(We,"toZonedDateParts");function zn(e,t){let n=i(r=>String(r).padStart(2,"0"),"pad");return`${String(e.year).padStart(4,"0")}-${n(e.month)}-${n(e.day)}${t}${n(e.hour)}:${n(e.minute)}:${n(e.second)}`}i(zn,"formatWallClock");function Gn(e){let t=i(r=>String(r).padStart(2,"0"),"pad"),n=Math.abs(e);return`${e>=0?"+":"-"}${t(Math.floor(n/60))}:${t(n%60)}`}i(Gn,"formatOffset");function de(e=new Date){return{date:li(e),timestamp:Math.floor(e.getTime()/1e3)}}i(de,"toDatePayload");var ui=/^(\d{4})-(\d{2})-(\d{2})(?:T|\s+)(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?\s*(?:(Z)|([+-])(\d{2}):?(\d{2}))$/i;function H(e){let t=ui.exec(e.trim());if(!t)return null;let[n,r,o,s,a,c]=t.slice(1,7).map(Number),l=t[7]?0:Number(t[9])*60+Number(t[10]),u=t[8]==="-"?-l:l,f=new Date(Date.UTC(n,r-1,o,s,a,c));return!(f.getUTCFullYear()===n&&f.getUTCMonth()===r-1&&f.getUTCDate()===o&&f.getUTCHours()===s&&f.getUTCMinutes()===a&&f.getUTCSeconds()===c)||Number(t[10]??0)>59?null:{year:n,month:r,day:o,hour:s,minute:a,second:c,offsetMinutes:u,timestamp:Math.floor(f.getTime()/1e3)-u*60}}i(H,"parseHeaderDate");function ze(e){return`${zn(e,"T")}${Gn(e.offsetMinutes)}`}i(ze,"formatIsoDate");var di={"git-created":"git first commit","filesystem-created":"filesystem creation time"};function Yn(e,t){let n=e.match(new RegExp(`${t}:[^\\S\\n]*(.*)$`,"m"));return n?n[1].trim():null}i(Yn,"readHeaderField");function Ge(e){let t=null;for(let{source:n,payload:r}of e)r&&(!t||r.timestamp<t.payload.timestamp)&&(t={source:n,payload:r});return t}i(Ge,"pickOldestDate");function Jn({existing:e,gitCreated:t,filesystemCreated:n,fixCreatedDate:r=!1}){let o=[{source:"git-created",payload:t},{source:"filesystem-created",payload:n}];if(!e)return Ge(o);if(!r)return{source:"existing-header",payload:e};let s=H(e.date)?e:null;return Ge([{source:"existing-header",payload:s},...o])}i(Jn,"resolveCreatedDate");function qn(e,t=null){if(t)return We(e.timestamp,t).year;let n=H(e.date);return n?n.year:new Date(e.timestamp*1e3).getFullYear()}i(qn,"dateYear");function Vn(e,t,n,r){let o=e.match(/^(.+?)\s*\((\d+)\)$/),s=o?H(o[1]):null;if(!o||!s)return r.push({check:`${n}-format`,field:t,advisory:!1,value:e,message:`${t} value "${e}" is not a "<datetime> (<epoch>)" pair with a recognised datetime`}),null;let a=Number.parseInt(o[2],10);return a!==s.timestamp&&r.push({check:`${n}-epoch`,field:t,advisory:!1,value:e,expected:`${o[1]} (${s.timestamp})`,message:`${t} epoch ${a} does not match ${o[1]} (expected ${s.timestamp})`}),{text:o[1],timestamp:s.timestamp}}i(Vn,"checkDateValue");function Kn(e,t={},n={}){let r=[],o=Yn(e,"@Date"),s=o===null?null:Vn(o,"@Date","created",r),a=Ge([{source:"git-created",payload:t.gitCreated},{source:"filesystem-created",payload:t.filesystemCreated}]);if(s&&a&&s.timestamp>a.payload.timestamp){let f=di[a.source];r.push({check:"created-newer-than-source",field:"@Date",advisory:n.strictCreatedDate!==!0,value:o,expected:`${a.payload.date} (${a.payload.timestamp})`,source:a.source,message:`@Date ${s.text} is later than the ${f} ${a.payload.date} (${a.payload.timestamp})`})}let c=Yn(e,"@Last modified time"),l=c===null?null:Vn(c,"@Last modified time","modified",r),u=t.gitLastModified;return l&&u&&l.timestamp!==u.timestamp&&r.push({check:"modified-git",field:"@Last modified time",advisory:!0,value:c,expected:`${u.date} (${u.timestamp})`,message:`@Last modified time ${l.text} does not match the git last commit ${u.date} (${u.timestamp})`}),r}i(Kn,"checkHeaderDates");function Ye(e){if(!e)return null;let t=H(e.date);return t&&t.timestamp!==e.timestamp?{date:e.date,timestamp:t.timestamp}:e}i(Ye,"repairDateEpoch");function Zn(e){let t=H(e.date);return t?{date:ze(t),timestamp:t.timestamp}:e}i(Zn,"normalizeDatePayload");function Xn(e,t){let n=H(e.date);if(!n)return e;let r=We(n.timestamp,t);return r.offsetMinutes===n.offsetMinutes||!Number.isInteger(r.offsetMinutes)?e:{date:/^\d{4}-\d{2}-\d{2}T/i.test(e.date.trim())?ze(r):Ue(r),timestamp:n.timestamp}}i(Xn,"convertDatePayload");import{relative as mi}from"node:path";import{extname as fi}from"node:path";function _(e,t={}){let n=fi(e).toLowerCase(),r=O(t.spacing,"spacing",Z);return n.length===0?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */",spacing:r}:{...Xt(e,t),spacing:r}}i(_,"getHeaderSyntaxForFile");function Qn(e,t){let n=e.spacing??Z;if(e.kind==="line"){let c=e.linePrefix||"#",l=typeof e.lineSeparator=="string"?e.lineSeparator:" ",u=Array.from({length:n},()=>c);return[...u,...t.map(f=>`${c}${l}${f}`),...u].join(`
12
- `)}let r=e.blockStart||(e.kind==="html"?"<!--":"/**"),o=e.blockLinePrefix||(e.kind==="html"?" ":" * "),s=e.blockEnd||(e.kind==="html"?"-->":" */"),a=Array.from({length:n},()=>o.trimEnd());return[r,...a,...t.map(c=>`${o}${c}`),...a,s].join(`
13
- `)}i(Qn,"renderHeaderLines");function er(e){let t=mi(e.projectRoot,e.absoluteFilePath).replace(/\\/g,"/"),n=_(e.absoluteFilePath,e.syntaxOptions||{language:e.language}),r=e.createdByName||e.authorName,o=e.createdByEmail||e.authorEmail,s=e.lastModifiedByName||e.authorName,a=e.lastModifiedByEmail||e.authorEmail,c=typeof e.companyName=="string"?e.companyName.trim():"",l=c.length>0?`${c} `:"",u=[`@Project: ${e.projectName}`,`@Filename: ${t}`,`@Date: ${e.createdAt.date} (${e.createdAt.timestamp})`,`@Author: ${r}`,`@Email: <${o}>`,"-----",`@Last modified by: ${s} (${a})`,`@Last modified time: ${e.lastModifiedAt.date} (${e.lastModifiedAt.timestamp})`,"-----",`@Copyright: Copyright (c) ${e.copyrightStartYear}-${e.currentYear} ${l}All rights reserved.`];return Qn(n,u)}i(er,"buildHeader");var pi=Object.freeze(["projectName","filename","createdAt","authorName","authorEmail","lastModifiedByName","lastModifiedByEmail","lastModifiedAt","copyrightStartYear","copyrightEndYear","companyName"]);function j(e,t){let n=e.match(new RegExp(`@${t}:[ \\t]*(.*)$`,"m")),r=n?n[1].trim():"";return r.length>0?r:null}i(j,"readTag");function hi(e){if(e===null)return{name:null,email:null};if(!e.endsWith(")"))return{name:e,email:null};let t=e.slice(0,-1),n=t.indexOf("(",t.lastIndexOf(")")+1);return n===-1?{name:e,email:null}:{name:t.slice(0,n).trimEnd()||null,email:t.slice(n+1)||null}}i(hi,"splitLastModifiedBy");function gi(e){let t={startYear:null,endYear:null,companyName:null},n=e?.match(/^Copyright\s+\(c\)\s+(\d{4})/i);if(!n)return t;let r=e.slice(n[0].length),o=r.match(/^\s*-\s*(\d{4})/);o&&(r=r.slice(o[0].length));let s=r.toLowerCase(),a=s.endsWith("all rights reserved.")?20:s.endsWith("all rights reserved")?19:0;return a===0||!/^\s/.test(r)?t:{startYear:n[1],endYear:o?o[1]:null,companyName:r.slice(0,-a).trim()||null}}i(gi,"splitCopyright");function tr(e){let t=hi(j(e,"Last modified by")),n=gi(j(e,"Copyright")),r=j(e,"Email");return{projectName:j(e,"Project"),filename:j(e,"Filename"),createdAt:j(e,"Date"),authorName:j(e,"Author"),authorEmail:r===null?null:r.replace(/^<(.*)>$/,"$1"),lastModifiedByName:t.name,lastModifiedByEmail:t.email,lastModifiedAt:j(e,"Last modified time"),copyrightStartYear:n.startYear,copyrightEndYear:n.endYear,companyName:n.companyName}}i(tr,"parseHeaderFields");function nr(e,t){let n=tr(e??""),r=tr(t);return pi.filter(o=>n[o]!==r[o]).map(o=>({field:o,previous:n[o],detected:r[o]}))}i(nr,"compareHeaderFields");function ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(ee,"escapeRegex");function Ve(e,t,n={}){let r=t.startsWith("\uFEFF")?"\uFEFF":"",o=t.slice(r.length),s=`${r}${ce(e,o,n)}`;return{prefix:s,body:t.slice(s.length)}}i(Ve,"splitPreservedPrefix");function fe(e){let t=e.indexOf(`
14
- `);return t===-1?null:t>0&&e[t-1]==="\r"?`\r
15
- `:`
16
- `}i(fe,"lineEnding");function G(e,t){if(t.kind==="html"){let r=ee(t.blockStart||"<!--"),o=ee(t.blockEnd||"-->");return e.match(new RegExp(`^${r}[\\s\\S]*?${o}(?:\\r?\\n)*`))}if(t.kind==="line"){let r=ee(t.linePrefix||"#");return e.match(new RegExp(`^(?:${r}[^\\n]*\\n)+(?:\\r?\\n)*`))}let n=ee((t.blockEnd||" */").trim());return e.match(new RegExp(`^/\\*[\\s\\S]*?${n}(?:\\r?\\n)*`))}i(G,"matchHeaderSegment");var ir=/^@(Project|Filename|Date|Author|Email|Last modified by|Last modified time|Copyright):/,yi="Moved out of the file header by fix-headers:";function sr(e){return e.some(t=>/^@(?:Project|Filename):/.test(t.text))}i(sr,"isFileHeader");function Je(e,t){let n=e.replace(/(?:\r?\n)+$/,"");if(t.kind==="line"){let f=new RegExp(`^${ee(t.linePrefix||"#")}[ \\t]*`);return n.split(`
17
- `).map(p=>{let x=p.replace(/\r$/,"");return{raw:x,text:x.replace(f,"").trim()}})}let r=t.kind==="html",o=r?n.replace(/^<!--/,"").replace(/--!?>\s*$/,""):n.replace(/^\/\*+/,"").replace(/\*+\/\s*$/,""),s=t.blockLinePrefix||(r?" ":" * "),a=r?/^\s*/:/^\s*\*?[ \t]*/,c=o.split(`
18
- `).map((f,p)=>({raw:p===0&&f.trim()!==""?`${s}${f.trim()}`:f.trimEnd(),text:(p===0?f:f.replace(a,"")).trim()})),l=c[0].raw===""?1:0,u=c.length>l&&c[c.length-1].raw.trim()===""?c.length-1:c.length;return c.slice(l,u)}i(Je,"segmentLines");function xi(e,t){let n=e.map(o=>{let s=o.text.match(ir);return o.text===""?"blank":s&&s[1]==="Copyright"?t.copyright?"copyright":(t.copyright=!0,"field"):s?"field":/^-{3,}$/.test(o.text)?"dash":"text"}),r=i((o,s)=>{for(let a=o+s;a>=0&&a<n.length;a+=s)if(n[a]!=="blank"&&n[a]!=="dash")return n[a]==="copyright"?"field":n[a]},"neighbour");return n.map((o,s)=>o==="dash"?r(s,-1)==="field"||r(s,1)==="field"?"separator":"text":o)}i(xi,"classifyLines");function wi(e,t="",n={}){let r=_(t,n),o=[],s=[],a={copyright:!1},c=e,l=G(c,r),u=!0;for(;l&&l[0].length>0;){let m=Je(l[0],r),w=xi(m,a),b=m.findIndex(k=>k.text!=="");!u&&b!==-1&&m[b].text===yi&&(w[b]="separator"),m.forEach((k,L)=>{w[L]==="copyright"&&s.push(k.text.replace(ir,"").trim()),o.push({raw:k.raw,kind:w[L]})}),c=c.slice(l[0].length),l=G(c,r),u=!1}let f=o.findIndex(m=>m.kind==="text");if(f===-1)return{foreign:[],copyrights:s};let p=o.map(m=>m.kind).lastIndexOf("text"),x=[],g=[],d=!1;for(let m of o.slice(f,p+1))m.kind==="text"?(x.push(...d?[]:g,m.raw),g=[],d=!1):m.kind==="blank"?g.push(m.raw):d=!0;return{foreign:x,copyrights:s}}i(wi,"splitHeaderText");function bi(e,t,n){let r=t.kind==="html";return t.kind==="line"?e.join(n):[t.blockStart||(r?"<!--":"/**"),...e,t.blockEnd||(r?"-->":" */")].join(n)}i(bi,"renderForeignBlock");function Ei(e,t,n){let r=e.split(`
19
- `),o=n.kind==="html",s=n.kind==="line"?n.linePrefix||"#":(n.blockLinePrefix||(o?" ":" * ")).trimEnd(),a=Math.min(r.length-1,(n.spacing??1)+(n.kind==="line"?0:1)),c=r.length-a;return[...r.slice(0,c),s,...t,...r.slice(c)].join(`
20
- `)}i(Ei,"appendToHeader");function rr(e){let t=e.trim(),n=t.match(/^copyright\b/i);t=n?t.slice(n[0].length).trimStart():t;for(let c=t.match(/^(?:\(c\)|©)/i);c;c=t.match(/^(?:\(c\)|©)/i))t=t.slice(c[0].length).trimStart();let r=t.match(/^\d{4}(?:\s*[-–,]\s*\d{4})*/);t=r?t.slice(r[0].length):t,t=t.trimEnd();let o=t.toLowerCase(),s=o.endsWith("all rights reserved.")?20:o.endsWith("all rights reserved")?19:0;t=t.slice(0,t.length-s);let a=t.length;for(;a>0&&`.,; \r
21
- `.includes(t[a-1]);)a-=1;return t.slice(0,a).split(/\s+/).filter(Boolean).join(" ").toLowerCase()}i(rr,"copyrightHolder");function ki(e,t){let n=e.split(`
22
- `),r=n.findIndex(c=>c.includes("@Copyright:")),o=n.map(c=>/@[A-Za-z][A-Za-z ]*:/.test(c)).lastIndexOf(!0),s=r!==-1?r:o;if(t.length===0||s===-1)return e;let a=n[s].slice(0,n[s].indexOf("@"));return[...n.slice(0,s+1),...t.map(c=>`${a}@Copyright: ${c}`),...n.slice(s+1)].join(`
23
- `)}i(ki,"insertCopyrights");function or(e,t){let n=0,r=G(e,t);for(;r&&r[0].length>0&&sr(Je(r[0],t));)n+=r[0].length,r=G(e.slice(n),t);return n}i(or,"leadingHeadersLength");function me(e,t="",n={}){let r=e.startsWith("\uFEFF")?"\uFEFF":"",o=e.slice(r.length),s=ce(t,o,n),a=_(t,n),c=s.length,l=or(o.slice(c),a);if(l===0)return e;let u=r===""&&c===0&&o.startsWith("\uFEFF",l);u&&(r="\uFEFF",o=`${o.slice(0,l)}${o.slice(l+1)}`,l+=or(o.slice(l),a));let f=o.slice(c,c+l),p=o.slice(c+l),x=ce(t,`${s}${p}`,n),g=x.length>s.length?x.slice(s.length):"";if(g===""&&!u)return e;let d=g===""||g.endsWith(`
24
- `)?g:`${g}${fe(e)??`
25
- `}`;return`${r}${s}${d}${f}${p.slice(g.length)}`}i(me,"restoreTopLines");function pe(e,t="",n={}){let{prefix:r,body:o}=Ve(t,e,n),s=o.split(`
26
- `).slice(0,tn).join(`
27
- `),a=_(t,n);if(!G(s,a))return null;let l=0,u=0;for(;;){let f=s.slice(l),p=G(f,a);if(!p||!sr(Je(p[0],a)))break;l+=p[0].length,u=l}return u===0?null:{start:r.length,end:r.length+u}}i(pe,"findProjectHeader");function he(e,t,n="",r={}){let o=me(e,n,r),s=pe(o,n,r),a=_(n,r),c=O(r.margin,"margin",le),l=a.kind==="line"?Math.max(1,c):c,u=i((h,$)=>$===`
28
- `?h:h.replace(/\r?\n/g,$),"withEol");if(!s){let{prefix:h,body:$}=Ve(n,o,r),D=fe(o)??`
29
- `,S=u(t,D),P=$.replace(/^(?:\r?\n)+/,""),ne=h.replace(/^\uFEFF/,"")!==""&&!h.endsWith(`
30
- `)?D:"",U=`${h}${ne}${P.trim()===""?`${S}${D}`:`${S}${D.repeat(l+1)}${P}`}`;return{nextContent:U,changed:U!==e,header:S,written:S,extraCopyrights:[]}}let f=o.slice(s.start,s.end),{foreign:p,copyrights:x}=wi(f,n,r),g=t.split(`
31
- `).find(h=>h.includes("@Copyright:")),d=new Set(g===void 0?[]:[rr(g.slice(g.indexOf("@Copyright:")+11))]),m=[];for(let h of x){let $=rr(h);d.has($)||(d.add($),m.push(h))}let w=fe(o.slice(s.end))??fe(f)??`
32
- `,b=w.repeat(l+1),k=r.strictHeaderBlock!==!1,L=ki(t,m),A=u(p.length>0&&!k?Ei(L,p,a):L,w),E=p.length>0&&k?bi(p,a,w):"",B=o.slice(s.end).replace(/^(?:\r?\n)+/,""),Y=E===""?B:`${E}${B.trim()===""?w:`${b}${B}`}`,V=`${o.slice(0,s.start)}${Y.trim()===""?`${A}${w}`:`${A}${b}${Y}`}`,te=`${A}${E===""?"":`${b}${E}`}`;return{nextContent:V,changed:V!==e,header:A,written:te,extraCopyrights:m}}i(he,"replaceOrInsertHeader");function qe(e,t="",n={}){let r=me(e,t,n),o=pe(r,t,n);if(o){let l=r.slice(0,o.start),f=he(r,"",t,{...n,strictHeaderBlock:!0}).nextContent.slice(l.length).replace(/^(?:\r?\n)+/,"");return`${l}${f.trim()===""?"":f}`}let{prefix:s,body:a}=Ve(t,r,n),c=a.replace(/^(?:\r?\n)+/,"");return`${s}${c.trim()===""?"":c}`}i(qe,"extractHeaderlessBody");function Si(e,t){let n=e.length,r=t.length,o=Array.from({length:n+1},()=>new Array(r+1).fill(0));for(let l=n-1;l>=0;l-=1)for(let u=r-1;u>=0;u-=1)o[l][u]=e[l]===t[u]?o[l+1][u+1]+1:Math.max(o[l+1][u],o[l][u+1]);let s=[],a=0,c=0;for(;a<n&&c<r;)e[a]===t[c]?(s.push({type:" ",line:e[a]}),a+=1,c+=1):o[a+1][c]>=o[a][c+1]?(s.push({type:"-",line:e[a]}),a+=1):(s.push({type:"+",line:t[c]}),c+=1);for(;a<n;a+=1)s.push({type:"-",line:e[a]});for(;c<r;c+=1)s.push({type:"+",line:t[c]});return s}i(Si,"diffLines");function ar(e,t){return`${t===0?e:e+1},${t}`}i(ar,"formatRange");function cr(e,t,n={}){let r=e===null?[]:e.split(`
33
- `),o=t.split(`
34
- `),s=Si(r,o),a=Math.max(0,n.context??3),c=n.lineOffset??0,l=[];if(s.forEach((x,g)=>{if(x.type===" ")return;let d=l[l.length-1];d&&g-d.last<=a*2+1?d.last=g:l.push({first:g,last:g})}),l.length===0)return"";let u=n.fromFile??"a",f=n.toFile??"b",p=[`--- ${e===null?"/dev/null":u}`,`+++ ${f}`];for(let x of l){let g=Math.max(0,x.first-a),d=Math.min(s.length,x.last+a+1),m=s.slice(0,g),w=s.slice(g,d),b=m.filter(E=>E.type!=="+").length+c,k=m.filter(E=>E.type!=="-").length+c,L=w.filter(E=>E.type!=="+").length,A=w.filter(E=>E.type!=="-").length;p.push(`@@ -${ar(b,L)} +${ar(k,A)} @@`);for(let E of w)p.push(`${E.type}${E.line}`)}return p.join(`
35
- `)}i(cr,"createUnifiedDiff");function Ai(e){return Et(e,"configFile")}i(Ai,"resolveRuntimeOptions");function Fi(e){if(e==null)return[];let t=Array.isArray(e)?e:[e];if(t.some(n=>typeof n!="string"))throw new Error(`input must be a path or an array of paths, got ${JSON.stringify(e)}`);return t.filter(n=>n.trim().length>0)}i(Fi,"resolveInputs");function Ni(e){let t=e.match(/@Author:\s*(.+)$/m),n=e.match(/@Email:\s*<([^>\n]+)>/m);return{authorName:t?.[1]?.trim(),authorEmail:n?.[1]?.trim()}}i(Ni,"extractHeaderAuthorIdentity");function vi(e){let t=e.match(/@Last modified by:\s*(.+?)\s*\(([^)\n]+)\)\s*$/m);return{authorName:t?.[1]?.trim(),authorEmail:t?.[2]?.trim()}}i(vi,"extractHeaderLastModifiedIdentity");function Li(e){let t=e.match(/@Date:\s*(.+?)\s*\((\d+)\)$/m);if(!t||!t[1]||!t[2])return null;let n=Number.parseInt(t[2],10);return Number.isNaN(n)?null:{date:t[1].trim(),timestamp:n}}i(Li,"extractHeaderCreatedAt");function Ri(e){let t=e.match(/@Last modified time:\s*(.+?)\s*\((\d+)\)$/m);if(!t||!t[1]||!t[2])return null;let n=Number.parseInt(t[2],10);return Number.isNaN(n)?null:{date:t[1].trim(),timestamp:n}}i(Ri,"extractHeaderLastModifiedAt");async function Mi(e,t,n){let r=await _n(t);return r.state!=="tracked"?{edited:r.state==="untracked",state:r.state}:{edited:qe(r.content,t,n)!==qe(e,t,n),state:"tracked"}}i(Mi,"detectContentEdit");async function ur(e={}){let t=await Ai(e),n=t.timezone===void 0||t.timezone===null?null:Un(t.timezone),r=t.convertTimezone===!0;if(r&&!n)throw new Error("convertTimezone requires timezone: set timezone (CLI --timezone <name>) to the IANA zone to convert header dates into");let o=qt(t.forcedDetectors),s=lr(t.projectRoot||t.cwd||process.cwd()),a=await Be({...t,cwd:s});O(t.spacing,"spacing",Z),O(t.margin,"margin",le);let c=t.check===!0,l=c||t.dryRun===!0,u=t.fixCreatedDate===!0,f=t.rewriteDeclarationCopies!==!1,p=i(h=>h,"keepDate"),x=t.normalizeDateFormat===!0?Zn:p,g=n?h=>Xn(h,n):p,d=r?g:p,m={language:a.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,forcedDetectors:o,includeFolders:t.includeFolders,excludeFolders:t.excludeFolders,includeExtensions:t.includeExtensions,gitignore:t.gitignore},w=Fi(t.input),b;if(w.length>0){let h=new Set;for(let $ of w){let D=lr(s,$),S=await Ci(D).catch(()=>null);if(!S)throw new Error(`Input path does not exist: ${$}`);if(S.isFile())h.add(D);else if(S.isDirectory())for(let P of await je({...m,projectRoot:D}))h.add(P);else throw new Error(`Input path must be a file or directory: ${$}`)}b=Array.from(h)}else b=await je({...m,projectRoot:s});let k=new Date().getFullYear(),L=[],A=[],E=new Set,B=0,Y=0,V=0,te=[];for(let h of b){let $=Zt(h,{enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,forcedDetectors:o});if($!==null){A.push({file:Ke(s,h),reason:$});continue}let D=Ke(s,h),S=await $i(h,"utf8"),P={enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,forcedDetectors:o,detectorSyntaxOverrides:t.detectorSyntaxOverrides},ne=me(S,h,P),U=f&&Se(ne,h)!==null,Ze=U?null:en(h,ne,P);if(Ze!==null){A.push({file:D,reason:Ze});continue}let y=await Be({...t,cwd:s,targetFilePath:h});E.add(`${y.language}:${y.projectRoot}`);let J={language:y.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,forcedDetectors:o,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin,strictHeaderBlock:t.strictHeaderBlock!==!1},ge=pe(S,h,J),F=ge?S.slice(ge.start,ge.end):"",Xe=F.length>0?Ni(F):{},Qe=F.length>0?vi(F):{},dr=F.length>0?Li(F):null,fr=F.length>0?Ri(F):null,et=await nn(h),tt=Ke(y.projectRoot,h),nt=await Tn(y.projectRoot,tt),q=await Hn(y.projectRoot,tt),rt=de(et.createdAt),ye=Jn({existing:Ye(dr),gitCreated:nt,filesystemCreated:rt,fixCreatedDate:u}),W=Ye(fr),ot=ye.source,mr=W?"existing-header":q?"git-last-modified":"filesystem-updated",xe=x(ot==="existing-header"?d(ye.payload):g(ye.payload)),pr=y.copyrightStartYear===null?"created-date":"option",it=y.copyrightStartYear??qn(xe,n),st=x(W?d(W):g(q||de(et.updatedAt))),at=t.forceAuthorUpdate===!0,hr=t.forceLastModifiedAuthorUpdate===!0,ct=U?null:await Mi(S,h,J),lt=U||f&&ct?.state==="untracked"&&F.length>0&&Tt(h),ut=lt?{edited:!1,state:"no-git"}:ct,dt=hr||ut.edited,ft=i(N=>er({absoluteFilePath:h,language:y.language,syntaxOptions:J,projectRoot:y.projectRoot,projectName:y.projectName,createdByName:at?y.authorName:Xe.authorName||y.authorName,createdByEmail:at?y.authorEmail:Xe.authorEmail||y.authorEmail,lastModifiedByName:dt?y.authorName:Qe.authorName||y.authorName,lastModifiedByEmail:dt?y.authorEmail:Qe.authorEmail||y.authorEmail,authorName:y.authorName,authorEmail:y.authorEmail,createdAt:xe,lastModifiedAt:N,copyrightStartYear:it,companyName:y.companyName,currentYear:k}),"renderHeader"),mt=ft(st),pt=he(S,mt,h,J),gr=ut.edited&&W!==null&&q!==null&&W.timestamp<q.timestamp,ht=pt.changed||gr,we=ht&&!(lt&&W!==null),gt=we?x(g(de(new Date))):st,yr=we?"current-time-on-change":mr,xr=we?ft(gt):mt,R=ht?he(S,xr,h,J):pt,re={file:D,changed:R.changed};if(c){let N=Kn(F,{gitCreated:nt,gitLastModified:q,filesystemCreated:rt},{strictCreatedDate:t.strictCreatedDate===!0}),K=N.filter(z=>z.advisory).length;re.dateIssues=N,V+=K,Y+=N.length>K?1:0}if(t.sampleOutput===!0&&R.changed){let N=F.length>0?F.trimEnd():null,K=D.replace(/\\/g,"/"),z=R.written,wr=R.nextContent.slice(0,R.nextContent.indexOf(z)).split(`
36
- `).length-1;re.sample={previousValue:N,newValue:z,diff:cr(N,z,{fromFile:`a/${K}`,toFile:`b/${K}`,lineOffset:wr}),issues:nr(N,z),detectedValues:{projectName:y.projectName,projectNameSource:y.projectNameSource,language:y.language,projectRoot:y.projectRoot,marker:y.marker,authorName:y.authorName,authorEmail:y.authorEmail,companyName:y.companyName,companyNameSource:y.companyNameSource,copyrightStartYear:it,copyrightStartYearSource:pr,createdAtSource:ot,lastModifiedAtSource:yr,createdAt:xe,lastModifiedAt:gt}}}if(R.extraCopyrights.length>0){re.extraCopyrights=R.extraCopyrights;for(let N of R.extraCopyrights)te.push({file:D,copyright:N})}L.push(re),R.changed&&(B+=1,l||await Di(h,R.nextContent,"utf8"))}return{metadata:a,detectedProjects:Array.from(E),filesScanned:b.length-A.length,filesUpdated:B,filesSkipped:A.length,dryRun:l,check:c,...c?{filesWithDateDrift:Y,dateAdvisories:V}:{},copyrightWarnings:te,changes:L,skipped:A}}i(ur,"fixHeaders");function ji(e){return ur(e)}i(ji,"fixHeaders");var _c=ji;export{_c as default,ji as fixHeaders};
37
- //# sourceMappingURL=index.mjs.map
1
+ var o=Object.defineProperty;var r=(e,f)=>o(e,"name",{value:f,configurable:!0});import{fixHeaders as t}from"./core/fix-headers.mjs";function a(e){return t(e)}r(a,"fixHeaders");var d=a;export{d as default,a as fixHeaders};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,5 @@
1
+ var A=Object.defineProperty;var g=(t,l)=>A(t,"name",{value:l,configurable:!0});function C(t,l){const f=t.length,u=l.length,i=Array.from({length:f+1},()=>new Array(u+1).fill(0));for(let o=f-1;o>=0;o-=1)for(let c=u-1;c>=0;c-=1)i[o][c]=t[o]===l[c]?i[o+1][c+1]+1:Math.max(i[o+1][c],i[o][c+1]);const s=[];let e=0,n=0;for(;e<f&&n<u;)t[e]===l[n]?(s.push({type:" ",line:t[e]}),e+=1,n+=1):i[e+1][n]>=i[e][n+1]?(s.push({type:"-",line:t[e]}),e+=1):(s.push({type:"+",line:l[n]}),n+=1);for(;e<f;e+=1)s.push({type:"-",line:t[e]});for(;n<u;n+=1)s.push({type:"+",line:l[n]});return s}g(C,"diffLines");function w(t,l){return`${l===0?t:t+1},${l}`}g(w,"formatRange");function d(t,l,f={}){const u=t===null?[]:t.split(`
2
+ `),i=l.split(`
3
+ `),s=C(u,i),e=Math.max(0,f.context??3),n=f.lineOffset??0,o=[];if(s.forEach((p,h)=>{if(p.type===" ")return;const a=o[o.length-1];a&&h-a.last<=e*2+1?a.last=h:o.push({first:h,last:h})}),o.length===0)return"";const c=f.fromFile??"a",F=f.toFile??"b",y=[`--- ${t===null?"/dev/null":c}`,`+++ ${F}`];for(const p of o){const h=Math.max(0,p.first-e),a=Math.min(s.length,p.last+e+1),$=s.slice(0,h),m=s.slice(h,a),M=$.filter(r=>r.type!=="+").length+n,b=$.filter(r=>r.type!=="-").length+n,x=m.filter(r=>r.type!=="+").length,L=m.filter(r=>r.type!=="-").length;y.push(`@@ -${w(M,x)} +${w(b,L)} @@`);for(const r of m)y.push(`${r.type}${r.line}`)}return y.join(`
4
+ `)}g(d,"createUnifiedDiff");export{d as createUnifiedDiff,C as diffLines};
5
+ //# sourceMappingURL=diff.mjs.map
@@ -0,0 +1,2 @@
1
+ var m=Object.defineProperty;var i=(e,t)=>m(e,"name",{value:t,configurable:!0});import{access as d,readdir as y,readFile as h,stat as w}from"node:fs/promises";import{constants as x}from"node:fs";import{dirname as p,join as c,resolve as D}from"node:path";async function u(e){try{return await d(e,x.F_OK),!0}catch{return!1}}i(u,"pathExists");async function S(e,t){let n=D(e);for(;;){for(const r of t){const s=c(n,r);if(await u(s))return{root:n,marker:r}}const a=p(n);if(a===n)return null;n=a}}i(S,"findProjectRoot");async function j(e){return await u(e)?h(e,"utf8"):null}i(j,"readTextIfExists");async function F(e,t){const n=[],a=await y(e,{withFileTypes:!0});for(const r of a){const s=c(e,r.name);if(r.isDirectory()&&t.recursive===!1||r.isDirectory()&&t.ignoreFolders.has(r.name)||r.isDirectory()&&await t.shouldSkipDirectory?.(s,r.name)===!0)continue;if(r.isDirectory()){const l=await F(s,t);n.push(...l);continue}if(!r.isFile())continue;const o=r.name.lastIndexOf(".");if(o===-1)continue;const f=r.name.slice(o).toLowerCase();t.allowedExtensions.has(f)&&n.push(s)}return n}i(F,"walkFiles");async function v(e){const t=await w(e);return{createdAt:t.birthtimeMs>0&&t.birthtime<t.mtime?t.birthtime:t.mtime,updatedAt:t.mtime}}i(v,"readFileDates");export{S as findProjectRoot,u as pathExists,v as readFileDates,j as readTextIfExists,F as walkFiles};
2
+ //# sourceMappingURL=fs.mjs.map
@@ -0,0 +1,4 @@
1
+ var m=Object.defineProperty;var o=(n,t)=>m(n,"name",{value:t,configurable:!0});import{execFile as g}from"node:child_process";import{basename as p,dirname as d}from"node:path";import{promisify as h}from"node:util";const s=h(g);async function u(n,t){try{const{stdout:e}=await s("git",t,{cwd:n}),r=e.trim();return r.length>0?r:null}catch{return null}}o(u,"runGit");function c(n,t){let e=0;for(let r=t-1;r>=0&&n[r]==="\\";r--)e++;return e%2===1}o(c,"isEscaped");function y(n){const t=n.trim();if(!t.endsWith(")")||c(t,t.length-1))return t;let e=0;for(let r=t.length-1;r>=0;r--){const i=t[r];if(!(i!=="("&&i!==")"||c(t,r))&&(e+=i===")"?1:-1,e===0))return t.slice(0,r).trim()}return t}o(y,"stripUidComment");function x(n){const t=n.trim();if(t.length===0)return{authorName:null,authorEmail:null};const e=t.match(/<([^>\n]+)>\s*$/),r=e?.[1]?.trim()||null,i=(e?t.slice(0,e.index):t).trim();return{authorName:y(i)||i||null,authorEmail:r}}o(x,"parseSignerUid");async function N(n,t){try{const{stdout:e}=await s(n,t),r=e.trim();return r.length>0?r:null}catch{return null}}o(N,"runProgram");function w(n){return n.replace(/\\x([0-9a-fA-F]{2})/g,(t,e)=>String.fromCharCode(Number.parseInt(e,16)))}o(w,"decodeColonField");async function b(n){const t=await u(n,["config","--get","gpg.format"]);if(t!==null&&t!=="openpgp")return null;const e=await u(n,["config","--get","user.signingkey"]);if(!e)return null;const r=await u(n,["config","--get","gpg.openpgp.program"])||await u(n,["config","--get","gpg.program"])||"gpg",i=await N(r,["--batch","--with-colons","--list-keys",e]);if(!i)return null;for(const a of i.split(`
2
+ `)){const l=a.split(":");if(l[0]==="uid"&&l[1]!=="r"&&l[1]!=="e"&&l[9])return w(l[9])}return null}o(b,"readSigningKeyUid");async function I(n,t={}){let e=await u(n,["config","--get","user.name"]),r=await u(n,["config","--get","user.email"]);if(t.useGpgSignerAuthor===!0){const i=await b(n)||await u(n,["log","-1","--format=%GS"]),a=x(i||"");e=a.authorName||e,r=r||a.authorEmail}if(!e||!r){const i=await u(n,["log","-1","--format=%an|%ae"]);if(i){const[a,l]=i.split("|");e=e||a||null,r=r||l||null}}return{authorName:e,authorEmail:r}}o(I,"detectGitAuthor");function f(n){return n.replace(/z$/i,"+00:00")}o(f,"canonicalGitDate");async function C(n,t){const e=await u(n,["log","--follow","--format=%aI|%at","--reverse","--",t]);if(!e)return null;const r=e.split(`
3
+ `)[0],[i,a]=r.split("|");if(!i||!a)return null;const l=Number.parseInt(a,10);return Number.isNaN(l)?null:{date:f(i),timestamp:l}}o(C,"getGitCreationDate");async function D(n,t){const e=await u(n,["log","-1","--format=%aI|%at","--",t]);if(!e)return null;const[r,i]=e.split("|");if(!r||!i)return null;const a=Number.parseInt(i,10);return Number.isNaN(a)?null:{date:f(r),timestamp:a}}o(D,"getGitLastModifiedDate");const E=256*1024*1024;async function S(n){const t=d(n);if(await u(t,["rev-parse","--is-inside-work-tree"])!=="true")return{state:"no-git",content:null};try{const{stdout:e}=await s("git",["show",`HEAD:./${p(n)}`],{cwd:t,encoding:"utf8",maxBuffer:E});return{state:"tracked",content:e}}catch{return{state:"untracked",content:null}}}o(S,"readGitHeadFile");export{I as detectGitAuthor,C as getGitCreationDate,D as getGitLastModifiedDate,x as parseSignerUid,S as readGitHeadFile,b as readSigningKeyUid,u as runGit};
4
+ //# sourceMappingURL=git.mjs.map
@@ -0,0 +1,2 @@
1
+ var l=Object.defineProperty;var r=(n,e)=>l(n,"name",{value:e,configurable:!0});function s(n){let e=n.indexOf("<");for(;e!==-1;){const i=n.indexOf(">",e+1);if(i===-1)return!1;if(i>e+1)return!0;e=n.indexOf("<",i+1)}return!1}r(s,"hasAngleTag");function o(n){let e=n.length;for(;e>0&&n[e-1]==="/";)e-=1;return n.slice(0,e)}r(o,"trimTrailingSlashes");export{s as hasAngleTag,o as trimTrailingSlashes};
2
+ //# sourceMappingURL=text.mjs.map
@@ -0,0 +1,2 @@
1
+ var T=Object.defineProperty;var o=(t,n)=>T(t,"name",{value:n,configurable:!0});function y(t){return $({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),offsetMinutes:-t.getTimezoneOffset()})}o(y,"formatDateWithTimezone");function $(t){return`${g(t," ")} ${h(t.offsetMinutes)}`}o($,"formatSpaceDate");function M(t){if(typeof t!="string")throw new Error(`timezone must be an IANA time zone name string, such as "America/Los_Angeles" or "UTC" (got ${typeof t})`);try{l(t)}catch(n){throw new Error(`Unknown time zone "${t}": expected an IANA time zone name, such as "America/Los_Angeles" or "UTC"`,{cause:n})}return t}o(M,"assertTimeZone");const d=new Map;function l(t){let n=d.get(t);return n||(n=new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),d.set(t,n)),n}o(l,"getZoneFormatter");function w(t,n){const e={};for(const u of l(n).formatToParts(new Date(t*1e3)))e[u.type]=Number(u.value);const r=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second)/1e3;return{year:e.year,month:e.month,day:e.day,hour:e.hour,minute:e.minute,second:e.second,offsetMinutes:(r-t)/60}}o(w,"toZonedDateParts");function g(t,n){const e=o(r=>String(r).padStart(2,"0"),"pad");return`${String(t.year).padStart(4,"0")}-${e(t.month)}-${e(t.day)}${n}${e(t.hour)}:${e(t.minute)}:${e(t.second)}`}o(g,"formatWallClock");function h(t){const n=o(r=>String(r).padStart(2,"0"),"pad"),e=Math.abs(t);return`${t>=0?"+":"-"}${n(Math.floor(e/60))}:${n(e%60)}`}o(h,"formatOffset");function U(t=new Date){return{date:y(t),timestamp:Math.floor(t.getTime()/1e3)}}o(U,"toDatePayload");const C=/^(\d{4})-(\d{2})-(\d{2})(?:T|\s+)(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?\s*(?:(Z)|([+-])(\d{2}):?(\d{2}))$/i;function A(t){const n=C.exec(t.trim());if(!n)return null;const[e,r,u,s,i,c]=n.slice(1,7).map(Number),f=n[7]?0:Number(n[9])*60+Number(n[10]),m=n[8]==="-"?-f:f,a=new Date(Date.UTC(e,r-1,u,s,i,c));return!(a.getUTCFullYear()===e&&a.getUTCMonth()===r-1&&a.getUTCDate()===u&&a.getUTCHours()===s&&a.getUTCMinutes()===i&&a.getUTCSeconds()===c)||Number(n[10]??0)>59?null:{year:e,month:r,day:u,hour:s,minute:i,second:c,offsetMinutes:m,timestamp:Math.floor(a.getTime()/1e3)-m*60}}o(A,"parseHeaderDate");function S(t){return`${g(t,"T")}${h(t.offsetMinutes)}`}o(S,"formatIsoDate");export{M as assertTimeZone,y as formatDateWithTimezone,S as formatIsoDate,$ as formatSpaceDate,A as parseHeaderDate,U as toDatePayload,w as toZonedDateParts};
2
+ //# sourceMappingURL=time.mjs.map
package/package.json CHANGED
@@ -1,33 +1,31 @@
1
1
  {
2
2
  "name": "@cldmv/fix-headers",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Multi-language project header normalizer with auto-detection and override support.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",
8
- "types": "./types/index.d.mts",
8
+ "types": "./types/src/index.d.mts",
9
9
  "files": [
10
10
  "dist/",
11
11
  "!dist/**/*.map",
12
- "types/",
13
- "bin/",
14
- "!bin/**/*.map"
12
+ "types/"
15
13
  ],
16
14
  "exports": {
17
15
  ".": {
18
16
  "fix-headers-dev": {
19
- "types": "./types/index.d.mts",
17
+ "types": "./types/src/index.d.mts",
20
18
  "import": "./src/index.mjs",
21
19
  "require": "./src/index.cjs"
22
20
  },
23
- "types": "./types/index.d.mts",
21
+ "types": "./types/src/index.d.mts",
24
22
  "import": "./dist/index.mjs",
25
23
  "require": "./dist/index.cjs"
26
24
  },
27
25
  "./package.json": "./package.json"
28
26
  },
29
27
  "bin": {
30
- "fix-headers": "./bin/fix-headers.mjs"
28
+ "fix-headers": "./dist/cli.mjs"
31
29
  },
32
30
  "scripts": {
33
31
  "build:ci": "npm run lint --if-present && npm run format:check --if-present && npm run types:check && npm run types:build && npm run build",
@@ -37,11 +35,11 @@
37
35
  "test:watch": "vitest --config .configs/vitest.config.mjs",
38
36
  "coverage": "node tests/run-vitest.mjs --coverage-quiet && npm run test:cjs",
39
37
  "ci:coverage": "npm run coverage && npm run test:dist",
40
- "types:build": "tsc -p .configs/tsconfig.json --noCheck",
38
+ "types:build": "tsc -p .configs/tsconfig.json --noCheck && node --conditions=fix-headers-dev ./src/cli.mjs --config .configs/fix-headers.json --input types",
41
39
  "types:check": "tsc -p .configs/tsconfig.json --noEmit",
42
40
  "cli": "node --conditions=fix-headers-dev ./src/cli.mjs",
43
- "build": "node -e \"for (const d of ['dist', 'bin']) require('node:fs').rmSync(d, { recursive: true, force: true })\" && tsup",
44
- "prepack": "node -e \"const fs=require('node:fs');const hasTsup=fs.existsSync('node_modules/.bin/tsup')||fs.existsSync('node_modules/.bin/tsup.cmd');if(hasTsup){require('node:child_process').execSync('npm run build',{stdio:'inherit'})}else if(!fs.existsSync('dist/index.mjs')){throw new Error('dist/ is missing and tsup is unavailable to build it (expected in a bare package-contents publish dir with a prebuilt dist/; unexpected anywhere else)')}\"",
41
+ "build": "node scripts/build.mjs",
42
+ "prepack": "node -e \"const fs=require('node:fs');if(fs.existsSync('node_modules/esbuild')){require('node:child_process').execSync('npm run types:build && npm run build',{stdio:'inherit'})}else if(!fs.existsSync('dist/index.mjs')){throw new Error('dist/ is missing and esbuild is unavailable to build it')}\"",
45
43
  "lint": "eslint --config .configs/eslint.config.mjs .",
46
44
  "lint:fix": "eslint --config .configs/eslint.config.mjs . --fix",
47
45
  "format": "prettier --config .configs/.prettierrc --write .",
@@ -110,7 +108,6 @@
110
108
  "eslint": "^10.11.0",
111
109
  "globals": "^17.14.0",
112
110
  "prettier": "^3.9.9",
113
- "tsup": "^9.0.0",
114
111
  "typescript": "^6.0.3",
115
112
  "vitest": "^5.0.0"
116
113
  },
@@ -1,4 +1,19 @@
1
1
  #!/usr/bin/env node
2
+ /**
3
+ *
4
+ * @Project: @cldmv/fix-headers
5
+ * @Filename: types/src/cli.d.mts
6
+ * @Date: 2026-03-01T17:59:32-08:00 (1772416772)
7
+ * @Author: Nate Corcoran <CLDMV>
8
+ * @Email: <Shinrai@users.noreply.github.com>
9
+ * -----
10
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
11
+ * @Last modified time: 2026-11-27T12:50:52-08:00 (1795812652)
12
+ * -----
13
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
14
+ *
15
+ */
16
+
2
17
  /**
3
18
  * Parses CLI arguments into fixHeaders options and control flags.
4
19
  * @param {string[]} argv - Process argument vector without node/script items.
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/config/load.d.mts
5
+ * @Date: 2026-09-28T21:19:05-07:00 (1790655545)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:23-08:00 (1795640843)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  /**
2
17
  * Merges `override` onto `base`: plain objects merge key by key, arrays and scalars replace.
3
18
  * Neither input is modified. `__proto__` keys are skipped so a config can't change prototypes.
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/constants.d.mts
5
+ * @Date: 2026-03-01T17:59:32-08:00 (1772416772)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:23-08:00 (1795640843)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  /**
2
17
  * Reads a layout count option (`spacing` / `margin`): unset means the default, anything but a whole number of 0 or more throws.
3
18
  * @param {unknown} value - Option value.
@@ -0,0 +1,58 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/core/declaration-sources.d.mts
5
+ * @Date: 2026-11-27T12:44:03-08:00 (1795812243)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-27T12:44:52-08:00 (1795812292)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
16
+ /**
17
+ * @typedef {{ rootDir: string | null, outDir: string | null, declarationDir: string | null, configDir: string }} DeclarationLayout
18
+ */
19
+ /**
20
+ * Parses tsconfig JSON, which allows comments and trailing commas.
21
+ * @param {string} text - File content.
22
+ * @returns {any} Parsed value.
23
+ */
24
+ export function parseJsonc(text: string): any;
25
+ /**
26
+ * Reads a tsconfig and the configs it extends, resolving each directory option against the
27
+ * folder of the config that sets it (a later config overrides an earlier one, as in `tsc`).
28
+ * @param {string} configPath - Absolute tsconfig path.
29
+ * @param {Set<string>} [seen] - Configs already read (guards against `extends` cycles).
30
+ * @returns {Promise<DeclarationLayout>} The directory options that matter for declarations.
31
+ */
32
+ export function readDeclarationLayout(configPath: string, seen?: Set<string>): Promise<DeclarationLayout>;
33
+ /**
34
+ * Finds the source a declaration was emitted from under a layout: the declaration's path inside
35
+ * `declarationDir` (else `outDir`), taken under `rootDir` (else the tsconfig's folder), with the
36
+ * first source extension that exists.
37
+ * @param {string} declarationPath - Absolute declaration path.
38
+ * @param {DeclarationLayout} layout - Tsconfig directory options.
39
+ * @returns {Promise<string | null>} Absolute source path, or null when none is found.
40
+ */
41
+ export function findDeclarationSource(declarationPath: string, layout: DeclarationLayout): Promise<string | null>;
42
+ /**
43
+ * Creates a lookup from a declaration to its source for one run. The tsconfig is the `tsconfig`
44
+ * option (relative to the scan root), else the first of `.configs/tsconfig.json` and
45
+ * `tsconfig.json` that exists; with none, every lookup returns null.
46
+ * @param {{ scanRoot: string, tsconfig?: string | null }} options - Scan root and optional tsconfig path.
47
+ * @returns {(declarationPath: string) => Promise<string | null>} Source lookup.
48
+ */
49
+ export function createDeclarationSourceResolver({ scanRoot, tsconfig }: {
50
+ scanRoot: string;
51
+ tsconfig?: string | null;
52
+ }): (declarationPath: string) => Promise<string | null>;
53
+ export type DeclarationLayout = {
54
+ rootDir: string | null;
55
+ outDir: string | null;
56
+ declarationDir: string | null;
57
+ configDir: string;
58
+ };
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/core/file-discovery.d.mts
5
+ * @Date: 2026-03-01T17:59:32-08:00 (1772416772)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:23-08:00 (1795640843)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  /**
2
17
  * Discovers source files for processing.
3
18
  * @param {{
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/core/fix-headers.d.mts
5
+ * @Date: 2026-03-01T17:59:32-08:00 (1772416772)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-27T12:50:52-08:00 (1795812652)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  /**
2
17
  * @fileoverview Main header-fixing engine with auto-detection and override support.
3
18
  * @module fix-headers/core/fix-headers
@@ -16,6 +31,7 @@ export type FixHeadersOptions = {
16
31
  fixCreatedDate?: boolean;
17
32
  strictCreatedDate?: boolean;
18
33
  rewriteDeclarationCopies?: boolean;
34
+ tsconfig?: string;
19
35
  strictHeaderBlock?: boolean;
20
36
  normalizeDateFormat?: boolean;
21
37
  timezone?: string;
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/core/ignore-rules.d.mts
5
+ * @Date: 2026-09-28T18:00:27-07:00 (1790643627)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:23-08:00 (1795640843)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  /**
2
17
  * Creates the ignore filter for one discovery root.
3
18
  * @param {{ root: string, gitignore?: boolean | string | string[] }} options - `gitignore`: `false`
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/detect/project.d.mts
5
+ * @Date: 2026-03-01T13:32:57-08:00 (1772400777)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:23-08:00 (1795640843)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  /**
2
17
  * Detects the project a path belongs to from the manifests of the project it sits in (see
3
18
  * {@link resolveManifestProject}), independent of the file's type.
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/detectors/c.d.mts
5
+ * @Date: 2026-11-25T08:41:13-08:00 (1795624873)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:23-08:00 (1795640843)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  export namespace detector {
2
17
  export let id: string;
3
18
  export { extensions };
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/detectors/css.d.mts
5
+ * @Date: 2026-03-01T17:59:32-08:00 (1772416772)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:23-08:00 (1795640843)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  export namespace detector {
2
17
  export let id: string;
3
18
  export { extensions };
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/detectors/go.d.mts
5
+ * @Date: 2026-03-01T17:59:32-08:00 (1772416772)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:23-08:00 (1795640843)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  export namespace detector {
2
17
  export let id: string;
3
18
  export { extensions };
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/detectors/html.d.mts
5
+ * @Date: 2026-03-01T17:59:32-08:00 (1772416772)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:23-08:00 (1795640843)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  export namespace detector {
2
17
  export let id: string;
3
18
  export { extensions };
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/detectors/index.d.mts
5
+ * @Date: 2026-03-01T16:34:41-08:00 (1772411681)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:24-08:00 (1795640844)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  /**
2
17
  * Validates the `forcedDetectors` option: each id must name a force-only detector
3
18
  * (`requiresForce: true`). Forcing a detector that is used without forcing, or one that does
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/detectors/json.d.mts
5
+ * @Date: 2026-03-01T20:00:00-08:00 (1772424000)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:24-08:00 (1795640844)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  export namespace detector {
2
17
  export let id: string;
3
18
  export { extensions };
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/fix-headers
4
+ * @Filename: types/src/detectors/markdown.d.mts
5
+ * @Date: 2026-10-03T17:04:18-07:00 (1791072258)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-25T13:07:24-08:00 (1795640844)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+
1
16
  export namespace detector {
2
17
  export let id: string;
3
18
  export { extensions };