@probelabs/probe 0.6.0-rc256 → 0.6.0-rc258

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.
@@ -11559,191 +11559,102 @@ var init_bashDefaults = __esm({
11559
11559
  "dir",
11560
11560
  "pwd",
11561
11561
  "cd",
11562
- "cd:*",
11563
11562
  // File reading commands
11564
11563
  "cat",
11565
- "cat:*",
11566
11564
  "head",
11567
- "head:*",
11568
11565
  "tail",
11569
- "tail:*",
11570
11566
  "less",
11571
11567
  "more",
11572
11568
  "view",
11573
11569
  // File information and metadata
11574
11570
  "file",
11575
- "file:*",
11576
11571
  "stat",
11577
- "stat:*",
11578
11572
  "wc",
11579
- "wc:*",
11580
11573
  "du",
11581
- "du:*",
11582
11574
  "df",
11583
- "df:*",
11584
11575
  "realpath",
11585
- "realpath:*",
11586
- // Search and find commands (read-only) - find restricted to safe operations
11576
+ // Search and find commands (read-only)
11577
+ // Note: bare 'find' allows all find variants; dangerous ones (find -exec) are blocked by deny list
11587
11578
  "find",
11588
- "find:-name:*",
11589
- "find:-type:*",
11590
- "find:-size:*",
11591
- "find:-mtime:*",
11592
- "find:-newer:*",
11593
- "find:-path:*",
11594
- "find:-iname:*",
11595
- "find:-maxdepth:*",
11596
- "find:-mindepth:*",
11597
- "find:-print",
11598
11579
  "grep",
11599
- "grep:*",
11600
11580
  "egrep",
11601
- "egrep:*",
11602
11581
  "fgrep",
11603
- "fgrep:*",
11604
11582
  "rg",
11605
- "rg:*",
11606
11583
  "ag",
11607
- "ag:*",
11608
11584
  "ack",
11609
- "ack:*",
11610
11585
  "which",
11611
- "which:*",
11612
11586
  "whereis",
11613
- "whereis:*",
11614
11587
  "locate",
11615
- "locate:*",
11616
11588
  "type",
11617
- "type:*",
11618
11589
  "command",
11619
- "command:*",
11620
11590
  // Tree and structure visualization
11621
11591
  "tree",
11622
- "tree:*",
11623
11592
  // Git read-only operations
11624
11593
  "git:status",
11625
- "git:status:*",
11626
11594
  "git:log",
11627
- "git:log:*",
11628
11595
  "git:diff",
11629
- "git:diff:*",
11630
11596
  "git:show",
11631
- "git:show:*",
11632
11597
  "git:branch",
11633
- "git:branch:*",
11634
11598
  "git:tag",
11635
- "git:tag:*",
11636
11599
  "git:describe",
11637
- "git:describe:*",
11638
11600
  "git:remote",
11639
- "git:remote:*",
11640
- "git:config:*",
11601
+ "git:config",
11641
11602
  "git:blame",
11642
- "git:blame:*",
11643
11603
  "git:shortlog",
11644
- "git:shortlog:*",
11645
11604
  "git:reflog",
11646
- "git:reflog:*",
11647
11605
  "git:ls-files",
11648
- "git:ls-files:*",
11649
11606
  "git:ls-tree",
11650
- "git:ls-tree:*",
11651
11607
  "git:ls-remote",
11652
- "git:ls-remote:*",
11653
11608
  "git:rev-parse",
11654
- "git:rev-parse:*",
11655
11609
  "git:rev-list",
11656
- "git:rev-list:*",
11657
11610
  "git:cat-file",
11658
- "git:cat-file:*",
11659
11611
  "git:diff-tree",
11660
- "git:diff-tree:*",
11661
11612
  "git:diff-files",
11662
- "git:diff-files:*",
11663
11613
  "git:diff-index",
11664
- "git:diff-index:*",
11665
11614
  "git:for-each-ref",
11666
- "git:for-each-ref:*",
11667
11615
  "git:merge-base",
11668
- "git:merge-base:*",
11669
11616
  "git:name-rev",
11670
- "git:name-rev:*",
11671
11617
  "git:count-objects",
11672
- "git:count-objects:*",
11673
11618
  "git:verify-commit",
11674
- "git:verify-commit:*",
11675
11619
  "git:verify-tag",
11676
- "git:verify-tag:*",
11677
11620
  "git:check-ignore",
11678
- "git:check-ignore:*",
11679
11621
  "git:check-attr",
11680
- "git:check-attr:*",
11681
11622
  "git:stash:list",
11682
11623
  "git:stash:show",
11683
- "git:stash:show:*",
11684
11624
  "git:worktree:list",
11685
- "git:worktree:list:*",
11686
11625
  "git:notes:list",
11687
11626
  "git:notes:show",
11688
- "git:notes:show:*",
11689
11627
  "git:--version",
11690
11628
  "git:help",
11691
- "git:help:*",
11692
11629
  // GitHub CLI (gh) read-only operations
11693
11630
  "gh:--version",
11694
11631
  "gh:help",
11695
- "gh:help:*",
11696
11632
  "gh:status",
11697
11633
  "gh:auth:status",
11698
- "gh:auth:status:*",
11699
11634
  "gh:issue:list",
11700
- "gh:issue:list:*",
11701
11635
  "gh:issue:view",
11702
- "gh:issue:view:*",
11703
11636
  "gh:issue:status",
11704
- "gh:issue:status:*",
11705
11637
  "gh:pr:list",
11706
- "gh:pr:list:*",
11707
11638
  "gh:pr:view",
11708
- "gh:pr:view:*",
11709
11639
  "gh:pr:status",
11710
- "gh:pr:status:*",
11711
11640
  "gh:pr:diff",
11712
- "gh:pr:diff:*",
11713
11641
  "gh:pr:checks",
11714
- "gh:pr:checks:*",
11715
11642
  "gh:repo:list",
11716
- "gh:repo:list:*",
11717
11643
  "gh:repo:view",
11718
- "gh:repo:view:*",
11719
11644
  "gh:release:list",
11720
- "gh:release:list:*",
11721
11645
  "gh:release:view",
11722
- "gh:release:view:*",
11723
11646
  "gh:run:list",
11724
- "gh:run:list:*",
11725
11647
  "gh:run:view",
11726
- "gh:run:view:*",
11727
11648
  "gh:workflow:list",
11728
- "gh:workflow:list:*",
11729
11649
  "gh:workflow:view",
11730
- "gh:workflow:view:*",
11731
11650
  "gh:gist:list",
11732
- "gh:gist:list:*",
11733
11651
  "gh:gist:view",
11734
- "gh:gist:view:*",
11735
11652
  "gh:search:issues",
11736
- "gh:search:issues:*",
11737
11653
  "gh:search:prs",
11738
- "gh:search:prs:*",
11739
11654
  "gh:search:repos",
11740
- "gh:search:repos:*",
11741
11655
  "gh:search:code",
11742
- "gh:search:code:*",
11743
11656
  "gh:search:commits",
11744
- "gh:search:commits:*",
11745
11657
  "gh:api",
11746
- "gh:api:*",
11747
11658
  // Package managers (information only)
11748
11659
  "npm:list",
11749
11660
  "npm:ls",
@@ -11804,7 +11715,6 @@ var init_bashDefaults = __esm({
11804
11715
  "sqlite3:--version",
11805
11716
  // System information
11806
11717
  "uname",
11807
- "uname:*",
11808
11718
  "hostname",
11809
11719
  "whoami",
11810
11720
  "id",
@@ -11815,23 +11725,17 @@ var init_bashDefaults = __esm({
11815
11725
  "w",
11816
11726
  "users",
11817
11727
  "sleep",
11818
- "sleep:*",
11819
11728
  // Environment and shell
11820
11729
  "env",
11821
11730
  "printenv",
11822
11731
  "echo",
11823
- "echo:*",
11824
11732
  "printf",
11825
- "printf:*",
11826
11733
  "export",
11827
- "export:*",
11828
11734
  "set",
11829
11735
  "unset",
11830
11736
  // Process information (read-only)
11831
11737
  "ps",
11832
- "ps:*",
11833
11738
  "pgrep",
11834
- "pgrep:*",
11835
11739
  "jobs",
11836
11740
  "top:-n:1",
11837
11741
  // Network information (read-only)
@@ -11846,39 +11750,24 @@ var init_bashDefaults = __esm({
11846
11750
  // Text processing and utilities (awk removed - too powerful)
11847
11751
  "sed:-n:*",
11848
11752
  "cut",
11849
- "cut:*",
11850
11753
  "sort",
11851
- "sort:*",
11852
11754
  "uniq",
11853
- "uniq:*",
11854
11755
  "tr",
11855
- "tr:*",
11856
11756
  "column",
11857
- "column:*",
11858
11757
  "paste",
11859
- "paste:*",
11860
11758
  "join",
11861
- "join:*",
11862
11759
  "comm",
11863
- "comm:*",
11864
11760
  "diff",
11865
- "diff:*",
11866
11761
  "cmp",
11867
- "cmp:*",
11868
11762
  "patch:--dry-run:*",
11869
11763
  // Hashing and encoding (read-only)
11870
11764
  "md5sum",
11871
- "md5sum:*",
11872
11765
  "sha1sum",
11873
- "sha1sum:*",
11874
11766
  "sha256sum",
11875
- "sha256sum:*",
11876
11767
  "base64",
11877
11768
  "base64:-d",
11878
11769
  "od",
11879
- "od:*",
11880
11770
  "hexdump",
11881
- "hexdump:*",
11882
11771
  // Archive and compression (list/view only)
11883
11772
  "tar:-tf:*",
11884
11773
  "tar:-tzf:*",
@@ -11888,15 +11777,11 @@ var init_bashDefaults = __esm({
11888
11777
  "gunzip:-l:*",
11889
11778
  // Help and documentation
11890
11779
  "man",
11891
- "man:*",
11892
11780
  "--help",
11893
11781
  "help",
11894
11782
  "info",
11895
- "info:*",
11896
11783
  "whatis",
11897
- "whatis:*",
11898
11784
  "apropos",
11899
- "apropos:*",
11900
11785
  // Make (dry run and info)
11901
11786
  "make:-n",
11902
11787
  "make:--dry-run",
@@ -11919,36 +11804,30 @@ var init_bashDefaults = __esm({
11919
11804
  "rm:-rf",
11920
11805
  "rm:-f:/",
11921
11806
  "rm:/",
11922
- "rm:-rf:*",
11923
11807
  "rmdir",
11924
11808
  "chmod:777",
11925
11809
  "chmod:-R:777",
11926
11810
  "chown",
11927
11811
  "chgrp",
11928
11812
  "dd",
11929
- "dd:*",
11930
11813
  "shred",
11931
- "shred:*",
11932
11814
  // Dangerous find operations that can execute arbitrary commands
11933
- "find:-exec:*",
11934
- "find:*:-exec:*",
11935
- "find:-execdir:*",
11936
- "find:*:-execdir:*",
11937
- "find:-ok:*",
11938
- "find:*:-ok:*",
11939
- "find:-okdir:*",
11940
- "find:*:-okdir:*",
11815
+ "find:-exec",
11816
+ "find:*:-exec",
11817
+ "find:-execdir",
11818
+ "find:*:-execdir",
11819
+ "find:-ok",
11820
+ "find:*:-ok",
11821
+ "find:-okdir",
11822
+ "find:*:-okdir",
11941
11823
  // Powerful scripting tools that can execute arbitrary commands
11942
11824
  "awk",
11943
- "awk:*",
11944
11825
  "perl",
11945
- "perl:*",
11946
11826
  "python:-c:*",
11947
11827
  "node:-e:*",
11948
11828
  // System administration and modification
11949
- "sudo:*",
11829
+ "sudo",
11950
11830
  "su",
11951
- "su:*",
11952
11831
  "passwd",
11953
11832
  "adduser",
11954
11833
  "useradd",
@@ -11986,11 +11865,11 @@ var init_bashDefaults = __esm({
11986
11865
  "composer:install",
11987
11866
  "composer:update",
11988
11867
  "composer:remove",
11989
- "apt:*",
11990
- "apt-get:*",
11991
- "yum:*",
11992
- "dnf:*",
11993
- "zypper:*",
11868
+ "apt",
11869
+ "apt-get",
11870
+ "yum",
11871
+ "dnf",
11872
+ "zypper",
11994
11873
  "brew:install",
11995
11874
  "brew:uninstall",
11996
11875
  "brew:upgrade",
@@ -11998,11 +11877,11 @@ var init_bashDefaults = __esm({
11998
11877
  "conda:remove",
11999
11878
  "conda:update",
12000
11879
  // Service and system control
12001
- "systemctl:*",
12002
- "service:*",
12003
- "chkconfig:*",
12004
- "initctl:*",
12005
- "upstart:*",
11880
+ "systemctl",
11881
+ "service",
11882
+ "chkconfig",
11883
+ "initctl",
11884
+ "upstart",
12006
11885
  // Network operations that could be dangerous
12007
11886
  "curl:-d:*",
12008
11887
  "curl:--data:*",
@@ -12011,32 +11890,21 @@ var init_bashDefaults = __esm({
12011
11890
  "wget:-O:/",
12012
11891
  "wget:--post-data:*",
12013
11892
  "ssh",
12014
- "ssh:*",
12015
11893
  "scp",
12016
- "scp:*",
12017
11894
  "sftp",
12018
- "sftp:*",
12019
- "rsync:*",
11895
+ "rsync",
12020
11896
  "nc",
12021
- "nc:*",
12022
11897
  "netcat",
12023
- "netcat:*",
12024
11898
  "telnet",
12025
- "telnet:*",
12026
11899
  "ftp",
12027
- "ftp:*",
12028
11900
  // Process control and termination
12029
11901
  "kill",
12030
- "kill:*",
12031
11902
  "killall",
12032
- "killall:*",
12033
11903
  "pkill",
12034
- "pkill:*",
12035
- "nohup:*",
12036
- "disown:*",
11904
+ "nohup",
11905
+ "disown",
12037
11906
  // System control and shutdown
12038
11907
  "shutdown",
12039
- "shutdown:*",
12040
11908
  "reboot",
12041
11909
  "halt",
12042
11910
  "poweroff",
@@ -12044,168 +11912,92 @@ var init_bashDefaults = __esm({
12044
11912
  "telinit",
12045
11913
  // Kernel and module operations
12046
11914
  "insmod",
12047
- "insmod:*",
12048
11915
  "rmmod",
12049
- "rmmod:*",
12050
11916
  "modprobe",
12051
- "modprobe:*",
12052
11917
  "sysctl:-w:*",
12053
11918
  // Dangerous git operations
12054
11919
  "git:push",
12055
- "git:push:*",
12056
11920
  "git:force",
12057
11921
  "git:reset",
12058
- "git:reset:*",
12059
11922
  "git:clean",
12060
- "git:clean:*",
12061
11923
  "git:rm",
12062
- "git:rm:*",
12063
11924
  "git:commit",
12064
- "git:commit:*",
12065
11925
  "git:merge",
12066
- "git:merge:*",
12067
11926
  "git:rebase",
12068
- "git:rebase:*",
12069
11927
  "git:cherry-pick",
12070
- "git:cherry-pick:*",
12071
11928
  "git:stash:drop",
12072
- "git:stash:drop:*",
12073
11929
  "git:stash:pop",
12074
- "git:stash:pop:*",
12075
11930
  "git:stash:push",
12076
- "git:stash:push:*",
12077
11931
  "git:stash:clear",
12078
11932
  "git:branch:-d",
12079
- "git:branch:-d:*",
12080
11933
  "git:branch:-D",
12081
- "git:branch:-D:*",
12082
11934
  "git:branch:--delete",
12083
- "git:branch:--delete:*",
12084
11935
  "git:tag:-d",
12085
- "git:tag:-d:*",
12086
11936
  "git:tag:--delete",
12087
- "git:tag:--delete:*",
12088
11937
  "git:remote:remove",
12089
- "git:remote:remove:*",
12090
11938
  "git:remote:rm",
12091
- "git:remote:rm:*",
12092
11939
  "git:checkout:--force",
12093
- "git:checkout:--force:*",
12094
11940
  "git:checkout:-f",
12095
- "git:checkout:-f:*",
12096
11941
  "git:submodule:deinit",
12097
- "git:submodule:deinit:*",
12098
11942
  "git:notes:add",
12099
- "git:notes:add:*",
12100
11943
  "git:notes:remove",
12101
- "git:notes:remove:*",
12102
11944
  "git:worktree:add",
12103
- "git:worktree:add:*",
12104
11945
  "git:worktree:remove",
12105
- "git:worktree:remove:*",
12106
11946
  // Dangerous GitHub CLI (gh) write operations
12107
11947
  "gh:issue:create",
12108
- "gh:issue:create:*",
12109
11948
  "gh:issue:close",
12110
- "gh:issue:close:*",
12111
11949
  "gh:issue:delete",
12112
- "gh:issue:delete:*",
12113
11950
  "gh:issue:edit",
12114
- "gh:issue:edit:*",
12115
11951
  "gh:issue:reopen",
12116
- "gh:issue:reopen:*",
12117
11952
  "gh:issue:comment",
12118
- "gh:issue:comment:*",
12119
11953
  "gh:pr:create",
12120
- "gh:pr:create:*",
12121
11954
  "gh:pr:close",
12122
- "gh:pr:close:*",
12123
11955
  "gh:pr:merge",
12124
- "gh:pr:merge:*",
12125
11956
  "gh:pr:edit",
12126
- "gh:pr:edit:*",
12127
11957
  "gh:pr:reopen",
12128
- "gh:pr:reopen:*",
12129
11958
  "gh:pr:review",
12130
- "gh:pr:review:*",
12131
11959
  "gh:pr:comment",
12132
- "gh:pr:comment:*",
12133
11960
  "gh:repo:create",
12134
- "gh:repo:create:*",
12135
11961
  "gh:repo:delete",
12136
- "gh:repo:delete:*",
12137
11962
  "gh:repo:fork",
12138
- "gh:repo:fork:*",
12139
11963
  "gh:repo:rename",
12140
- "gh:repo:rename:*",
12141
11964
  "gh:repo:archive",
12142
- "gh:repo:archive:*",
12143
11965
  "gh:repo:clone",
12144
- "gh:repo:clone:*",
12145
11966
  "gh:release:create",
12146
- "gh:release:create:*",
12147
11967
  "gh:release:delete",
12148
- "gh:release:delete:*",
12149
11968
  "gh:release:edit",
12150
- "gh:release:edit:*",
12151
11969
  "gh:run:cancel",
12152
- "gh:run:cancel:*",
12153
11970
  "gh:run:rerun",
12154
- "gh:run:rerun:*",
12155
11971
  "gh:workflow:run",
12156
- "gh:workflow:run:*",
12157
11972
  "gh:workflow:enable",
12158
- "gh:workflow:enable:*",
12159
11973
  "gh:workflow:disable",
12160
- "gh:workflow:disable:*",
12161
11974
  "gh:gist:create",
12162
- "gh:gist:create:*",
12163
11975
  "gh:gist:delete",
12164
- "gh:gist:delete:*",
12165
11976
  "gh:gist:edit",
12166
- "gh:gist:edit:*",
12167
11977
  "gh:secret:set",
12168
- "gh:secret:set:*",
12169
11978
  "gh:secret:delete",
12170
- "gh:secret:delete:*",
12171
11979
  "gh:variable:set",
12172
- "gh:variable:set:*",
12173
11980
  "gh:variable:delete",
12174
- "gh:variable:delete:*",
12175
11981
  "gh:label:create",
12176
- "gh:label:create:*",
12177
11982
  "gh:label:delete",
12178
- "gh:label:delete:*",
12179
11983
  "gh:ssh-key:add",
12180
- "gh:ssh-key:add:*",
12181
11984
  "gh:ssh-key:delete",
12182
- "gh:ssh-key:delete:*",
12183
11985
  // File system mounting and partitioning
12184
11986
  "mount",
12185
- "mount:*",
12186
11987
  "umount",
12187
- "umount:*",
12188
11988
  "fdisk",
12189
- "fdisk:*",
12190
11989
  "parted",
12191
- "parted:*",
12192
11990
  "mkfs",
12193
- "mkfs:*",
12194
11991
  "fsck",
12195
- "fsck:*",
12196
11992
  // Cron and scheduling
12197
11993
  "crontab",
12198
- "crontab:*",
12199
11994
  "at",
12200
- "at:*",
12201
11995
  "batch",
12202
- "batch:*",
12203
11996
  // Compression with potential overwrite
12204
11997
  "tar:-xf:*",
12205
11998
  "unzip",
12206
- "unzip:*",
12207
- "gzip:*",
12208
- "gunzip:*",
11999
+ "gzip",
12000
+ "gunzip",
12209
12001
  // Build and compilation that might modify files
12210
12002
  "make",
12211
12003
  "make:install",
@@ -12218,11 +12010,8 @@ var init_bashDefaults = __esm({
12218
12010
  "gradle:build",
12219
12011
  // Docker operations that could modify state
12220
12012
  "docker:run",
12221
- "docker:run:*",
12222
12013
  "docker:exec",
12223
- "docker:exec:*",
12224
12014
  "docker:build",
12225
- "docker:build:*",
12226
12015
  "docker:pull",
12227
12016
  "docker:push",
12228
12017
  "docker:rm",
@@ -12236,22 +12025,15 @@ var init_bashDefaults = __esm({
12236
12025
  "mongo:--eval:*",
12237
12026
  // Text editors that could modify files
12238
12027
  "vi",
12239
- "vi:*",
12240
12028
  "vim",
12241
- "vim:*",
12242
12029
  "nano",
12243
- "nano:*",
12244
12030
  "emacs",
12245
- "emacs:*",
12246
12031
  "sed:-i:*",
12247
12032
  "perl:-i:*",
12248
12033
  // Potentially dangerous utilities
12249
12034
  "eval",
12250
- "eval:*",
12251
12035
  "exec",
12252
- "exec:*",
12253
12036
  "source",
12254
- "source:*",
12255
12037
  "bash:-c:*",
12256
12038
  "sh:-c:*",
12257
12039
  "zsh:-c:*"
@@ -12530,9 +12312,19 @@ var init_bashPermissions = __esm({
12530
12312
  BashPermissionChecker = class {
12531
12313
  /**
12532
12314
  * Create a permission checker
12315
+ *
12316
+ * Priority order (highest to lowest):
12317
+ * 1. Custom deny — always blocks (user explicitly blocked it)
12318
+ * 2. Custom allow — overrides default deny (user explicitly allowed it)
12319
+ * 3. Default deny — blocks by default
12320
+ * 4. Allow list — allows recognized safe commands
12321
+ *
12322
+ * This means `--bash-allow "git:push"` overrides the default deny for git:push
12323
+ * without requiring `--no-default-bash-deny`.
12324
+ *
12533
12325
  * @param {Object} config - Configuration options
12534
- * @param {string[]} [config.allow] - Additional allow patterns
12535
- * @param {string[]} [config.deny] - Additional deny patterns
12326
+ * @param {string[]} [config.allow] - Additional allow patterns (override default deny)
12327
+ * @param {string[]} [config.deny] - Additional deny patterns (always win)
12536
12328
  * @param {boolean} [config.disableDefaultAllow] - Disable default allow list
12537
12329
  * @param {boolean} [config.disableDefaultDeny] - Disable default deny list
12538
12330
  * @param {boolean} [config.debug] - Enable debug logging
@@ -12541,40 +12333,22 @@ var init_bashPermissions = __esm({
12541
12333
  constructor(config = {}) {
12542
12334
  this.debug = config.debug || false;
12543
12335
  this.tracer = config.tracer || null;
12544
- this.allowPatterns = [];
12545
- if (!config.disableDefaultAllow) {
12546
- this.allowPatterns.push(...DEFAULT_ALLOW_PATTERNS);
12547
- if (this.debug) {
12548
- console.log(`[BashPermissions] Added ${DEFAULT_ALLOW_PATTERNS.length} default allow patterns`);
12549
- }
12550
- }
12551
- if (config.allow && Array.isArray(config.allow)) {
12552
- this.allowPatterns.push(...config.allow);
12553
- if (this.debug) {
12554
- console.log(`[BashPermissions] Added ${config.allow.length} custom allow patterns:`, config.allow);
12555
- }
12556
- }
12557
- this.denyPatterns = [];
12558
- if (!config.disableDefaultDeny) {
12559
- this.denyPatterns.push(...DEFAULT_DENY_PATTERNS);
12560
- if (this.debug) {
12561
- console.log(`[BashPermissions] Added ${DEFAULT_DENY_PATTERNS.length} default deny patterns`);
12562
- }
12563
- }
12564
- if (config.deny && Array.isArray(config.deny)) {
12565
- this.denyPatterns.push(...config.deny);
12566
- if (this.debug) {
12567
- console.log(`[BashPermissions] Added ${config.deny.length} custom deny patterns:`, config.deny);
12568
- }
12569
- }
12336
+ this.defaultAllowPatterns = config.disableDefaultAllow ? [] : [...DEFAULT_ALLOW_PATTERNS];
12337
+ this.customAllowPatterns = config.allow && Array.isArray(config.allow) ? [...config.allow] : [];
12338
+ this.allowPatterns = [...this.defaultAllowPatterns, ...this.customAllowPatterns];
12339
+ this.defaultDenyPatterns = config.disableDefaultDeny ? [] : [...DEFAULT_DENY_PATTERNS];
12340
+ this.customDenyPatterns = config.deny && Array.isArray(config.deny) ? [...config.deny] : [];
12341
+ this.denyPatterns = [...this.defaultDenyPatterns, ...this.customDenyPatterns];
12570
12342
  if (this.debug) {
12343
+ console.log(`[BashPermissions] Default allow: ${this.defaultAllowPatterns.length}, Custom allow: ${this.customAllowPatterns.length}`);
12344
+ console.log(`[BashPermissions] Default deny: ${this.defaultDenyPatterns.length}, Custom deny: ${this.customDenyPatterns.length}`);
12571
12345
  console.log(`[BashPermissions] Total patterns - Allow: ${this.allowPatterns.length}, Deny: ${this.denyPatterns.length}`);
12572
12346
  }
12573
12347
  this.recordBashEvent("permissions.initialized", {
12574
12348
  allowPatternCount: this.allowPatterns.length,
12575
12349
  denyPatternCount: this.denyPatterns.length,
12576
- hasCustomAllowPatterns: !!(config.allow && config.allow.length > 0),
12577
- hasCustomDenyPatterns: !!(config.deny && config.deny.length > 0),
12350
+ hasCustomAllowPatterns: this.customAllowPatterns.length > 0,
12351
+ hasCustomDenyPatterns: this.customDenyPatterns.length > 0,
12578
12352
  disableDefaultAllow: !!config.disableDefaultAllow,
12579
12353
  disableDefaultDeny: !!config.disableDefaultDeny
12580
12354
  });
@@ -12644,8 +12418,11 @@ var init_bashPermissions = __esm({
12644
12418
  console.log(`[BashPermissions] Checking simple command: "${command}"`);
12645
12419
  console.log(`[BashPermissions] Parsed: ${parsed.command} with args: [${parsed.args.join(", ")}]`);
12646
12420
  }
12647
- if (matchesAnyPattern(parsed, this.denyPatterns)) {
12648
- const matchedPatterns = this.denyPatterns.filter((pattern) => matchesPattern(parsed, pattern));
12421
+ if (matchesAnyPattern(parsed, this.customDenyPatterns)) {
12422
+ const matchedPatterns = this.customDenyPatterns.filter((pattern) => matchesPattern(parsed, pattern));
12423
+ if (this.debug) {
12424
+ console.log(`[BashPermissions] DENIED - matches custom deny pattern: ${matchedPatterns[0]}`);
12425
+ }
12649
12426
  const result2 = {
12650
12427
  allowed: false,
12651
12428
  reason: `Command matches deny pattern: ${matchedPatterns[0]}`,
@@ -12658,7 +12435,31 @@ var init_bashPermissions = __esm({
12658
12435
  parsedCommand: parsed.command,
12659
12436
  reason: "matches_deny_pattern",
12660
12437
  matchedPattern: matchedPatterns[0],
12661
- isComplex: false
12438
+ isComplex: false,
12439
+ isCustomDeny: true
12440
+ });
12441
+ return result2;
12442
+ }
12443
+ const matchesCustomAllow = matchesAnyPattern(parsed, this.customAllowPatterns);
12444
+ if (!matchesCustomAllow && matchesAnyPattern(parsed, this.defaultDenyPatterns)) {
12445
+ const matchedPatterns = this.defaultDenyPatterns.filter((pattern) => matchesPattern(parsed, pattern));
12446
+ if (this.debug) {
12447
+ console.log(`[BashPermissions] DENIED - matches default deny pattern: ${matchedPatterns[0]}`);
12448
+ }
12449
+ const result2 = {
12450
+ allowed: false,
12451
+ reason: `Command matches deny pattern: ${matchedPatterns[0]}`,
12452
+ command,
12453
+ parsed,
12454
+ matchedPatterns
12455
+ };
12456
+ this.recordBashEvent("permission.denied", {
12457
+ command,
12458
+ parsedCommand: parsed.command,
12459
+ reason: "matches_deny_pattern",
12460
+ matchedPattern: matchedPatterns[0],
12461
+ isComplex: false,
12462
+ isCustomDeny: false
12662
12463
  });
12663
12464
  return result2;
12664
12465
  }
@@ -12683,15 +12484,21 @@ var init_bashPermissions = __esm({
12683
12484
  allowed: true,
12684
12485
  command,
12685
12486
  parsed,
12686
- isComplex: false
12487
+ isComplex: false,
12488
+ overriddenDeny: matchesCustomAllow && matchesAnyPattern(parsed, this.defaultDenyPatterns)
12687
12489
  };
12688
12490
  if (this.debug) {
12689
- console.log(`[BashPermissions] ALLOWED - command passed all checks`);
12491
+ if (result.overriddenDeny) {
12492
+ console.log(`[BashPermissions] ALLOWED - custom allow overrides default deny`);
12493
+ } else {
12494
+ console.log(`[BashPermissions] ALLOWED - command passed all checks`);
12495
+ }
12690
12496
  }
12691
12497
  this.recordBashEvent("permission.allowed", {
12692
12498
  command,
12693
12499
  parsedCommand: parsed.command,
12694
- isComplex: false
12500
+ isComplex: false,
12501
+ overriddenDeny: result.overriddenDeny || false
12695
12502
  });
12696
12503
  return result;
12697
12504
  }
@@ -12860,9 +12667,19 @@ var init_bashPermissions = __esm({
12860
12667
  deniedReason = parsed.error || "Component contains nested complex constructs";
12861
12668
  break;
12862
12669
  }
12863
- if (matchesAnyPattern(parsed, this.denyPatterns)) {
12670
+ if (matchesAnyPattern(parsed, this.customDenyPatterns)) {
12864
12671
  if (this.debug) {
12865
- console.log(`[BashPermissions] Component "${component}" matches deny pattern`);
12672
+ console.log(`[BashPermissions] Component "${component}" matches custom deny pattern`);
12673
+ }
12674
+ allAllowed = false;
12675
+ deniedComponent = component;
12676
+ deniedReason = "Component matches deny pattern";
12677
+ break;
12678
+ }
12679
+ const componentMatchesCustomAllow = matchesAnyPattern(parsed, this.customAllowPatterns);
12680
+ if (!componentMatchesCustomAllow && matchesAnyPattern(parsed, this.defaultDenyPatterns)) {
12681
+ if (this.debug) {
12682
+ console.log(`[BashPermissions] Component "${component}" matches default deny pattern`);
12866
12683
  }
12867
12684
  allAllowed = false;
12868
12685
  deniedComponent = component;
@@ -12942,6 +12759,10 @@ var init_bashPermissions = __esm({
12942
12759
  return {
12943
12760
  allowPatterns: this.allowPatterns.length,
12944
12761
  denyPatterns: this.denyPatterns.length,
12762
+ customAllowPatterns: this.customAllowPatterns.length,
12763
+ customDenyPatterns: this.customDenyPatterns.length,
12764
+ defaultAllowPatterns: this.defaultAllowPatterns.length,
12765
+ defaultDenyPatterns: this.defaultDenyPatterns.length,
12945
12766
  totalPatterns: this.allowPatterns.length + this.denyPatterns.length
12946
12767
  };
12947
12768
  }
@@ -13323,8 +13144,8 @@ Common reasons:
13323
13144
  2. The command is not in the allow list (not a recognized safe command)
13324
13145
 
13325
13146
  If you believe this command should be allowed, you can:
13326
- - Use the --bash-allow option to add specific patterns
13327
- - Use the --no-default-bash-deny flag to remove default restrictions (not recommended)
13147
+ - Use the --bash-allow option to add specific patterns (overrides default deny list)
13148
+ Example: --bash-allow "git:push" allows git push while keeping all other deny rules
13328
13149
 
13329
13150
  For code exploration, try these safe alternatives:
13330
13151
  - ls, cat, head, tail for file operations
@@ -23679,13 +23500,39 @@ var init_unescape = __esm({
23679
23500
  });
23680
23501
 
23681
23502
  // node_modules/minimatch/dist/esm/ast.js
23682
- var types2, isExtglobType, startNoTraversal, startNoDot, addPatternStart, justDots, reSpecials, regExpEscape, qmark, star, starNoEmpty, AST;
23503
+ var _a, types2, isExtglobType, isExtglobAST, adoptionMap, adoptionWithSpaceMap, adoptionAnyMap, usurpMap, startNoTraversal, startNoDot, addPatternStart, justDots, reSpecials, regExpEscape, qmark, star, starNoEmpty, AST;
23683
23504
  var init_ast = __esm({
23684
23505
  "node_modules/minimatch/dist/esm/ast.js"() {
23685
23506
  init_brace_expressions();
23686
23507
  init_unescape();
23687
23508
  types2 = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
23688
23509
  isExtglobType = (c) => types2.has(c);
23510
+ isExtglobAST = (c) => isExtglobType(c.type);
23511
+ adoptionMap = /* @__PURE__ */ new Map([
23512
+ ["!", ["@"]],
23513
+ ["?", ["?", "@"]],
23514
+ ["@", ["@"]],
23515
+ ["*", ["*", "+", "?", "@"]],
23516
+ ["+", ["+", "@"]]
23517
+ ]);
23518
+ adoptionWithSpaceMap = /* @__PURE__ */ new Map([
23519
+ ["!", ["?"]],
23520
+ ["@", ["?"]],
23521
+ ["+", ["?", "*"]]
23522
+ ]);
23523
+ adoptionAnyMap = /* @__PURE__ */ new Map([
23524
+ ["!", ["?", "@"]],
23525
+ ["?", ["?", "@"]],
23526
+ ["@", ["?", "@"]],
23527
+ ["*", ["*", "+", "?", "@"]],
23528
+ ["+", ["+", "@", "?", "*"]]
23529
+ ]);
23530
+ usurpMap = /* @__PURE__ */ new Map([
23531
+ ["!", /* @__PURE__ */ new Map([["!", "@"]])],
23532
+ ["?", /* @__PURE__ */ new Map([["*", "*"], ["+", "*"]])],
23533
+ ["@", /* @__PURE__ */ new Map([["!", "!"], ["?", "?"], ["@", "@"], ["*", "*"], ["+", "+"]])],
23534
+ ["+", /* @__PURE__ */ new Map([["?", "*"], ["*", "*"]])]
23535
+ ]);
23689
23536
  startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
23690
23537
  startNoDot = "(?!\\.)";
23691
23538
  addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
@@ -23695,7 +23542,7 @@ var init_ast = __esm({
23695
23542
  qmark = "[^/]";
23696
23543
  star = qmark + "*?";
23697
23544
  starNoEmpty = qmark + "+?";
23698
- AST = class _AST {
23545
+ AST = class {
23699
23546
  type;
23700
23547
  #root;
23701
23548
  #hasMagic;
@@ -23775,7 +23622,7 @@ var init_ast = __esm({
23775
23622
  for (const p of parts) {
23776
23623
  if (p === "")
23777
23624
  continue;
23778
- if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
23625
+ if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
23779
23626
  throw new Error("invalid part: " + p);
23780
23627
  }
23781
23628
  this.#parts.push(p);
@@ -23800,7 +23647,7 @@ var init_ast = __esm({
23800
23647
  const p = this.#parent;
23801
23648
  for (let i = 0; i < this.#parentIndex; i++) {
23802
23649
  const pp2 = p.#parts[i];
23803
- if (!(pp2 instanceof _AST && pp2.type === "!")) {
23650
+ if (!(pp2 instanceof _a && pp2.type === "!")) {
23804
23651
  return false;
23805
23652
  }
23806
23653
  }
@@ -23825,13 +23672,14 @@ var init_ast = __esm({
23825
23672
  this.push(part.clone(this));
23826
23673
  }
23827
23674
  clone(parent) {
23828
- const c = new _AST(this.type, parent);
23675
+ const c = new _a(this.type, parent);
23829
23676
  for (const p of this.#parts) {
23830
23677
  c.copyIn(p);
23831
23678
  }
23832
23679
  return c;
23833
23680
  }
23834
- static #parseAST(str, ast, pos, opt) {
23681
+ static #parseAST(str, ast, pos, opt, extDepth) {
23682
+ const maxDepth = opt.maxExtglobRecursion ?? 2;
23835
23683
  let escaping = false;
23836
23684
  let inBrace = false;
23837
23685
  let braceStart = -1;
@@ -23863,11 +23711,12 @@ var init_ast = __esm({
23863
23711
  acc2 += c;
23864
23712
  continue;
23865
23713
  }
23866
- if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
23714
+ const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i2) === "(" && extDepth <= maxDepth;
23715
+ if (doRecurse) {
23867
23716
  ast.push(acc2);
23868
23717
  acc2 = "";
23869
- const ext2 = new _AST(c, ast);
23870
- i2 = _AST.#parseAST(str, ext2, i2, opt);
23718
+ const ext2 = new _a(c, ast);
23719
+ i2 = _a.#parseAST(str, ext2, i2, opt, extDepth + 1);
23871
23720
  ast.push(ext2);
23872
23721
  continue;
23873
23722
  }
@@ -23877,7 +23726,7 @@ var init_ast = __esm({
23877
23726
  return i2;
23878
23727
  }
23879
23728
  let i = pos + 1;
23880
- let part = new _AST(null, ast);
23729
+ let part = new _a(null, ast);
23881
23730
  const parts = [];
23882
23731
  let acc = "";
23883
23732
  while (i < str.length) {
@@ -23904,19 +23753,22 @@ var init_ast = __esm({
23904
23753
  acc += c;
23905
23754
  continue;
23906
23755
  }
23907
- if (isExtglobType(c) && str.charAt(i) === "(") {
23756
+ const doRecurse = isExtglobType(c) && str.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
23757
+ (extDepth <= maxDepth || ast && ast.#canAdoptType(c));
23758
+ if (doRecurse) {
23759
+ const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
23908
23760
  part.push(acc);
23909
23761
  acc = "";
23910
- const ext2 = new _AST(c, part);
23762
+ const ext2 = new _a(c, part);
23911
23763
  part.push(ext2);
23912
- i = _AST.#parseAST(str, ext2, i, opt);
23764
+ i = _a.#parseAST(str, ext2, i, opt, extDepth + depthAdd);
23913
23765
  continue;
23914
23766
  }
23915
23767
  if (c === "|") {
23916
23768
  part.push(acc);
23917
23769
  acc = "";
23918
23770
  parts.push(part);
23919
- part = new _AST(null, ast);
23771
+ part = new _a(null, ast);
23920
23772
  continue;
23921
23773
  }
23922
23774
  if (c === ")") {
@@ -23935,9 +23787,101 @@ var init_ast = __esm({
23935
23787
  ast.#parts = [str.substring(pos - 1)];
23936
23788
  return i;
23937
23789
  }
23790
+ #canAdoptWithSpace(child) {
23791
+ return this.#canAdopt(child, adoptionWithSpaceMap);
23792
+ }
23793
+ #canAdopt(child, map2 = adoptionMap) {
23794
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
23795
+ return false;
23796
+ }
23797
+ const gc = child.#parts[0];
23798
+ if (!gc || typeof gc !== "object" || gc.type === null) {
23799
+ return false;
23800
+ }
23801
+ return this.#canAdoptType(gc.type, map2);
23802
+ }
23803
+ #canAdoptType(c, map2 = adoptionAnyMap) {
23804
+ return !!map2.get(this.type)?.includes(c);
23805
+ }
23806
+ #adoptWithSpace(child, index) {
23807
+ const gc = child.#parts[0];
23808
+ const blank = new _a(null, gc, this.options);
23809
+ blank.#parts.push("");
23810
+ gc.push(blank);
23811
+ this.#adopt(child, index);
23812
+ }
23813
+ #adopt(child, index) {
23814
+ const gc = child.#parts[0];
23815
+ this.#parts.splice(index, 1, ...gc.#parts);
23816
+ for (const p of gc.#parts) {
23817
+ if (typeof p === "object")
23818
+ p.#parent = this;
23819
+ }
23820
+ this.#toString = void 0;
23821
+ }
23822
+ #canUsurpType(c) {
23823
+ const m = usurpMap.get(this.type);
23824
+ return !!m?.has(c);
23825
+ }
23826
+ #canUsurp(child) {
23827
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
23828
+ return false;
23829
+ }
23830
+ const gc = child.#parts[0];
23831
+ if (!gc || typeof gc !== "object" || gc.type === null) {
23832
+ return false;
23833
+ }
23834
+ return this.#canUsurpType(gc.type);
23835
+ }
23836
+ #usurp(child) {
23837
+ const m = usurpMap.get(this.type);
23838
+ const gc = child.#parts[0];
23839
+ const nt = m?.get(gc.type);
23840
+ if (!nt)
23841
+ return false;
23842
+ this.#parts = gc.#parts;
23843
+ for (const p of this.#parts) {
23844
+ if (typeof p === "object")
23845
+ p.#parent = this;
23846
+ }
23847
+ this.type = nt;
23848
+ this.#toString = void 0;
23849
+ this.#emptyExt = false;
23850
+ }
23851
+ #flatten() {
23852
+ if (!isExtglobAST(this)) {
23853
+ for (const p of this.#parts) {
23854
+ if (typeof p === "object")
23855
+ p.#flatten();
23856
+ }
23857
+ } else {
23858
+ let iterations = 0;
23859
+ let done = false;
23860
+ do {
23861
+ done = true;
23862
+ for (let i = 0; i < this.#parts.length; i++) {
23863
+ const c = this.#parts[i];
23864
+ if (typeof c === "object") {
23865
+ c.#flatten();
23866
+ if (this.#canAdopt(c)) {
23867
+ done = false;
23868
+ this.#adopt(c, i);
23869
+ } else if (this.#canAdoptWithSpace(c)) {
23870
+ done = false;
23871
+ this.#adoptWithSpace(c, i);
23872
+ } else if (this.#canUsurp(c)) {
23873
+ done = false;
23874
+ this.#usurp(c);
23875
+ }
23876
+ }
23877
+ }
23878
+ } while (!done && ++iterations < 10);
23879
+ }
23880
+ this.#toString = void 0;
23881
+ }
23938
23882
  static fromGlob(pattern, options = {}) {
23939
- const ast = new _AST(null, void 0, options);
23940
- _AST.#parseAST(pattern, ast, 0, options);
23883
+ const ast = new _a(null, void 0, options);
23884
+ _a.#parseAST(pattern, ast, 0, options, 0);
23941
23885
  return ast;
23942
23886
  }
23943
23887
  // returns the regular expression if there's magic, or the unescaped
@@ -24031,12 +23975,14 @@ var init_ast = __esm({
24031
23975
  // or start or whatever) and prepend ^ or / at the Regexp construction.
24032
23976
  toRegExpSource(allowDot) {
24033
23977
  const dot = allowDot ?? !!this.#options.dot;
24034
- if (this.#root === this)
23978
+ if (this.#root === this) {
23979
+ this.#flatten();
24035
23980
  this.#fillNegs();
24036
- if (!this.type) {
23981
+ }
23982
+ if (!isExtglobAST(this)) {
24037
23983
  const noEmpty = this.isStart() && this.isEnd();
24038
23984
  const src = this.#parts.map((p) => {
24039
- const [re, _, hasMagic2, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
23985
+ const [re, _, hasMagic2, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
24040
23986
  this.#hasMagic = this.#hasMagic || hasMagic2;
24041
23987
  this.#uflag = this.#uflag || uflag;
24042
23988
  return re;
@@ -24075,9 +24021,10 @@ var init_ast = __esm({
24075
24021
  let body = this.#partsToRegExp(dot);
24076
24022
  if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
24077
24023
  const s = this.toString();
24078
- this.#parts = [s];
24079
- this.type = null;
24080
- this.#hasMagic = void 0;
24024
+ const me = this;
24025
+ me.#parts = [s];
24026
+ me.type = null;
24027
+ me.#hasMagic = void 0;
24081
24028
  return [s, unescape2(this.toString()), false, false];
24082
24029
  }
24083
24030
  let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
@@ -24166,6 +24113,7 @@ var init_ast = __esm({
24166
24113
  return [re, unescape2(glob2), !!hasMagic2, uflag];
24167
24114
  }
24168
24115
  };
24116
+ _a = AST;
24169
24117
  }
24170
24118
  });
24171
24119
 
@@ -24339,11 +24287,13 @@ var init_esm3 = __esm({
24339
24287
  isWindows;
24340
24288
  platform;
24341
24289
  windowsNoMagicRoot;
24290
+ maxGlobstarRecursion;
24342
24291
  regexp;
24343
24292
  constructor(pattern, options = {}) {
24344
24293
  assertValidPattern(pattern);
24345
24294
  options = options || {};
24346
24295
  this.options = options;
24296
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
24347
24297
  this.pattern = pattern;
24348
24298
  this.platform = options.platform || defaultPlatform;
24349
24299
  this.isWindows = this.platform === "win32";
@@ -24676,7 +24626,8 @@ var init_esm3 = __esm({
24676
24626
  // out of pattern, then that's fine, as long as all
24677
24627
  // the parts match.
24678
24628
  matchOne(file, pattern, partial = false) {
24679
- const options = this.options;
24629
+ let fileStartIndex = 0;
24630
+ let patternStartIndex = 0;
24680
24631
  if (this.isWindows) {
24681
24632
  const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
24682
24633
  const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
@@ -24685,14 +24636,14 @@ var init_esm3 = __esm({
24685
24636
  const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
24686
24637
  const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
24687
24638
  if (typeof fdi === "number" && typeof pdi === "number") {
24688
- const [fd, pd] = [file[fdi], pattern[pdi]];
24639
+ const [fd, pd] = [
24640
+ file[fdi],
24641
+ pattern[pdi]
24642
+ ];
24689
24643
  if (fd.toLowerCase() === pd.toLowerCase()) {
24690
24644
  pattern[pdi] = fd;
24691
- if (pdi > fdi) {
24692
- pattern = pattern.slice(pdi);
24693
- } else if (fdi > pdi) {
24694
- file = file.slice(fdi);
24695
- }
24645
+ patternStartIndex = pdi;
24646
+ fileStartIndex = fdi;
24696
24647
  }
24697
24648
  }
24698
24649
  }
@@ -24700,51 +24651,114 @@ var init_esm3 = __esm({
24700
24651
  if (optimizationLevel >= 2) {
24701
24652
  file = this.levelTwoFileOptimize(file);
24702
24653
  }
24703
- this.debug("matchOne", this, { file, pattern });
24704
- this.debug("matchOne", file.length, pattern.length);
24705
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
24706
- this.debug("matchOne loop");
24707
- var p = pattern[pi];
24708
- var f = file[fi];
24709
- this.debug(pattern, p, f);
24710
- if (p === false) {
24654
+ if (pattern.includes(GLOBSTAR)) {
24655
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
24656
+ }
24657
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
24658
+ }
24659
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
24660
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
24661
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
24662
+ const [head2, body, tail] = [
24663
+ pattern.slice(patternIndex, firstgs),
24664
+ pattern.slice(firstgs + 1, lastgs),
24665
+ pattern.slice(lastgs + 1)
24666
+ ];
24667
+ if (head2.length) {
24668
+ const fileHead = file.slice(fileIndex, fileIndex + head2.length);
24669
+ if (!this.#matchOne(fileHead, head2, partial, 0, 0))
24711
24670
  return false;
24712
- }
24713
- if (p === GLOBSTAR) {
24714
- this.debug("GLOBSTAR", [pattern, p, f]);
24715
- var fr = fi;
24716
- var pr = pi + 1;
24717
- if (pr === pl) {
24718
- this.debug("** at the end");
24719
- for (; fi < fl; fi++) {
24720
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
24721
- return false;
24722
- }
24723
- return true;
24671
+ fileIndex += head2.length;
24672
+ }
24673
+ let fileTailMatch = 0;
24674
+ if (tail.length) {
24675
+ if (tail.length + fileIndex > file.length)
24676
+ return false;
24677
+ let tailStart = file.length - tail.length;
24678
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
24679
+ fileTailMatch = tail.length;
24680
+ } else {
24681
+ if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
24682
+ return false;
24724
24683
  }
24725
- while (fr < fl) {
24726
- var swallowee = file[fr];
24727
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
24728
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
24729
- this.debug("globstar found match!", fr, fl, swallowee);
24730
- return true;
24731
- } else {
24732
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
24733
- this.debug("dot detected!", file, fr, pattern, pr);
24734
- break;
24735
- }
24736
- this.debug("globstar swallow a segment, and continue");
24737
- fr++;
24738
- }
24684
+ tailStart--;
24685
+ if (!this.#matchOne(file, tail, partial, tailStart, 0))
24686
+ return false;
24687
+ fileTailMatch = tail.length + 1;
24688
+ }
24689
+ }
24690
+ if (!body.length) {
24691
+ let sawSome = !!fileTailMatch;
24692
+ for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
24693
+ const f = String(file[i2]);
24694
+ sawSome = true;
24695
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
24696
+ return false;
24739
24697
  }
24740
- if (partial) {
24741
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
24742
- if (fr === fl) {
24743
- return true;
24744
- }
24698
+ }
24699
+ return sawSome;
24700
+ }
24701
+ const bodySegments = [[[], 0]];
24702
+ let currentBody = bodySegments[0];
24703
+ let nonGsParts = 0;
24704
+ const nonGsPartsSums = [0];
24705
+ for (const b of body) {
24706
+ if (b === GLOBSTAR) {
24707
+ nonGsPartsSums.push(nonGsParts);
24708
+ currentBody = [[], 0];
24709
+ bodySegments.push(currentBody);
24710
+ } else {
24711
+ currentBody[0].push(b);
24712
+ nonGsParts++;
24713
+ }
24714
+ }
24715
+ let i = bodySegments.length - 1;
24716
+ const fileLength = file.length - fileTailMatch;
24717
+ for (const b of bodySegments) {
24718
+ b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
24719
+ }
24720
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
24721
+ }
24722
+ #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
24723
+ const bs = bodySegments[bodyIndex];
24724
+ if (!bs) {
24725
+ for (let i = fileIndex; i < file.length; i++) {
24726
+ sawTail = true;
24727
+ const f = file[i];
24728
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
24729
+ return false;
24745
24730
  }
24731
+ }
24732
+ return sawTail;
24733
+ }
24734
+ const [body, after] = bs;
24735
+ while (fileIndex <= after) {
24736
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
24737
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
24738
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
24739
+ if (sub !== false)
24740
+ return sub;
24741
+ }
24742
+ const f = file[fileIndex];
24743
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
24746
24744
  return false;
24747
24745
  }
24746
+ fileIndex++;
24747
+ }
24748
+ return null;
24749
+ }
24750
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
24751
+ let fi;
24752
+ let pi;
24753
+ let pl;
24754
+ let fl;
24755
+ for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
24756
+ this.debug("matchOne loop");
24757
+ let p = pattern[pi];
24758
+ let f = file[fi];
24759
+ this.debug(pattern, p, f);
24760
+ if (p === false || p === GLOBSTAR)
24761
+ return false;
24748
24762
  let hit;
24749
24763
  if (typeof p === "string") {
24750
24764
  hit = f === p;
@@ -42434,8 +42448,8 @@ var init_llk_lookahead = __esm({
42434
42448
  init_lookahead();
42435
42449
  LLkLookaheadStrategy = class {
42436
42450
  constructor(options) {
42437
- var _a;
42438
- this.maxLookahead = (_a = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a !== void 0 ? _a : DEFAULT_PARSER_CONFIG.maxLookahead;
42451
+ var _a2;
42452
+ this.maxLookahead = (_a2 = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a2 !== void 0 ? _a2 : DEFAULT_PARSER_CONFIG.maxLookahead;
42439
42453
  }
42440
42454
  validate(options) {
42441
42455
  const leftRecursionErrors = this.validateNoLeftRecursion(options.rules);
@@ -44304,8 +44318,8 @@ var init_parser = __esm({
44304
44318
  });
44305
44319
  }
44306
44320
  this.TRACE_INIT("ComputeLookaheadFunctions", () => {
44307
- var _a, _b;
44308
- (_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, {
44321
+ var _a2, _b;
44322
+ (_b = (_a2 = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a2, {
44309
44323
  rules: values_default(this.gastProductionsCache)
44310
44324
  });
44311
44325
  this.preComputeLookaheadFunctions(values_default(this.gastProductionsCache));
@@ -62259,7 +62273,7 @@ function toGraph(model) {
62259
62273
  return { graph: { nodes, edges, subgraphs, direction: model.direction }, laneGroups };
62260
62274
  }
62261
62275
  function renderState(model) {
62262
- var _a;
62276
+ var _a2;
62263
62277
  const { graph, laneGroups } = toGraph(model);
62264
62278
  const layout = new DagreLayoutEngine().layout(graph);
62265
62279
  let svg = new SVGRenderer().render(layout);
@@ -62274,7 +62288,7 @@ function renderState(model) {
62274
62288
  const members = lg.nodes.map((id) => byId[id]).filter(Boolean);
62275
62289
  if (!members.length)
62276
62290
  continue;
62277
- (groupByParent[_a = lg.parentId] || (groupByParent[_a] = [])).push({ id: lg.id, nodes: members });
62291
+ (groupByParent[_a2 = lg.parentId] || (groupByParent[_a2] = [])).push({ id: lg.id, nodes: members });
62278
62292
  }
62279
62293
  const laneIndex = (id) => {
62280
62294
  const m = /(.*)__lane(\d+)/.exec(id);
@@ -63362,12 +63376,12 @@ var require_code = __commonJS({
63362
63376
  return item === "" || item === '""';
63363
63377
  }
63364
63378
  get str() {
63365
- var _a;
63366
- return (_a = this._str) !== null && _a !== void 0 ? _a : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
63379
+ var _a2;
63380
+ return (_a2 = this._str) !== null && _a2 !== void 0 ? _a2 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
63367
63381
  }
63368
63382
  get names() {
63369
- var _a;
63370
- return (_a = this._names) !== null && _a !== void 0 ? _a : this._names = this._items.reduce((names, c) => {
63383
+ var _a2;
63384
+ return (_a2 = this._names) !== null && _a2 !== void 0 ? _a2 : this._names = this._items.reduce((names, c) => {
63371
63385
  if (c instanceof Name)
63372
63386
  names[c.str] = (names[c.str] || 0) + 1;
63373
63387
  return names;
@@ -63513,8 +63527,8 @@ var require_scope = __commonJS({
63513
63527
  return `${prefix}${ng.index++}`;
63514
63528
  }
63515
63529
  _nameGroup(prefix) {
63516
- var _a, _b;
63517
- if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
63530
+ var _a2, _b;
63531
+ if (((_b = (_a2 = this._parent) === null || _a2 === void 0 ? void 0 : _a2._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
63518
63532
  throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
63519
63533
  }
63520
63534
  return this._names[prefix] = { prefix, index: 0 };
@@ -63547,12 +63561,12 @@ var require_scope = __commonJS({
63547
63561
  return new ValueScopeName(prefix, this._newName(prefix));
63548
63562
  }
63549
63563
  value(nameOrPrefix, value) {
63550
- var _a;
63564
+ var _a2;
63551
63565
  if (value.ref === void 0)
63552
63566
  throw new Error("CodeGen: ref must be passed in value");
63553
63567
  const name = this.toName(nameOrPrefix);
63554
63568
  const { prefix } = name;
63555
- const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref;
63569
+ const valueKey = (_a2 = value.key) !== null && _a2 !== void 0 ? _a2 : value.ref;
63556
63570
  let vs = this._values[prefix];
63557
63571
  if (vs) {
63558
63572
  const _name = vs.get(valueKey);
@@ -63870,8 +63884,8 @@ var require_codegen = __commonJS({
63870
63884
  return this;
63871
63885
  }
63872
63886
  optimizeNames(names, constants) {
63873
- var _a;
63874
- this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
63887
+ var _a2;
63888
+ this.else = (_a2 = this.else) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names, constants);
63875
63889
  if (!(super.optimizeNames(names, constants) || this.else))
63876
63890
  return;
63877
63891
  this.condition = optimizeExpr(this.condition, names, constants);
@@ -63975,16 +63989,16 @@ var require_codegen = __commonJS({
63975
63989
  return code;
63976
63990
  }
63977
63991
  optimizeNodes() {
63978
- var _a, _b;
63992
+ var _a2, _b;
63979
63993
  super.optimizeNodes();
63980
- (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes();
63994
+ (_a2 = this.catch) === null || _a2 === void 0 ? void 0 : _a2.optimizeNodes();
63981
63995
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
63982
63996
  return this;
63983
63997
  }
63984
63998
  optimizeNames(names, constants) {
63985
- var _a, _b;
63999
+ var _a2, _b;
63986
64000
  super.optimizeNames(names, constants);
63987
- (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
64001
+ (_a2 = this.catch) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names, constants);
63988
64002
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
63989
64003
  return this;
63990
64004
  }
@@ -64764,8 +64778,8 @@ var require_applicability = __commonJS({
64764
64778
  }
64765
64779
  exports2.shouldUseGroup = shouldUseGroup;
64766
64780
  function shouldUseRule(schema, rule) {
64767
- var _a;
64768
- return schema[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== void 0));
64781
+ var _a2;
64782
+ return schema[rule.keyword] !== void 0 || ((_a2 = rule.definition.implements) === null || _a2 === void 0 ? void 0 : _a2.some((kwd) => schema[kwd] !== void 0));
64769
64783
  }
64770
64784
  exports2.shouldUseRule = shouldUseRule;
64771
64785
  }
@@ -65153,14 +65167,14 @@ var require_keyword = __commonJS({
65153
65167
  }
65154
65168
  exports2.macroKeywordCode = macroKeywordCode;
65155
65169
  function funcKeywordCode(cxt, def) {
65156
- var _a;
65170
+ var _a2;
65157
65171
  const { gen, keyword, schema, parentSchema, $data, it } = cxt;
65158
65172
  checkAsyncKeyword(it, def);
65159
65173
  const validate2 = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
65160
65174
  const validateRef = useKeyword(gen, keyword, validate2);
65161
65175
  const valid = gen.let("valid");
65162
65176
  cxt.block$data(valid, validateKeyword);
65163
- cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
65177
+ cxt.ok((_a2 = def.valid) !== null && _a2 !== void 0 ? _a2 : valid);
65164
65178
  function validateKeyword() {
65165
65179
  if (def.errors === false) {
65166
65180
  assignValid();
@@ -65191,8 +65205,8 @@ var require_keyword = __commonJS({
65191
65205
  gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
65192
65206
  }
65193
65207
  function reportErrs(errors) {
65194
- var _a2;
65195
- gen.if((0, codegen_1.not)((_a2 = def.valid) !== null && _a2 !== void 0 ? _a2 : valid), errors);
65208
+ var _a3;
65209
+ gen.if((0, codegen_1.not)((_a3 = def.valid) !== null && _a3 !== void 0 ? _a3 : valid), errors);
65196
65210
  }
65197
65211
  }
65198
65212
  exports2.funcKeywordCode = funcKeywordCode;
@@ -66160,7 +66174,7 @@ var require_compile = __commonJS({
66160
66174
  var validate_1 = require_validate();
66161
66175
  var SchemaEnv = class {
66162
66176
  constructor(env) {
66163
- var _a;
66177
+ var _a2;
66164
66178
  this.refs = {};
66165
66179
  this.dynamicAnchors = {};
66166
66180
  let schema;
@@ -66169,7 +66183,7 @@ var require_compile = __commonJS({
66169
66183
  this.schema = env.schema;
66170
66184
  this.schemaId = env.schemaId;
66171
66185
  this.root = env.root || this;
66172
- this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
66186
+ this.baseId = (_a2 = env.baseId) !== null && _a2 !== void 0 ? _a2 : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
66173
66187
  this.schemaPath = env.schemaPath;
66174
66188
  this.localRefs = env.localRefs;
66175
66189
  this.meta = env.meta;
@@ -66265,14 +66279,14 @@ var require_compile = __commonJS({
66265
66279
  }
66266
66280
  exports2.compileSchema = compileSchema;
66267
66281
  function resolveRef(root2, baseId, ref2) {
66268
- var _a;
66282
+ var _a2;
66269
66283
  ref2 = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref2);
66270
66284
  const schOrFunc = root2.refs[ref2];
66271
66285
  if (schOrFunc)
66272
66286
  return schOrFunc;
66273
66287
  let _sch = resolve9.call(this, root2, ref2);
66274
66288
  if (_sch === void 0) {
66275
- const schema = (_a = root2.localRefs) === null || _a === void 0 ? void 0 : _a[ref2];
66289
+ const schema = (_a2 = root2.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref2];
66276
66290
  const { schemaId } = this.opts;
66277
66291
  if (schema)
66278
66292
  _sch = new SchemaEnv({ schema, schemaId, root: root2, baseId });
@@ -66341,8 +66355,8 @@ var require_compile = __commonJS({
66341
66355
  "definitions"
66342
66356
  ]);
66343
66357
  function getJsonPointer(parsedRef, { baseId, schema, root: root2 }) {
66344
- var _a;
66345
- if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/")
66358
+ var _a2;
66359
+ if (((_a2 = parsedRef.fragment) === null || _a2 === void 0 ? void 0 : _a2[0]) !== "/")
66346
66360
  return;
66347
66361
  for (const part of parsedRef.fragment.slice(1).split("/")) {
66348
66362
  if (typeof schema === "boolean")
@@ -67203,9 +67217,9 @@ var require_core = __commonJS({
67203
67217
  };
67204
67218
  var MAX_EXPRESSION = 200;
67205
67219
  function requiredOptions(o) {
67206
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
67220
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
67207
67221
  const s = o.strict;
67208
- const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
67222
+ const _optz = (_a2 = o.code) === null || _a2 === void 0 ? void 0 : _a2.optimize;
67209
67223
  const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
67210
67224
  const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
67211
67225
  const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
@@ -67679,7 +67693,7 @@ var require_core = __commonJS({
67679
67693
  }
67680
67694
  }
67681
67695
  function addRule(keyword, definition, dataType) {
67682
- var _a;
67696
+ var _a2;
67683
67697
  const post = definition === null || definition === void 0 ? void 0 : definition.post;
67684
67698
  if (dataType && post)
67685
67699
  throw new Error('keyword with "post" flag cannot have "type"');
@@ -67705,7 +67719,7 @@ var require_core = __commonJS({
67705
67719
  else
67706
67720
  ruleGroup.rules.push(rule);
67707
67721
  RULES.all[keyword] = rule;
67708
- (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
67722
+ (_a2 = definition.implements) === null || _a2 === void 0 ? void 0 : _a2.forEach((kwd) => this.addKeyword(kwd));
67709
67723
  }
67710
67724
  function addBeforeRule(ruleGroup, rule, before) {
67711
67725
  const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
@@ -67839,10 +67853,10 @@ var require_ref = __commonJS({
67839
67853
  gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
67840
67854
  }
67841
67855
  function addEvaluatedFrom(source) {
67842
- var _a;
67856
+ var _a2;
67843
67857
  if (!it.opts.unevaluated)
67844
67858
  return;
67845
- const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated;
67859
+ const schEvaluated = (_a2 = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a2 === void 0 ? void 0 : _a2.evaluated;
67846
67860
  if (it.props !== true) {
67847
67861
  if (schEvaluated && !schEvaluated.dynamicProps) {
67848
67862
  if (schEvaluated.props !== void 0) {
@@ -69493,7 +69507,7 @@ var require_discriminator = __commonJS({
69493
69507
  return _valid;
69494
69508
  }
69495
69509
  function getMapping() {
69496
- var _a;
69510
+ var _a2;
69497
69511
  const oneOfMapping = {};
69498
69512
  const topRequired = hasRequired(parentSchema);
69499
69513
  let tagRequired = true;
@@ -69507,7 +69521,7 @@ var require_discriminator = __commonJS({
69507
69521
  if (sch === void 0)
69508
69522
  throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref2);
69509
69523
  }
69510
- const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName];
69524
+ const propSch = (_a2 = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a2 === void 0 ? void 0 : _a2[tagName];
69511
69525
  if (typeof propSch != "object") {
69512
69526
  throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
69513
69527
  }
@@ -71610,20 +71624,52 @@ When reviewing code:
71610
71624
  - Evaluate code style and consistency
71611
71625
  - Provide specific, actionable suggestions with code examples where appropriate`,
71612
71626
  "code-review-template": `You are going to perform code review according to provided user rules. Ensure to review only code provided in diff and latest commit, if provided. However you still need to fully understand how modified code works, and read dependencies if something is not clear.`,
71613
- "engineer": `You are senior engineer focused on software architecture and design.
71614
- Before jumping on the task you first, in details analyse user request, and try to provide elegant and concise solution.
71615
- If solution is clear, you can jump to implementation right away, if not, you can ask user a clarification question, by calling attempt_completion tool, with required details.
71627
+ "engineer": `You are a senior engineer focused on software architecture and design.
71628
+ Before jumping on the task you first analyse the user request in detail, and try to provide an elegant and concise solution.
71629
+ If the solution is clear, you can jump to implementation right away. If not, ask the user a clarification question by calling the attempt_completion tool with the required details.
71616
71630
 
71617
- Before jumping to implementation:
71631
+ # Tone and Style
71632
+ - Be concise and direct. Explain your approach briefly before implementing, then let the code speak for itself.
71633
+ - Do not add unnecessary preamble or postamble. Skip "Here is what I will do" or "Here is a summary of changes" unless the user asks.
71634
+ - Do not add code comments unless the logic is genuinely complex and non-obvious.
71635
+
71636
+ # Before Implementation
71618
71637
  - Focus on high-level design patterns and system organization
71619
71638
  - Identify architectural patterns and component relationships
71620
71639
  - Evaluate system structure and suggest architectural improvements
71621
- - Focus on backward compatibility.
71640
+ - Focus on backward compatibility
71622
71641
  - Consider scalability, maintainability, and extensibility in your analysis
71623
71642
 
71624
- During the implementation:
71625
- - Avoid implementing special cases
71626
- - Do not forget to add the tests`,
71643
+ # Following Conventions
71644
+ - NEVER assume a library or dependency is available. Before using any library, check the project's dependency file (package.json, Cargo.toml, go.mod, requirements.txt, etc.) to confirm it exists in the project.
71645
+ - Before writing new code, look at neighboring files and existing implementations to understand the project's code style, naming conventions, and patterns. Mimic them.
71646
+ - Check imports and existing utilities before creating new helpers \u2014 the project may already have what you need.
71647
+
71648
+ # Task Planning
71649
+ - If the task tool is available, use it to break complex work into milestones before starting implementation.
71650
+ - Stay flexible \u2014 if your understanding changes mid-task, add, remove, or reorganize tasks as needed. The plan should serve you, not constrain you.
71651
+
71652
+ # During Implementation
71653
+ - Always create a new branch before making changes to the codebase.
71654
+ - Fix problems at the root cause, not with surface-level patches. Prefer general solutions over special cases.
71655
+ - Avoid implementing special cases when a general approach works
71656
+ - Never expose secrets, API keys, or credentials in generated code. Never log sensitive information.
71657
+ - Do not surprise the user with unrequested changes. Do what was asked, including reasonable follow-up actions, but do not refactor surrounding code or add features that were not requested.
71658
+ - After every significant change, verify the project still builds and passes linting. Do not wait until the end to discover breakage.
71659
+
71660
+ # After Implementation
71661
+ - Always run the project's tests before considering the task complete. If tests fail, fix them.
71662
+ - Run lint and typecheck commands if known for the project.
71663
+ - If a build, lint, or test fails, fix the issue before finishing.
71664
+ - When the task is done, respond to the user with a concise summary of what was implemented, what files were changed, and any relevant details. Include links (e.g. pull request URL) so the user has everything they need.
71665
+
71666
+ # GitHub Integration
71667
+ - Use the \`gh\` CLI for all GitHub operations: issues, pull requests, checks, releases.
71668
+ - To create a pull request: commit your changes, push the branch, then use \`gh pr create --title "..." --body "..."\`.
71669
+ - To view issues or PRs: \`gh issue view <number>\`, \`gh pr view <number>\`.
71670
+ - If given a GitHub URL, use \`gh\` to fetch the relevant information rather than guessing.
71671
+ - Always return the pull request URL to the user after creating one.
71672
+ - When checking GitHub Actions, only read logs of failed jobs \u2014 do not waste time on successful ones. Use \`gh run view <run-id> --log-failed\` to fetch only the relevant output.`,
71627
71673
  "support": `You are ProbeChat Support, a specialized AI assistant focused on helping developers troubleshoot issues and solve problems. Your primary function is to help users diagnose errors, understand unexpected behaviors, and find solutions using the provided code analysis tools.
71628
71674
 
71629
71675
  When troubleshooting:
@@ -80696,10 +80742,10 @@ var init_FallbackManager = __esm({
80696
80742
  // Use custom provider list
80697
80743
  };
80698
80744
  DEFAULT_MODELS = {
80699
- anthropic: "claude-sonnet-4-5-20250929",
80700
- openai: "gpt-4o",
80701
- google: "gemini-2.0-flash-exp",
80702
- bedrock: "anthropic.claude-sonnet-4-20250514-v1:0"
80745
+ anthropic: "claude-sonnet-4-6",
80746
+ openai: "gpt-5.2",
80747
+ google: "gemini-2.5-flash",
80748
+ bedrock: "anthropic.claude-sonnet-4-6"
80703
80749
  };
80704
80750
  FallbackManager = class {
80705
80751
  /**
@@ -83219,7 +83265,7 @@ var init_ProbeAgent = __esm({
83219
83265
  }
83220
83266
  this.clientApiProvider = "claude-code";
83221
83267
  this.provider = null;
83222
- this.model = this.clientApiModel || "claude-3-5-sonnet-20241022";
83268
+ this.model = this.clientApiModel || "claude-sonnet-4-6";
83223
83269
  this.apiType = "claude-code";
83224
83270
  } else if (codexAvailable) {
83225
83271
  if (this.debug) {
@@ -83228,7 +83274,7 @@ var init_ProbeAgent = __esm({
83228
83274
  }
83229
83275
  this.clientApiProvider = "codex";
83230
83276
  this.provider = null;
83231
- this.model = this.clientApiModel || "gpt-4o";
83277
+ this.model = this.clientApiModel || "gpt-5.2";
83232
83278
  this.apiType = "codex";
83233
83279
  } else {
83234
83280
  throw new Error("No API key provided and neither claude nor codex command found. Please either:\n1. Set an API key: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, or AWS credentials\n2. Install claude command from https://docs.claude.com/en/docs/claude-code\n3. Install codex command from https://openai.com/codex");
@@ -83466,7 +83512,7 @@ var init_ProbeAgent = __esm({
83466
83512
  }
83467
83513
  if (this.clientApiProvider === "claude-code" || process.env.USE_CLAUDE_CODE === "true") {
83468
83514
  this.provider = null;
83469
- this.model = modelName || "claude-3-5-sonnet-20241022";
83515
+ this.model = modelName || "claude-sonnet-4-6";
83470
83516
  this.apiType = "claude-code";
83471
83517
  if (this.debug) {
83472
83518
  console.log("[DEBUG] Claude Code engine selected - will use built-in access if available");
@@ -83833,7 +83879,7 @@ var init_ProbeAgent = __esm({
83833
83879
  apiKey,
83834
83880
  ...apiUrl && { baseURL: apiUrl }
83835
83881
  });
83836
- this.model = modelName || "claude-sonnet-4-5-20250929";
83882
+ this.model = modelName || "claude-sonnet-4-6";
83837
83883
  this.apiType = "anthropic";
83838
83884
  if (this.debug) {
83839
83885
  console.log(`Using Anthropic API with model: ${this.model}${apiUrl ? ` (URL: ${apiUrl})` : ""}`);
@@ -83848,7 +83894,7 @@ var init_ProbeAgent = __esm({
83848
83894
  apiKey,
83849
83895
  ...apiUrl && { baseURL: apiUrl }
83850
83896
  });
83851
- this.model = modelName || "gpt-5-thinking";
83897
+ this.model = modelName || "gpt-5.2";
83852
83898
  this.apiType = "openai";
83853
83899
  if (this.debug) {
83854
83900
  console.log(`Using OpenAI API with model: ${this.model}${apiUrl ? ` (URL: ${apiUrl})` : ""}`);
@@ -83952,7 +83998,7 @@ var init_ProbeAgent = __esm({
83952
83998
  config.baseURL = baseURL;
83953
83999
  }
83954
84000
  this.provider = createAmazonBedrock2(config);
83955
- this.model = modelName || "anthropic.claude-sonnet-4-20250514-v1:0";
84001
+ this.model = modelName || "anthropic.claude-sonnet-4-6";
83956
84002
  this.apiType = "bedrock";
83957
84003
  if (this.debug) {
83958
84004
  const authMethod = apiKey ? "API Key" : "AWS Credentials";
@@ -84011,7 +84057,7 @@ var init_ProbeAgent = __esm({
84011
84057
  allowedTools: this.allowedTools,
84012
84058
  // Pass tool filtering configuration
84013
84059
  model: this.model
84014
- // Pass model name (e.g., gpt-4o, o3, etc.)
84060
+ // Pass model name (e.g., gpt-5.2, o3, etc.)
84015
84061
  });
84016
84062
  if (this.debug) {
84017
84063
  console.log("[DEBUG] Using Codex CLI engine with Probe tools");
@@ -85266,9 +85312,7 @@ You are working with a workspace. Available paths: ${workspaceDesc}
85266
85312
  let maxResponseTokens = this.maxResponseTokens;
85267
85313
  if (!maxResponseTokens) {
85268
85314
  maxResponseTokens = 4e3;
85269
- if (this.model && this.model.includes("opus") || this.model && this.model.includes("sonnet") || this.model && this.model.startsWith("gpt-4-")) {
85270
- maxResponseTokens = 8192;
85271
- } else if (this.model && this.model.startsWith("gpt-4o")) {
85315
+ if (this.model && this.model.includes("opus") || this.model && this.model.includes("sonnet") || this.model && this.model.startsWith("gpt-4") || this.model && this.model.startsWith("gpt-5")) {
85272
85316
  maxResponseTokens = 8192;
85273
85317
  } else if (this.model && this.model.startsWith("gemini")) {
85274
85318
  maxResponseTokens = 32e3;