tribunal-kit 5.8.1 → 5.8.2
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/.agent/history/memory/.memory.idx +305 -1
- package/.agent/history/memory/MEMORY.md +21 -1
- package/.agent/scripts/signal_detector.js +173 -0
- package/.agent/scripts/skill_evolution.js +298 -53
- package/CONTRIBUTING.md +134 -0
- package/SECURITY.md +52 -0
- package/bin/tribunal-kit.js +92 -46
- package/dist/commands/init.js +68 -30
- package/dist/esm/index.mjs +116 -0
- package/dist/index.d.ts +288 -0
- package/dist/utils/helpers.js +21 -9
- package/package.json +20 -8
|
@@ -1687,7 +1687,311 @@
|
|
|
1687
1687
|
"token_estimate": 18,
|
|
1688
1688
|
"source": "manual",
|
|
1689
1689
|
"session_id": null
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
"id": 112,
|
|
1693
|
+
"memory_type": "semantic",
|
|
1694
|
+
"content": "❌ Overriding project idioms without explicit justification -> ✅ Idioms represent team decisions; flag deviations with reasoning",
|
|
1695
|
+
"tags": [
|
|
1696
|
+
"project-idiom",
|
|
1697
|
+
"auto-learned"
|
|
1698
|
+
],
|
|
1699
|
+
"created_at": "1783790009Z",
|
|
1700
|
+
"last_accessed": "1783790009Z",
|
|
1701
|
+
"access_count": 0,
|
|
1702
|
+
"token_estimate": 32,
|
|
1703
|
+
"source": "manual",
|
|
1704
|
+
"session_id": null
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
"id": 113,
|
|
1708
|
+
"memory_type": "semantic",
|
|
1709
|
+
"content": "❌ Applying idioms from one project to a different project -> ✅ Idioms are project-specific; verify they apply to the current codebase",
|
|
1710
|
+
"tags": [
|
|
1711
|
+
"project-idiom",
|
|
1712
|
+
"auto-learned"
|
|
1713
|
+
],
|
|
1714
|
+
"created_at": "1783790009Z",
|
|
1715
|
+
"last_accessed": "1783790009Z",
|
|
1716
|
+
"access_count": 0,
|
|
1717
|
+
"token_estimate": 34,
|
|
1718
|
+
"source": "manual",
|
|
1719
|
+
"session_id": null
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
"id": 114,
|
|
1723
|
+
"memory_type": "semantic",
|
|
1724
|
+
"content": "❌ **Forbidden:** Declaring a task complete because the output \"looks correct.\"",
|
|
1725
|
+
"tags": [
|
|
1726
|
+
"project-idiom",
|
|
1727
|
+
"auto-learned"
|
|
1728
|
+
],
|
|
1729
|
+
"created_at": "1783790009Z",
|
|
1730
|
+
"last_accessed": "1783790009Z",
|
|
1731
|
+
"access_count": 0,
|
|
1732
|
+
"token_estimate": 20,
|
|
1733
|
+
"source": "manual",
|
|
1734
|
+
"session_id": null
|
|
1735
|
+
},
|
|
1736
|
+
{
|
|
1737
|
+
"id": 115,
|
|
1738
|
+
"memory_type": "semantic",
|
|
1739
|
+
"content": "✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.",
|
|
1740
|
+
"tags": [
|
|
1741
|
+
"project-idiom",
|
|
1742
|
+
"auto-learned"
|
|
1743
|
+
],
|
|
1744
|
+
"created_at": "1783790009Z",
|
|
1745
|
+
"last_accessed": "1783790009Z",
|
|
1746
|
+
"access_count": 0,
|
|
1747
|
+
"token_estimate": 54,
|
|
1748
|
+
"source": "manual",
|
|
1749
|
+
"session_id": null
|
|
1750
|
+
},
|
|
1751
|
+
{
|
|
1752
|
+
"id": 116,
|
|
1753
|
+
"memory_type": "semantic",
|
|
1754
|
+
"content": "[ ] Have I reviewed the user's specific constraints and requests?",
|
|
1755
|
+
"tags": [
|
|
1756
|
+
"project-idiom",
|
|
1757
|
+
"auto-learned"
|
|
1758
|
+
],
|
|
1759
|
+
"created_at": "1783790009Z",
|
|
1760
|
+
"last_accessed": "1783790009Z",
|
|
1761
|
+
"access_count": 0,
|
|
1762
|
+
"token_estimate": 17,
|
|
1763
|
+
"source": "manual",
|
|
1764
|
+
"session_id": null
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
"id": 117,
|
|
1768
|
+
"memory_type": "semantic",
|
|
1769
|
+
"content": "[ ] Have I checked the environment for relevant existing implementations?",
|
|
1770
|
+
"tags": [
|
|
1771
|
+
"project-idiom",
|
|
1772
|
+
"auto-learned"
|
|
1773
|
+
],
|
|
1774
|
+
"created_at": "1783790009Z",
|
|
1775
|
+
"last_accessed": "1783790009Z",
|
|
1776
|
+
"access_count": 0,
|
|
1777
|
+
"token_estimate": 19,
|
|
1778
|
+
"source": "manual",
|
|
1779
|
+
"session_id": null
|
|
1780
|
+
},
|
|
1781
|
+
{
|
|
1782
|
+
"id": 118,
|
|
1783
|
+
"memory_type": "semantic",
|
|
1784
|
+
"content": "❌ **Forbidden:** Declaring a task complete because the output \"looks correct.\"",
|
|
1785
|
+
"tags": [
|
|
1786
|
+
"project-idiom",
|
|
1787
|
+
"auto-learned"
|
|
1788
|
+
],
|
|
1789
|
+
"created_at": "1783790009Z",
|
|
1790
|
+
"last_accessed": "1783790009Z",
|
|
1791
|
+
"access_count": 0,
|
|
1792
|
+
"token_estimate": 20,
|
|
1793
|
+
"source": "manual",
|
|
1794
|
+
"session_id": null
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
"id": 119,
|
|
1798
|
+
"memory_type": "semantic",
|
|
1799
|
+
"content": "✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.",
|
|
1800
|
+
"tags": [
|
|
1801
|
+
"project-idiom",
|
|
1802
|
+
"auto-learned"
|
|
1803
|
+
],
|
|
1804
|
+
"created_at": "1783790009Z",
|
|
1805
|
+
"last_accessed": "1783790009Z",
|
|
1806
|
+
"access_count": 0,
|
|
1807
|
+
"token_estimate": 54,
|
|
1808
|
+
"source": "manual",
|
|
1809
|
+
"session_id": null
|
|
1810
|
+
},
|
|
1811
|
+
{
|
|
1812
|
+
"id": 120,
|
|
1813
|
+
"memory_type": "procedural",
|
|
1814
|
+
"content": "Run `echo 'No build step required for this project'` to build the project",
|
|
1815
|
+
"tags": [
|
|
1816
|
+
"build-script",
|
|
1817
|
+
"build",
|
|
1818
|
+
"auto-learned"
|
|
1819
|
+
],
|
|
1820
|
+
"created_at": "1783790009Z",
|
|
1821
|
+
"last_accessed": "1783790009Z",
|
|
1822
|
+
"access_count": 0,
|
|
1823
|
+
"token_estimate": 19,
|
|
1824
|
+
"source": "manual",
|
|
1825
|
+
"session_id": null
|
|
1826
|
+
},
|
|
1827
|
+
{
|
|
1828
|
+
"id": 121,
|
|
1829
|
+
"memory_type": "procedural",
|
|
1830
|
+
"content": "Run `npm run validate-payload && jest --coverage` to test the project",
|
|
1831
|
+
"tags": [
|
|
1832
|
+
"build-script",
|
|
1833
|
+
"test",
|
|
1834
|
+
"auto-learned"
|
|
1835
|
+
],
|
|
1836
|
+
"created_at": "1783790009Z",
|
|
1837
|
+
"last_accessed": "1783790009Z",
|
|
1838
|
+
"access_count": 0,
|
|
1839
|
+
"token_estimate": 18,
|
|
1840
|
+
"source": "manual",
|
|
1841
|
+
"session_id": null
|
|
1842
|
+
},
|
|
1843
|
+
{
|
|
1844
|
+
"id": 122,
|
|
1845
|
+
"memory_type": "semantic",
|
|
1846
|
+
"content": "❌ Overriding project idioms without explicit justification -> ✅ Idioms represent team decisions; flag deviations with reasoning",
|
|
1847
|
+
"tags": [
|
|
1848
|
+
"project-idiom",
|
|
1849
|
+
"auto-learned"
|
|
1850
|
+
],
|
|
1851
|
+
"created_at": "1784187808Z",
|
|
1852
|
+
"last_accessed": "1784187808Z",
|
|
1853
|
+
"access_count": 0,
|
|
1854
|
+
"token_estimate": 32,
|
|
1855
|
+
"source": "manual",
|
|
1856
|
+
"session_id": null
|
|
1857
|
+
},
|
|
1858
|
+
{
|
|
1859
|
+
"id": 123,
|
|
1860
|
+
"memory_type": "semantic",
|
|
1861
|
+
"content": "❌ Applying idioms from one project to a different project -> ✅ Idioms are project-specific; verify they apply to the current codebase",
|
|
1862
|
+
"tags": [
|
|
1863
|
+
"project-idiom",
|
|
1864
|
+
"auto-learned"
|
|
1865
|
+
],
|
|
1866
|
+
"created_at": "1784187808Z",
|
|
1867
|
+
"last_accessed": "1784187808Z",
|
|
1868
|
+
"access_count": 0,
|
|
1869
|
+
"token_estimate": 34,
|
|
1870
|
+
"source": "manual",
|
|
1871
|
+
"session_id": null
|
|
1872
|
+
},
|
|
1873
|
+
{
|
|
1874
|
+
"id": 124,
|
|
1875
|
+
"memory_type": "semantic",
|
|
1876
|
+
"content": "❌ **Forbidden:** Declaring a task complete because the output \"looks correct.\"",
|
|
1877
|
+
"tags": [
|
|
1878
|
+
"project-idiom",
|
|
1879
|
+
"auto-learned"
|
|
1880
|
+
],
|
|
1881
|
+
"created_at": "1784187808Z",
|
|
1882
|
+
"last_accessed": "1784187808Z",
|
|
1883
|
+
"access_count": 0,
|
|
1884
|
+
"token_estimate": 20,
|
|
1885
|
+
"source": "manual",
|
|
1886
|
+
"session_id": null
|
|
1887
|
+
},
|
|
1888
|
+
{
|
|
1889
|
+
"id": 125,
|
|
1890
|
+
"memory_type": "semantic",
|
|
1891
|
+
"content": "✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.",
|
|
1892
|
+
"tags": [
|
|
1893
|
+
"project-idiom",
|
|
1894
|
+
"auto-learned"
|
|
1895
|
+
],
|
|
1896
|
+
"created_at": "1784187808Z",
|
|
1897
|
+
"last_accessed": "1784187808Z",
|
|
1898
|
+
"access_count": 0,
|
|
1899
|
+
"token_estimate": 54,
|
|
1900
|
+
"source": "manual",
|
|
1901
|
+
"session_id": null
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
"id": 126,
|
|
1905
|
+
"memory_type": "semantic",
|
|
1906
|
+
"content": "[ ] Have I reviewed the user's specific constraints and requests?",
|
|
1907
|
+
"tags": [
|
|
1908
|
+
"project-idiom",
|
|
1909
|
+
"auto-learned"
|
|
1910
|
+
],
|
|
1911
|
+
"created_at": "1784187808Z",
|
|
1912
|
+
"last_accessed": "1784187808Z",
|
|
1913
|
+
"access_count": 0,
|
|
1914
|
+
"token_estimate": 17,
|
|
1915
|
+
"source": "manual",
|
|
1916
|
+
"session_id": null
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
"id": 127,
|
|
1920
|
+
"memory_type": "semantic",
|
|
1921
|
+
"content": "[ ] Have I checked the environment for relevant existing implementations?",
|
|
1922
|
+
"tags": [
|
|
1923
|
+
"project-idiom",
|
|
1924
|
+
"auto-learned"
|
|
1925
|
+
],
|
|
1926
|
+
"created_at": "1784187808Z",
|
|
1927
|
+
"last_accessed": "1784187808Z",
|
|
1928
|
+
"access_count": 0,
|
|
1929
|
+
"token_estimate": 19,
|
|
1930
|
+
"source": "manual",
|
|
1931
|
+
"session_id": null
|
|
1932
|
+
},
|
|
1933
|
+
{
|
|
1934
|
+
"id": 128,
|
|
1935
|
+
"memory_type": "semantic",
|
|
1936
|
+
"content": "❌ **Forbidden:** Declaring a task complete because the output \"looks correct.\"",
|
|
1937
|
+
"tags": [
|
|
1938
|
+
"project-idiom",
|
|
1939
|
+
"auto-learned"
|
|
1940
|
+
],
|
|
1941
|
+
"created_at": "1784187808Z",
|
|
1942
|
+
"last_accessed": "1784187808Z",
|
|
1943
|
+
"access_count": 0,
|
|
1944
|
+
"token_estimate": 20,
|
|
1945
|
+
"source": "manual",
|
|
1946
|
+
"session_id": null
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
"id": 129,
|
|
1950
|
+
"memory_type": "semantic",
|
|
1951
|
+
"content": "✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.",
|
|
1952
|
+
"tags": [
|
|
1953
|
+
"project-idiom",
|
|
1954
|
+
"auto-learned"
|
|
1955
|
+
],
|
|
1956
|
+
"created_at": "1784187808Z",
|
|
1957
|
+
"last_accessed": "1784187808Z",
|
|
1958
|
+
"access_count": 0,
|
|
1959
|
+
"token_estimate": 54,
|
|
1960
|
+
"source": "manual",
|
|
1961
|
+
"session_id": null
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
"id": 130,
|
|
1965
|
+
"memory_type": "procedural",
|
|
1966
|
+
"content": "Run `echo 'No build step required for this project'` to build the project",
|
|
1967
|
+
"tags": [
|
|
1968
|
+
"build-script",
|
|
1969
|
+
"build",
|
|
1970
|
+
"auto-learned"
|
|
1971
|
+
],
|
|
1972
|
+
"created_at": "1784187808Z",
|
|
1973
|
+
"last_accessed": "1784187808Z",
|
|
1974
|
+
"access_count": 0,
|
|
1975
|
+
"token_estimate": 19,
|
|
1976
|
+
"source": "manual",
|
|
1977
|
+
"session_id": null
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
"id": 131,
|
|
1981
|
+
"memory_type": "procedural",
|
|
1982
|
+
"content": "Run `npm run validate-payload && jest --coverage` to test the project",
|
|
1983
|
+
"tags": [
|
|
1984
|
+
"build-script",
|
|
1985
|
+
"test",
|
|
1986
|
+
"auto-learned"
|
|
1987
|
+
],
|
|
1988
|
+
"created_at": "1784187808Z",
|
|
1989
|
+
"last_accessed": "1784187808Z",
|
|
1990
|
+
"access_count": 0,
|
|
1991
|
+
"token_estimate": 18,
|
|
1992
|
+
"source": "manual",
|
|
1993
|
+
"session_id": null
|
|
1690
1994
|
}
|
|
1691
1995
|
],
|
|
1692
|
-
"next_id":
|
|
1996
|
+
"next_id": 132
|
|
1693
1997
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🧠 Tribunal Memory Index
|
|
2
2
|
> Auto-generated by `tribunal-kit memory export`. Do not edit manually.
|
|
3
|
-
> Entries:
|
|
3
|
+
> Entries: 131 | Semantic: 105 | Procedural: 26 | Episodic: 0 | Working: 0
|
|
4
4
|
|
|
5
5
|
## SEMANTIC (Permanent Facts)
|
|
6
6
|
| ID | Content | Tags | Source | Created |
|
|
@@ -94,6 +94,22 @@
|
|
|
94
94
|
| 107 | [ ] Have I checked the environment for relevant existing implementations? | project-idiom, auto-learned | manual | 1783785670Z |
|
|
95
95
|
| 108 | ❌ **Forbidden:** Declaring a task complete because the output "looks correct." | project-idiom, auto-learned | manual | 1783785670Z |
|
|
96
96
|
| 109 | ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended. | project-idiom, auto-learned | manual | 1783785670Z |
|
|
97
|
+
| 112 | ❌ Overriding project idioms without explicit justification -> ✅ Idioms represent team decisions; flag deviations with reasoning | project-idiom, auto-learned | manual | 1783790009Z |
|
|
98
|
+
| 113 | ❌ Applying idioms from one project to a different project -> ✅ Idioms are project-specific; verify they apply to the current codebase | project-idiom, auto-learned | manual | 1783790009Z |
|
|
99
|
+
| 114 | ❌ **Forbidden:** Declaring a task complete because the output "looks correct." | project-idiom, auto-learned | manual | 1783790009Z |
|
|
100
|
+
| 115 | ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended. | project-idiom, auto-learned | manual | 1783790009Z |
|
|
101
|
+
| 116 | [ ] Have I reviewed the user's specific constraints and requests? | project-idiom, auto-learned | manual | 1783790009Z |
|
|
102
|
+
| 117 | [ ] Have I checked the environment for relevant existing implementations? | project-idiom, auto-learned | manual | 1783790009Z |
|
|
103
|
+
| 118 | ❌ **Forbidden:** Declaring a task complete because the output "looks correct." | project-idiom, auto-learned | manual | 1783790009Z |
|
|
104
|
+
| 119 | ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended. | project-idiom, auto-learned | manual | 1783790009Z |
|
|
105
|
+
| 122 | ❌ Overriding project idioms without explicit justification -> ✅ Idioms represent team decisions; flag deviations with reasoning | project-idiom, auto-learned | manual | 1784187808Z |
|
|
106
|
+
| 123 | ❌ Applying idioms from one project to a different project -> ✅ Idioms are project-specific; verify they apply to the current codebase | project-idiom, auto-learned | manual | 1784187808Z |
|
|
107
|
+
| 124 | ❌ **Forbidden:** Declaring a task complete because the output "looks correct." | project-idiom, auto-learned | manual | 1784187808Z |
|
|
108
|
+
| 125 | ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended. | project-idiom, auto-learned | manual | 1784187808Z |
|
|
109
|
+
| 126 | [ ] Have I reviewed the user's specific constraints and requests? | project-idiom, auto-learned | manual | 1784187808Z |
|
|
110
|
+
| 127 | [ ] Have I checked the environment for relevant existing implementations? | project-idiom, auto-learned | manual | 1784187808Z |
|
|
111
|
+
| 128 | ❌ **Forbidden:** Declaring a task complete because the output "looks correct." | project-idiom, auto-learned | manual | 1784187808Z |
|
|
112
|
+
| 129 | ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended. | project-idiom, auto-learned | manual | 1784187808Z |
|
|
97
113
|
|
|
98
114
|
## PROCEDURAL (How-To Recipes)
|
|
99
115
|
| ID | Content | Tags | Source | Created |
|
|
@@ -120,4 +136,8 @@
|
|
|
120
136
|
| 100 | Run `npm run validate-payload && jest --coverage` to test the project | build-script, test, auto-learned | manual | 1783782132Z |
|
|
121
137
|
| 110 | Run `echo 'No build step required for this project'` to build the project | build-script, build, auto-learned | manual | 1783785670Z |
|
|
122
138
|
| 111 | Run `npm run validate-payload && jest --coverage` to test the project | build-script, test, auto-learned | manual | 1783785670Z |
|
|
139
|
+
| 120 | Run `echo 'No build step required for this project'` to build the project | build-script, build, auto-learned | manual | 1783790009Z |
|
|
140
|
+
| 121 | Run `npm run validate-payload && jest --coverage` to test the project | build-script, test, auto-learned | manual | 1783790009Z |
|
|
141
|
+
| 130 | Run `echo 'No build step required for this project'` to build the project | build-script, build, auto-learned | manual | 1784187808Z |
|
|
142
|
+
| 131 | Run `npm run validate-payload && jest --coverage` to test the project | build-script, test, auto-learned | manual | 1784187808Z |
|
|
123
143
|
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* signal_detector.js — Tribunal Kit Signal Detector
|
|
3
|
+
* ====================================================
|
|
4
|
+
* Parses runtime log files, test logs, and build transcripts to extract
|
|
5
|
+
* structured "Improvement Signals" (errors, bottlenecks, gaps).
|
|
6
|
+
*
|
|
7
|
+
* Supported log sources/patterns:
|
|
8
|
+
* - JS/TS Node Stack Traces
|
|
9
|
+
* - Python Stack Traces
|
|
10
|
+
* - Rust Compiler Errors
|
|
11
|
+
* - Jest/Vitest Test Failures
|
|
12
|
+
* - ESLint Warnings/Errors
|
|
13
|
+
* - Performance measurements (e.g. "Slow query", "duration: 1200ms")
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
"use strict";
|
|
17
|
+
|
|
18
|
+
const fs = require("fs");
|
|
19
|
+
const path = require("path");
|
|
20
|
+
|
|
21
|
+
const SIGNAL_TYPES = {
|
|
22
|
+
ERROR: "log_error",
|
|
23
|
+
PERF: "perf_bottleneck",
|
|
24
|
+
GAP: "capability_gap",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Parses a string log and extracts list of typed signals.
|
|
29
|
+
* @param {string} logText
|
|
30
|
+
* @returns {Array<{type: string, file: string|null, line: number|null, message: string, context: string}>}
|
|
31
|
+
*/
|
|
32
|
+
function detectSignals(logText) {
|
|
33
|
+
const signals = [];
|
|
34
|
+
const lines = logText.split(/\r?\n/);
|
|
35
|
+
|
|
36
|
+
// 1. Check for stack traces and syntax/runtime errors
|
|
37
|
+
// JS/TS stack trace line: " at Object.foo (src/utils.js:12:45)" or " at src/utils.js:12:45"
|
|
38
|
+
const jsStackRegex = /\bat\s+(?:async\s+)?(?:[^(]+\()?([^:()\s]+):(\d+):(\d+)\)?/;
|
|
39
|
+
// Python File location: ' File "src/main.py", line 12, in <module>'
|
|
40
|
+
const pyStackRegex = /File\s+"([^"]+)"\s*,\s*line\s*(\d+)/;
|
|
41
|
+
// Rust location: ' --> src/main.rs:12:34'
|
|
42
|
+
const rustRegex = /-->\s*([^:\s]+):(\d+):(\d+)/;
|
|
43
|
+
// ESLint standard line: ' /path/to/file.js:12:34: error: Message' or ' 12:34 error Message'
|
|
44
|
+
// But ESLint often has file heading first. So let's handle inline: 'file.js: line 12, col 34, Error - Message'
|
|
45
|
+
const eslintInlineRegex = /([^:\s]+):\s*line\s*(\d+)\s*,\s*col\s*\d+,\s*(?:Error|Warning)\s*-\s*(.+)/i;
|
|
46
|
+
// Also standard unix format: '/path/to/file.js:12:34: error message'
|
|
47
|
+
const unixErrorRegex = /^([^:\s\(\)]+):(\d+):(?:\d+:)?\s*(error|warning|info):?\s*(.+)/i;
|
|
48
|
+
|
|
49
|
+
// Let's also scan for performance bottlenecks
|
|
50
|
+
const slowQueryRegex = /slow\s+query|duration:\s*(\d+)ms|execution\s+time:\s*(\d+)ms|response\s+time\s*>\s*(\d+)ms/i;
|
|
51
|
+
|
|
52
|
+
let currentFile = null;
|
|
53
|
+
|
|
54
|
+
for (let i = 0; i < lines.length; i++) {
|
|
55
|
+
const line = lines[i];
|
|
56
|
+
|
|
57
|
+
// Detect Jest/Vitest file heading: "FAIL src/utils.test.js"
|
|
58
|
+
if (line.startsWith("FAIL ")) {
|
|
59
|
+
const match = line.match(/^FAIL\s+(\S+)/);
|
|
60
|
+
if (match) {
|
|
61
|
+
currentFile = match[1];
|
|
62
|
+
signals.push({
|
|
63
|
+
type: SIGNAL_TYPES.ERROR,
|
|
64
|
+
file: currentFile,
|
|
65
|
+
line: null,
|
|
66
|
+
message: `Test suite failed: ${path.basename(currentFile)}`,
|
|
67
|
+
context: lines.slice(Math.max(0, i - 1), Math.min(lines.length, i + 5)).join("\n"),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// JS Stack Trace Match
|
|
74
|
+
const jsMatch = line.match(jsStackRegex);
|
|
75
|
+
if (jsMatch && !line.includes("node_modules")) {
|
|
76
|
+
const filePath = jsMatch[1].replace(/\\/g, "/");
|
|
77
|
+
signals.push({
|
|
78
|
+
type: SIGNAL_TYPES.ERROR,
|
|
79
|
+
file: filePath,
|
|
80
|
+
line: parseInt(jsMatch[2], 10),
|
|
81
|
+
message: `Stack Trace Error: ${line.trim()}`,
|
|
82
|
+
context: lines.slice(Math.max(0, i - 2), Math.min(lines.length, i + 3)).join("\n"),
|
|
83
|
+
});
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Python Stack Trace Match
|
|
88
|
+
const pyMatch = line.match(pyStackRegex);
|
|
89
|
+
if (pyMatch) {
|
|
90
|
+
const filePath = pyMatch[1].replace(/\\/g, "/");
|
|
91
|
+
signals.push({
|
|
92
|
+
type: SIGNAL_TYPES.ERROR,
|
|
93
|
+
file: filePath,
|
|
94
|
+
line: parseInt(pyMatch[2], 10),
|
|
95
|
+
message: `Python Exception: ${lines[i+1] ? lines[i+1].trim() : line.trim()}`,
|
|
96
|
+
context: lines.slice(Math.max(0, i - 1), Math.min(lines.length, i + 4)).join("\n"),
|
|
97
|
+
});
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Rust Compiler Error Match
|
|
102
|
+
const rustMatch = line.match(rustRegex);
|
|
103
|
+
if (rustMatch) {
|
|
104
|
+
const filePath = rustMatch[1].replace(/\\/g, "/");
|
|
105
|
+
signals.push({
|
|
106
|
+
type: SIGNAL_TYPES.ERROR,
|
|
107
|
+
file: filePath,
|
|
108
|
+
line: parseInt(rustMatch[2], 10),
|
|
109
|
+
message: `Rust compilation failure: ${lines[Math.max(0, i - 1)].trim()}`,
|
|
110
|
+
context: lines.slice(Math.max(0, i - 2), Math.min(lines.length, i + 5)).join("\n"),
|
|
111
|
+
});
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ESLint Inline Match
|
|
116
|
+
const eslintMatch = line.match(eslintInlineRegex);
|
|
117
|
+
if (eslintMatch) {
|
|
118
|
+
signals.push({
|
|
119
|
+
type: SIGNAL_TYPES.ERROR,
|
|
120
|
+
file: eslintMatch[1].replace(/\\/g, "/"),
|
|
121
|
+
line: parseInt(eslintMatch[2], 10),
|
|
122
|
+
message: `Linter Violation: ${eslintMatch[3]}`,
|
|
123
|
+
context: line.trim(),
|
|
124
|
+
});
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Unix Error Format Match
|
|
129
|
+
const unixMatch = line.match(unixErrorRegex);
|
|
130
|
+
if (unixMatch && !line.includes("node_modules")) {
|
|
131
|
+
const filePath = unixMatch[1].replace(/\\/g, "/");
|
|
132
|
+
signals.push({
|
|
133
|
+
type: SIGNAL_TYPES.ERROR,
|
|
134
|
+
file: filePath,
|
|
135
|
+
line: parseInt(unixMatch[2], 10),
|
|
136
|
+
message: `${unixMatch[3].toUpperCase()}: ${unixMatch[4]}`,
|
|
137
|
+
context: line.trim(),
|
|
138
|
+
});
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Slow Query/Performance Match
|
|
143
|
+
const slowMatch = line.match(slowQueryRegex);
|
|
144
|
+
if (slowMatch) {
|
|
145
|
+
signals.push({
|
|
146
|
+
type: SIGNAL_TYPES.PERF,
|
|
147
|
+
file: currentFile || null,
|
|
148
|
+
line: null,
|
|
149
|
+
message: `Performance warning: ${line.trim()}`,
|
|
150
|
+
context: lines.slice(Math.max(0, i - 1), Math.min(lines.length, i + 2)).join("\n"),
|
|
151
|
+
});
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Deduplicate near-identical signals (same file, line, and message type)
|
|
157
|
+
const unique = [];
|
|
158
|
+
const keys = new Set();
|
|
159
|
+
for (const s of signals) {
|
|
160
|
+
const key = `${s.type}:${s.file}:${s.line}:${s.message.substring(0, 40)}`;
|
|
161
|
+
if (!keys.has(key)) {
|
|
162
|
+
keys.add(key);
|
|
163
|
+
unique.push(s);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return unique;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
module.exports = {
|
|
171
|
+
detectSignals,
|
|
172
|
+
SIGNAL_TYPES,
|
|
173
|
+
};
|