@funnycode/myclaude 0.1.184 → 0.1.185
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/dist/myclaude.js +126 -83
- package/dist/myclaude.mjs +126 -83
- package/package.json +1 -1
package/dist/myclaude.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// MACRO - build-time constants (injected by build.ts)
|
|
5
5
|
// MACRO injected by build script
|
|
6
6
|
globalThis.MACRO = {
|
|
7
|
-
VERSION: "0.1.
|
|
8
|
-
BUILD_TIME: "2026-08-
|
|
7
|
+
VERSION: "0.1.185",
|
|
8
|
+
BUILD_TIME: "2026-08-10T03:07:07.347Z",
|
|
9
9
|
PACKAGE_URL: "@funnycode/myclaude",
|
|
10
10
|
NATIVE_PACKAGE_URL: "@funnycode/myclaude",
|
|
11
11
|
VERSION_CHANGELOG: '',
|
|
@@ -60512,6 +60512,7 @@ var init_types4 = __esm(() => {
|
|
|
60512
60512
|
autoDreamEnabled: exports_external.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),
|
|
60513
60513
|
showThinkingSummaries: exports_external.boolean().optional().describe("Show thinking summaries in the transcript view (ctrl+o). Default: false."),
|
|
60514
60514
|
skipDangerousModePermissionPrompt: exports_external.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),
|
|
60515
|
+
commandApproval: exports_external.enum(["always", "dangerous", "never"]).optional().describe('Terminal command approval policy: "always" asks before every command, ' + '"dangerous" only asks for heuristically dangerous commands (default), ' + '"never" auto-approves commands that pass deny rules without prompting'),
|
|
60515
60516
|
...{},
|
|
60516
60517
|
disableAutoMode: exports_external.enum(["disable"]).optional().describe("Disable auto mode"),
|
|
60517
60518
|
sshConfigs: exports_external.array(exports_external.object({
|
|
@@ -117151,7 +117152,7 @@ var package_default;
|
|
|
117151
117152
|
var init_package = __esm(() => {
|
|
117152
117153
|
package_default = {
|
|
117153
117154
|
name: "@funnycode/myclaude",
|
|
117154
|
-
version: "0.1.
|
|
117155
|
+
version: "0.1.185",
|
|
117155
117156
|
private: false,
|
|
117156
117157
|
description: "An open-source AI coding assistant in your terminal - powered by Claude",
|
|
117157
117158
|
license: "MIT",
|
|
@@ -382545,7 +382546,8 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
382545
382546
|
};
|
|
382546
382547
|
},
|
|
382547
382548
|
async checkPermissions(input, context) {
|
|
382548
|
-
|
|
382549
|
+
const verdict = await bashToolHasPermission(input, context);
|
|
382550
|
+
return applyCommandApprovalPolicy(input.command, verdict);
|
|
382549
382551
|
},
|
|
382550
382552
|
renderToolUseMessage: renderToolUseMessage7,
|
|
382551
382553
|
renderToolUseProgressMessage: renderToolUseProgressMessage5,
|
|
@@ -382781,6 +382783,101 @@ ${stderr}` : stdout;
|
|
|
382781
382783
|
});
|
|
382782
382784
|
});
|
|
382783
382785
|
|
|
382786
|
+
// src/tools/BashTool/destructiveCommandWarning.ts
|
|
382787
|
+
function getDestructiveCommandWarning(command) {
|
|
382788
|
+
for (const { pattern, warning } of DESTRUCTIVE_PATTERNS) {
|
|
382789
|
+
if (pattern.test(command)) {
|
|
382790
|
+
return warning;
|
|
382791
|
+
}
|
|
382792
|
+
}
|
|
382793
|
+
return null;
|
|
382794
|
+
}
|
|
382795
|
+
var DESTRUCTIVE_PATTERNS;
|
|
382796
|
+
var init_destructiveCommandWarning = __esm(() => {
|
|
382797
|
+
DESTRUCTIVE_PATTERNS = [
|
|
382798
|
+
{
|
|
382799
|
+
pattern: /\bgit\s+reset\s+--hard\b/,
|
|
382800
|
+
warning: "Note: may discard uncommitted changes"
|
|
382801
|
+
},
|
|
382802
|
+
{
|
|
382803
|
+
pattern: /\bgit\s+push\b[^;&|\n]*[ \t](--force|--force-with-lease|-f)\b/,
|
|
382804
|
+
warning: "Note: may overwrite remote history"
|
|
382805
|
+
},
|
|
382806
|
+
{
|
|
382807
|
+
pattern: /\bgit\s+clean\b(?![^;&|\n]*(?:-[a-zA-Z]*n|--dry-run))[^;&|\n]*-[a-zA-Z]*f/,
|
|
382808
|
+
warning: "Note: may permanently delete untracked files"
|
|
382809
|
+
},
|
|
382810
|
+
{
|
|
382811
|
+
pattern: /\bgit\s+checkout\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
|
|
382812
|
+
warning: "Note: may discard all working tree changes"
|
|
382813
|
+
},
|
|
382814
|
+
{
|
|
382815
|
+
pattern: /\bgit\s+restore\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
|
|
382816
|
+
warning: "Note: may discard all working tree changes"
|
|
382817
|
+
},
|
|
382818
|
+
{
|
|
382819
|
+
pattern: /\bgit\s+stash[ \t]+(drop|clear)\b/,
|
|
382820
|
+
warning: "Note: may permanently remove stashed changes"
|
|
382821
|
+
},
|
|
382822
|
+
{
|
|
382823
|
+
pattern: /\bgit\s+branch\s+(-D[ \t]|--delete\s+--force|--force\s+--delete)\b/,
|
|
382824
|
+
warning: "Note: may force-delete a branch"
|
|
382825
|
+
},
|
|
382826
|
+
{
|
|
382827
|
+
pattern: /\bgit\s+(commit|push|merge)\b[^;&|\n]*--no-verify\b/,
|
|
382828
|
+
warning: "Note: may skip safety hooks"
|
|
382829
|
+
},
|
|
382830
|
+
{
|
|
382831
|
+
pattern: /\bgit\s+commit\b[^;&|\n]*--amend\b/,
|
|
382832
|
+
warning: "Note: may rewrite the last commit"
|
|
382833
|
+
},
|
|
382834
|
+
{
|
|
382835
|
+
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*[rR][a-zA-Z]*f|(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*f[a-zA-Z]*[rR]/,
|
|
382836
|
+
warning: "Note: may recursively force-remove files"
|
|
382837
|
+
},
|
|
382838
|
+
{
|
|
382839
|
+
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*[rR]/,
|
|
382840
|
+
warning: "Note: may recursively remove files"
|
|
382841
|
+
},
|
|
382842
|
+
{
|
|
382843
|
+
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*f/,
|
|
382844
|
+
warning: "Note: may force-remove files"
|
|
382845
|
+
},
|
|
382846
|
+
{
|
|
382847
|
+
pattern: /\b(DROP|TRUNCATE)\s+(TABLE|DATABASE|SCHEMA)\b/i,
|
|
382848
|
+
warning: "Note: may drop or truncate database objects"
|
|
382849
|
+
},
|
|
382850
|
+
{
|
|
382851
|
+
pattern: /\bDELETE\s+FROM\s+\w+[ \t]*(;|"|'|\n|$)/i,
|
|
382852
|
+
warning: "Note: may delete all rows from a database table"
|
|
382853
|
+
},
|
|
382854
|
+
{
|
|
382855
|
+
pattern: /\bkubectl\s+delete\b/,
|
|
382856
|
+
warning: "Note: may delete Kubernetes resources"
|
|
382857
|
+
},
|
|
382858
|
+
{
|
|
382859
|
+
pattern: /\bterraform\s+destroy\b/,
|
|
382860
|
+
warning: "Note: may destroy Terraform infrastructure"
|
|
382861
|
+
},
|
|
382862
|
+
{
|
|
382863
|
+
pattern: /\bsudo\b/,
|
|
382864
|
+
warning: "Note: runs with elevated privileges"
|
|
382865
|
+
},
|
|
382866
|
+
{
|
|
382867
|
+
pattern: /\bdd\b[^;&|\n]*\bof=(?:\/dev\/(?!null\b)[a-zA-Z0-9]+|\/dev\/disk)/,
|
|
382868
|
+
warning: "Note: may overwrite a raw block device"
|
|
382869
|
+
},
|
|
382870
|
+
{
|
|
382871
|
+
pattern: /\bchmod\b[^;&|\n]*(?:-[a-zA-Z]*R[a-zA-Z]*|\s+[0-7]{3,4}\s+\/)/,
|
|
382872
|
+
warning: "Note: recursively changes permissions (may break system files)"
|
|
382873
|
+
},
|
|
382874
|
+
{
|
|
382875
|
+
pattern: /\bmkfs(?:\.\w+)?\b/,
|
|
382876
|
+
warning: "Note: will format/erase a filesystem"
|
|
382877
|
+
}
|
|
382878
|
+
];
|
|
382879
|
+
});
|
|
382880
|
+
|
|
382784
382881
|
// src/tools/BashTool/bashCommandHelpers.ts
|
|
382785
382882
|
async function segmentedCommandPermissionResult(input, segments, bashToolHasPermissionFn, checkers) {
|
|
382786
382883
|
const cdCommands = segments.filter((segment2) => {
|
|
@@ -383809,6 +383906,29 @@ function isNormalizedCdCommand(command) {
|
|
|
383809
383906
|
function commandHasAnyCd(command) {
|
|
383810
383907
|
return splitCommand(command).some((subcmd) => isNormalizedCdCommand(subcmd.trim()));
|
|
383811
383908
|
}
|
|
383909
|
+
async function applyCommandApprovalPolicy(command, result) {
|
|
383910
|
+
if (result.behavior !== "allow") {
|
|
383911
|
+
return result;
|
|
383912
|
+
}
|
|
383913
|
+
const approvalMode = getInitialSettings().commandApproval;
|
|
383914
|
+
if (approvalMode === "never") {
|
|
383915
|
+
return result;
|
|
383916
|
+
}
|
|
383917
|
+
const isDangerous = getDestructiveCommandWarning(command) !== null;
|
|
383918
|
+
if (approvalMode === "always" || approvalMode === "dangerous" && isDangerous) {
|
|
383919
|
+
const decisionReason = {
|
|
383920
|
+
type: "other",
|
|
383921
|
+
reason: approvalMode === "always" ? "commandApproval=always requires confirmation before running commands" : "commandApproval=dangerous requires confirmation for heuristically dangerous commands"
|
|
383922
|
+
};
|
|
383923
|
+
return {
|
|
383924
|
+
behavior: "ask",
|
|
383925
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
383926
|
+
updatedInput: result.updatedInput,
|
|
383927
|
+
decisionReason
|
|
383928
|
+
};
|
|
383929
|
+
}
|
|
383930
|
+
return result;
|
|
383931
|
+
}
|
|
383812
383932
|
var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR_SECURITY_CHECK = 50, MAX_SUGGESTED_RULES_FOR_COMPOUND = 5, BARE_SHELL_PREFIXES, permissionRuleExtractPrefix3, bashPermissionRule, SAFE_ENV_VARS2, ANT_ONLY_SAFE_ENV_VARS, BINARY_HIJACK_VARS, bashToolCheckExactMatchPermission = (input, toolPermissionContext) => {
|
|
383813
383933
|
const command = input.command.trim();
|
|
383814
383934
|
const { matchingDenyRules, matchingAskRules, matchingAllowRules } = matchingRulesForInput2(input, toolPermissionContext, "exact");
|
|
@@ -383946,8 +384066,10 @@ var init_bashPermissions = __esm(() => {
|
|
|
383946
384066
|
init_platform();
|
|
383947
384067
|
init_sandbox_adapter();
|
|
383948
384068
|
init_slowOperations();
|
|
384069
|
+
init_settings2();
|
|
383949
384070
|
init_windowsPaths();
|
|
383950
384071
|
init_BashTool();
|
|
384072
|
+
init_destructiveCommandWarning();
|
|
383951
384073
|
init_bashCommandHelpers();
|
|
383952
384074
|
init_bashSecurity();
|
|
383953
384075
|
init_modeValidation2();
|
|
@@ -514611,85 +514733,6 @@ var init_AskUserQuestionPermissionRequest = __esm(() => {
|
|
|
514611
514733
|
jsx_dev_runtime373 = __toESM(require_jsx_dev_runtime(), 1);
|
|
514612
514734
|
});
|
|
514613
514735
|
|
|
514614
|
-
// src/tools/BashTool/destructiveCommandWarning.ts
|
|
514615
|
-
function getDestructiveCommandWarning(command8) {
|
|
514616
|
-
for (const { pattern, warning } of DESTRUCTIVE_PATTERNS) {
|
|
514617
|
-
if (pattern.test(command8)) {
|
|
514618
|
-
return warning;
|
|
514619
|
-
}
|
|
514620
|
-
}
|
|
514621
|
-
return null;
|
|
514622
|
-
}
|
|
514623
|
-
var DESTRUCTIVE_PATTERNS;
|
|
514624
|
-
var init_destructiveCommandWarning = __esm(() => {
|
|
514625
|
-
DESTRUCTIVE_PATTERNS = [
|
|
514626
|
-
{
|
|
514627
|
-
pattern: /\bgit\s+reset\s+--hard\b/,
|
|
514628
|
-
warning: "Note: may discard uncommitted changes"
|
|
514629
|
-
},
|
|
514630
|
-
{
|
|
514631
|
-
pattern: /\bgit\s+push\b[^;&|\n]*[ \t](--force|--force-with-lease|-f)\b/,
|
|
514632
|
-
warning: "Note: may overwrite remote history"
|
|
514633
|
-
},
|
|
514634
|
-
{
|
|
514635
|
-
pattern: /\bgit\s+clean\b(?![^;&|\n]*(?:-[a-zA-Z]*n|--dry-run))[^;&|\n]*-[a-zA-Z]*f/,
|
|
514636
|
-
warning: "Note: may permanently delete untracked files"
|
|
514637
|
-
},
|
|
514638
|
-
{
|
|
514639
|
-
pattern: /\bgit\s+checkout\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
|
|
514640
|
-
warning: "Note: may discard all working tree changes"
|
|
514641
|
-
},
|
|
514642
|
-
{
|
|
514643
|
-
pattern: /\bgit\s+restore\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
|
|
514644
|
-
warning: "Note: may discard all working tree changes"
|
|
514645
|
-
},
|
|
514646
|
-
{
|
|
514647
|
-
pattern: /\bgit\s+stash[ \t]+(drop|clear)\b/,
|
|
514648
|
-
warning: "Note: may permanently remove stashed changes"
|
|
514649
|
-
},
|
|
514650
|
-
{
|
|
514651
|
-
pattern: /\bgit\s+branch\s+(-D[ \t]|--delete\s+--force|--force\s+--delete)\b/,
|
|
514652
|
-
warning: "Note: may force-delete a branch"
|
|
514653
|
-
},
|
|
514654
|
-
{
|
|
514655
|
-
pattern: /\bgit\s+(commit|push|merge)\b[^;&|\n]*--no-verify\b/,
|
|
514656
|
-
warning: "Note: may skip safety hooks"
|
|
514657
|
-
},
|
|
514658
|
-
{
|
|
514659
|
-
pattern: /\bgit\s+commit\b[^;&|\n]*--amend\b/,
|
|
514660
|
-
warning: "Note: may rewrite the last commit"
|
|
514661
|
-
},
|
|
514662
|
-
{
|
|
514663
|
-
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*[rR][a-zA-Z]*f|(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*f[a-zA-Z]*[rR]/,
|
|
514664
|
-
warning: "Note: may recursively force-remove files"
|
|
514665
|
-
},
|
|
514666
|
-
{
|
|
514667
|
-
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*[rR]/,
|
|
514668
|
-
warning: "Note: may recursively remove files"
|
|
514669
|
-
},
|
|
514670
|
-
{
|
|
514671
|
-
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*f/,
|
|
514672
|
-
warning: "Note: may force-remove files"
|
|
514673
|
-
},
|
|
514674
|
-
{
|
|
514675
|
-
pattern: /\b(DROP|TRUNCATE)\s+(TABLE|DATABASE|SCHEMA)\b/i,
|
|
514676
|
-
warning: "Note: may drop or truncate database objects"
|
|
514677
|
-
},
|
|
514678
|
-
{
|
|
514679
|
-
pattern: /\bDELETE\s+FROM\s+\w+[ \t]*(;|"|'|\n|$)/i,
|
|
514680
|
-
warning: "Note: may delete all rows from a database table"
|
|
514681
|
-
},
|
|
514682
|
-
{
|
|
514683
|
-
pattern: /\bkubectl\s+delete\b/,
|
|
514684
|
-
warning: "Note: may delete Kubernetes resources"
|
|
514685
|
-
},
|
|
514686
|
-
{
|
|
514687
|
-
pattern: /\bterraform\s+destroy\b/,
|
|
514688
|
-
warning: "Note: may destroy Terraform infrastructure"
|
|
514689
|
-
}
|
|
514690
|
-
];
|
|
514691
|
-
});
|
|
514692
|
-
|
|
514693
514736
|
// src/utils/shell/specPrefix.ts
|
|
514694
514737
|
function isKnownSubcommand(arg, spec) {
|
|
514695
514738
|
if (!spec?.subcommands?.length)
|
package/dist/myclaude.mjs
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// MACRO - build-time constants (injected by build.ts)
|
|
5
5
|
// MACRO injected by build script
|
|
6
6
|
globalThis.MACRO = {
|
|
7
|
-
VERSION: "0.1.
|
|
8
|
-
BUILD_TIME: "2026-08-
|
|
7
|
+
VERSION: "0.1.185",
|
|
8
|
+
BUILD_TIME: "2026-08-10T03:07:07.347Z",
|
|
9
9
|
PACKAGE_URL: "@funnycode/myclaude",
|
|
10
10
|
NATIVE_PACKAGE_URL: "@funnycode/myclaude",
|
|
11
11
|
VERSION_CHANGELOG: '',
|
|
@@ -60512,6 +60512,7 @@ var init_types4 = __esm(() => {
|
|
|
60512
60512
|
autoDreamEnabled: exports_external.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),
|
|
60513
60513
|
showThinkingSummaries: exports_external.boolean().optional().describe("Show thinking summaries in the transcript view (ctrl+o). Default: false."),
|
|
60514
60514
|
skipDangerousModePermissionPrompt: exports_external.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),
|
|
60515
|
+
commandApproval: exports_external.enum(["always", "dangerous", "never"]).optional().describe('Terminal command approval policy: "always" asks before every command, ' + '"dangerous" only asks for heuristically dangerous commands (default), ' + '"never" auto-approves commands that pass deny rules without prompting'),
|
|
60515
60516
|
...{},
|
|
60516
60517
|
disableAutoMode: exports_external.enum(["disable"]).optional().describe("Disable auto mode"),
|
|
60517
60518
|
sshConfigs: exports_external.array(exports_external.object({
|
|
@@ -117151,7 +117152,7 @@ var package_default;
|
|
|
117151
117152
|
var init_package = __esm(() => {
|
|
117152
117153
|
package_default = {
|
|
117153
117154
|
name: "@funnycode/myclaude",
|
|
117154
|
-
version: "0.1.
|
|
117155
|
+
version: "0.1.185",
|
|
117155
117156
|
private: false,
|
|
117156
117157
|
description: "An open-source AI coding assistant in your terminal - powered by Claude",
|
|
117157
117158
|
license: "MIT",
|
|
@@ -382545,7 +382546,8 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
382545
382546
|
};
|
|
382546
382547
|
},
|
|
382547
382548
|
async checkPermissions(input, context) {
|
|
382548
|
-
|
|
382549
|
+
const verdict = await bashToolHasPermission(input, context);
|
|
382550
|
+
return applyCommandApprovalPolicy(input.command, verdict);
|
|
382549
382551
|
},
|
|
382550
382552
|
renderToolUseMessage: renderToolUseMessage7,
|
|
382551
382553
|
renderToolUseProgressMessage: renderToolUseProgressMessage5,
|
|
@@ -382781,6 +382783,101 @@ ${stderr}` : stdout;
|
|
|
382781
382783
|
});
|
|
382782
382784
|
});
|
|
382783
382785
|
|
|
382786
|
+
// src/tools/BashTool/destructiveCommandWarning.ts
|
|
382787
|
+
function getDestructiveCommandWarning(command) {
|
|
382788
|
+
for (const { pattern, warning } of DESTRUCTIVE_PATTERNS) {
|
|
382789
|
+
if (pattern.test(command)) {
|
|
382790
|
+
return warning;
|
|
382791
|
+
}
|
|
382792
|
+
}
|
|
382793
|
+
return null;
|
|
382794
|
+
}
|
|
382795
|
+
var DESTRUCTIVE_PATTERNS;
|
|
382796
|
+
var init_destructiveCommandWarning = __esm(() => {
|
|
382797
|
+
DESTRUCTIVE_PATTERNS = [
|
|
382798
|
+
{
|
|
382799
|
+
pattern: /\bgit\s+reset\s+--hard\b/,
|
|
382800
|
+
warning: "Note: may discard uncommitted changes"
|
|
382801
|
+
},
|
|
382802
|
+
{
|
|
382803
|
+
pattern: /\bgit\s+push\b[^;&|\n]*[ \t](--force|--force-with-lease|-f)\b/,
|
|
382804
|
+
warning: "Note: may overwrite remote history"
|
|
382805
|
+
},
|
|
382806
|
+
{
|
|
382807
|
+
pattern: /\bgit\s+clean\b(?![^;&|\n]*(?:-[a-zA-Z]*n|--dry-run))[^;&|\n]*-[a-zA-Z]*f/,
|
|
382808
|
+
warning: "Note: may permanently delete untracked files"
|
|
382809
|
+
},
|
|
382810
|
+
{
|
|
382811
|
+
pattern: /\bgit\s+checkout\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
|
|
382812
|
+
warning: "Note: may discard all working tree changes"
|
|
382813
|
+
},
|
|
382814
|
+
{
|
|
382815
|
+
pattern: /\bgit\s+restore\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
|
|
382816
|
+
warning: "Note: may discard all working tree changes"
|
|
382817
|
+
},
|
|
382818
|
+
{
|
|
382819
|
+
pattern: /\bgit\s+stash[ \t]+(drop|clear)\b/,
|
|
382820
|
+
warning: "Note: may permanently remove stashed changes"
|
|
382821
|
+
},
|
|
382822
|
+
{
|
|
382823
|
+
pattern: /\bgit\s+branch\s+(-D[ \t]|--delete\s+--force|--force\s+--delete)\b/,
|
|
382824
|
+
warning: "Note: may force-delete a branch"
|
|
382825
|
+
},
|
|
382826
|
+
{
|
|
382827
|
+
pattern: /\bgit\s+(commit|push|merge)\b[^;&|\n]*--no-verify\b/,
|
|
382828
|
+
warning: "Note: may skip safety hooks"
|
|
382829
|
+
},
|
|
382830
|
+
{
|
|
382831
|
+
pattern: /\bgit\s+commit\b[^;&|\n]*--amend\b/,
|
|
382832
|
+
warning: "Note: may rewrite the last commit"
|
|
382833
|
+
},
|
|
382834
|
+
{
|
|
382835
|
+
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*[rR][a-zA-Z]*f|(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*f[a-zA-Z]*[rR]/,
|
|
382836
|
+
warning: "Note: may recursively force-remove files"
|
|
382837
|
+
},
|
|
382838
|
+
{
|
|
382839
|
+
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*[rR]/,
|
|
382840
|
+
warning: "Note: may recursively remove files"
|
|
382841
|
+
},
|
|
382842
|
+
{
|
|
382843
|
+
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*f/,
|
|
382844
|
+
warning: "Note: may force-remove files"
|
|
382845
|
+
},
|
|
382846
|
+
{
|
|
382847
|
+
pattern: /\b(DROP|TRUNCATE)\s+(TABLE|DATABASE|SCHEMA)\b/i,
|
|
382848
|
+
warning: "Note: may drop or truncate database objects"
|
|
382849
|
+
},
|
|
382850
|
+
{
|
|
382851
|
+
pattern: /\bDELETE\s+FROM\s+\w+[ \t]*(;|"|'|\n|$)/i,
|
|
382852
|
+
warning: "Note: may delete all rows from a database table"
|
|
382853
|
+
},
|
|
382854
|
+
{
|
|
382855
|
+
pattern: /\bkubectl\s+delete\b/,
|
|
382856
|
+
warning: "Note: may delete Kubernetes resources"
|
|
382857
|
+
},
|
|
382858
|
+
{
|
|
382859
|
+
pattern: /\bterraform\s+destroy\b/,
|
|
382860
|
+
warning: "Note: may destroy Terraform infrastructure"
|
|
382861
|
+
},
|
|
382862
|
+
{
|
|
382863
|
+
pattern: /\bsudo\b/,
|
|
382864
|
+
warning: "Note: runs with elevated privileges"
|
|
382865
|
+
},
|
|
382866
|
+
{
|
|
382867
|
+
pattern: /\bdd\b[^;&|\n]*\bof=(?:\/dev\/(?!null\b)[a-zA-Z0-9]+|\/dev\/disk)/,
|
|
382868
|
+
warning: "Note: may overwrite a raw block device"
|
|
382869
|
+
},
|
|
382870
|
+
{
|
|
382871
|
+
pattern: /\bchmod\b[^;&|\n]*(?:-[a-zA-Z]*R[a-zA-Z]*|\s+[0-7]{3,4}\s+\/)/,
|
|
382872
|
+
warning: "Note: recursively changes permissions (may break system files)"
|
|
382873
|
+
},
|
|
382874
|
+
{
|
|
382875
|
+
pattern: /\bmkfs(?:\.\w+)?\b/,
|
|
382876
|
+
warning: "Note: will format/erase a filesystem"
|
|
382877
|
+
}
|
|
382878
|
+
];
|
|
382879
|
+
});
|
|
382880
|
+
|
|
382784
382881
|
// src/tools/BashTool/bashCommandHelpers.ts
|
|
382785
382882
|
async function segmentedCommandPermissionResult(input, segments, bashToolHasPermissionFn, checkers) {
|
|
382786
382883
|
const cdCommands = segments.filter((segment2) => {
|
|
@@ -383809,6 +383906,29 @@ function isNormalizedCdCommand(command) {
|
|
|
383809
383906
|
function commandHasAnyCd(command) {
|
|
383810
383907
|
return splitCommand(command).some((subcmd) => isNormalizedCdCommand(subcmd.trim()));
|
|
383811
383908
|
}
|
|
383909
|
+
async function applyCommandApprovalPolicy(command, result) {
|
|
383910
|
+
if (result.behavior !== "allow") {
|
|
383911
|
+
return result;
|
|
383912
|
+
}
|
|
383913
|
+
const approvalMode = getInitialSettings().commandApproval;
|
|
383914
|
+
if (approvalMode === "never") {
|
|
383915
|
+
return result;
|
|
383916
|
+
}
|
|
383917
|
+
const isDangerous = getDestructiveCommandWarning(command) !== null;
|
|
383918
|
+
if (approvalMode === "always" || approvalMode === "dangerous" && isDangerous) {
|
|
383919
|
+
const decisionReason = {
|
|
383920
|
+
type: "other",
|
|
383921
|
+
reason: approvalMode === "always" ? "commandApproval=always requires confirmation before running commands" : "commandApproval=dangerous requires confirmation for heuristically dangerous commands"
|
|
383922
|
+
};
|
|
383923
|
+
return {
|
|
383924
|
+
behavior: "ask",
|
|
383925
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
383926
|
+
updatedInput: result.updatedInput,
|
|
383927
|
+
decisionReason
|
|
383928
|
+
};
|
|
383929
|
+
}
|
|
383930
|
+
return result;
|
|
383931
|
+
}
|
|
383812
383932
|
var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR_SECURITY_CHECK = 50, MAX_SUGGESTED_RULES_FOR_COMPOUND = 5, BARE_SHELL_PREFIXES, permissionRuleExtractPrefix3, bashPermissionRule, SAFE_ENV_VARS2, ANT_ONLY_SAFE_ENV_VARS, BINARY_HIJACK_VARS, bashToolCheckExactMatchPermission = (input, toolPermissionContext) => {
|
|
383813
383933
|
const command = input.command.trim();
|
|
383814
383934
|
const { matchingDenyRules, matchingAskRules, matchingAllowRules } = matchingRulesForInput2(input, toolPermissionContext, "exact");
|
|
@@ -383946,8 +384066,10 @@ var init_bashPermissions = __esm(() => {
|
|
|
383946
384066
|
init_platform();
|
|
383947
384067
|
init_sandbox_adapter();
|
|
383948
384068
|
init_slowOperations();
|
|
384069
|
+
init_settings2();
|
|
383949
384070
|
init_windowsPaths();
|
|
383950
384071
|
init_BashTool();
|
|
384072
|
+
init_destructiveCommandWarning();
|
|
383951
384073
|
init_bashCommandHelpers();
|
|
383952
384074
|
init_bashSecurity();
|
|
383953
384075
|
init_modeValidation2();
|
|
@@ -514611,85 +514733,6 @@ var init_AskUserQuestionPermissionRequest = __esm(() => {
|
|
|
514611
514733
|
jsx_dev_runtime373 = __toESM(require_jsx_dev_runtime(), 1);
|
|
514612
514734
|
});
|
|
514613
514735
|
|
|
514614
|
-
// src/tools/BashTool/destructiveCommandWarning.ts
|
|
514615
|
-
function getDestructiveCommandWarning(command8) {
|
|
514616
|
-
for (const { pattern, warning } of DESTRUCTIVE_PATTERNS) {
|
|
514617
|
-
if (pattern.test(command8)) {
|
|
514618
|
-
return warning;
|
|
514619
|
-
}
|
|
514620
|
-
}
|
|
514621
|
-
return null;
|
|
514622
|
-
}
|
|
514623
|
-
var DESTRUCTIVE_PATTERNS;
|
|
514624
|
-
var init_destructiveCommandWarning = __esm(() => {
|
|
514625
|
-
DESTRUCTIVE_PATTERNS = [
|
|
514626
|
-
{
|
|
514627
|
-
pattern: /\bgit\s+reset\s+--hard\b/,
|
|
514628
|
-
warning: "Note: may discard uncommitted changes"
|
|
514629
|
-
},
|
|
514630
|
-
{
|
|
514631
|
-
pattern: /\bgit\s+push\b[^;&|\n]*[ \t](--force|--force-with-lease|-f)\b/,
|
|
514632
|
-
warning: "Note: may overwrite remote history"
|
|
514633
|
-
},
|
|
514634
|
-
{
|
|
514635
|
-
pattern: /\bgit\s+clean\b(?![^;&|\n]*(?:-[a-zA-Z]*n|--dry-run))[^;&|\n]*-[a-zA-Z]*f/,
|
|
514636
|
-
warning: "Note: may permanently delete untracked files"
|
|
514637
|
-
},
|
|
514638
|
-
{
|
|
514639
|
-
pattern: /\bgit\s+checkout\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
|
|
514640
|
-
warning: "Note: may discard all working tree changes"
|
|
514641
|
-
},
|
|
514642
|
-
{
|
|
514643
|
-
pattern: /\bgit\s+restore\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
|
|
514644
|
-
warning: "Note: may discard all working tree changes"
|
|
514645
|
-
},
|
|
514646
|
-
{
|
|
514647
|
-
pattern: /\bgit\s+stash[ \t]+(drop|clear)\b/,
|
|
514648
|
-
warning: "Note: may permanently remove stashed changes"
|
|
514649
|
-
},
|
|
514650
|
-
{
|
|
514651
|
-
pattern: /\bgit\s+branch\s+(-D[ \t]|--delete\s+--force|--force\s+--delete)\b/,
|
|
514652
|
-
warning: "Note: may force-delete a branch"
|
|
514653
|
-
},
|
|
514654
|
-
{
|
|
514655
|
-
pattern: /\bgit\s+(commit|push|merge)\b[^;&|\n]*--no-verify\b/,
|
|
514656
|
-
warning: "Note: may skip safety hooks"
|
|
514657
|
-
},
|
|
514658
|
-
{
|
|
514659
|
-
pattern: /\bgit\s+commit\b[^;&|\n]*--amend\b/,
|
|
514660
|
-
warning: "Note: may rewrite the last commit"
|
|
514661
|
-
},
|
|
514662
|
-
{
|
|
514663
|
-
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*[rR][a-zA-Z]*f|(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*f[a-zA-Z]*[rR]/,
|
|
514664
|
-
warning: "Note: may recursively force-remove files"
|
|
514665
|
-
},
|
|
514666
|
-
{
|
|
514667
|
-
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*[rR]/,
|
|
514668
|
-
warning: "Note: may recursively remove files"
|
|
514669
|
-
},
|
|
514670
|
-
{
|
|
514671
|
-
pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*f/,
|
|
514672
|
-
warning: "Note: may force-remove files"
|
|
514673
|
-
},
|
|
514674
|
-
{
|
|
514675
|
-
pattern: /\b(DROP|TRUNCATE)\s+(TABLE|DATABASE|SCHEMA)\b/i,
|
|
514676
|
-
warning: "Note: may drop or truncate database objects"
|
|
514677
|
-
},
|
|
514678
|
-
{
|
|
514679
|
-
pattern: /\bDELETE\s+FROM\s+\w+[ \t]*(;|"|'|\n|$)/i,
|
|
514680
|
-
warning: "Note: may delete all rows from a database table"
|
|
514681
|
-
},
|
|
514682
|
-
{
|
|
514683
|
-
pattern: /\bkubectl\s+delete\b/,
|
|
514684
|
-
warning: "Note: may delete Kubernetes resources"
|
|
514685
|
-
},
|
|
514686
|
-
{
|
|
514687
|
-
pattern: /\bterraform\s+destroy\b/,
|
|
514688
|
-
warning: "Note: may destroy Terraform infrastructure"
|
|
514689
|
-
}
|
|
514690
|
-
];
|
|
514691
|
-
});
|
|
514692
|
-
|
|
514693
514736
|
// src/utils/shell/specPrefix.ts
|
|
514694
514737
|
function isKnownSubcommand(arg, spec) {
|
|
514695
514738
|
if (!spec?.subcommands?.length)
|