voidmachine 6.0.0 → 7.0.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.
- package/core-assets/.claude-plugin/plugin.json +2 -2
- package/core-assets/PHILOSOPHY.md +18 -5
- package/core-assets/data/catalog.v3.json +29 -109
- package/core-assets/data/certification.json +1 -1
- package/core-assets/data/model.json +28 -52
- package/core-assets/hooks/_syntax-worker.cjs +1 -1
- package/core-assets/hooks/_void-hook.mjs +8 -6
- package/core-assets/hooks/tdd-guard.md +45 -88
- package/core-assets/hooks/viewport-screenshot-gate.sh +3 -3
- package/core-assets/packs/pack-monorepo/skills/void-dependency-direction/SKILL.md +27 -146
- package/core-assets/packs/pack-monorepo/skills/void-service-package/SKILL.md +5 -8
- package/core-assets/packs/pack-server/skills/void-webhook-handler-pattern/.source +4 -2
- package/core-assets/packs/pack-server/skills/void-webhook-handler-pattern/SKILL.md +32 -132
- package/core-assets/skills/void-accessibility/SKILL.md +2 -2
- package/core-assets/skills/void-async-safety/SKILL.md +37 -24
- package/core-assets/skills/void-autopilot/SKILL.md +4 -3
- package/core-assets/skills/void-code-review/SKILL.md +1 -1
- package/core-assets/skills/void-commit-discipline/SKILL.md +5 -11
- package/core-assets/skills/void-frontend-design/SKILL.md +2 -2
- package/core-assets/skills/void-hexagonal-architecture/SKILL.md +5 -5
- package/core-assets/skills/void-implement/SKILL.md +7 -3
- package/core-assets/skills/void-observability/SKILL.md +4 -4
- package/core-assets/skills/void-orchestrate/SKILL.md +50 -222
- package/core-assets/skills/void-testing/SKILL.md +4 -4
- package/core-assets/skills/void-verify/SKILL.md +1 -1
- package/dist/main.js +1055 -1321
- package/package.json +2 -2
- package/core-assets/hooks/block-protected-push.sh +0 -81
|
@@ -261,16 +261,6 @@
|
|
|
261
261
|
"staticTokens": 96,
|
|
262
262
|
"type": "hook"
|
|
263
263
|
},
|
|
264
|
-
{
|
|
265
|
-
"description": "",
|
|
266
|
-
"id": "hook:block-protected-push",
|
|
267
|
-
"lines": 81,
|
|
268
|
-
"name": "block-protected-push",
|
|
269
|
-
"pack": null,
|
|
270
|
-
"source": "packages/core/hooks/block-protected-push.sh",
|
|
271
|
-
"staticTokens": 971,
|
|
272
|
-
"type": "hook"
|
|
273
|
-
},
|
|
274
264
|
{
|
|
275
265
|
"description": "",
|
|
276
266
|
"id": "hook:boundary-direction-check",
|
|
@@ -528,7 +518,7 @@
|
|
|
528
518
|
"name": "viewport-screenshot-gate",
|
|
529
519
|
"pack": null,
|
|
530
520
|
"source": "packages/core/hooks/viewport-screenshot-gate.sh",
|
|
531
|
-
"staticTokens":
|
|
521
|
+
"staticTokens": 570,
|
|
532
522
|
"type": "hook"
|
|
533
523
|
},
|
|
534
524
|
{
|
|
@@ -822,7 +812,7 @@
|
|
|
822
812
|
"type": "skill"
|
|
823
813
|
},
|
|
824
814
|
{
|
|
825
|
-
"description": "
|
|
815
|
+
"description": "Declare cross-package dependencies explicitly and preserve domain-owned ports. Use when crossing a workspace package boundary or fixing boundary-direction-check.",
|
|
826
816
|
"enforcement": {
|
|
827
817
|
"floor": "ci",
|
|
828
818
|
"inline": {
|
|
@@ -839,7 +829,7 @@
|
|
|
839
829
|
}
|
|
840
830
|
],
|
|
841
831
|
"id": "skill:pack-monorepo/void-dependency-direction",
|
|
842
|
-
"lines":
|
|
832
|
+
"lines": 41,
|
|
843
833
|
"name": "void-dependency-direction",
|
|
844
834
|
"owner": "folpe",
|
|
845
835
|
"pack": "pack-monorepo",
|
|
@@ -848,7 +838,7 @@
|
|
|
848
838
|
"codex"
|
|
849
839
|
],
|
|
850
840
|
"source": "packages/packs/pack-monorepo/skills/void-dependency-direction/SKILL.md",
|
|
851
|
-
"staticTokens":
|
|
841
|
+
"staticTokens": 535,
|
|
852
842
|
"type": "skill"
|
|
853
843
|
},
|
|
854
844
|
{
|
|
@@ -899,7 +889,7 @@
|
|
|
899
889
|
}
|
|
900
890
|
],
|
|
901
891
|
"id": "skill:pack-monorepo/void-service-package",
|
|
902
|
-
"lines":
|
|
892
|
+
"lines": 119,
|
|
903
893
|
"name": "void-service-package",
|
|
904
894
|
"owner": "folpe",
|
|
905
895
|
"pack": "pack-monorepo",
|
|
@@ -908,7 +898,7 @@
|
|
|
908
898
|
"codex"
|
|
909
899
|
],
|
|
910
900
|
"source": "packages/packs/pack-monorepo/skills/void-service-package/SKILL.md",
|
|
911
|
-
"staticTokens":
|
|
901
|
+
"staticTokens": 1444,
|
|
912
902
|
"type": "skill"
|
|
913
903
|
},
|
|
914
904
|
{
|
|
@@ -1512,7 +1502,7 @@
|
|
|
1512
1502
|
"type": "skill"
|
|
1513
1503
|
},
|
|
1514
1504
|
{
|
|
1515
|
-
"description": "Build a webhook handler with signature verification, idempotency, and dead-letter routing. Per-source patterns (Stripe, Resend, GitHub).
|
|
1505
|
+
"description": "Build a webhook handler with signature verification, idempotency, and dead-letter routing. Per-source patterns (Stripe, Resend, GitHub). Uses the shared async-safety contract.",
|
|
1516
1506
|
"enforcement": {
|
|
1517
1507
|
"floor": "ci",
|
|
1518
1508
|
"inline": {
|
|
@@ -1529,7 +1519,7 @@
|
|
|
1529
1519
|
}
|
|
1530
1520
|
],
|
|
1531
1521
|
"id": "skill:pack-server/void-webhook-handler-pattern",
|
|
1532
|
-
"lines":
|
|
1522
|
+
"lines": 105,
|
|
1533
1523
|
"name": "void-webhook-handler-pattern",
|
|
1534
1524
|
"owner": "folpe",
|
|
1535
1525
|
"pack": "pack-server",
|
|
@@ -1538,7 +1528,7 @@
|
|
|
1538
1528
|
"codex"
|
|
1539
1529
|
],
|
|
1540
1530
|
"source": "packages/packs/pack-server/skills/void-webhook-handler-pattern/SKILL.md",
|
|
1541
|
-
"staticTokens":
|
|
1531
|
+
"staticTokens": 1436,
|
|
1542
1532
|
"type": "skill"
|
|
1543
1533
|
},
|
|
1544
1534
|
{
|
|
@@ -1569,7 +1559,7 @@
|
|
|
1569
1559
|
"codex"
|
|
1570
1560
|
],
|
|
1571
1561
|
"source": "packages/core/skills/void-accessibility/SKILL.md",
|
|
1572
|
-
"staticTokens":
|
|
1562
|
+
"staticTokens": 2247,
|
|
1573
1563
|
"triggers": {
|
|
1574
1564
|
"extensions": [
|
|
1575
1565
|
"tsx"
|
|
@@ -1633,7 +1623,7 @@
|
|
|
1633
1623
|
}
|
|
1634
1624
|
],
|
|
1635
1625
|
"id": "skill:void-async-safety",
|
|
1636
|
-
"lines":
|
|
1626
|
+
"lines": 300,
|
|
1637
1627
|
"name": "void-async-safety",
|
|
1638
1628
|
"owner": "folpe",
|
|
1639
1629
|
"pack": null,
|
|
@@ -1642,7 +1632,7 @@
|
|
|
1642
1632
|
"codex"
|
|
1643
1633
|
],
|
|
1644
1634
|
"source": "packages/core/skills/void-async-safety/SKILL.md",
|
|
1645
|
-
"staticTokens":
|
|
1635
|
+
"staticTokens": 3424,
|
|
1646
1636
|
"triggers": {
|
|
1647
1637
|
"globs": [
|
|
1648
1638
|
"**/webhooks/**",
|
|
@@ -1703,7 +1693,7 @@
|
|
|
1703
1693
|
}
|
|
1704
1694
|
],
|
|
1705
1695
|
"id": "skill:void-autopilot",
|
|
1706
|
-
"lines":
|
|
1696
|
+
"lines": 396,
|
|
1707
1697
|
"name": "void-autopilot",
|
|
1708
1698
|
"owner": "folpe",
|
|
1709
1699
|
"pack": null,
|
|
@@ -1712,7 +1702,7 @@
|
|
|
1712
1702
|
"codex"
|
|
1713
1703
|
],
|
|
1714
1704
|
"source": "packages/core/skills/void-autopilot/SKILL.md",
|
|
1715
|
-
"staticTokens":
|
|
1705
|
+
"staticTokens": 7059,
|
|
1716
1706
|
"type": "skill"
|
|
1717
1707
|
},
|
|
1718
1708
|
{
|
|
@@ -1833,12 +1823,12 @@
|
|
|
1833
1823
|
"codex"
|
|
1834
1824
|
],
|
|
1835
1825
|
"source": "packages/core/skills/void-code-review/SKILL.md",
|
|
1836
|
-
"staticTokens":
|
|
1826
|
+
"staticTokens": 3443,
|
|
1837
1827
|
"type": "skill"
|
|
1838
1828
|
},
|
|
1839
1829
|
{
|
|
1840
1830
|
"activation": "always",
|
|
1841
|
-
"description": "Conventional Commits + mandatory \"why\" in body + scope + breaking-change marking.
|
|
1831
|
+
"description": "Conventional Commits + mandatory \"why\" in body + scope + breaking-change marking. Co-author trailer for AI pair. The git log is documentation. Use at every commit.",
|
|
1842
1832
|
"enforcement": {
|
|
1843
1833
|
"floor": "ci",
|
|
1844
1834
|
"inline": {
|
|
@@ -1855,7 +1845,7 @@
|
|
|
1855
1845
|
}
|
|
1856
1846
|
],
|
|
1857
1847
|
"id": "skill:void-commit-discipline",
|
|
1858
|
-
"lines":
|
|
1848
|
+
"lines": 204,
|
|
1859
1849
|
"name": "void-commit-discipline",
|
|
1860
1850
|
"owner": "folpe",
|
|
1861
1851
|
"pack": null,
|
|
@@ -1864,7 +1854,7 @@
|
|
|
1864
1854
|
"codex"
|
|
1865
1855
|
],
|
|
1866
1856
|
"source": "packages/core/skills/void-commit-discipline/SKILL.md",
|
|
1867
|
-
"staticTokens":
|
|
1857
|
+
"staticTokens": 1830,
|
|
1868
1858
|
"type": "skill"
|
|
1869
1859
|
},
|
|
1870
1860
|
{
|
|
@@ -2077,7 +2067,7 @@
|
|
|
2077
2067
|
"codex"
|
|
2078
2068
|
],
|
|
2079
2069
|
"source": "packages/core/skills/void-frontend-design/SKILL.md",
|
|
2080
|
-
"staticTokens":
|
|
2070
|
+
"staticTokens": 3622,
|
|
2081
2071
|
"triggers": {
|
|
2082
2072
|
"extensions": [
|
|
2083
2073
|
"tsx"
|
|
@@ -2174,7 +2164,7 @@
|
|
|
2174
2164
|
"codex"
|
|
2175
2165
|
],
|
|
2176
2166
|
"source": "packages/core/skills/void-hexagonal-architecture/SKILL.md",
|
|
2177
|
-
"staticTokens":
|
|
2167
|
+
"staticTokens": 2797,
|
|
2178
2168
|
"type": "skill"
|
|
2179
2169
|
},
|
|
2180
2170
|
{
|
|
@@ -2195,7 +2185,7 @@
|
|
|
2195
2185
|
}
|
|
2196
2186
|
],
|
|
2197
2187
|
"id": "skill:void-implement",
|
|
2198
|
-
"lines":
|
|
2188
|
+
"lines": 234,
|
|
2199
2189
|
"name": "void-implement",
|
|
2200
2190
|
"owner": "folpe",
|
|
2201
2191
|
"pack": null,
|
|
@@ -2204,7 +2194,7 @@
|
|
|
2204
2194
|
"codex"
|
|
2205
2195
|
],
|
|
2206
2196
|
"source": "packages/core/skills/void-implement/SKILL.md",
|
|
2207
|
-
"staticTokens":
|
|
2197
|
+
"staticTokens": 6632,
|
|
2208
2198
|
"type": "skill"
|
|
2209
2199
|
},
|
|
2210
2200
|
{
|
|
@@ -2394,11 +2384,11 @@
|
|
|
2394
2384
|
"codex"
|
|
2395
2385
|
],
|
|
2396
2386
|
"source": "packages/core/skills/void-observability/SKILL.md",
|
|
2397
|
-
"staticTokens":
|
|
2387
|
+
"staticTokens": 2277,
|
|
2398
2388
|
"type": "skill"
|
|
2399
2389
|
},
|
|
2400
2390
|
{
|
|
2401
|
-
"description": "Delegate independent research and substantial implementation through native agents; choose context, isolation and bounded concurrency, collect results and preserve review evidence.
|
|
2391
|
+
"description": "Delegate independent research and substantial implementation through native agents; choose context, isolation and bounded concurrency, collect results and preserve review evidence. Publish observed worker lifecycle events.",
|
|
2402
2392
|
"enforcement": {
|
|
2403
2393
|
"floor": "ci",
|
|
2404
2394
|
"inline": {
|
|
@@ -2415,7 +2405,7 @@
|
|
|
2415
2405
|
}
|
|
2416
2406
|
],
|
|
2417
2407
|
"id": "skill:void-orchestrate",
|
|
2418
|
-
"lines":
|
|
2408
|
+
"lines": 198,
|
|
2419
2409
|
"name": "void-orchestrate",
|
|
2420
2410
|
"owner": "folpe",
|
|
2421
2411
|
"pack": null,
|
|
@@ -2424,7 +2414,7 @@
|
|
|
2424
2414
|
"codex"
|
|
2425
2415
|
],
|
|
2426
2416
|
"source": "packages/core/skills/void-orchestrate/SKILL.md",
|
|
2427
|
-
"staticTokens":
|
|
2417
|
+
"staticTokens": 3221,
|
|
2428
2418
|
"type": "skill"
|
|
2429
2419
|
},
|
|
2430
2420
|
{
|
|
@@ -2733,7 +2723,7 @@
|
|
|
2733
2723
|
"codex"
|
|
2734
2724
|
],
|
|
2735
2725
|
"source": "packages/core/skills/void-testing/SKILL.md",
|
|
2736
|
-
"staticTokens":
|
|
2726
|
+
"staticTokens": 3097,
|
|
2737
2727
|
"triggers": {
|
|
2738
2728
|
"globs": [
|
|
2739
2729
|
"**/*.test.ts",
|
|
@@ -2868,7 +2858,7 @@
|
|
|
2868
2858
|
"codex"
|
|
2869
2859
|
],
|
|
2870
2860
|
"source": "packages/core/skills/void-verify/SKILL.md",
|
|
2871
|
-
"staticTokens":
|
|
2861
|
+
"staticTokens": 1573,
|
|
2872
2862
|
"type": "skill"
|
|
2873
2863
|
}
|
|
2874
2864
|
],
|
|
@@ -2922,13 +2912,6 @@
|
|
|
2922
2912
|
"origin": "declared",
|
|
2923
2913
|
"evidence": "block-dangerous-bash blocks destructive shell — enforces security-guidance"
|
|
2924
2914
|
},
|
|
2925
|
-
{
|
|
2926
|
-
"from": "hook:block-protected-push",
|
|
2927
|
-
"to": "skill:void-autopilot",
|
|
2928
|
-
"kind": "enforces",
|
|
2929
|
-
"origin": "declared",
|
|
2930
|
-
"evidence": "block-protected-push guards protected-branch pushes for commit-only autopilot workers — enforces autopilot"
|
|
2931
|
-
},
|
|
2932
2915
|
{
|
|
2933
2916
|
"from": "hook:boundary-direction-check",
|
|
2934
2917
|
"to": "skill:void-hexagonal-architecture",
|
|
@@ -3104,13 +3087,6 @@
|
|
|
3104
3087
|
"origin": "declared",
|
|
3105
3088
|
"evidence": "ubiquitous-language-lint checks domain vocabulary — enforces domain-driven-design"
|
|
3106
3089
|
},
|
|
3107
|
-
{
|
|
3108
|
-
"from": "hook:viewport-screenshot-gate",
|
|
3109
|
-
"to": "skill:void-accessibility",
|
|
3110
|
-
"kind": "enforces",
|
|
3111
|
-
"origin": "declared",
|
|
3112
|
-
"evidence": "viewport-screenshot-gate gates mobile+desktop viewports — enforces accessibility"
|
|
3113
|
-
},
|
|
3114
3090
|
{
|
|
3115
3091
|
"from": "pack:pack-mobile",
|
|
3116
3092
|
"to": "skill:pack-mobile/void-eas-build-profile",
|
|
@@ -443,7 +443,7 @@ Project '${_.projectName}' (${ew[_.projectKind]}) ${o}
|
|
|
443
443
|
`&&(!_||_.length===0||cet(_,o))){let{lineText:u,absolutePosition:g}=s.textStorage.getAbsolutePositionAndLineText(t.line);if(u&&u.search("\\S")<0){let m=i.getIndentationAtPosition(n,o,c),h=0,S,T;for(S=0,T=u.length;S<T;S++)if(u.charAt(S)===" ")h++;else if(u.charAt(S)===" ")h+=c.tabSize;else break;if(m!==h){let k=g+S;_.push({span:xc(g,k),newText:Zc.getIndentationString(m,c)})}}}if(_)return _.map(u=>({start:s.positionToLineOffset(u.span.start),end:s.positionToLineOffset(Ko(u.span)),newText:u.newText?u.newText:""}))}getCompletions(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),_=s.getLanguageService().getCompletionsAtPosition(i,c,{...ufe(this.getPreferences(i)),triggerCharacter:t.triggerCharacter,triggerKind:t.triggerKind,includeExternalModuleExports:t.includeExternalModuleExports,includeInsertTextCompletions:t.includeInsertTextCompletions},s.projectService.getFormatCodeOptions(i));if(_===void 0)return;if(n==="completions-full")return _;let u=t.prefix||"",g=Ni(_.entries,h=>{if(_.isMemberCompletion||Ui(h.name.toLowerCase(),u.toLowerCase())){let S=h.replacementSpan?Tm(h.replacementSpan,o):void 0;return{...h,replacementSpan:S,hasAction:h.hasAction||void 0,symbol:void 0}}});return n==="completions"?(_.metadata&&(g.metadata=_.metadata),g):{..._,optionalReplacementSpan:_.optionalReplacementSpan&&Tm(_.optionalReplacementSpan,o),entries:g}}getCompletionEntryDetails(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),_=s.projectService.getFormatCodeOptions(i),u=!!this.getPreferences(i).displayPartsForJSDoc,g=Ni(t.entryNames,m=>{let{name:h,source:S,data:T}=typeof m=="string"?{name:m,source:void 0,data:void 0}:m;return s.getLanguageService().getCompletionEntryDetails(i,c,h,_,S,this.getPreferences(i),T?Rs(T,ket):void 0)});return n?u?g:g.map(m=>({...m,tags:this.mapJSDocTagInfo(m.tags,s,!1)})):g.map(m=>({...m,codeActions:dr(m.codeActions,h=>this.mapCodeAction(h)),documentation:this.mapDisplayParts(m.documentation,s),tags:this.mapJSDocTagInfo(m.tags,s,u)}))}getCompileOnSaveAffectedFileList(t){let n=this.getProjects(t,!0,!0),i=this.projectService.getScriptInfo(t.file);return i?_et(i,s=>this.projectService.getScriptInfoForPath(s),n,(s,o)=>{if(!s.compileOnSaveEnabled||!s.languageServiceEnabled||s.isOrphan())return;let c=s.getCompilationSettings();if(!(c.noEmit||Al(o.fileName)&&!oet(c)))return{projectFileName:s.getProjectName(),fileNames:s.getCompileOnSaveAffectedFileList(o),projectUsesOutFile:!!c.outFile}}):yl}emitFile(t){let{file:n,project:i}=this.getFileAndProject(t);if(i||Ph.ThrowNoProject(),!i.languageServiceEnabled)return t.richResponse?{emitSkipped:!0,diagnostics:[]}:!1;let s=i.getScriptInfo(n),{emitSkipped:o,diagnostics:c}=i.emitFile(s,(_,u,g)=>this.host.writeFile(_,u,g));return t.richResponse?{emitSkipped:o,diagnostics:t.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(c):c.map(_=>YI(_,!0))}:!o}getSignatureHelpItems(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),_=s.getLanguageService().getSignatureHelpItems(i,c,t),u=!!this.getPreferences(i).displayPartsForJSDoc;if(_&&n){let g=_.applicableSpan;return{..._,applicableSpan:{start:o.positionToLineOffset(g.start),end:o.positionToLineOffset(g.start+g.length)},items:this.mapSignatureHelpItems(_.items,s,u)}}else return u||!_?_:{..._,items:_.items.map(g=>({...g,tags:this.mapJSDocTagInfo(g.tags,s,!1)}))}}toPendingErrorCheck(t){let n=ro(t),i=this.projectService.tryGetDefaultProjectForFile(n);return i&&{fileName:n,project:i}}getDiagnostics(t,n,i){this.suppressDiagnosticEvents||i.length>0&&this.updateErrorCheck(t,i,n)}change(t){let n=this.projectService.getScriptInfo(t.file);E.assert(!!n),n.textStorage.switchToScriptVersionCache();let i=n.lineOffsetToPosition(t.line,t.offset),s=n.lineOffsetToPosition(t.endLine,t.endOffset);i>=0&&(this.changeSeq++,this.projectService.applyChangesToFile(n,mQ({span:{start:i,length:s-i},newText:t.insertString})))}reload(t){let n=ro(t.file),i=t.tmpfile===void 0?void 0:ro(t.tmpfile),s=this.projectService.getScriptInfoForNormalizedPath(n);s&&(this.changeSeq++,s.reloadFromFile(i))}saveToTmp(t,n){let i=this.projectService.getScriptInfo(t);i&&i.saveTo(n)}closeClientFile(t){if(!t)return;let n=zs(t);this.projectService.closeClientFile(n)}mapLocationNavigationBarItems(t,n){return dr(t,i=>({text:i.text,kind:i.kind,kindModifiers:i.kindModifiers,spans:i.spans.map(s=>Tm(s,n)),childItems:this.mapLocationNavigationBarItems(i.childItems,n),indent:i.indent}))}getNavigationBarItems(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=s.getNavigationBarItems(i);return o?n?this.mapLocationNavigationBarItems(o,this.projectService.getScriptInfoForNormalizedPath(i)):o:void 0}toLocationNavigationTree(t,n){return{text:t.text,kind:t.kind,kindModifiers:t.kindModifiers,spans:t.spans.map(i=>Tm(i,n)),nameSpan:t.nameSpan&&Tm(t.nameSpan,n),childItems:dr(t.childItems,i=>this.toLocationNavigationTree(i,n))}}getNavigationTree(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=s.getNavigationTree(i);return o?n?this.toLocationNavigationTree(o,this.projectService.getScriptInfoForNormalizedPath(i)):o:void 0}getNavigateToItems(t,n){let i=this.getFullNavigateToItems(t);return n?ua(i,({project:s,navigateToItems:o})=>o.map(c=>{let _=s.getScriptInfo(c.fileName),u={name:c.name,kind:c.kind,kindModifiers:c.kindModifiers,isCaseSensitive:c.isCaseSensitive,matchKind:c.matchKind,file:c.fileName,start:_.positionToLineOffset(c.textSpan.start),end:_.positionToLineOffset(Ko(c.textSpan))};return c.kindModifiers&&c.kindModifiers!==""&&(u.kindModifiers=c.kindModifiers),c.containerName&&c.containerName.length>0&&(u.containerName=c.containerName),c.containerKind&&c.containerKind.length>0&&(u.containerKind=c.containerKind),u})):ua(i,({navigateToItems:s})=>s)}getFullNavigateToItems(t){let{currentFileOnly:n,searchValue:i,maxResultCount:s,projectFileName:o}=t;if(n){E.assertIsDefined(t.file);let{file:S,project:T}=this.getFileAndProject(t);return[{project:T,navigateToItems:T.getLanguageService().getNavigateToItems(i,s,S)}]}let c=this.getHostPreferences(),_=[],u=new Map;if(!t.file&&!o)this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(S=>g(S));else{let S=this.getProjects(t);Mwe(S,void 0,T=>g(T))}return _;function g(S){let T=S.getLanguageService().getNavigateToItems(i,s,void 0,S.isNonTsProject(),c.excludeLibrarySymbolsInNavTo),k=Cn(T,D=>m(D)&&!KG(tw(D),S));k.length&&_.push({project:S,navigateToItems:k})}function m(S){let T=S.name;if(!u.has(T))return u.set(T,[S]),!0;let k=u.get(T);for(let D of k)if(h(D,S))return!1;return k.push(S),!0}function h(S,T){return S===T?!0:!S||!T?!1:S.containerKind===T.containerKind&&S.containerName===T.containerName&&S.fileName===T.fileName&&S.isCaseSensitive===T.isCaseSensitive&&S.kind===T.kind&&S.kindModifiers===T.kindModifiers&&S.matchKind===T.matchKind&&S.name===T.name&&S.textSpan.start===T.textSpan.start&&S.textSpan.length===T.textSpan.length}}getSupportedCodeFixes(t){if(!t)return hH();if(t.file){let{file:i,project:s}=this.getFileAndProject(t);return s.getLanguageService().getSupportedCodeFixes(i)}let n=this.getProject(t.projectFileName);return n||Ph.ThrowNoProject(),n.getLanguageService().getSupportedCodeFixes()}isLocation(t){return t.line!==void 0}extractPositionOrRange(t,n){let i,s;return this.isLocation(t)?i=o(t):s=this.getRange(t,n),E.checkDefined(i===void 0?s:i);function o(c){return c.position!==void 0?c.position:n.lineOffsetToPosition(c.line,c.offset)}}getRange(t,n){let{startPosition:i,endPosition:s}=this.getStartAndEndPosition(t,n);return{pos:i,end:s}}getApplicableRefactors(t){let{file:n,project:i}=this.getFileAndProject(t),s=i.getScriptInfoForNormalizedPath(n);return i.getLanguageService().getApplicableRefactors(n,this.extractPositionOrRange(t,s),this.getPreferences(n),t.triggerReason,t.kind,t.includeInteractiveActions).map(c=>({...c,actions:c.actions.map(_=>({..._,range:_.range?{start:p6({line:_.range.start.line,character:_.range.start.offset}),end:p6({line:_.range.end.line,character:_.range.end.offset})}:void 0}))}))}getEditsForRefactor(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=s.getScriptInfoForNormalizedPath(i),c=s.getLanguageService().getEditsForRefactor(i,this.getFormatOptions(i),this.extractPositionOrRange(t,o),t.refactor,t.action,this.getPreferences(i),t.interactiveRefactorArguments);if(c===void 0)return{edits:[]};if(n){let{renameFilename:_,renameLocation:u,edits:g}=c,m;if(_!==void 0&&u!==void 0){let h=s.getScriptInfoForNormalizedPath(ro(_));m=Nfe(Sk(h.getSnapshot()),_,u,g)}return{renameLocation:m,renameFilename:_,edits:this.mapTextChangesToCodeEdits(g),notApplicableReason:c.notApplicableReason}}return c}getMoveToRefactoringFileSuggestions(t){let{file:n,project:i}=this.getFileAndProject(t),s=i.getScriptInfoForNormalizedPath(n);return i.getLanguageService().getMoveToRefactoringFileSuggestions(n,this.extractPositionOrRange(t,s),this.getPreferences(n))}preparePasteEdits(t){let{file:n,project:i}=this.getFileAndProject(t);return i.getLanguageService().preparePasteEditsForFile(n,t.copiedTextSpan.map(s=>this.getRange({file:n,startLine:s.start.line,startOffset:s.start.offset,endLine:s.end.line,endOffset:s.end.offset},this.projectService.getScriptInfoForNormalizedPath(n))))}getPasteEdits(t){let{file:n,project:i}=this.getFileAndProject(t);if(KP(n))return;let s=t.copiedFrom?{file:t.copiedFrom.file,range:t.copiedFrom.spans.map(c=>this.getRange({file:t.copiedFrom.file,startLine:c.start.line,startOffset:c.start.offset,endLine:c.end.line,endOffset:c.end.offset},i.getScriptInfoForNormalizedPath(ro(t.copiedFrom.file))))}:void 0,o=i.getLanguageService().getPasteEdits({targetFile:n,pastedText:t.pastedText,pasteLocations:t.pasteLocations.map(c=>this.getRange({file:n,startLine:c.start.line,startOffset:c.start.offset,endLine:c.end.line,endOffset:c.end.offset},i.getScriptInfoForNormalizedPath(n))),copiedFrom:s,preferences:this.getPreferences(n)},this.getFormatOptions(n));return o&&this.mapPasteEditsAction(o)}organizeImports(t,n){E.assert(t.scope.type==="file");let{file:i,project:s}=this.getFileAndProject(t.scope.args),o=s.getLanguageService().organizeImports({fileName:i,mode:t.mode??(t.skipDestructiveCodeActions?"SortAndCombine":void 0),type:"file"},this.getFormatOptions(i),this.getPreferences(i));return n?this.mapTextChangesToCodeEdits(o):o}getEditsForFileRename(t,n){let i=ro(t.oldFilePath),s=ro(t.newFilePath),o=this.getHostFormatOptions(),c=this.getHostPreferences(),_=new Set,u=[];return this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(g=>{let m=g.getLanguageService().getEditsForFileRename(i,s,o,c),h=[];for(let S of m)_.has(S.fileName)||(u.push(S),h.push(S.fileName));for(let S of h)_.add(S)}),n?u.map(g=>this.mapTextChangeToCodeEdit(g)):u}getCodeFixes(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=s.getScriptInfoForNormalizedPath(i),{startPosition:c,endPosition:_}=this.getStartAndEndPosition(t,o),u;try{u=s.getLanguageService().getCodeFixesAtPosition(i,c,_,t.errorCodes,this.getFormatOptions(i),this.getPreferences(i))}catch(g){let m=g instanceof Error?g:new Error(g),h=s.getLanguageService(),S=[...h.getSyntacticDiagnostics(i),...h.getSemanticDiagnostics(i),...h.getSuggestionDiagnostics(i)].filter(k=>_3(c,_-c,k.start,k.length)).map(k=>k.code),T=t.errorCodes.find(k=>!S.includes(k));throw T!==void 0&&(m.message+=`
|
|
444
444
|
Additional information: BADCLIENT: Bad error code, ${T} not found in range ${c}..${_} (found: ${S.join(", ")})`),m}return n?u.map(g=>this.mapCodeFixAction(g)):u}getCombinedCodeFix({scope:t,fixId:n},i){E.assert(t.type==="file");let{file:s,project:o}=this.getFileAndProject(t.args),c=o.getLanguageService().getCombinedCodeFix({type:"file",fileName:s},n,this.getFormatOptions(s),this.getPreferences(s));return i?{changes:this.mapTextChangesToCodeEdits(c.changes),commands:c.commands}:c}applyCodeActionCommand(t){let n=t.command;for(let i of KT(n)){let{file:s,project:o}=this.getFileAndProject(i);o.getLanguageService().applyCodeActionCommand(i,this.getFormatOptions(s)).then(c=>{},c=>{})}return{}}getStartAndEndPosition(t,n){let i,s;return t.startPosition!==void 0?i=t.startPosition:(i=n.lineOffsetToPosition(t.startLine,t.startOffset),t.startPosition=i),t.endPosition!==void 0?s=t.endPosition:(s=n.lineOffsetToPosition(t.endLine,t.endOffset),t.endPosition=s),{startPosition:i,endPosition:s}}mapCodeAction({description:t,changes:n,commands:i}){return{description:t,changes:this.mapTextChangesToCodeEdits(n),commands:i}}mapCodeFixAction({fixName:t,description:n,changes:i,commands:s,fixId:o,fixAllDescription:c}){return{fixName:t,description:n,changes:this.mapTextChangesToCodeEdits(i),commands:s,fixId:o,fixAllDescription:c}}mapPasteEditsAction({edits:t,fixId:n}){return{edits:this.mapTextChangesToCodeEdits(t),fixId:n}}mapTextChangesToCodeEdits(t){return t.map(n=>this.mapTextChangeToCodeEdit(n))}mapTextChangeToCodeEdit(t){let n=this.projectService.getScriptInfoOrConfig(t.fileName);return!!t.isNewFile==!!n&&(n||this.projectService.logErrorForScriptInfoNotFound(t.fileName),E.fail("Expected isNewFile for (only) new files. "+JSON.stringify({isNewFile:!!t.isNewFile,hasScriptInfo:!!n}))),n?{fileName:t.fileName,textChanges:t.textChanges.map(i=>het(i,n))}:bet(t)}convertTextChangeToCodeEdit(t,n){return{start:n.positionToLineOffset(t.span.start),end:n.positionToLineOffset(t.span.start+t.span.length),newText:t.newText?t.newText:""}}getBraceMatching(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),_=s.getBraceMatchingAtPosition(i,c);return _?n?_.map(u=>Tm(u,o)):_:void 0}getDiagnosticsForProject(t,n,i){if(this.suppressDiagnosticEvents)return;let{fileNames:s,languageServiceDisabled:o}=this.getProjectInfoWorker(i,void 0,!0,void 0,!0);if(o)return;let c=s.filter(D=>!D.includes("lib.d.ts"));if(c.length===0)return;let _=[],u=[],g=[],m=[],h=ro(i),S=this.projectService.ensureDefaultProjectForFile(h);for(let D of c)this.getCanonicalFileName(D)===this.getCanonicalFileName(i)?_.push(D):this.projectService.getScriptInfo(D).isScriptOpen()?u.push(D):Al(D)?m.push(D):g.push(D);let k=[..._,...u,...g,...m].map(D=>({fileName:D,project:S}));this.updateErrorCheck(t,k,n,!1)}configurePlugin(t){this.projectService.configurePlugin(t)}getSmartSelectionRange(t,n){let{locations:i}=t,{file:s,languageService:o}=this.getFileAndLanguageServiceForSyntacticOperation(t),c=E.checkDefined(this.projectService.getScriptInfo(s));return dr(i,_=>{let u=this.getPosition(_,c),g=o.getSmartSelectionRange(s,u);return n?this.mapSelectionRange(g,c):g})}toggleLineComment(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfo(i),c=this.getRange(t,o),_=s.toggleLineComment(i,c);if(n){let u=this.projectService.getScriptInfoForNormalizedPath(i);return _.map(g=>this.convertTextChangeToCodeEdit(g,u))}return _}toggleMultilineComment(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),_=s.toggleMultilineComment(i,c);if(n){let u=this.projectService.getScriptInfoForNormalizedPath(i);return _.map(g=>this.convertTextChangeToCodeEdit(g,u))}return _}commentSelection(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),_=s.commentSelection(i,c);if(n){let u=this.projectService.getScriptInfoForNormalizedPath(i);return _.map(g=>this.convertTextChangeToCodeEdit(g,u))}return _}uncommentSelection(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),_=s.uncommentSelection(i,c);if(n){let u=this.projectService.getScriptInfoForNormalizedPath(i);return _.map(g=>this.convertTextChangeToCodeEdit(g,u))}return _}mapSelectionRange(t,n){let i={textSpan:Tm(t.textSpan,n)};return t.parent&&(i.parent=this.mapSelectionRange(t.parent,n)),i}getScriptInfoFromProjectService(t){let n=ro(t),i=this.projectService.getScriptInfoForNormalizedPath(n);return i||(this.projectService.logErrorForScriptInfoNotFound(n),Ph.ThrowNoProject())}toProtocolCallHierarchyItem(t){let n=this.getScriptInfoFromProjectService(t.file);return{name:t.name,kind:t.kind,kindModifiers:t.kindModifiers,file:t.file,containerName:t.containerName,span:Tm(t.span,n),selectionSpan:Tm(t.selectionSpan,n)}}toProtocolCallHierarchyIncomingCall(t){let n=this.getScriptInfoFromProjectService(t.from.file);return{from:this.toProtocolCallHierarchyItem(t.from),fromSpans:t.fromSpans.map(i=>Tm(i,n))}}toProtocolCallHierarchyOutgoingCall(t,n){return{to:this.toProtocolCallHierarchyItem(t.to),fromSpans:t.fromSpans.map(i=>Tm(i,n))}}prepareCallHierarchy(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.projectService.getScriptInfoForNormalizedPath(n);if(s){let o=this.getPosition(t,s),c=i.getLanguageService().prepareCallHierarchy(n,o);return c&&Eq(c,_=>this.toProtocolCallHierarchyItem(_))}}provideCallHierarchyIncomingCalls(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyIncomingCalls(n,this.getPosition(t,s)).map(c=>this.toProtocolCallHierarchyIncomingCall(c))}provideCallHierarchyOutgoingCalls(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyOutgoingCalls(n,this.getPosition(t,s)).map(c=>this.toProtocolCallHierarchyOutgoingCall(c,s))}getCanonicalFileName(t){let n=this.host.useCaseSensitiveFileNames?t:_y(t);return zs(n)}exit(){}notRequired(t){return t&&this.doOutput(void 0,t.command,t.seq,!0,this.performanceData),{responseRequired:!1,performanceData:this.performanceData}}requiredResponse(t){return{response:t,responseRequired:!0,performanceData:this.performanceData}}addProtocolHandler(t,n){if(this.handlers.has(t))throw new Error(`Protocol handler already exists for command "${t}"`);this.handlers.set(t,n)}setCurrentRequest(t){E.assert(this.currentRequestId===void 0),this.currentRequestId=t,this.cancellationToken.setRequest(t)}resetCurrentRequest(t){E.assert(this.currentRequestId===t),this.currentRequestId=void 0,this.cancellationToken.resetRequest(t)}executeWithRequestId(t,n,i){let s=this.performanceData;try{return this.performanceData=i,this.setCurrentRequest(t),n()}finally{this.resetCurrentRequest(t),this.performanceData=s}}executeCommand(t){let n=this.handlers.get(t.command);if(n){let i=this.executeWithRequestId(t.seq,()=>n(t),void 0);return this.projectService.enableRequestedPlugins(),i}else return this.logger.msg(`Unrecognized JSON command:${vv(t)}`,"Err"),this.doOutput(void 0,"unknown",t.seq,!1,void 0,`Unrecognized JSON command: ${t.command}`),{responseRequired:!1}}onMessage(t){var n,i,s,o,c,_,u;this.gcTimer.scheduleCollect();let g,m=this.performanceData;this.logger.hasLevel(2)&&(g=this.hrtime(),this.logger.hasLevel(3)&&this.logger.info(`request:${kP(this.toStringMessage(t))}`));let h,S;try{h=this.parseMessage(t),S=h.arguments&&h.arguments.file?h.arguments:void 0,(n=sn)==null||n.instant(sn.Phase.Session,"request",{seq:h.seq,command:h.command}),(i=sn)==null||i.push(sn.Phase.Session,"executeCommand",{seq:h.seq,command:h.command},!0);let{response:T,responseRequired:k,performanceData:D}=this.executeCommand(h);if((s=sn)==null||s.pop(),this.logger.hasLevel(2)){let w=aet(this.hrtime(g)).toFixed(4);k?this.logger.perftrc(`${h.seq}::${h.command}: elapsed time (in milliseconds) ${w}`):this.logger.perftrc(`${h.seq}::${h.command}: async elapsed time (in milliseconds) ${w}`)}(o=sn)==null||o.instant(sn.Phase.Session,"response",{seq:h.seq,command:h.command,success:!!T}),T?this.doOutput(T,h.command,h.seq,!0,D):k&&this.doOutput(void 0,h.command,h.seq,!1,D,"No content available.")}catch(T){if((c=sn)==null||c.popAll(),T instanceof h4){(_=sn)==null||_.instant(sn.Phase.Session,"commandCanceled",{seq:h?.seq,command:h?.command}),this.doOutput({canceled:!0},h.command,h.seq,!0,this.performanceData);return}this.logErrorWorker(T,this.toStringMessage(t),S),(u=sn)==null||u.instant(sn.Phase.Session,"commandError",{seq:h?.seq,command:h?.command,message:T.message}),this.doOutput(void 0,h?h.command:"unknown",h?h.seq:0,!1,this.performanceData,"Error processing request. "+T.message+`
|
|
445
445
|
`+T.stack)}finally{this.performanceData=m}}parseMessage(t){return JSON.parse(t)}toStringMessage(t){return t}getFormatOptions(t){return this.projectService.getFormatCodeOptions(t)}getPreferences(t){return this.projectService.getPreferences(t)}getHostFormatOptions(){return this.projectService.getHostFormatCodeOptions()}getHostPreferences(){return this.projectService.getHostPreferences()}};function Uwe(e){let t=e.diagnosticsDuration&&is(e.diagnosticsDuration,([n,i])=>({...i,file:n}));return{...e,diagnosticsDuration:t}}function Tm(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Ko(e))}}function wfe(e,t,n){let i=Tm(e,n),s=t&&Tm(t,n);return s?{...i,contextStart:s.start,contextEnd:s.end}:i}function het(e,t){return{start:Vwe(t,e.span.start),end:Vwe(t,Ko(e.span)),newText:e.newText}}function Vwe(e,t){return Tfe(e)?vet(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function yet(e,t){let n=e.ranges.map(i=>({start:t.positionToLineOffset(i.start),end:t.positionToLineOffset(i.start+i.length)}));return e.wordPattern?{ranges:n,wordPattern:e.wordPattern}:{ranges:n}}function vet(e){return{line:e.line+1,offset:e.character+1}}function bet(e){E.assert(e.textChanges.length===1);let t=ya(e.textChanges);return E.assert(t.span.start===0&&t.span.length===0),{fileName:e.fileName,textChanges:[{start:{line:0,offset:0},end:{line:0,offset:0},newText:t.newText}]}}function Nfe(e,t,n,i){let s=Tet(e,t,i),{line:o,character:c}=AC(cx(s),n);return{line:o+1,offset:c+1}}function Tet(e,t,n){for(let{fileName:i,textChanges:s}of n)if(i===t)for(let o=s.length-1;o>=0;o--){let{newText:c,span:{start:_,length:u}}=s[o];e=e.slice(0,_)+c+e.slice(_+u)}return e}function qwe(e,{fileName:t,textSpan:n,contextSpan:i,isWriteAccess:s,isDefinition:o},{disableLineTextInReferences:c}){let _=E.checkDefined(e.getScriptInfo(t)),u=wfe(n,i,_),g=c?void 0:xet(_,u);return{file:t,...u,lineText:g,isWriteAccess:s,isDefinition:o}}function xet(e,t){let n=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(n.start,Ko(n)).replace(/\r|\n/g,"")}function ket(e){return e===void 0||e&&typeof e=="object"&&typeof e.exportName=="string"&&(e.fileName===void 0||typeof e.fileName=="string")&&(e.ambientModuleName===void 0||typeof e.ambientModuleName=="string"&&(e.isPackageJsonImport===void 0||typeof e.isPackageJsonImport=="boolean"))}var d6=4,Afe=(e=>(e[e.PreStart=0]="PreStart",e[e.Start=1]="Start",e[e.Entire=2]="Entire",e[e.Mid=3]="Mid",e[e.End=4]="End",e[e.PostEnd=5]="PostEnd",e))(Afe||{}),Cet=class{constructor(){this.goSubtree=!0,this.lineIndex=new ZI,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new m6,this.startPath=[this.lineIndex.root],this.stack=[this.lineIndex.root]}get done(){return!1}insertLines(e,t){t&&(this.trailingText=""),e?e=this.initialText+e+this.trailingText:e=this.initialText+this.trailingText;let i=ZI.linesFromText(e).lines;i.length>1&&i[i.length-1]===""&&i.pop();let s,o;for(let _=this.endBranch.length-1;_>=0;_--)this.endBranch[_].updateCounts(),this.endBranch[_].charCount()===0&&(o=this.endBranch[_],_>0?s=this.endBranch[_-1]:s=this.branchNode);o&&s.remove(o);let c=this.startPath[this.startPath.length-1];if(i.length>0)if(c.text=i[0],i.length>1){let _=new Array(i.length-1),u=c;for(let h=1;h<i.length;h++)_[h-1]=new iM(i[h]);let g=this.startPath.length-2;for(;g>=0;){let h=this.startPath[g];_=h.insertAt(u,_),g--,u=h}let m=_.length;for(;m>0;){let h=new m6;h.add(this.lineIndex.root),_=h.insertAt(this.lineIndex.root,_),m=_.length,this.lineIndex.root=h}this.lineIndex.root.updateCounts()}else for(let _=this.startPath.length-2;_>=0;_--)this.startPath[_].updateCounts();else{this.startPath[this.startPath.length-2].remove(c);for(let u=this.startPath.length-2;u>=0;u--)this.startPath[u].updateCounts()}return this.lineIndex}post(e,t,n){n===this.lineCollectionAtBranch&&(this.state=4),this.stack.pop()}pre(e,t,n,i,s){let o=this.stack[this.stack.length-1];this.state===2&&s===1&&(this.state=1,this.branchNode=o,this.lineCollectionAtBranch=n);let c;function _(u){return u.isLeaf()?new iM(""):new m6}switch(s){case 0:this.goSubtree=!1,this.state!==4&&o.add(n);break;case 1:this.state===4?this.goSubtree=!1:(c=_(n),o.add(c),this.startPath.push(c));break;case 2:this.state!==4?(c=_(n),o.add(c),this.startPath.push(c)):n.isLeaf()||(c=_(n),o.add(c),this.endBranch.push(c));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:n.isLeaf()||(c=_(n),o.add(c),this.endBranch.push(c));break;case 5:this.goSubtree=!1,this.state!==1&&o.add(n);break}this.goSubtree&&this.stack.push(c)}leaf(e,t,n){this.state===1?this.initialText=n.text.substring(0,e):this.state===2?(this.initialText=n.text.substring(0,e),this.trailingText=n.text.substring(e+t)):this.trailingText=n.text.substring(e+t)}},Eet=class{constructor(e,t,n){this.pos=e,this.deleteLen=t,this.insertedText=n}getTextChangeRange(){return f3(Xl(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},e$=class XT{constructor(){this.changes=[],this.versions=new Array(XT.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%XT.maxVersions}currentVersionToIndex(){return this.currentVersion%XT.maxVersions}edit(t,n,i){this.changes.push(new Eet(t,n,i)),(this.changes.length>XT.changeNumberThreshold||n>XT.changeLengthThreshold||i&&i.length>XT.changeLengthThreshold)&&this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let t=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let n=t.index;for(let i of this.changes)n=n.edit(i.pos,i.deleteLen,i.insertedText);t=new Hwe(this.currentVersion+1,this,n,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=XT.maxVersions&&(this.minVersion=this.currentVersion-XT.maxVersions+1)}return t}getSnapshotVersion(){return this._getSnapshot().version}getAbsolutePositionAndLineText(t){return this._getSnapshot().index.lineNumberToInfo(t)}lineOffsetToPosition(t,n){return this._getSnapshot().index.absolutePositionOfStartOfLine(t)+(n-1)}positionToLineOffset(t){return this._getSnapshot().index.positionToLineOffset(t)}lineToTextSpan(t){let n=this._getSnapshot().index,{lineText:i,absolutePosition:s}=n.lineNumberToInfo(t+1),o=i!==void 0?i.length:n.absolutePositionOfStartOfLine(t+2)-s;return Xl(s,o)}getTextChangesBetweenVersions(t,n){if(t<n)if(t>=this.minVersion){let i=[];for(let s=t+1;s<=n;s++){let o=this.versions[this.versionToIndex(s)];for(let c of o.changesSincePreviousVersion)i.push(c.getTextChangeRange())}return gZ(i)}else return;else return A7}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){let n=new XT,i=new Hwe(0,n,new ZI);n.versions[n.currentVersion]=i;let s=ZI.linesFromText(t);return i.index.load(s.lines),n}};e$.changeNumberThreshold=8,e$.changeLengthThreshold=256,e$.maxVersions=8;var t$=e$,Hwe=class K5e{constructor(t,n,i,s=yl){this.version=t,this.cache=n,this.index=i,this.changesSincePreviousVersion=s}getText(t,n){return this.index.getText(t,n-t)}getLength(){return this.index.getLength()}getChangeRange(t){if(t instanceof K5e&&this.cache===t.cache)return this.version<=t.version?A7:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},ZI=class Cge{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(t){return this.lineNumberToInfo(t).absolutePosition}positionToLineOffset(t){let{oneBasedLine:n,zeroBasedColumn:i}=this.root.charOffsetToLineInfo(1,t);return{line:n,offset:i+1}}positionToColumnAndLineText(t){return this.root.charOffsetToLineInfo(1,t)}getLineCount(){return this.root.lineCount()}lineNumberToInfo(t){let n=this.getLineCount();if(t<=n){let{position:i,leaf:s}=this.root.lineNumberToInfo(t,0);return{absolutePosition:i,lineText:s&&s.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(t){if(t.length>0){let n=[];for(let i=0;i<t.length;i++)n[i]=new iM(t[i]);this.root=Cge.buildTreeFromBottom(n)}else this.root=new m6}walk(t,n,i){this.root.walk(t,n,i)}getText(t,n){let i="";return n>0&&t<this.root.charCount()&&this.walk(t,n,{goSubtree:!0,done:!1,leaf:(s,o,c)=>{i=i.concat(c.text.substring(s,s+o))}}),i}getLength(){return this.root.charCount()}every(t,n,i){i||(i=this.root.charCount());let s={goSubtree:!0,done:!1,leaf(o,c,_){t(_,o,c)||(this.done=!0)}};return this.walk(n,i-n,s),!s.done}edit(t,n,i){if(this.root.charCount()===0)return E.assert(n===0),i!==void 0?(this.load(Cge.linesFromText(i).lines),this):void 0;{let s;if(this.checkEdits){let _=this.getText(0,this.root.charCount());s=_.slice(0,t)+i+_.slice(t+n)}let o=new Cet,c=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;let _=this.getText(t,1);i?i=_+i:i=_,n=0,c=!0}else if(n>0){let _=t+n,{zeroBasedColumn:u,lineText:g}=this.positionToColumnAndLineText(_);u===0&&(n+=g.length,i=i?i+g:g)}if(this.root.walk(t,n,o),o.insertLines(i,c),this.checkEdits){let _=o.lineIndex.getText(0,o.lineIndex.getLength());E.assert(s===_,"buffer edit mismatch")}return o.lineIndex}}static buildTreeFromBottom(t){if(t.length<d6)return new m6(t);let n=new Array(Math.ceil(t.length/d6)),i=0;for(let s=0;s<n.length;s++){let o=Math.min(i+d6,t.length);n[s]=new m6(t.slice(i,o)),i=o}return this.buildTreeFromBottom(n)}static linesFromText(t){let n=cx(t);if(n.length===0)return{lines:[],lineMap:n};let i=new Array(n.length),s=n.length-1;for(let c=0;c<s;c++)i[c]=t.substring(n[c],n[c+1]);let o=t.substring(n[s]);return o.length>0?i[s]=o:i.pop(),{lines:i,lineMap:n}}},m6=class Ege{constructor(t=[]){this.children=t,this.totalChars=0,this.totalLines=0,t.length&&this.updateCounts()}isLeaf(){return!1}updateCounts(){this.totalChars=0,this.totalLines=0;for(let t of this.children)this.totalChars+=t.charCount(),this.totalLines+=t.lineCount()}execWalk(t,n,i,s,o){return i.pre&&i.pre(t,n,this.children[s],this,o),i.goSubtree?(this.children[s].walk(t,n,i),i.post&&i.post(t,n,this.children[s],this,o)):i.goSubtree=!0,i.done}skipChild(t,n,i,s,o){s.pre&&!s.done&&(s.pre(t,n,this.children[i],this,o),s.goSubtree=!0)}walk(t,n,i){if(this.children.length===0)return;let s=0,o=this.children[s].charCount(),c=t;for(;c>=o;)this.skipChild(c,n,s,i,0),c-=o,s++,o=this.children[s].charCount();if(c+n<=o){if(this.execWalk(c,n,i,s,2))return}else{if(this.execWalk(c,o-c,i,s,1))return;let _=n-(o-c);for(s++,o=this.children[s].charCount();_>o;){if(this.execWalk(0,o,i,s,3))return;_-=o,s++,o=this.children[s].charCount()}if(_>0&&this.execWalk(0,_,i,s,4))return}if(i.pre){let _=this.children.length;if(s<_-1)for(let u=s+1;u<_;u++)this.skipChild(0,0,u,i,5)}}charOffsetToLineInfo(t,n){if(this.children.length===0)return{oneBasedLine:t,zeroBasedColumn:n,lineText:void 0};for(let o of this.children){if(o.charCount()>n)return o.isLeaf()?{oneBasedLine:t,zeroBasedColumn:n,lineText:o.text}:o.charOffsetToLineInfo(t,n);n-=o.charCount(),t+=o.lineCount()}let i=this.lineCount();if(i===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};let s=E.checkDefined(this.lineNumberToInfo(i,0).leaf);return{oneBasedLine:i,zeroBasedColumn:s.charCount(),lineText:void 0}}lineNumberToInfo(t,n){for(let i of this.children){let s=i.lineCount();if(s>=t)return i.isLeaf()?{position:n,leaf:i}:i.lineNumberToInfo(t,n);t-=s,n+=i.charCount()}return{position:n,leaf:void 0}}splitAfter(t){let n,i=this.children.length;t++;let s=t;if(t<i){for(n=new Ege;t<i;)n.add(this.children[t]),t++;n.updateCounts()}return this.children.length=s,n}remove(t){let n=this.findChildIndex(t),i=this.children.length;if(n<i-1)for(let s=n;s<i-1;s++)this.children[s]=this.children[s+1];this.children.pop()}findChildIndex(t){let n=this.children.indexOf(t);return E.assert(n!==-1),n}insertAt(t,n){let i=this.findChildIndex(t),s=this.children.length,o=n.length;if(s<d6&&i===s-1&&o===1)return this.add(n[0]),this.updateCounts(),[];{let c=this.splitAfter(i),_=0;for(i++;i<d6&&_<o;)this.children[i]=n[_],i++,_++;let u=[],g=0;if(_<o){g=Math.ceil((o-_)/d6),u=new Array(g);let m=0;for(let S=0;S<g;S++)u[S]=new Ege;let h=u[0];for(;_<o;)h.add(n[_]),_++,h.children.length===d6&&(m++,h=u[m]);for(let S=u.length-1;S>=0;S--)u[S].children.length===0&&u.pop()}c&&u.push(c),this.updateCounts();for(let m=0;m<g;m++)u[m].updateCounts();return u}}add(t){this.children.push(t),E.assert(this.children.length<=d6)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},iM=class{constructor(e){this.text=e}isLeaf(){return!0}walk(e,t,n){n.leaf(e,t,this)}charCount(){return this.text.length}lineCount(){return 1}},Gwe=class eFe{constructor(t,n,i,s,o,c){this.telemetryEnabled=t,this.logger=n,this.host=i,this.globalTypingsCacheLocation=s,this.event=o,this.maxActiveRequestCount=c,this.activeRequestCount=0,this.requestQueue=Qw(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var n;return zg.validatePackageName(t)!==zg.NameValidationResult.Ok?!1:(this.requestedRegistry||(this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"})),!!((n=this.typesRegistryCache)!=null&&n.has(t)))}installPackage(t){this.packageInstallId++;let n={kind:"installPackage",...t,id:this.packageInstallId},i=new Promise((s,o)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:s,reject:o})});return this.installer.send(n),i}attach(t){this.projectService=t,this.installer=this.createInstallerProcess()}onProjectClosed(t){this.installer.send({projectName:t.getProjectName(),kind:"closeProject"})}enqueueInstallTypingsRequest(t,n,i){let s=j_e(t,n,i);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${vv(s)}`),this.activeRequestCount<this.maxActiveRequestCount?this.scheduleRequest(s):(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Deferring request for: ${s.projectName}`),this.requestQueue.enqueue(s),this.requestMap.set(s.projectName,s))}handleMessage(t){var n,i;switch(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Received response:${vv(t)}`),t.kind){case CV:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case qA:{let s=(n=this.packageInstalledPromise)==null?void 0:n.get(t.id);E.assertIsDefined(s,"Should find the promise for package install"),(i=this.packageInstalledPromise)==null||i.delete(t.id),t.success?s.resolve({successMessage:t.message}):s.reject(t.message),this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case Vse:{let s={message:t.message};this.event(s,"typesInstallerInitializationFailed");break}case EV:{let s={eventId:t.eventId,packages:t.packagesToInstall};this.event(s,"beginInstallTypes");break}case DV:{if(this.telemetryEnabled){let c={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(c,"telemetry")}let s={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(s,"endInstallTypes");break}case k9:{this.projectService.updateTypingsForProject(t);break}case x9:{for(this.activeRequestCount>0?this.activeRequestCount--:E.fail("TIAdapter:: Received too many responses");!this.requestQueue.isEmpty();){let s=this.requestQueue.dequeue();if(this.requestMap.get(s.projectName)===s){this.requestMap.delete(s.projectName),this.scheduleRequest(s);break}this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Skipping defunct request for: ${s.projectName}`)}this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case HA:this.projectService.watchTypingLocations(t);break;default:}}scheduleRequest(t){this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling request for: ${t.projectName}`),this.activeRequestCount++,this.host.setTimeout(()=>{this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Sending request:${vv(t)}`),this.installer.send(t)},eFe.requestDelayMillis,`${t.projectName}::${t.kind}`)}};Gwe.requestDelayMillis=100;var $we=Gwe,Xwe={};Oc(Xwe,{ActionInvalidate:()=>k9,ActionPackageInstalled:()=>qA,ActionSet:()=>x9,ActionWatchTypingLocations:()=>HA,Arguments:()=>PV,AutoImportProviderProject:()=>sfe,AuxiliaryProject:()=>nfe,CharRangeSection:()=>Afe,CloseFileWatcherEvent:()=>UG,CommandNames:()=>Owe,ConfigFileDiagEvent:()=>jG,ConfiguredProject:()=>afe,ConfiguredProjectLoadKind:()=>ffe,CreateDirectoryWatcherEvent:()=>WG,CreateFileWatcherEvent:()=>zG,Errors:()=>Ph,EventBeginInstallTypes:()=>EV,EventEndInstallTypes:()=>DV,EventInitializationFailed:()=>Vse,EventTypesRegistry:()=>CV,ExternalProject:()=>IG,GcTimer:()=>q_e,InferredProject:()=>rfe,LargeFileReferencedEvent:()=>RG,LineIndex:()=>ZI,LineLeaf:()=>iM,LineNode:()=>m6,LogLevel:()=>M_e,Msg:()=>R_e,OpenFileInfoTelemetryEvent:()=>ofe,Project:()=>Lk,ProjectInfoTelemetryEvent:()=>JG,ProjectKind:()=>ew,ProjectLanguageServiceStateEvent:()=>BG,ProjectLoadingFinishEvent:()=>MG,ProjectLoadingStartEvent:()=>LG,ProjectService:()=>Sfe,ProjectsUpdatedInBackgroundEvent:()=>tM,ScriptInfo:()=>X_e,ScriptVersionCache:()=>t$,Session:()=>Wwe,TextStorage:()=>$_e,ThrottledOperations:()=>V_e,TypingsInstallerAdapter:()=>$we,allFilesAreJsOrDts:()=>K_e,allRootFilesAreJsOrDts:()=>Z_e,asNormalizedPath:()=>awe,convertCompilerOptions:()=>rM,convertFormatOptions:()=>f6,convertScriptKindName:()=>qG,convertTypeAcquisition:()=>lfe,convertUserPreferences:()=>ufe,convertWatchOptions:()=>QI,countEachFileTypes:()=>HI,createInstallTypingsRequest:()=>j_e,createModuleSpecifierCache:()=>kfe,createNormalizedPathMap:()=>owe,createPackageJsonCache:()=>Cfe,createSortedArray:()=>U_e,emptyArray:()=>yl,findArgument:()=>o2e,formatDiagnosticToProtocol:()=>YI,formatMessage:()=>Efe,getBaseConfigFileName:()=>AG,getDetailWatchInfo:()=>XG,getLocationInNewDocument:()=>Nfe,hasArgument:()=>a2e,hasNoTypeScriptSource:()=>efe,indent:()=>kP,isBackgroundProject:()=>$I,isConfigFile:()=>Tfe,isConfiguredProject:()=>w0,isDynamicFileName:()=>KP,isExternalProject:()=>GI,isInferredProject:()=>Mk,isInferredProjectName:()=>B_e,isProjectDeferredClose:()=>XI,makeAutoImportProviderProjectName:()=>z_e,makeAuxiliaryProjectName:()=>W_e,makeInferredProjectName:()=>J_e,maxFileSize:()=>OG,maxProgramSizeForNonTsFiles:()=>FG,normalizedPathToPath:()=>_6,nowString:()=>c2e,nullCancellationToken:()=>Awe,nullTypingsInstaller:()=>nM,protocol:()=>H_e,scriptInfoIsContainedByBackgroundProject:()=>Q_e,scriptInfoIsContainedByDeferredClosedProject:()=>Y_e,stringifyIndented:()=>vv,toEvent:()=>Dfe,toNormalizedPath:()=>ro,tryConvertScriptKindName:()=>VG,typingsInstaller:()=>L_e,updateProjectIfDirty:()=>Wp}),typeof console<"u"&&(E.loggingHost={log(e,t){switch(e){case 1:return console.error(t);case 2:return console.warn(t);case 3:return console.log(t);case 4:return console.log(t)}}})})({get exports(){return G5e},set exports(Aa){G5e=Aa,typeof uQ<"u"&&uQ.exports&&(uQ.exports=Aa)}})});var nFe=q5e((odt,rFe)=>{rFe.exports=tFe()});var iFe={};xpt(iFe,{analyzeSyntax:()=>Ept});function Ept(Aa){let Gl=/\.tsx$/.test(Aa.path)?Tc.ScriptKind.TSX:/\.jsx$/.test(Aa.path)?Tc.ScriptKind.JSX:/\.[cm]?js$/.test(Aa.path)?Tc.ScriptKind.JS:Tc.ScriptKind.TS,bu=Tc.createSourceFile(Aa.path,Aa.source,Tc.ScriptTarget.Latest,!1,Gl),Bm={getSourceFile:$a=>$a===Aa.path?bu:void 0,getDefaultLibFileName:()=>"",writeFile:()=>{},getCurrentDirectory:()=>"",getCanonicalFileName:$a=>$a,useCaseSensitiveFileNames:()=>!0,getNewLine:()=>`
|
|
446
|
-
`,fileExists:$a=>$a===Aa.path,readFile:$a=>$a===Aa.path?Aa.source:void 0};if(Tc.createProgram([Aa.path],{noResolve:!0,noLib:!0},Bm).getSyntacticDiagnostics(bu).length>0)throw new SyntaxError;let Oc=[bu],qw=new Set,LR=new Set,o7=[],H2=0;for(;Oc.length>0;){if(++H2>2e4)throw new RangeError;let $a=Oc.pop();if($a===void 0)break;if(Aa.purpose==="declarations"){if($a.kind===Tc.SyntaxKind.JsxText){o7.push({start:$a.pos,end:$a.end});continue}let p_=[...Tc.getLeadingCommentRanges(Aa.source,$a.pos)??[],...Tc.getTrailingCommentRanges(Aa.source,$a.end)??[]];for(let Ve of p_)/^\/\/\s*tdd-cover:/.test(Aa.source.slice(Ve.pos,Ve.end))&&LR.add(Ve.pos);Oc.push(...$a.getChildren(bu));continue}if(Tc.isPropertyAccessExpression($a)&&Tc.isIdentifier($a.expression)){let p_=$a.expression.text;(["it","test","describe"].includes(p_)&&$a.name.text==="only"||["it","test"].includes(p_)&&$a.name.text==="skip")&&qw.add(bu.getLineAndCharacterOfPosition($a.getStart(bu)).line+1)}if(Tc.isCallExpression($a)||Tc.isTaggedTemplateExpression($a)){let p_=Tc.isCallExpression($a)?$a.expression:$a.tag;for(;Tc.isPropertyAccessExpression(p_)||Tc.isElementAccessExpression(p_)||Tc.isParenthesizedExpression(p_)||Tc.isAsExpression(p_)||Tc.isTypeAssertionExpression(p_)||Tc.isNonNullExpression(p_)||Tc.isSatisfiesExpression(p_);){if(++H2>2e4)throw new RangeError;p_=p_.expression}Tc.isIdentifier(p_)&&["xit","xdescribe"].includes(p_.text)&&qw.add(bu.getLineAndCharacterOfPosition($a.getStart(bu)).line+1)}Tc.forEachChild($a,p_=>{Oc.push(p_)})}for(let $a of LR)o7.some(p_=>$a>=p_.start&&$a<p_.end)||qw.add(bu.getLineAndCharacterOfPosition($a).line+1);return{lines:[...qw].sort(($a,p_)=>$a-p_)}}var Tc,sFe=Tpt(()=>{"use strict";Tc=Cpt(nFe(),1)});var aFe=require("node:fs");function H5e(Aa){if(!(!Aa||typeof Aa!="object")&&!(!("version"in Aa)||Aa.version!==1||!("path"in Aa)||typeof Aa.path!="string"||Aa.path.length>4096||!("source"in Aa)||typeof Aa.source!="string"||!("purpose"in Aa)||Aa.purpose!=="focused-tests"&&Aa.purpose!=="declarations"))return{path:Aa.path,source:Aa.source,purpose:Aa.purpose}}async function Dpt(){let Aa=Buffer.alloc(425984),Gl=0;try{for(;Gl<Aa.length;){let Bm=(0,aFe.readSync)(0,Aa,{offset:Gl,length:Aa.length-Gl});if(Bm===0)break;Gl+=Bm}if(Gl===Aa.length)return{version:1,kind:"invalid-request"};let bu=H5e(JSON.parse(Aa.toString("utf8",0,Gl)));if(bu===void 0||Buffer.byteLength(bu.source)>65536)return{version:1,kind:"invalid-request"};try{let{analyzeSyntax:Bm}=await Promise.resolve().then(()=>(sFe(),iFe));return{version:1,kind:"inspected",...Bm(bu)}}catch(Bm){return{version:1,kind:Bm instanceof SyntaxError?"invalid-source":Bm instanceof RangeError?"limit":"unavailable"}}}catch{return{version:1,kind:"invalid-request"}}}Dpt().then(Aa=>{process.stdout.write(JSON.stringify(Aa))});
|
|
446
|
+
`,fileExists:$a=>$a===Aa.path,readFile:$a=>$a===Aa.path?Aa.source:void 0};if(Tc.createProgram([Aa.path],{noResolve:!0,noLib:!0},Bm).getSyntacticDiagnostics(bu).length>0)throw new SyntaxError;let Oc=[bu],qw=new Set,LR=new Set,o7=[],H2=0;for(;Oc.length>0;){if(++H2>2e4)throw new RangeError;let $a=Oc.pop();if($a===void 0)break;if(Aa.purpose==="declarations"){if($a.kind===Tc.SyntaxKind.JsxText){o7.push({start:$a.pos,end:$a.end});continue}let p_=[...Tc.getLeadingCommentRanges(Aa.source,$a.pos)??[],...Tc.getTrailingCommentRanges(Aa.source,$a.end)??[]];for(let Ve of p_)/^\/\/\s*tdd-cover:/.test(Aa.source.slice(Ve.pos,Ve.end))&&LR.add(Ve.pos);Oc.push(...$a.getChildren(bu));continue}if(Tc.isPropertyAccessExpression($a)&&Tc.isIdentifier($a.expression)){let p_=$a.expression.text;(["it","test","describe"].includes(p_)&&$a.name.text==="only"||["it","test","describe"].includes(p_)&&$a.name.text==="skip")&&qw.add(bu.getLineAndCharacterOfPosition($a.getStart(bu)).line+1)}if(Tc.isCallExpression($a)||Tc.isTaggedTemplateExpression($a)){let p_=Tc.isCallExpression($a)?$a.expression:$a.tag;for(;Tc.isPropertyAccessExpression(p_)||Tc.isElementAccessExpression(p_)||Tc.isParenthesizedExpression(p_)||Tc.isAsExpression(p_)||Tc.isTypeAssertionExpression(p_)||Tc.isNonNullExpression(p_)||Tc.isSatisfiesExpression(p_);){if(++H2>2e4)throw new RangeError;p_=p_.expression}Tc.isIdentifier(p_)&&["xit","xdescribe","fit","fdescribe"].includes(p_.text)&&qw.add(bu.getLineAndCharacterOfPosition($a.getStart(bu)).line+1)}Tc.forEachChild($a,p_=>{Oc.push(p_)})}for(let $a of LR)o7.some(p_=>$a>=p_.start&&$a<p_.end)||qw.add(bu.getLineAndCharacterOfPosition($a).line+1);return{lines:[...qw].sort(($a,p_)=>$a-p_)}}var Tc,sFe=Tpt(()=>{"use strict";Tc=Cpt(nFe(),1)});var aFe=require("node:fs");function H5e(Aa){if(!(!Aa||typeof Aa!="object")&&!(!("version"in Aa)||Aa.version!==1||!("path"in Aa)||typeof Aa.path!="string"||Aa.path.length>4096||!("source"in Aa)||typeof Aa.source!="string"||!("purpose"in Aa)||Aa.purpose!=="focused-tests"&&Aa.purpose!=="declarations"))return{path:Aa.path,source:Aa.source,purpose:Aa.purpose}}async function Dpt(){let Aa=Buffer.alloc(425984),Gl=0;try{for(;Gl<Aa.length;){let Bm=(0,aFe.readSync)(0,Aa,{offset:Gl,length:Aa.length-Gl});if(Bm===0)break;Gl+=Bm}if(Gl===Aa.length)return{version:1,kind:"invalid-request"};let bu=H5e(JSON.parse(Aa.toString("utf8",0,Gl)));if(bu===void 0||Buffer.byteLength(bu.source)>65536)return{version:1,kind:"invalid-request"};try{let{analyzeSyntax:Bm}=await Promise.resolve().then(()=>(sFe(),iFe));return{version:1,kind:"inspected",...Bm(bu)}}catch(Bm){return{version:1,kind:Bm instanceof SyntaxError?"invalid-source":Bm instanceof RangeError?"limit":"unavailable"}}}catch{return{version:1,kind:"invalid-request"}}}Dpt().then(Aa=>{process.stdout.write(JSON.stringify(Aa))});
|
|
447
447
|
/*! TypeScript (Apache-2.0)
|
|
448
448
|
Apache License
|
|
449
449
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// syntax-worker: {"sha256":"
|
|
1
|
+
// syntax-worker: {"sha256":"462f4c488e85f6e104338e09b283bb934a84442f26c40102ec268eeb89c12ffe","bytes":3588428}
|
|
2
2
|
import { createRequire as createNodeRequire } from 'node:module'; const require = createNodeRequire(import.meta.url);
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -52,7 +52,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
52
52
|
var define_VOID_SYNTAX_WORKER_IDENTITY_default;
|
|
53
53
|
var init_define_VOID_SYNTAX_WORKER_IDENTITY = __esm({
|
|
54
54
|
"<define:__VOID_SYNTAX_WORKER_IDENTITY__>"() {
|
|
55
|
-
define_VOID_SYNTAX_WORKER_IDENTITY_default = { sha256: "
|
|
55
|
+
define_VOID_SYNTAX_WORKER_IDENTITY_default = { sha256: "462f4c488e85f6e104338e09b283bb934a84442f26c40102ec268eeb89c12ffe", bytes: 3588428 };
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
|
|
@@ -7842,7 +7842,7 @@ function noConsole(edits, projectRoot2) {
|
|
|
7842
7842
|
}
|
|
7843
7843
|
|
|
7844
7844
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
7845
|
-
var FOCUSED = /\b(?:it|test|describe)\.only\b|\b(?:it|test)\.skip\b|\b(?:xit|xdescribe)\b/;
|
|
7845
|
+
var FOCUSED = /\b(?:it|test|describe)\.only\b|\b(?:it|test|describe)\.skip\b|\b(?:xit|xdescribe|fit|fdescribe)\b/;
|
|
7846
7846
|
function noFocusedTest(edits) {
|
|
7847
7847
|
return evidenceVerdict(
|
|
7848
7848
|
"FOCUSED_OR_SKIPPED_TEST",
|
|
@@ -8406,7 +8406,7 @@ import { readFileSync as readFileSync4, statSync } from "node:fs";
|
|
|
8406
8406
|
import { fileURLToPath } from "node:url";
|
|
8407
8407
|
|
|
8408
8408
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
8409
|
-
var SYNTAX_WORKER_IDENTITY = { "sha256": "
|
|
8409
|
+
var SYNTAX_WORKER_IDENTITY = { "sha256": "462f4c488e85f6e104338e09b283bb934a84442f26c40102ec268eeb89c12ffe", "bytes": 3588428 };
|
|
8410
8410
|
|
|
8411
8411
|
function runSyntaxWorker(root, input, remainingMs) {
|
|
8412
8412
|
const started = performance.now();
|
|
@@ -8746,8 +8746,8 @@ function focusedVerdict(root, edits, raw, syntaxInspector) {
|
|
|
8746
8746
|
edit.path,
|
|
8747
8747
|
"provide an exact supported Edit/patch or a complete Write within 64 KiB"
|
|
8748
8748
|
);
|
|
8749
|
-
if (!/\b(?:only|skip|xit|xdescribe)\b|\\u/.test(proposed.content)) continue;
|
|
8750
|
-
if (/^[ \t]*(?:(?:it|test|describe)\.only|(?:it|test)\.skip|xit|xdescribe)[ \t]*\(/.test(proposed.content)) {
|
|
8749
|
+
if (!/\b(?:only|skip|xit|xdescribe|fit|fdescribe)\b|\\u/.test(proposed.content)) continue;
|
|
8750
|
+
if (/^[ \t]*(?:(?:it|test|describe)\.only|(?:it|test|describe)\.skip|xit|xdescribe|fit|fdescribe)[ \t]*\(/.test(proposed.content)) {
|
|
8751
8751
|
return noFocusedTest([{ path: edit.path, addedContent: proposed.content.split("\n")[0] ?? "" }]);
|
|
8752
8752
|
}
|
|
8753
8753
|
const verdict = syntaxInspector(root, edit.path, proposed.content, deadline - performance.now());
|
|
@@ -15099,6 +15099,8 @@ function replayEventLog(text3) {
|
|
|
15099
15099
|
|
|
15100
15100
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
15101
15101
|
|
|
15102
|
+
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
15103
|
+
|
|
15102
15104
|
var MAX_EVENT_LOG_BYTES = 8 * 1024 * 1024;
|
|
15103
15105
|
var MISSION_ID3 = /^mis_[A-Za-z0-9_-]{8,100}$/;
|
|
15104
15106
|
var EVENT_ID2 = /^evt_[A-Za-z0-9_-]{8,100}$/;
|
|
@@ -1,90 +1,47 @@
|
|
|
1
1
|
# `tdd-guard` hook
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
## Pure-deletion bypass
|
|
50
|
-
|
|
51
|
-
If the staged diff for the file contains only deletions (no `+` non-marker lines), the hook allows. Pure deletion does not require a new failing test.
|
|
52
|
-
|
|
53
|
-
## Override
|
|
54
|
-
|
|
55
|
-
- Per-file: add `// tdd-mode: exploratory` (or `strict` / `souple`) at the top of the file.
|
|
56
|
-
- Per-repo: set `.void/config.json` `modes.tdd` to `strict` / `souple` / `exploratory`.
|
|
57
|
-
- Per-session: set env `VOIDCORP_MODE_TDD=souple` (not yet wired — open question).
|
|
58
|
-
|
|
59
|
-
## Inputs (env vars set by the runner)
|
|
60
|
-
|
|
61
|
-
- `VOIDCORP_HOOK_FILE` — absolute path of the file
|
|
62
|
-
- `VOIDCORP_HOOK_TOOL` — `Edit` / `Write`
|
|
63
|
-
- `VOIDCORP_HOOK_PHASE` — `pre` / `post` (this hook only runs on `pre`)
|
|
64
|
-
- `VOIDCORP_HOOK_DIFF` — optional, the staged diff content
|
|
65
|
-
- `VOIDCORP_CONFIG` — optional, defaults to `.void/config.json`
|
|
66
|
-
|
|
67
|
-
## Exit codes
|
|
68
|
-
|
|
69
|
-
- `0` — allow
|
|
70
|
-
- `1` — block (message on stderr)
|
|
71
|
-
- `2` — warn (allow, message on stderr)
|
|
72
|
-
|
|
73
|
-
## Test fixtures (for `test/tdd-guard/`)
|
|
74
|
-
|
|
75
|
-
The skill test suite must cover at least:
|
|
76
|
-
|
|
77
|
-
- `strict` mode + production edit without sibling test → block
|
|
78
|
-
- `strict` mode + production edit WITH sibling test in same staged set → allow
|
|
79
|
-
- `souple` mode + production edit without sibling test → warn
|
|
80
|
-
- `exploratory` mode + any edit → allow
|
|
81
|
-
- Each of the 10 bypasses → allow
|
|
82
|
-
- Pure deletion → allow
|
|
83
|
-
- Override marker `// tdd-mode: exploratory` in file → allow
|
|
84
|
-
|
|
85
|
-
## Open questions
|
|
86
|
-
|
|
87
|
-
- Per-session env override (`VOIDCORP_MODE_TDD`) — wire it up in the hook or rely on `.void/config.json` only? Lean wire (faster iteration during work).
|
|
88
|
-
- Glob matching for `paths.business` — current `case` statement is shell glob, fine for simple patterns but not full minimatch. Defer until a consumer needs `**` patterns more complex than `apps/*/src/**`.
|
|
89
|
-
- Auto-detection of the test runner (vitest vs jest) for the sibling-test naming convention. Currently assumes `.test.ts(x)`. Make configurable in Phase D.
|
|
90
|
-
- Performance — `git diff --cached --name-only` runs every edit. Cache for the duration of a session? Defer; measure first.
|
|
3
|
+
The native PreToolUse manifests invoke the shared Node `tdd-order` rule for
|
|
4
|
+
supported structured writes. `tdd-guard.sh` is its compatibility adapter.
|
|
5
|
+
`packages/hook-runner/src/rules/tdd-order.ts` owns the structural rule and
|
|
6
|
+
`enforcement/runner.ts` resolves the proposed file and evidence.
|
|
7
|
+
|
|
8
|
+
This floor checks that a governed production file has an existing sibling test,
|
|
9
|
+
or a valid first-line `// tdd-cover: e2e <project-relative spec>` declaration pointing
|
|
10
|
+
to an existing test inside the project. It does **not** run that test, require a
|
|
11
|
+
staged test modification, assess behavior coverage, or prove an observed RED.
|
|
12
|
+
`void-tdd` and `void-debug` own the observed RED-before-fix/GREEN evidence.
|
|
13
|
+
|
|
14
|
+
## Configuration and scope
|
|
15
|
+
|
|
16
|
+
The rule reads `.void/config.json`: `modes.tdd`, `paths.business` and `paths.spikes`.
|
|
17
|
+
The default business glob is `apps/*/src/**`; the default spike glob is
|
|
18
|
+
`apps/*/scripts/spike-*`. The first five existing lines may declare
|
|
19
|
+
`// tdd-mode: strict`, `souple` or `exploratory`.
|
|
20
|
+
|
|
21
|
+
- `auto` and `strict` refuse a governed write with no test evidence.
|
|
22
|
+
- `souple` allows it with a warning.
|
|
23
|
+
- `exploratory` allows it.
|
|
24
|
+
|
|
25
|
+
Only the supported JS/TS production paths inside business globs are governed.
|
|
26
|
+
The owning rule excludes test/declaration files, docs, fixtures, seeds, migrations,
|
|
27
|
+
codemods, generated paths and configured spikes. This is a path floor, not a
|
|
28
|
+
semantic classifier of all configuration or generated code.
|
|
29
|
+
|
|
30
|
+
A complete file deletion is exempt. A deletion-only edit to a surviving file is
|
|
31
|
+
still checked. A module containing only re-exports is exempt only when both the
|
|
32
|
+
original and complete proposed source meet that condition. Adding behavior removes
|
|
33
|
+
the exemption. Unresolvable evidence on a governed file is refused, not guessed.
|
|
34
|
+
|
|
35
|
+
## Runtime results
|
|
36
|
+
|
|
37
|
+
The rule returns a verdict. Runtime adapters translate a refusal into Claude's
|
|
38
|
+
blocking exit 2 or Codex's native deny response; warning and allow are successful
|
|
39
|
+
responses. There are no `VOIDCORP_HOOK_FILE`, staged-diff or per-session TDD env
|
|
40
|
+
inputs to this native contract. Configured does not mean invoked: the runtime must
|
|
41
|
+
load and trust its hooks. Shell writes do not provide this test-content guarantee.
|
|
42
|
+
|
|
43
|
+
## Proof
|
|
44
|
+
|
|
45
|
+
The rule and enforcement tests cover sibling/declaration existence, modes,
|
|
46
|
+
re-export detection, path escapes, deletion-only edits and unsupported evidence.
|
|
47
|
+
Behavioral RED/GREEN for the changed application remains a separate required proof.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# viewport-screenshot-gate —
|
|
2
|
+
# viewport-screenshot-gate — optional PR-text advisory (not installed in native manifests)
|
|
3
3
|
#
|
|
4
|
-
#
|
|
4
|
+
# Reports if PR text for UI changes lacks mobile and desktop capture references
|
|
5
5
|
# in the PR body. Composed with the `accessibility` and
|
|
6
6
|
# `frontend-design` skills (mobile-first dual-quality invariant).
|
|
7
7
|
#
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# "no-ui-change: <reason>" in the body for non-UI PRs that happen to
|
|
14
14
|
# touch tsx files.
|
|
15
15
|
#
|
|
16
|
-
# Exit
|
|
16
|
+
# No image validation. Missing PR/base is skipped. Exit 0 no finding, 2 advisory finding.
|
|
17
17
|
|
|
18
18
|
set -euo pipefail
|
|
19
19
|
|