@funnycode/myclaude 0.1.184 → 0.1.186

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 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.184",
8
- BUILD_TIME: "2026-08-10T02:03:01.135Z",
7
+ VERSION: "0.1.186",
8
+ BUILD_TIME: "2026-08-10T04:16:05.099Z",
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.184",
117155
+ version: "0.1.186",
117155
117156
  private: false,
117156
117157
  description: "An open-source AI coding assistant in your terminal - powered by Claude",
117157
117158
  license: "MIT",
@@ -209358,6 +209359,13 @@ function parseEventData(event) {
209358
209359
  return null;
209359
209360
  }
209360
209361
  }
209362
+ function isDumpPromptsEnabled() {
209363
+ if (false)
209364
+ ;
209365
+ if (process.env.DUMP_PROMPTS !== "1")
209366
+ return false;
209367
+ return process.env.USER_TYPE === "ant" || process.env.MYCLAUDE_ALLOW_DUMP_PROMPTS === "1";
209368
+ }
209361
209369
  function hashString3(str) {
209362
209370
  return createHash5("sha256").update(str).digest("hex");
209363
209371
  }
@@ -209414,7 +209422,7 @@ function clearAllDumpState() {
209414
209422
  dumpState.clear();
209415
209423
  }
209416
209424
  function addApiRequestToCache(requestData) {
209417
- if (process.env.USER_TYPE !== "ant")
209425
+ if (!isDumpPromptsEnabled())
209418
209426
  return;
209419
209427
  const metadata = {
209420
209428
  timestamp: new Date().toISOString(),
@@ -209453,7 +209461,7 @@ function initFingerprint(req) {
209453
209461
  async function dumpRequest(body, ts, state, filePath) {
209454
209462
  if (false)
209455
209463
  ;
209456
- if (process.env.USER_TYPE !== "ant")
209464
+ if (!isDumpPromptsEnabled())
209457
209465
  return;
209458
209466
  try {
209459
209467
  const req = jsonParse(body);
@@ -209511,7 +209519,7 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
209511
209519
  trimDumpState();
209512
209520
  let timestamp;
209513
209521
  if (init2?.method === "POST" && init2.body) {
209514
- if (process.env.USER_TYPE === "ant") {
209522
+ if (isDumpPromptsEnabled()) {
209515
209523
  timestamp = new Date().toISOString();
209516
209524
  enqueueDumpRequest(agentIdOrSessionId, async () => {
209517
209525
  await dumpRequest(init2.body, timestamp, state, filePath);
@@ -209519,7 +209527,7 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
209519
209527
  }
209520
209528
  }
209521
209529
  const response = await globalThis.fetch(input, init2);
209522
- if (timestamp && response.ok && true && process.env.USER_TYPE === "ant" && process.env.DUMP_PROMPTS === "1") {
209530
+ if (timestamp && response.ok && isDumpPromptsEnabled()) {
209523
209531
  const cloned = response.clone();
209524
209532
  (async () => {
209525
209533
  try {
@@ -209623,7 +209631,7 @@ var init_dumpPrompts = __esm(() => {
209623
209631
  init_debug();
209624
209632
  init_log3();
209625
209633
  init_async_mutex();
209626
- if (process.env.USER_TYPE === "ant" && process.env.DUMP_PROMPTS === "1") {
209634
+ if (isDumpPromptsEnabled()) {
209627
209635
  logForDebugging("DUMP_PROMPTS is enabled. This will write full API payloads (including system prompts, user messages, and tool definitions) to the filesystem. This is intended for debugging only and should NOT be used in production.", { level: "warn" });
209628
209636
  }
209629
209637
  cachedApiRequests = [];
@@ -382545,7 +382553,8 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
382545
382553
  };
382546
382554
  },
382547
382555
  async checkPermissions(input, context) {
382548
- return bashToolHasPermission(input, context);
382556
+ const verdict = await bashToolHasPermission(input, context);
382557
+ return applyCommandApprovalPolicy(input.command, verdict);
382549
382558
  },
382550
382559
  renderToolUseMessage: renderToolUseMessage7,
382551
382560
  renderToolUseProgressMessage: renderToolUseProgressMessage5,
@@ -382781,6 +382790,101 @@ ${stderr}` : stdout;
382781
382790
  });
382782
382791
  });
382783
382792
 
382793
+ // src/tools/BashTool/destructiveCommandWarning.ts
382794
+ function getDestructiveCommandWarning(command) {
382795
+ for (const { pattern, warning } of DESTRUCTIVE_PATTERNS) {
382796
+ if (pattern.test(command)) {
382797
+ return warning;
382798
+ }
382799
+ }
382800
+ return null;
382801
+ }
382802
+ var DESTRUCTIVE_PATTERNS;
382803
+ var init_destructiveCommandWarning = __esm(() => {
382804
+ DESTRUCTIVE_PATTERNS = [
382805
+ {
382806
+ pattern: /\bgit\s+reset\s+--hard\b/,
382807
+ warning: "Note: may discard uncommitted changes"
382808
+ },
382809
+ {
382810
+ pattern: /\bgit\s+push\b[^;&|\n]*[ \t](--force|--force-with-lease|-f)\b/,
382811
+ warning: "Note: may overwrite remote history"
382812
+ },
382813
+ {
382814
+ pattern: /\bgit\s+clean\b(?![^;&|\n]*(?:-[a-zA-Z]*n|--dry-run))[^;&|\n]*-[a-zA-Z]*f/,
382815
+ warning: "Note: may permanently delete untracked files"
382816
+ },
382817
+ {
382818
+ pattern: /\bgit\s+checkout\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
382819
+ warning: "Note: may discard all working tree changes"
382820
+ },
382821
+ {
382822
+ pattern: /\bgit\s+restore\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
382823
+ warning: "Note: may discard all working tree changes"
382824
+ },
382825
+ {
382826
+ pattern: /\bgit\s+stash[ \t]+(drop|clear)\b/,
382827
+ warning: "Note: may permanently remove stashed changes"
382828
+ },
382829
+ {
382830
+ pattern: /\bgit\s+branch\s+(-D[ \t]|--delete\s+--force|--force\s+--delete)\b/,
382831
+ warning: "Note: may force-delete a branch"
382832
+ },
382833
+ {
382834
+ pattern: /\bgit\s+(commit|push|merge)\b[^;&|\n]*--no-verify\b/,
382835
+ warning: "Note: may skip safety hooks"
382836
+ },
382837
+ {
382838
+ pattern: /\bgit\s+commit\b[^;&|\n]*--amend\b/,
382839
+ warning: "Note: may rewrite the last commit"
382840
+ },
382841
+ {
382842
+ 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]/,
382843
+ warning: "Note: may recursively force-remove files"
382844
+ },
382845
+ {
382846
+ pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*[rR]/,
382847
+ warning: "Note: may recursively remove files"
382848
+ },
382849
+ {
382850
+ pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*f/,
382851
+ warning: "Note: may force-remove files"
382852
+ },
382853
+ {
382854
+ pattern: /\b(DROP|TRUNCATE)\s+(TABLE|DATABASE|SCHEMA)\b/i,
382855
+ warning: "Note: may drop or truncate database objects"
382856
+ },
382857
+ {
382858
+ pattern: /\bDELETE\s+FROM\s+\w+[ \t]*(;|"|'|\n|$)/i,
382859
+ warning: "Note: may delete all rows from a database table"
382860
+ },
382861
+ {
382862
+ pattern: /\bkubectl\s+delete\b/,
382863
+ warning: "Note: may delete Kubernetes resources"
382864
+ },
382865
+ {
382866
+ pattern: /\bterraform\s+destroy\b/,
382867
+ warning: "Note: may destroy Terraform infrastructure"
382868
+ },
382869
+ {
382870
+ pattern: /\bsudo\b/,
382871
+ warning: "Note: runs with elevated privileges"
382872
+ },
382873
+ {
382874
+ pattern: /\bdd\b[^;&|\n]*\bof=(?:\/dev\/(?!null\b)[a-zA-Z0-9]+|\/dev\/disk)/,
382875
+ warning: "Note: may overwrite a raw block device"
382876
+ },
382877
+ {
382878
+ pattern: /\bchmod\b[^;&|\n]*(?:-[a-zA-Z]*R[a-zA-Z]*|\s+[0-7]{3,4}\s+\/)/,
382879
+ warning: "Note: recursively changes permissions (may break system files)"
382880
+ },
382881
+ {
382882
+ pattern: /\bmkfs(?:\.\w+)?\b/,
382883
+ warning: "Note: will format/erase a filesystem"
382884
+ }
382885
+ ];
382886
+ });
382887
+
382784
382888
  // src/tools/BashTool/bashCommandHelpers.ts
382785
382889
  async function segmentedCommandPermissionResult(input, segments, bashToolHasPermissionFn, checkers) {
382786
382890
  const cdCommands = segments.filter((segment2) => {
@@ -383809,6 +383913,29 @@ function isNormalizedCdCommand(command) {
383809
383913
  function commandHasAnyCd(command) {
383810
383914
  return splitCommand(command).some((subcmd) => isNormalizedCdCommand(subcmd.trim()));
383811
383915
  }
383916
+ async function applyCommandApprovalPolicy(command, result) {
383917
+ if (result.behavior !== "allow") {
383918
+ return result;
383919
+ }
383920
+ const approvalMode = getInitialSettings().commandApproval;
383921
+ if (approvalMode === "never") {
383922
+ return result;
383923
+ }
383924
+ const isDangerous = getDestructiveCommandWarning(command) !== null;
383925
+ if (approvalMode === "always" || approvalMode === "dangerous" && isDangerous) {
383926
+ const decisionReason = {
383927
+ type: "other",
383928
+ reason: approvalMode === "always" ? "commandApproval=always requires confirmation before running commands" : "commandApproval=dangerous requires confirmation for heuristically dangerous commands"
383929
+ };
383930
+ return {
383931
+ behavior: "ask",
383932
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
383933
+ updatedInput: result.updatedInput,
383934
+ decisionReason
383935
+ };
383936
+ }
383937
+ return result;
383938
+ }
383812
383939
  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
383940
  const command = input.command.trim();
383814
383941
  const { matchingDenyRules, matchingAskRules, matchingAllowRules } = matchingRulesForInput2(input, toolPermissionContext, "exact");
@@ -383946,8 +384073,10 @@ var init_bashPermissions = __esm(() => {
383946
384073
  init_platform();
383947
384074
  init_sandbox_adapter();
383948
384075
  init_slowOperations();
384076
+ init_settings2();
383949
384077
  init_windowsPaths();
383950
384078
  init_BashTool();
384079
+ init_destructiveCommandWarning();
383951
384080
  init_bashCommandHelpers();
383952
384081
  init_bashSecurity();
383953
384082
  init_modeValidation2();
@@ -514611,85 +514740,6 @@ var init_AskUserQuestionPermissionRequest = __esm(() => {
514611
514740
  jsx_dev_runtime373 = __toESM(require_jsx_dev_runtime(), 1);
514612
514741
  });
514613
514742
 
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
514743
  // src/utils/shell/specPrefix.ts
514694
514744
  function isKnownSubcommand(arg, spec) {
514695
514745
  if (!spec?.subcommands?.length)
@@ -563509,6 +563559,7 @@ var init_migrateEnableAllProjectMcpServersToSettings = __esm(() => {
563509
563559
  // src/migrations/migrateFennecToOpus.ts
563510
563560
  var init_migrateFennecToOpus = __esm(() => {
563511
563561
  init_log3();
563562
+ init_config();
563512
563563
  init_providers();
563513
563564
  init_settings2();
563514
563565
  });
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.184",
8
- BUILD_TIME: "2026-08-10T02:03:01.135Z",
7
+ VERSION: "0.1.186",
8
+ BUILD_TIME: "2026-08-10T04:16:05.099Z",
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.184",
117155
+ version: "0.1.186",
117155
117156
  private: false,
117156
117157
  description: "An open-source AI coding assistant in your terminal - powered by Claude",
117157
117158
  license: "MIT",
@@ -209358,6 +209359,13 @@ function parseEventData(event) {
209358
209359
  return null;
209359
209360
  }
209360
209361
  }
209362
+ function isDumpPromptsEnabled() {
209363
+ if (false)
209364
+ ;
209365
+ if (process.env.DUMP_PROMPTS !== "1")
209366
+ return false;
209367
+ return process.env.USER_TYPE === "ant" || process.env.MYCLAUDE_ALLOW_DUMP_PROMPTS === "1";
209368
+ }
209361
209369
  function hashString3(str) {
209362
209370
  return createHash5("sha256").update(str).digest("hex");
209363
209371
  }
@@ -209414,7 +209422,7 @@ function clearAllDumpState() {
209414
209422
  dumpState.clear();
209415
209423
  }
209416
209424
  function addApiRequestToCache(requestData) {
209417
- if (process.env.USER_TYPE !== "ant")
209425
+ if (!isDumpPromptsEnabled())
209418
209426
  return;
209419
209427
  const metadata = {
209420
209428
  timestamp: new Date().toISOString(),
@@ -209453,7 +209461,7 @@ function initFingerprint(req) {
209453
209461
  async function dumpRequest(body, ts, state, filePath) {
209454
209462
  if (false)
209455
209463
  ;
209456
- if (process.env.USER_TYPE !== "ant")
209464
+ if (!isDumpPromptsEnabled())
209457
209465
  return;
209458
209466
  try {
209459
209467
  const req = jsonParse(body);
@@ -209511,7 +209519,7 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
209511
209519
  trimDumpState();
209512
209520
  let timestamp;
209513
209521
  if (init2?.method === "POST" && init2.body) {
209514
- if (process.env.USER_TYPE === "ant") {
209522
+ if (isDumpPromptsEnabled()) {
209515
209523
  timestamp = new Date().toISOString();
209516
209524
  enqueueDumpRequest(agentIdOrSessionId, async () => {
209517
209525
  await dumpRequest(init2.body, timestamp, state, filePath);
@@ -209519,7 +209527,7 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
209519
209527
  }
209520
209528
  }
209521
209529
  const response = await globalThis.fetch(input, init2);
209522
- if (timestamp && response.ok && true && process.env.USER_TYPE === "ant" && process.env.DUMP_PROMPTS === "1") {
209530
+ if (timestamp && response.ok && isDumpPromptsEnabled()) {
209523
209531
  const cloned = response.clone();
209524
209532
  (async () => {
209525
209533
  try {
@@ -209623,7 +209631,7 @@ var init_dumpPrompts = __esm(() => {
209623
209631
  init_debug();
209624
209632
  init_log3();
209625
209633
  init_async_mutex();
209626
- if (process.env.USER_TYPE === "ant" && process.env.DUMP_PROMPTS === "1") {
209634
+ if (isDumpPromptsEnabled()) {
209627
209635
  logForDebugging("DUMP_PROMPTS is enabled. This will write full API payloads (including system prompts, user messages, and tool definitions) to the filesystem. This is intended for debugging only and should NOT be used in production.", { level: "warn" });
209628
209636
  }
209629
209637
  cachedApiRequests = [];
@@ -382545,7 +382553,8 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
382545
382553
  };
382546
382554
  },
382547
382555
  async checkPermissions(input, context) {
382548
- return bashToolHasPermission(input, context);
382556
+ const verdict = await bashToolHasPermission(input, context);
382557
+ return applyCommandApprovalPolicy(input.command, verdict);
382549
382558
  },
382550
382559
  renderToolUseMessage: renderToolUseMessage7,
382551
382560
  renderToolUseProgressMessage: renderToolUseProgressMessage5,
@@ -382781,6 +382790,101 @@ ${stderr}` : stdout;
382781
382790
  });
382782
382791
  });
382783
382792
 
382793
+ // src/tools/BashTool/destructiveCommandWarning.ts
382794
+ function getDestructiveCommandWarning(command) {
382795
+ for (const { pattern, warning } of DESTRUCTIVE_PATTERNS) {
382796
+ if (pattern.test(command)) {
382797
+ return warning;
382798
+ }
382799
+ }
382800
+ return null;
382801
+ }
382802
+ var DESTRUCTIVE_PATTERNS;
382803
+ var init_destructiveCommandWarning = __esm(() => {
382804
+ DESTRUCTIVE_PATTERNS = [
382805
+ {
382806
+ pattern: /\bgit\s+reset\s+--hard\b/,
382807
+ warning: "Note: may discard uncommitted changes"
382808
+ },
382809
+ {
382810
+ pattern: /\bgit\s+push\b[^;&|\n]*[ \t](--force|--force-with-lease|-f)\b/,
382811
+ warning: "Note: may overwrite remote history"
382812
+ },
382813
+ {
382814
+ pattern: /\bgit\s+clean\b(?![^;&|\n]*(?:-[a-zA-Z]*n|--dry-run))[^;&|\n]*-[a-zA-Z]*f/,
382815
+ warning: "Note: may permanently delete untracked files"
382816
+ },
382817
+ {
382818
+ pattern: /\bgit\s+checkout\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
382819
+ warning: "Note: may discard all working tree changes"
382820
+ },
382821
+ {
382822
+ pattern: /\bgit\s+restore\s+(--\s+)?\.[ \t]*($|[;&|\n])/,
382823
+ warning: "Note: may discard all working tree changes"
382824
+ },
382825
+ {
382826
+ pattern: /\bgit\s+stash[ \t]+(drop|clear)\b/,
382827
+ warning: "Note: may permanently remove stashed changes"
382828
+ },
382829
+ {
382830
+ pattern: /\bgit\s+branch\s+(-D[ \t]|--delete\s+--force|--force\s+--delete)\b/,
382831
+ warning: "Note: may force-delete a branch"
382832
+ },
382833
+ {
382834
+ pattern: /\bgit\s+(commit|push|merge)\b[^;&|\n]*--no-verify\b/,
382835
+ warning: "Note: may skip safety hooks"
382836
+ },
382837
+ {
382838
+ pattern: /\bgit\s+commit\b[^;&|\n]*--amend\b/,
382839
+ warning: "Note: may rewrite the last commit"
382840
+ },
382841
+ {
382842
+ 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]/,
382843
+ warning: "Note: may recursively force-remove files"
382844
+ },
382845
+ {
382846
+ pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*[rR]/,
382847
+ warning: "Note: may recursively remove files"
382848
+ },
382849
+ {
382850
+ pattern: /(^|[;&|\n]\s*)rm\s+-[a-zA-Z]*f/,
382851
+ warning: "Note: may force-remove files"
382852
+ },
382853
+ {
382854
+ pattern: /\b(DROP|TRUNCATE)\s+(TABLE|DATABASE|SCHEMA)\b/i,
382855
+ warning: "Note: may drop or truncate database objects"
382856
+ },
382857
+ {
382858
+ pattern: /\bDELETE\s+FROM\s+\w+[ \t]*(;|"|'|\n|$)/i,
382859
+ warning: "Note: may delete all rows from a database table"
382860
+ },
382861
+ {
382862
+ pattern: /\bkubectl\s+delete\b/,
382863
+ warning: "Note: may delete Kubernetes resources"
382864
+ },
382865
+ {
382866
+ pattern: /\bterraform\s+destroy\b/,
382867
+ warning: "Note: may destroy Terraform infrastructure"
382868
+ },
382869
+ {
382870
+ pattern: /\bsudo\b/,
382871
+ warning: "Note: runs with elevated privileges"
382872
+ },
382873
+ {
382874
+ pattern: /\bdd\b[^;&|\n]*\bof=(?:\/dev\/(?!null\b)[a-zA-Z0-9]+|\/dev\/disk)/,
382875
+ warning: "Note: may overwrite a raw block device"
382876
+ },
382877
+ {
382878
+ pattern: /\bchmod\b[^;&|\n]*(?:-[a-zA-Z]*R[a-zA-Z]*|\s+[0-7]{3,4}\s+\/)/,
382879
+ warning: "Note: recursively changes permissions (may break system files)"
382880
+ },
382881
+ {
382882
+ pattern: /\bmkfs(?:\.\w+)?\b/,
382883
+ warning: "Note: will format/erase a filesystem"
382884
+ }
382885
+ ];
382886
+ });
382887
+
382784
382888
  // src/tools/BashTool/bashCommandHelpers.ts
382785
382889
  async function segmentedCommandPermissionResult(input, segments, bashToolHasPermissionFn, checkers) {
382786
382890
  const cdCommands = segments.filter((segment2) => {
@@ -383809,6 +383913,29 @@ function isNormalizedCdCommand(command) {
383809
383913
  function commandHasAnyCd(command) {
383810
383914
  return splitCommand(command).some((subcmd) => isNormalizedCdCommand(subcmd.trim()));
383811
383915
  }
383916
+ async function applyCommandApprovalPolicy(command, result) {
383917
+ if (result.behavior !== "allow") {
383918
+ return result;
383919
+ }
383920
+ const approvalMode = getInitialSettings().commandApproval;
383921
+ if (approvalMode === "never") {
383922
+ return result;
383923
+ }
383924
+ const isDangerous = getDestructiveCommandWarning(command) !== null;
383925
+ if (approvalMode === "always" || approvalMode === "dangerous" && isDangerous) {
383926
+ const decisionReason = {
383927
+ type: "other",
383928
+ reason: approvalMode === "always" ? "commandApproval=always requires confirmation before running commands" : "commandApproval=dangerous requires confirmation for heuristically dangerous commands"
383929
+ };
383930
+ return {
383931
+ behavior: "ask",
383932
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
383933
+ updatedInput: result.updatedInput,
383934
+ decisionReason
383935
+ };
383936
+ }
383937
+ return result;
383938
+ }
383812
383939
  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
383940
  const command = input.command.trim();
383814
383941
  const { matchingDenyRules, matchingAskRules, matchingAllowRules } = matchingRulesForInput2(input, toolPermissionContext, "exact");
@@ -383946,8 +384073,10 @@ var init_bashPermissions = __esm(() => {
383946
384073
  init_platform();
383947
384074
  init_sandbox_adapter();
383948
384075
  init_slowOperations();
384076
+ init_settings2();
383949
384077
  init_windowsPaths();
383950
384078
  init_BashTool();
384079
+ init_destructiveCommandWarning();
383951
384080
  init_bashCommandHelpers();
383952
384081
  init_bashSecurity();
383953
384082
  init_modeValidation2();
@@ -514611,85 +514740,6 @@ var init_AskUserQuestionPermissionRequest = __esm(() => {
514611
514740
  jsx_dev_runtime373 = __toESM(require_jsx_dev_runtime(), 1);
514612
514741
  });
514613
514742
 
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
514743
  // src/utils/shell/specPrefix.ts
514694
514744
  function isKnownSubcommand(arg, spec) {
514695
514745
  if (!spec?.subcommands?.length)
@@ -563509,6 +563559,7 @@ var init_migrateEnableAllProjectMcpServersToSettings = __esm(() => {
563509
563559
  // src/migrations/migrateFennecToOpus.ts
563510
563560
  var init_migrateFennecToOpus = __esm(() => {
563511
563561
  init_log3();
563562
+ init_config();
563512
563563
  init_providers();
563513
563564
  init_settings2();
563514
563565
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnycode/myclaude",
3
- "version": "0.1.184",
3
+ "version": "0.1.186",
4
4
  "private": false,
5
5
  "description": "An open-source AI coding assistant in your terminal - powered by Claude",
6
6
  "license": "MIT",