[{"data":1,"prerenderedAt":573},["ShallowReactive",2],{"navigation_docs":3,"-start":249,"-start-surround":566,"page-views-\u002Fstart":569},[4,29,104,124,194],{"title":5,"icon":6,"path":7,"stem":8,"children":9},"Start",false,"\u002Fstart","1.start",[10,14,19,24],{"title":11,"path":7,"stem":12,"icon":13},"What jscpd finds","1.start\u002Findex","i-lucide-house",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fstart\u002Finstallation","1.start\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quickstart","\u002Fstart\u002Fquickstart","1.start\u002F3.quickstart","i-lucide-rocket",{"title":25,"path":26,"stem":27,"icon":28},"Configuration basics","\u002Fstart\u002Fconfiguration","1.start\u002F4.configuration","i-lucide-settings-2",{"title":30,"icon":6,"path":31,"stem":32,"children":33,"page":6},"Guides","\u002Fguides","2.guides",[34,39,44,49,54,59,64,69,74,79,84,89,94,99],{"title":35,"path":36,"stem":37,"icon":38},"Use jscpd in CI","\u002Fguides\u002Fci","2.guides\u002F01.ci","i-lucide-github",{"title":40,"path":41,"stem":42,"icon":43},"Pre-commit hooks","\u002Fguides\u002Fpre-commit","2.guides\u002F02.pre-commit","i-lucide-git-commit",{"title":45,"path":46,"stem":47,"icon":48},"Fail only on new duplication","\u002Fguides\u002Fbaseline","2.guides\u002F03.baseline","i-lucide-git-compare",{"title":50,"path":51,"stem":52,"icon":53},"Monorepos","\u002Fguides\u002Fmonorepos","2.guides\u002F04.monorepos","i-lucide-folder-tree",{"title":55,"path":56,"stem":57,"icon":58},"Cross-format detection","\u002Fguides\u002Fcross-format","2.guides\u002F05.cross-format","i-lucide-layers",{"title":60,"path":61,"stem":62,"icon":63},"Agents","\u002Fguides\u002Fagents","2.guides\u002F06.agents","i-lucide-cpu",{"title":65,"path":66,"stem":67,"icon":68},"Editors","\u002Fguides\u002Feditors","2.guides\u002F07.editors","i-lucide-code",{"title":70,"path":71,"stem":72,"icon":73},"Duplication over git history","\u002Fguides\u002Fhistory","2.guides\u002F08.history","i-lucide-chart-no-axes-combined",{"title":75,"path":76,"stem":77,"icon":78},"Dashboard and health score","\u002Fguides\u002Fdashboard","2.guides\u002F09.dashboard","i-lucide-layout-dashboard",{"title":80,"path":81,"stem":82,"icon":83},"Dead code","\u002Fguides\u002Fdead-code","2.guides\u002F10.dead-code","i-lucide-ghost",{"title":85,"path":86,"stem":87,"icon":88},"Comparing two codebases","\u002Fguides\u002Fcompare","2.guides\u002F11.compare","i-lucide-git-compare-arrows",{"title":90,"path":91,"stem":92,"icon":93},"Semantic clones","\u002Fguides\u002Fsemantic-clones","2.guides\u002F12.semantic-clones","i-lucide-brain-circuit",{"title":95,"path":96,"stem":97,"icon":98},"Similar functions","\u002Fguides\u002Fsimilarity","2.guides\u002F13.similarity","i-lucide-list-tree",{"title":100,"path":101,"stem":102,"icon":103},"Boundaries","\u002Fguides\u002Fboundaries","2.guides\u002F14.boundaries","i-lucide-fence",{"title":105,"icon":6,"path":106,"stem":107,"children":108,"page":6},"Concepts","\u002Fconcepts","3.concepts",[109,114,119],{"title":110,"path":111,"stem":112,"icon":113},"Types of code clones","\u002Fconcepts\u002Fclone-types","3.concepts\u002F1.clone-types","i-lucide-copy",{"title":115,"path":116,"stem":117,"icon":118},"How detection works","\u002Fconcepts\u002Fhow-detection-works","3.concepts\u002F2.how-detection-works","i-lucide-scan-search",{"title":120,"path":121,"stem":122,"icon":123},"The health score","\u002Fconcepts\u002Fhealth-score","3.concepts\u002F3.health-score","i-lucide-heart-pulse",{"title":125,"icon":6,"path":126,"stem":127,"children":128,"page":6},"Reference","\u002Freference","4.reference",[129,134,139,144,181,186,190],{"title":130,"path":131,"stem":132,"icon":133},"CLI options","\u002Freference\u002Fcli","4.reference\u002F1.cli","i-lucide-terminal",{"title":135,"path":136,"stem":137,"icon":138},"The config file","\u002Freference\u002Fconfig-file","4.reference\u002F2.config-file","i-lucide-settings",{"title":140,"path":141,"stem":142,"icon":143},"Exit codes","\u002Freference\u002Fexit-codes","4.reference\u002F3.exit-codes","i-lucide-log-out",{"title":145,"icon":6,"path":146,"stem":147,"children":148},"Reporters","\u002Freference\u002Freporters","4.reference\u002F4.reporters\u002Findex",[149,151,156,161,166,171,176],{"title":145,"path":146,"stem":147,"icon":150},"i-lucide-file-chart-column",{"title":152,"path":153,"stem":154,"icon":155},"HTML reporter","\u002Freference\u002Freporters\u002Fhtml","4.reference\u002F4.reporters\u002F2.html","i-lucide-file-code",{"title":157,"path":158,"stem":159,"icon":160},"JSON reporter","\u002Freference\u002Freporters\u002Fjson","4.reference\u002F4.reporters\u002F3.json","i-lucide-braces",{"title":162,"path":163,"stem":164,"icon":165},"Badge reporter","\u002Freference\u002Freporters\u002Fbadge","4.reference\u002F4.reporters\u002F4.badge","i-lucide-award",{"title":167,"path":168,"stem":169,"icon":170},"SARIF reporter","\u002Freference\u002Freporters\u002Fsarif","4.reference\u002F4.reporters\u002F5.sarif","i-lucide-shield-check",{"title":172,"path":173,"stem":174,"icon":175},"CodeClimate reporter","\u002Freference\u002Freporters\u002Fcodeclimate","4.reference\u002F4.reporters\u002F6.codeclimate","i-lucide-flag-triangle-right",{"title":177,"path":178,"stem":179,"icon":180},"OpenMetrics reporter","\u002Freference\u002Freporters\u002Fopenmetrics","4.reference\u002F4.reporters\u002F7.openmetrics","i-lucide-activity",{"title":182,"path":183,"stem":184,"icon":185},"Supported formats","\u002Freference\u002Fsupported-formats","4.reference\u002F5.supported-formats","i-lucide-languages",{"title":187,"path":188,"stem":189,"icon":38},"GitHub Action","\u002Freference\u002Fgithub-action","4.reference\u002F6.github-action",{"title":191,"path":192,"stem":193,"icon":68},"Rust crates","\u002Freference\u002Frust-crates","4.reference\u002F7.rust-crates",{"title":195,"icon":6,"path":196,"stem":197,"children":198,"page":6},"Project","\u002Fproject","5.project",[199,204,209,214,239,244],{"title":200,"path":201,"stem":202,"icon":203},"Changelog","\u002Fproject\u002Fchangelog","5.project\u002F1.changelog","i-lucide-scroll-text",{"title":205,"path":206,"stem":207,"icon":208},"Migrating from v4 to v5","\u002Fproject\u002Fmigration","5.project\u002F2.migration","i-lucide-arrow-right-left",{"title":210,"path":211,"stem":212,"icon":213},"jscpd v4 (TypeScript)","\u002Fproject\u002Fv4","5.project\u002F3.v4","i-simple-icons-typescript",{"title":215,"icon":6,"path":216,"stem":217,"children":218},"Benchmarks","\u002Fproject\u002Fbenchmarks","5.project\u002F4.benchmarks\u002Findex",[219,221,226,230,235],{"title":215,"path":216,"stem":217,"icon":220},"i-lucide-gauge",{"title":222,"path":223,"stem":224,"icon":225},"Detection Speed","\u002Fproject\u002Fbenchmarks\u002Fdetection-speed","5.project\u002F4.benchmarks\u002F2.detection-speed","i-lucide-zap",{"title":227,"path":228,"stem":229,"icon":58},"Multi-Format Detection","\u002Fproject\u002Fbenchmarks\u002Fcross-format","5.project\u002F4.benchmarks\u002F3.cross-format",{"title":231,"path":232,"stem":233,"icon":234},"AI Token Efficiency","\u002Fproject\u002Fbenchmarks\u002Fai-token-efficiency","5.project\u002F4.benchmarks\u002F4.ai-token-efficiency","i-lucide-sparkles",{"title":236,"path":237,"stem":238,"icon":93},"Embedding Models","\u002Fproject\u002Fbenchmarks\u002Fembedding-models","5.project\u002F4.benchmarks\u002F5.embedding-models",{"title":240,"path":241,"stem":242,"icon":243},"Research","\u002Fproject\u002Fresearch","5.project\u002F5.research","i-lucide-graduation-cap",{"title":245,"path":246,"stem":247,"icon":248},"Articles","\u002Fproject\u002Farticles","5.project\u002F6.articles","i-lucide-newspaper",{"id":250,"title":11,"body":251,"description":558,"extension":559,"links":560,"meta":561,"navigation":562,"path":7,"seo":563,"stem":12,"__hash__":565},"docs\u002F1.start\u002Findex.md",{"type":252,"value":253,"toc":550},"minimark",[254,258,263,286,309,317,320,369,384,388,431,436,440,443,447,501,505,546],[255,256,257],"p",{},"jscpd finds duplicated code in a repository and reports it in the terminal, in CI, in an editor or to a coding agent. It is for teams that want a duplication number to gate a build on, and the copies behind it.",[259,260,262],"h2",{"id":261},"what-a-default-run-reports","What a default run reports",[255,264,265,266,270,271,274,275,278,279,282,283,285],{},"Without options, jscpd reports exact copies: every block of at least 50 tokens and 5 lines that appears more than once (",[267,268,269],"code",{},"--min-tokens",", ",[267,272,273],{},"--min-lines","). It reads 224 formats and tokenizes each with that language's own comment and string rules, JavaScript and TypeScript through the oxc parser, so a clone is a repeated run of language tokens. A rolling Rabin-Karp hash over those tokens finds the repeats. Inside a git repository, files that ",[267,276,277],{},".gitignore"," lists are skipped. ",[280,281,115],"a",{"href":116}," follows a file through the pipeline; ",[280,284,182],{"href":183}," lists the formats.",[287,288,294],"pre",{"className":289,"code":290,"filename":291,"language":292,"meta":293,"style":293},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","jscpd .\n","Terminal","bash","",[267,295,296],{"__ignoreMap":293},[297,298,301,305],"span",{"class":299,"line":300},"line",1,[297,302,304],{"class":303},"sBMFI","jscpd",[297,306,308],{"class":307},"sfazB"," .\n",[287,310,315],{"className":311,"code":313,"language":314,"meta":293},[312],"language-text","Clone found (javascript)\n - generated\u002Fcheckout.js [2:1 - 25:2] (24 lines, 179 tokens)\n   src\u002Fcheckout.js [1:1 - 24:2]\nClone found (javascript)\n - generated\u002Fcheckout.js [2:1 - 25:2] (24 lines, 179 tokens)\n   vendor\u002Fcheckout.js [2:1 - 25:2]\nFound 2 clones.\n","text",[267,316,313],{"__ignoreMap":293},[255,318,319],{},"After the clones, the terminal prints one row per format and a total; for this run it is one row:",[321,322,323,346],"table",{},[324,325,326],"thead",{},[327,328,329,333,337,340,343],"tr",{},[330,331,332],"th",{},"Format",[330,334,336],{"align":335},"right","Files analyzed",[330,338,339],{"align":335},"Lines",[330,341,342],{"align":335},"Clones",[330,344,345],{"align":335},"Duplicated lines",[347,348,349],"tbody",{},[327,350,351,357,360,363,366],{},[352,353,354],"td",{},[267,355,356],{},"javascript",[352,358,359],{"align":335},"3",[352,361,362],{"align":335},"74",[352,364,365],{"align":335},"2",[352,367,368],{"align":335},"48 (64.86 %)",[255,370,371,372,375,376,379,380,383],{},"The run is ",[267,373,374],{},"fixtures\u002Fignore-demo\u002Fglob"," from the jscpd repository: one file copied into ",[267,377,378],{},"vendor\u002F"," and ",[267,381,382],{},"generated\u002F",". Each clone names both places with line and column; the percentage is the duplication of the scan.",[259,385,387],{"id":386},"what-it-finds-when-you-ask","What it finds when you ask",[389,390,391,405,417,424],"ul",{},[392,393,394,395,270,398,379,401,404],"li",{},"Renamed copies, the same code under other variable, function or literal names: ",[267,396,397],{},"--ignore-identifiers",[267,399,400],{},"--ignore-literals",[267,402,403],{},"--ignore-annotations",".",[392,406,407,408,411,412,404],{},"Near-miss copies with a few inserted or edited lines: ",[267,409,410],{},"--max-gap-lines","; and functions with the same structure in 15 languages: ",[280,413,414],{"href":96},[267,415,416],{},"--similarity",[392,418,419,420,423],{},"Semantic clones, functions that do the same job with different code, in one language or across languages: ",[267,421,422],{},"--semantic",", experimental, with a code embedding model.",[392,425,426,427,430],{},"Copies of code that must stay in one module, such as money math that only the backend may do, whether copied, edited or written again in another language: ",[280,428,429],{"href":101},"boundary rules"," in the config file.",[255,432,433,435],{},[280,434,110],{"href":111}," says where the lines between these sit and which flag turns each on.",[259,437,439],{"id":438},"what-it-does-not-do","What it does not do",[255,441,442],{},"jscpd does not rewrite code: it reports, and the refactoring is yours or your agent's. A scan reads the paths you pass and makes no network call; there is no hosted service and no index of other repositories to compare against. The semantic mode is the exception: it downloads a 548 MB model once, or talks to an embeddings API you name. A default run reports exact clones only; the other kinds need their flags.",[259,444,446],{"id":445},"other-questions-jscpd-answers","Other questions jscpd answers",[255,448,449,379,452,455,456,270,459,462,463,466,467,462,470,473,474,477,478,481,482,462,485,488,489,492,493,496,497,500],{},[267,450,451],{},"--dashboard",[267,453,454],{},"--health"," put duplication, dead code and complexity on one screen with a score (",[280,457,458],{"href":76},"dashboard",[280,460,461],{"href":121},"health score","). ",[267,464,465],{},"--dead-code"," finds unused files, exports, symbols and imports in JavaScript, TypeScript and Python (",[280,468,469],{"href":81},"dead code",[267,471,472],{},"--history"," plots duplication over git history (",[280,475,476],{"href":71},"history","), and ",[267,479,480],{},"--compare"," measures a port or two implementations of one app (",[280,483,484],{"href":86},"compare",[267,486,487],{},"--mcp"," serves the detector to coding agents (",[280,490,491],{"href":61},"agents",") and ",[267,494,495],{},"--lsp"," to editors (",[280,498,499],{"href":66},"editors",").",[259,502,504],{"id":503},"where-to-go-next","Where to go next",[321,506,507,517],{},[324,508,509],{},[327,510,511,514],{},[330,512,513],{},"You want to",[330,515,516],{},"Read",[347,518,519,528,537],{},[327,520,521,524],{},[352,522,523],{},"Install jscpd with your package manager or a one-line installer",[352,525,526],{},[280,527,15],{"href":16},[327,529,530,533],{},[352,531,532],{},"Scan your repository and read the report, in about ten minutes",[352,534,535],{},[280,536,20],{"href":21},[327,538,539,542],{},[352,540,541],{},"Fail a pull request when duplication grows",[352,543,544],{},[280,545,35],{"href":36},[547,548,549],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":293,"searchDepth":551,"depth":551,"links":552},2,[553,554,555,556,557],{"id":261,"depth":551,"text":262},{"id":386,"depth":551,"text":387},{"id":438,"depth":551,"text":439},{"id":445,"depth":551,"text":446},{"id":503,"depth":551,"text":504},"What a default run reports, what jscpd finds when you ask for it, what it leaves alone, and where to go first.","md",null,{},{"icon":13},{"title":11,"description":564},"jscpd finds duplicated code in 224 formats, from exact copies to renamed, near-miss and semantic clones, and reports it in the terminal, in CI, in editors and to coding agents.","-hajMh4CTVBfSuoAeBQ40ns6CYPvspwA2VB_aFH1jOE",[560,567],{"title":15,"path":16,"stem":17,"description":568,"icon":18,"children":-1},"Every channel installs the same binary; pick the one your project already uses, then check the version.",{"\u002Fstart":570},{"views":571,"visits":572},579,175,1795510267450]