@codemcp/ade-cli 0.2.5 → 0.2.6

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.
Files changed (2) hide show
  1. package/dist/index.js +317 -338
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -12595,49 +12595,6 @@ var backpressureFacet = {
12595
12595
  };
12596
12596
 
12597
12597
  // ../core/dist/catalog/facets/autonomy.js
12598
- var ALL_CAPABILITIES = [
12599
- "read",
12600
- "edit_write",
12601
- "search_list",
12602
- "bash_safe",
12603
- "bash_unsafe",
12604
- "web",
12605
- "task_agent"
12606
- ];
12607
- function capabilityMap(defaultDecision, overrides = {}) {
12608
- return Object.fromEntries(ALL_CAPABILITIES.map((capability) => [
12609
- capability,
12610
- overrides[capability] ?? defaultDecision
12611
- ]));
12612
- }
12613
- function autonomyPolicy(profile) {
12614
- switch (profile) {
12615
- case "rigid":
12616
- return {
12617
- profile,
12618
- capabilities: capabilityMap("ask")
12619
- };
12620
- case "sensible-defaults":
12621
- return {
12622
- profile,
12623
- capabilities: capabilityMap("ask", {
12624
- read: "allow",
12625
- edit_write: "allow",
12626
- search_list: "allow",
12627
- bash_safe: "allow",
12628
- task_agent: "allow",
12629
- web: "ask"
12630
- })
12631
- };
12632
- case "max-autonomy":
12633
- return {
12634
- profile,
12635
- capabilities: capabilityMap("allow", {
12636
- web: "ask"
12637
- })
12638
- };
12639
- }
12640
- }
12641
12598
  var autonomyFacet = {
12642
12599
  id: "autonomy",
12643
12600
  label: "Autonomy",
@@ -12652,7 +12609,7 @@ var autonomyFacet = {
12652
12609
  recipe: [
12653
12610
  {
12654
12611
  writer: "permission-policy",
12655
- config: autonomyPolicy("rigid")
12612
+ config: { profile: "rigid" }
12656
12613
  }
12657
12614
  ]
12658
12615
  },
@@ -12663,7 +12620,7 @@ var autonomyFacet = {
12663
12620
  recipe: [
12664
12621
  {
12665
12622
  writer: "permission-policy",
12666
- config: autonomyPolicy("sensible-defaults")
12623
+ config: { profile: "sensible-defaults" }
12667
12624
  }
12668
12625
  ]
12669
12626
  },
@@ -12674,7 +12631,7 @@ var autonomyFacet = {
12674
12631
  recipe: [
12675
12632
  {
12676
12633
  writer: "permission-policy",
12677
- config: autonomyPolicy("max-autonomy")
12634
+ config: { profile: "max-autonomy" }
12678
12635
  }
12679
12636
  ]
12680
12637
  }
@@ -12874,11 +12831,7 @@ function mergePermissionPolicy(existing, incoming) {
12874
12831
  }
12875
12832
  return {
12876
12833
  ...existing,
12877
- ...incoming,
12878
- capabilities: {
12879
- ...existing.capabilities,
12880
- ...incoming.capabilities
12881
- }
12834
+ ...incoming
12882
12835
  };
12883
12836
  }
12884
12837
  function collectDocsets(choices, catalog) {
@@ -21975,28 +21928,28 @@ ${skill.body}
21975
21928
  }
21976
21929
  return modified;
21977
21930
  }
21931
+ function formatYamlKey(value) {
21932
+ return /^[A-Za-z_][A-Za-z0-9_-]*$/.test(value) ? value : JSON.stringify(value);
21933
+ }
21978
21934
 
21979
21935
  // ../harnesses/dist/writers/universal.js
21980
21936
  import { join as join10 } from "path";
21981
21937
  import { writeFile as writeFile5 } from "fs/promises";
21982
- var CAPABILITY_ORDER = [
21983
- "read",
21984
- "edit_write",
21985
- "search_list",
21986
- "bash_safe",
21987
- "bash_unsafe",
21988
- "web",
21989
- "task_agent"
21990
- ];
21991
- function formatCapabilityGuidance(capability, decision) {
21992
- return `- \`${capability}\`: ${decision}`;
21938
+
21939
+ // ../harnesses/dist/permission-policy.js
21940
+ function getAutonomyProfile(config) {
21941
+ return config.permission_policy?.profile;
21993
21942
  }
21943
+ function hasPermissionPolicy(config) {
21944
+ return config.permission_policy !== void 0;
21945
+ }
21946
+
21947
+ // ../harnesses/dist/writers/universal.js
21994
21948
  function renderAutonomyGuidance(config) {
21995
- const policy = config.permission_policy;
21996
- if (!policy) {
21949
+ const profile = getAutonomyProfile(config);
21950
+ if (!profile) {
21997
21951
  return void 0;
21998
21952
  }
21999
- const capabilityLines = CAPABILITY_ORDER.map((capability) => formatCapabilityGuidance(capability, policy.capabilities[capability]));
22000
21953
  return [
22001
21954
  "## Autonomy",
22002
21955
  "",
@@ -22004,14 +21957,51 @@ function renderAutonomyGuidance(config) {
22004
21957
  "",
22005
21958
  "Treat this autonomy profile as documentation-only guidance for built-in/basic operations.",
22006
21959
  "",
22007
- `Profile: \`${policy.profile}\``,
21960
+ `Profile: \`${profile}\``,
22008
21961
  "",
22009
- "Built-in/basic capability guidance:",
22010
- ...capabilityLines,
21962
+ ...getUniversalProfileGuidance(profile),
22011
21963
  "",
22012
21964
  "MCP permissions are not re-modeled by autonomy here; any MCP approvals must come from provisioning-aware consuming harnesses rather than the Universal writer."
22013
21965
  ].join("\n");
22014
21966
  }
21967
+ function getUniversalProfileGuidance(profile) {
21968
+ const header = "Built-in/basic capability guidance:";
21969
+ switch (profile) {
21970
+ case "rigid":
21971
+ return [
21972
+ header,
21973
+ "- `read`: allow",
21974
+ "- `edit_write`: ask",
21975
+ "- `search_list`: ask",
21976
+ "- `bash_safe`: ask",
21977
+ "- `bash_unsafe`: ask",
21978
+ "- `web`: ask",
21979
+ "- `task_agent`: ask"
21980
+ ];
21981
+ case "sensible-defaults":
21982
+ return [
21983
+ header,
21984
+ "- `read`: allow",
21985
+ "- `edit_write`: allow",
21986
+ "- `search_list`: allow",
21987
+ "- `bash_safe`: allow",
21988
+ "- `bash_unsafe`: ask",
21989
+ "- `web`: ask",
21990
+ "- `task_agent`: allow"
21991
+ ];
21992
+ case "max-autonomy":
21993
+ return [
21994
+ header,
21995
+ "- `read`: allow",
21996
+ "- `edit_write`: allow",
21997
+ "- `search_list`: allow",
21998
+ "- `bash_safe`: allow",
21999
+ "- `bash_unsafe`: allow",
22000
+ "- `web`: ask",
22001
+ "- `task_agent`: allow"
22002
+ ];
22003
+ }
22004
+ }
22015
22005
  var universalWriter = {
22016
22006
  id: "universal",
22017
22007
  label: "Universal (AGENTS.md + .mcp.json)",
@@ -22039,162 +22029,6 @@ var universalWriter = {
22039
22029
 
22040
22030
  // ../harnesses/dist/writers/claude-code.js
22041
22031
  import { join as join11 } from "path";
22042
-
22043
- // ../harnesses/dist/permission-policy.js
22044
- var SENSIBLE_DEFAULTS_RULES = {
22045
- read: {
22046
- "*": "allow",
22047
- "*.env": "deny",
22048
- "*.env.*": "deny",
22049
- "*.env.example": "allow"
22050
- },
22051
- edit: "allow",
22052
- glob: "allow",
22053
- grep: "allow",
22054
- list: "allow",
22055
- lsp: "allow",
22056
- task: "allow",
22057
- todoread: "deny",
22058
- todowrite: "deny",
22059
- skill: "deny",
22060
- webfetch: "ask",
22061
- websearch: "ask",
22062
- codesearch: "ask",
22063
- bash: {
22064
- "*": "deny",
22065
- "grep *": "allow",
22066
- "rg *": "allow",
22067
- "find *": "allow",
22068
- "fd *": "allow",
22069
- ls: "allow",
22070
- "ls *": "allow",
22071
- "cat *": "allow",
22072
- "head *": "allow",
22073
- "tail *": "allow",
22074
- "wc *": "allow",
22075
- "sort *": "allow",
22076
- "uniq *": "allow",
22077
- "diff *": "allow",
22078
- "echo *": "allow",
22079
- "printf *": "allow",
22080
- pwd: "allow",
22081
- "which *": "allow",
22082
- "type *": "allow",
22083
- whoami: "allow",
22084
- date: "allow",
22085
- "date *": "allow",
22086
- env: "allow",
22087
- "tree *": "allow",
22088
- "file *": "allow",
22089
- "stat *": "allow",
22090
- "readlink *": "allow",
22091
- "realpath *": "allow",
22092
- "dirname *": "allow",
22093
- "basename *": "allow",
22094
- "sed *": "allow",
22095
- "awk *": "allow",
22096
- "cut *": "allow",
22097
- "tr *": "allow",
22098
- "tee *": "allow",
22099
- "xargs *": "allow",
22100
- "jq *": "allow",
22101
- "yq *": "allow",
22102
- "mkdir *": "allow",
22103
- "touch *": "allow",
22104
- "cp *": "ask",
22105
- "mv *": "ask",
22106
- "ln *": "ask",
22107
- "npm *": "ask",
22108
- "node *": "ask",
22109
- "pip *": "ask",
22110
- "python *": "ask",
22111
- "python3 *": "ask",
22112
- "rm *": "deny",
22113
- "rmdir *": "deny",
22114
- "curl *": "deny",
22115
- "wget *": "deny",
22116
- "chmod *": "deny",
22117
- "chown *": "deny",
22118
- "sudo *": "deny",
22119
- "su *": "deny",
22120
- "sh *": "deny",
22121
- "bash *": "deny",
22122
- "zsh *": "deny",
22123
- "eval *": "deny",
22124
- "exec *": "deny",
22125
- "source *": "deny",
22126
- ". *": "deny",
22127
- "nohup *": "deny",
22128
- "dd *": "deny",
22129
- "mkfs *": "deny",
22130
- "mount *": "deny",
22131
- "umount *": "deny",
22132
- "kill *": "deny",
22133
- "killall *": "deny",
22134
- "pkill *": "deny",
22135
- "nc *": "deny",
22136
- "ncat *": "deny",
22137
- "ssh *": "deny",
22138
- "scp *": "deny",
22139
- "rsync *": "deny",
22140
- "docker *": "deny",
22141
- "kubectl *": "deny",
22142
- "systemctl *": "deny",
22143
- "service *": "deny",
22144
- "crontab *": "deny",
22145
- reboot: "deny",
22146
- "shutdown *": "deny",
22147
- "passwd *": "deny",
22148
- "useradd *": "deny",
22149
- "userdel *": "deny",
22150
- "iptables *": "deny"
22151
- },
22152
- external_directory: "deny",
22153
- doom_loop: "deny"
22154
- };
22155
- function getAutonomyProfile(config) {
22156
- return config.permission_policy?.profile;
22157
- }
22158
- function hasPermissionPolicy(config) {
22159
- return config.permission_policy !== void 0;
22160
- }
22161
- function getCapabilityDecision(config, capability) {
22162
- return config.permission_policy?.capabilities?.[capability];
22163
- }
22164
- function allowsCapability(config, capability) {
22165
- return getCapabilityDecision(config, capability) === "allow";
22166
- }
22167
- function keepsWebOnAsk(config) {
22168
- return getCapabilityDecision(config, "web") === "ask";
22169
- }
22170
- function getHarnessPermissionRules(config) {
22171
- switch (config.permission_policy?.profile) {
22172
- case "rigid":
22173
- return {
22174
- "*": "ask",
22175
- webfetch: "ask",
22176
- websearch: "ask",
22177
- codesearch: "ask",
22178
- external_directory: "deny",
22179
- doom_loop: "deny"
22180
- };
22181
- case "sensible-defaults":
22182
- return SENSIBLE_DEFAULTS_RULES;
22183
- case "max-autonomy":
22184
- return {
22185
- "*": "allow",
22186
- webfetch: "ask",
22187
- websearch: "ask",
22188
- codesearch: "ask",
22189
- external_directory: "deny",
22190
- doom_loop: "deny"
22191
- };
22192
- default:
22193
- return void 0;
22194
- }
22195
- }
22196
-
22197
- // ../harnesses/dist/writers/claude-code.js
22198
22032
  var claudeCodeWriter = {
22199
22033
  id: "claude-code",
22200
22034
  label: "Claude Code",
@@ -22217,7 +22051,7 @@ async function writeClaudeSettings(config, projectRoot) {
22217
22051
  const existingPerms = existing.permissions ?? {};
22218
22052
  const existingAllow = asStringArray2(existingPerms.allow);
22219
22053
  const existingAsk = asStringArray2(existingPerms.ask);
22220
- const autonomyRules = getClaudeAutonomyRules(config);
22054
+ const autonomyRules = getClaudeAutonomyRules(getAutonomyProfile(config));
22221
22055
  const mcpRules = getClaudeMcpAllowRules(config);
22222
22056
  const allowRules = [
22223
22057
  .../* @__PURE__ */ new Set([...existingAllow, ...autonomyRules.allow, ...mcpRules])
@@ -22243,6 +22077,7 @@ function getClaudeMcpAllowRules(config) {
22243
22077
  for (const server of config.mcp_servers) {
22244
22078
  const allowedTools = server.allowedTools;
22245
22079
  if (!allowedTools || allowedTools.includes("*")) {
22080
+ allowRules.push(`mcp__${server.ref}__*`);
22246
22081
  continue;
22247
22082
  }
22248
22083
  for (const tool of allowedTools) {
@@ -22251,41 +22086,40 @@ function getClaudeMcpAllowRules(config) {
22251
22086
  }
22252
22087
  return allowRules;
22253
22088
  }
22254
- function getClaudeAutonomyRules(config) {
22255
- const ask = keepsWebOnAsk(config) ? ["WebFetch", "WebSearch"] : [];
22256
- return {
22257
- allow: [
22258
- ...allowsCapability(config, "read") ? ["Read"] : [],
22259
- ...allowsCapability(config, "edit_write") ? ["Edit"] : [],
22260
- ...allowsCapability(config, "search_list") ? ["Glob", "Grep"] : [],
22261
- ...allowsCapability(config, "bash_unsafe") ? ["Bash"] : [],
22262
- ...allowsCapability(config, "task_agent") ? ["TodoWrite"] : []
22263
- ],
22264
- ask
22265
- };
22089
+ function getClaudeAutonomyRules(profile) {
22090
+ switch (profile) {
22091
+ case "rigid":
22092
+ return {
22093
+ allow: ["Read"],
22094
+ ask: [
22095
+ "Edit",
22096
+ "Write",
22097
+ "Glob",
22098
+ "Grep",
22099
+ "Bash",
22100
+ "WebFetch",
22101
+ "WebSearch",
22102
+ "TodoWrite"
22103
+ ]
22104
+ };
22105
+ case "sensible-defaults":
22106
+ return {
22107
+ allow: ["Read", "Edit", "Write", "Glob", "Grep", "TodoWrite"],
22108
+ ask: ["WebFetch", "WebSearch"]
22109
+ };
22110
+ case "max-autonomy":
22111
+ return {
22112
+ allow: ["Read", "Edit", "Write", "Glob", "Grep", "Bash", "TodoWrite"],
22113
+ ask: ["WebFetch", "WebSearch"]
22114
+ };
22115
+ default:
22116
+ return { allow: [], ask: [] };
22117
+ }
22266
22118
  }
22267
22119
 
22268
22120
  // ../harnesses/dist/writers/cursor.js
22269
22121
  import { mkdir as mkdir4, writeFile as writeFile6 } from "fs/promises";
22270
22122
  import { join as join12 } from "path";
22271
- var CURSOR_CAPABILITY_ORDER = [
22272
- "read",
22273
- "edit_write",
22274
- "search_list",
22275
- "bash_safe",
22276
- "bash_unsafe",
22277
- "web",
22278
- "task_agent"
22279
- ];
22280
- var CURSOR_CAPABILITY_LABELS = {
22281
- read: "read project files",
22282
- edit_write: "edit and write project files",
22283
- search_list: "search and list project contents",
22284
- bash_safe: "run safe local shell commands",
22285
- bash_unsafe: "run high-impact shell commands",
22286
- web: "use web or network access",
22287
- task_agent: "delegate or decompose work into agent tasks"
22288
- };
22289
22123
  var cursorWriter = {
22290
22124
  id: "cursor",
22291
22125
  label: "Cursor",
@@ -22318,21 +22152,36 @@ function getCursorAutonomyNotes(config) {
22318
22152
  if (!hasPermissionPolicy(config)) {
22319
22153
  return [];
22320
22154
  }
22321
- const allowedCapabilities = CURSOR_CAPABILITY_ORDER.filter((capability) => getCapabilityDecision(config, capability) === "allow").map((capability) => CURSOR_CAPABILITY_LABELS[capability]);
22322
- const approvalGatedCapabilities = CURSOR_CAPABILITY_ORDER.filter((capability) => getCapabilityDecision(config, capability) === "ask").map((capability) => CURSOR_CAPABILITY_LABELS[capability]);
22155
+ const profile = getAutonomyProfile(config);
22323
22156
  return [
22324
- `Cursor autonomy note (documented, not enforced): ${getAutonomyProfile(config) ?? "custom"}.`,
22157
+ `Cursor autonomy note (documented, not enforced): ${profile ?? "custom"}.`,
22325
22158
  "Cursor has no verified committed project-local built-in ask/allow/deny config surface, so ADE documents autonomy intent here instead of writing unsupported permission config.",
22326
- ...allowedCapabilities.length > 0 ? [
22327
- `Prefer handling these built-in capabilities without extra approval when Cursor permits it: ${allowedCapabilities.join(", ")}.`
22328
- ] : [],
22329
- ...approvalGatedCapabilities.length > 0 ? [
22330
- `Request approval before these capabilities: ${approvalGatedCapabilities.join(", ")}.`
22331
- ] : [],
22159
+ ...getCursorProfileGuidance(profile),
22332
22160
  "Web and network access must remain approval-gated.",
22333
22161
  "MCP server registration stays in .cursor/mcp.json; MCP tool approvals remain owned by provisioning and are not enforced or re-modeled in this rules file."
22334
22162
  ];
22335
22163
  }
22164
+ function getCursorProfileGuidance(profile) {
22165
+ switch (profile) {
22166
+ case "rigid":
22167
+ return [
22168
+ "Prefer handling these built-in capabilities without extra approval when Cursor permits it: read project files.",
22169
+ "Request approval before these capabilities: edit and write project files, search and list project contents, run safe local shell commands, run high-impact shell commands, use web or network access, delegate or decompose work into agent tasks."
22170
+ ];
22171
+ case "sensible-defaults":
22172
+ return [
22173
+ "Prefer handling these built-in capabilities without extra approval when Cursor permits it: read project files, edit and write project files, search and list project contents, run safe local shell commands, delegate or decompose work into agent tasks.",
22174
+ "Request approval before these capabilities: run high-impact shell commands, use web or network access."
22175
+ ];
22176
+ case "max-autonomy":
22177
+ return [
22178
+ "Prefer handling these built-in capabilities without extra approval when Cursor permits it: read project files, edit and write project files, search and list project contents, run safe local shell commands, run high-impact shell commands, delegate or decompose work into agent tasks.",
22179
+ "Request approval before these capabilities: use web or network access."
22180
+ ];
22181
+ default:
22182
+ return [];
22183
+ }
22184
+ }
22336
22185
 
22337
22186
  // ../harnesses/dist/writers/copilot.js
22338
22187
  import { join as join13 } from "path";
@@ -22347,7 +22196,7 @@ var copilotWriter = {
22347
22196
  transform: stdioEntry
22348
22197
  });
22349
22198
  const tools = [
22350
- ...getBuiltInTools(config),
22199
+ ...getBuiltInTools(getAutonomyProfile(config)),
22351
22200
  ...getForwardedMcpTools(config.mcp_servers)
22352
22201
  ];
22353
22202
  await writeAgentMd(config, {
@@ -22361,19 +22210,17 @@ var copilotWriter = {
22361
22210
  await writeGitHooks(config.git_hooks, projectRoot);
22362
22211
  }
22363
22212
  };
22364
- function getBuiltInTools(config) {
22365
- if (!hasPermissionPolicy(config)) {
22366
- return ["read", "edit", "search", "execute", "agent", "web"];
22213
+ function getBuiltInTools(profile) {
22214
+ switch (profile) {
22215
+ case "rigid":
22216
+ return ["read"];
22217
+ case "sensible-defaults":
22218
+ return ["read", "edit", "search", "agent"];
22219
+ case "max-autonomy":
22220
+ return ["read", "edit", "search", "execute", "agent", "todo"];
22221
+ default:
22222
+ return ["read", "edit", "search", "execute", "agent", "web"];
22367
22223
  }
22368
- return [
22369
- ...allowsCapability(config, "read") ? ["read"] : [],
22370
- ...allowsCapability(config, "edit_write") ? ["edit"] : [],
22371
- ...allowsCapability(config, "search_list") ? ["search"] : [],
22372
- ...allowsCapability(config, "bash_unsafe") ? ["execute"] : [],
22373
- ...allowsCapability(config, "task_agent") ? ["agent"] : [],
22374
- ...allowsCapability(config, "task_agent") && allowsCapability(config, "bash_unsafe") ? ["todo"] : [],
22375
- ...!keepsWebOnAsk(config) && allowsCapability(config, "web") ? ["web"] : []
22376
- ];
22377
22224
  }
22378
22225
  function getForwardedMcpTools(servers) {
22379
22226
  return servers.flatMap((server) => {
@@ -22404,9 +22251,6 @@ function renderCopilotAgentMcpServers(servers) {
22404
22251
  }
22405
22252
  return lines;
22406
22253
  }
22407
- function formatYamlKey(value) {
22408
- return /^[A-Za-z_][A-Za-z0-9_-]*$/.test(value) ? value : JSON.stringify(value);
22409
- }
22410
22254
 
22411
22255
  // ../harnesses/dist/writers/windsurf.js
22412
22256
  import { join as join14 } from "path";
@@ -22427,41 +22271,37 @@ function getWindsurfRules(config) {
22427
22271
  if (!hasPermissionPolicy(config)) {
22428
22272
  return config.instructions;
22429
22273
  }
22430
- const { capabilities } = config.permission_policy;
22431
- const allow = listCapabilities(capabilities, "allow");
22432
- const ask = listCapabilities(capabilities, "ask");
22433
- const deny = listCapabilities(capabilities, "deny");
22434
22274
  const autonomyGuidance = [
22435
22275
  "Windsurf limitation: ADE could not verify a stable committed project-local permission schema for Windsurf built-in tools, so this autonomy policy is advisory only and should be applied conservatively.",
22436
- formatGuidance(allow, ask, deny)
22276
+ getWindsurfProfileGuidance(getAutonomyProfile(config))
22437
22277
  ];
22438
22278
  return [...autonomyGuidance, ...config.instructions];
22439
22279
  }
22440
- function listCapabilities(capabilities, decision) {
22441
- return Object.entries(capabilities).filter(([, value]) => value === decision).map(([capability]) => CAPABILITY_LABELS[capability]);
22442
- }
22443
- function formatGuidance(allow, ask, deny) {
22444
- const lines = ["Autonomy guidance for Windsurf built-in capabilities:"];
22445
- if (allow.length > 0) {
22446
- lines.push(`- May proceed without extra approval: ${allow.join(", ")}.`);
22447
- }
22448
- if (ask.length > 0) {
22449
- lines.push(`- Ask before: ${ask.join(", ")}.`);
22450
- }
22451
- if (deny.length > 0) {
22452
- lines.push(`- Do not use unless the user explicitly overrides: ${deny.join(", ")}.`);
22280
+ function getWindsurfProfileGuidance(profile) {
22281
+ const header = "Autonomy guidance for Windsurf built-in capabilities:";
22282
+ switch (profile) {
22283
+ case "rigid":
22284
+ return [
22285
+ header,
22286
+ "- May proceed without extra approval: read files.",
22287
+ "- Ask before: edit and write files, search and list files, safe local shell commands, unsafe local shell commands, web and network access, task or agent delegation."
22288
+ ].join("\n");
22289
+ case "sensible-defaults":
22290
+ return [
22291
+ header,
22292
+ "- May proceed without extra approval: read files, edit and write files, search and list files, safe local shell commands, task or agent delegation.",
22293
+ "- Ask before: unsafe local shell commands, web and network access."
22294
+ ].join("\n");
22295
+ case "max-autonomy":
22296
+ return [
22297
+ header,
22298
+ "- May proceed without extra approval: read files, edit and write files, search and list files, safe local shell commands, unsafe local shell commands, task or agent delegation.",
22299
+ "- Ask before: web and network access."
22300
+ ].join("\n");
22301
+ default:
22302
+ return `${header} follow project conventions.`;
22453
22303
  }
22454
- return lines.join("\n");
22455
22304
  }
22456
- var CAPABILITY_LABELS = {
22457
- read: "read files",
22458
- edit_write: "edit and write files",
22459
- search_list: "search and list files",
22460
- bash_safe: "safe local shell commands",
22461
- bash_unsafe: "unsafe local shell commands",
22462
- web: "web and network access",
22463
- task_agent: "task or agent delegation"
22464
- };
22465
22305
 
22466
22306
  // ../harnesses/dist/writers/cline.js
22467
22307
  import { join as join15 } from "path";
@@ -22510,7 +22350,7 @@ async function writeRooModes(config, projectRoot) {
22510
22350
  slug: "ade",
22511
22351
  name: "ADE",
22512
22352
  roleDefinition: "ADE \u2014 Agentic Development Environment mode generated by ADE.",
22513
- groups: getRooModeGroups(config),
22353
+ groups: getRooModeGroups(getAutonomyProfile(config), config.mcp_servers.length > 0),
22514
22354
  source: "project"
22515
22355
  }
22516
22356
  }
@@ -22519,13 +22359,18 @@ async function writeRooModes(config, projectRoot) {
22519
22359
  function asRecord(value) {
22520
22360
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
22521
22361
  }
22522
- function getRooModeGroups(config) {
22523
- return [
22524
- ...allowsCapability(config, "read") ? ["read"] : [],
22525
- ...allowsCapability(config, "edit_write") ? ["edit"] : [],
22526
- ...allowsCapability(config, "bash_unsafe") ? ["command"] : [],
22527
- ...config.mcp_servers.length > 0 ? ["mcp"] : []
22528
- ];
22362
+ function getRooModeGroups(profile, hasMcpServers) {
22363
+ const mcpGroup = hasMcpServers ? ["mcp"] : [];
22364
+ switch (profile) {
22365
+ case "rigid":
22366
+ return ["read", ...mcpGroup];
22367
+ case "sensible-defaults":
22368
+ return ["read", "edit", ...mcpGroup];
22369
+ case "max-autonomy":
22370
+ return ["read", "edit", "command", ...mcpGroup];
22371
+ default:
22372
+ return ["read", "edit", "command", ...mcpGroup];
22373
+ }
22529
22374
  }
22530
22375
 
22531
22376
  // ../harnesses/dist/writers/kiro.js
@@ -22542,33 +22387,31 @@ var kiroWriter = {
22542
22387
  autoApprove: server.allowedTools ?? ["*"]
22543
22388
  })
22544
22389
  });
22390
+ const tools = getKiroTools(getAutonomyProfile(config), config.mcp_servers);
22545
22391
  await writeJson(join17(projectRoot, ".kiro", "agents", "ade.json"), {
22546
22392
  name: "ade",
22547
22393
  description: "ADE \u2014 Agentic Development Environment agent with project conventions and tools.",
22548
22394
  prompt: config.instructions.join("\n\n") || "ADE \u2014 Agentic Development Environment agent.",
22549
22395
  mcpServers: getKiroAgentMcpServers(config.mcp_servers),
22550
- tools: getKiroTools(config),
22551
- allowedTools: getKiroAllowedTools(config),
22396
+ tools,
22397
+ allowedTools: tools,
22552
22398
  useLegacyMcpJson: true
22553
22399
  });
22554
22400
  await writeGitHooks(config.git_hooks, projectRoot);
22555
22401
  }
22556
22402
  };
22557
- function getKiroTools(config) {
22558
- const mcpTools = getKiroForwardedMcpTools(config.mcp_servers);
22559
- if (!hasPermissionPolicy(config)) {
22560
- return ["read", "write", "shell", "spec", ...mcpTools];
22403
+ function getKiroTools(profile, servers) {
22404
+ const mcpTools = getKiroForwardedMcpTools(servers);
22405
+ switch (profile) {
22406
+ case "rigid":
22407
+ return ["read", "shell", "spec", ...mcpTools];
22408
+ case "sensible-defaults":
22409
+ return ["read", "write", "shell", "spec", ...mcpTools];
22410
+ case "max-autonomy":
22411
+ return ["read", "write", "shell(*)", "spec", ...mcpTools];
22412
+ default:
22413
+ return ["read", "write", "shell", "spec", ...mcpTools];
22561
22414
  }
22562
- return [
22563
- ...getCapabilityDecision(config, "read") !== "deny" ? ["read"] : [],
22564
- ...allowsCapability(config, "edit_write") ? ["write"] : [],
22565
- ...allowsCapability(config, "bash_unsafe") ? ["shell(*)"] : ["shell"],
22566
- "spec",
22567
- ...mcpTools
22568
- ];
22569
- }
22570
- function getKiroAllowedTools(config) {
22571
- return getKiroTools(config);
22572
22415
  }
22573
22416
  function getKiroForwardedMcpTools(servers) {
22574
22417
  return servers.flatMap((server) => {
@@ -22591,6 +22434,145 @@ function getKiroAgentMcpServers(servers) {
22591
22434
 
22592
22435
  // ../harnesses/dist/writers/opencode.js
22593
22436
  import { join as join18 } from "path";
22437
+ var RIGID_RULES = {
22438
+ "*": "ask",
22439
+ webfetch: "ask",
22440
+ websearch: "ask",
22441
+ codesearch: "ask",
22442
+ external_directory: "deny",
22443
+ doom_loop: "deny"
22444
+ };
22445
+ var SENSIBLE_DEFAULTS_RULES = {
22446
+ read: {
22447
+ "*": "allow",
22448
+ "*.env": "deny",
22449
+ "*.env.*": "deny",
22450
+ "*.env.example": "allow"
22451
+ },
22452
+ edit: "allow",
22453
+ glob: "allow",
22454
+ grep: "allow",
22455
+ list: "allow",
22456
+ lsp: "allow",
22457
+ task: "allow",
22458
+ todoread: "deny",
22459
+ todowrite: "deny",
22460
+ skill: "deny",
22461
+ webfetch: "ask",
22462
+ websearch: "ask",
22463
+ codesearch: "ask",
22464
+ bash: {
22465
+ "*": "deny",
22466
+ "grep *": "allow",
22467
+ "rg *": "allow",
22468
+ "find *": "allow",
22469
+ "fd *": "allow",
22470
+ ls: "allow",
22471
+ "ls *": "allow",
22472
+ "cat *": "allow",
22473
+ "head *": "allow",
22474
+ "tail *": "allow",
22475
+ "wc *": "allow",
22476
+ "sort *": "allow",
22477
+ "uniq *": "allow",
22478
+ "diff *": "allow",
22479
+ "echo *": "allow",
22480
+ "printf *": "allow",
22481
+ pwd: "allow",
22482
+ "which *": "allow",
22483
+ "type *": "allow",
22484
+ whoami: "allow",
22485
+ date: "allow",
22486
+ "date *": "allow",
22487
+ env: "allow",
22488
+ "tree *": "allow",
22489
+ "file *": "allow",
22490
+ "stat *": "allow",
22491
+ "readlink *": "allow",
22492
+ "realpath *": "allow",
22493
+ "dirname *": "allow",
22494
+ "basename *": "allow",
22495
+ "sed *": "allow",
22496
+ "awk *": "allow",
22497
+ "cut *": "allow",
22498
+ "tr *": "allow",
22499
+ "tee *": "allow",
22500
+ "xargs *": "allow",
22501
+ "jq *": "allow",
22502
+ "yq *": "allow",
22503
+ "mkdir *": "allow",
22504
+ "touch *": "allow",
22505
+ "cp *": "ask",
22506
+ "mv *": "ask",
22507
+ "ln *": "ask",
22508
+ "npm *": "ask",
22509
+ "node *": "ask",
22510
+ "pip *": "ask",
22511
+ "python *": "ask",
22512
+ "python3 *": "ask",
22513
+ "rm *": "deny",
22514
+ "rmdir *": "deny",
22515
+ "curl *": "deny",
22516
+ "wget *": "deny",
22517
+ "chmod *": "deny",
22518
+ "chown *": "deny",
22519
+ "sudo *": "deny",
22520
+ "su *": "deny",
22521
+ "sh *": "deny",
22522
+ "bash *": "deny",
22523
+ "zsh *": "deny",
22524
+ "eval *": "deny",
22525
+ "exec *": "deny",
22526
+ "source *": "deny",
22527
+ ". *": "deny",
22528
+ "nohup *": "deny",
22529
+ "dd *": "deny",
22530
+ "mkfs *": "deny",
22531
+ "mount *": "deny",
22532
+ "umount *": "deny",
22533
+ "kill *": "deny",
22534
+ "killall *": "deny",
22535
+ "pkill *": "deny",
22536
+ "nc *": "deny",
22537
+ "ncat *": "deny",
22538
+ "ssh *": "deny",
22539
+ "scp *": "deny",
22540
+ "rsync *": "deny",
22541
+ "docker *": "deny",
22542
+ "kubectl *": "deny",
22543
+ "systemctl *": "deny",
22544
+ "service *": "deny",
22545
+ "crontab *": "deny",
22546
+ reboot: "deny",
22547
+ "shutdown *": "deny",
22548
+ "passwd *": "deny",
22549
+ "useradd *": "deny",
22550
+ "userdel *": "deny",
22551
+ "iptables *": "deny"
22552
+ },
22553
+ external_directory: "deny",
22554
+ doom_loop: "deny"
22555
+ };
22556
+ var MAX_AUTONOMY_RULES = {
22557
+ "*": "allow",
22558
+ webfetch: "ask",
22559
+ websearch: "ask",
22560
+ codesearch: "ask",
22561
+ external_directory: "deny",
22562
+ doom_loop: "deny"
22563
+ };
22564
+ function getPermissionRules(profile) {
22565
+ switch (profile) {
22566
+ case "rigid":
22567
+ return RIGID_RULES;
22568
+ case "sensible-defaults":
22569
+ return SENSIBLE_DEFAULTS_RULES;
22570
+ case "max-autonomy":
22571
+ return MAX_AUTONOMY_RULES;
22572
+ default:
22573
+ return void 0;
22574
+ }
22575
+ }
22594
22576
  var opencodeWriter = {
22595
22577
  id: "opencode",
22596
22578
  label: "OpenCode",
@@ -22606,7 +22588,7 @@ var opencodeWriter = {
22606
22588
  }),
22607
22589
  defaults: { $schema: "https://opencode.ai/config.json" }
22608
22590
  });
22609
- const permission = getHarnessPermissionRules(config);
22591
+ const permission = getPermissionRules(getAutonomyProfile(config));
22610
22592
  await writeAgentMd(config, {
22611
22593
  path: join18(projectRoot, ".opencode", "agents", "ade.md"),
22612
22594
  extraFrontmatter: permission ? renderYamlMapping("permission", permission) : void 0,
@@ -22617,19 +22599,16 @@ var opencodeWriter = {
22617
22599
  };
22618
22600
  function renderYamlMapping(key, value, indent = 0) {
22619
22601
  const prefix = " ".repeat(indent);
22620
- const lines = [`${prefix}${formatYamlKey2(key)}:`];
22602
+ const lines = [`${prefix}${formatYamlKey(key)}:`];
22621
22603
  for (const [childKey, childValue] of Object.entries(value)) {
22622
22604
  if (typeof childValue === "object" && childValue !== null && !Array.isArray(childValue)) {
22623
22605
  lines.push(...renderYamlMapping(childKey, childValue, indent + 2));
22624
22606
  continue;
22625
22607
  }
22626
- lines.push(`${" ".repeat(indent + 2)}${formatYamlKey2(childKey)}: ${JSON.stringify(childValue)}`);
22608
+ lines.push(`${" ".repeat(indent + 2)}${formatYamlKey(childKey)}: ${JSON.stringify(childValue)}`);
22627
22609
  }
22628
22610
  return lines;
22629
22611
  }
22630
- function formatYamlKey2(value) {
22631
- return /^[A-Za-z_][A-Za-z0-9_-]*$/.test(value) ? value : JSON.stringify(value);
22632
- }
22633
22612
 
22634
22613
  // ../harnesses/dist/index.js
22635
22614
  var allHarnessWriters = [
package/package.json CHANGED
@@ -15,8 +15,8 @@
15
15
  "dependencies": {
16
16
  "@clack/prompts": "^1.1.0",
17
17
  "yaml": "^2.8.2",
18
- "@codemcp/ade-core": "0.2.5",
19
- "@codemcp/ade-harnesses": "0.2.5"
18
+ "@codemcp/ade-core": "0.2.6",
19
+ "@codemcp/ade-harnesses": "0.2.6"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@codemcp/knowledge": "2.1.0",
@@ -27,7 +27,7 @@
27
27
  "typescript": "^5.9.3",
28
28
  "vitest": "^3.2.4"
29
29
  },
30
- "version": "0.2.5",
30
+ "version": "0.2.6",
31
31
  "scripts": {
32
32
  "build": "tsup",
33
33
  "clean:build": "rimraf ./dist",