agentsmesh 0.26.0 → 0.28.0

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/engine.js CHANGED
@@ -31,16 +31,21 @@ function canUseScopedSettings(feature) {
31
31
  return settingsBackedFeatures.includes(feature);
32
32
  }
33
33
  function validateCapabilityImplementations(descriptor31, capabilities17, ctx, pathPrefix) {
34
+ const isGlobalScope = pathPrefix[0] === "globalSupport";
35
+ const hasScopeExtras = isGlobalScope && typeof descriptor31.globalSupport?.scopeExtras === "function";
34
36
  for (const requirement of generatorRequirements) {
35
37
  const level = capabilityLevel(capabilities17[requirement.feature]);
36
38
  if (level === "none") continue;
39
+ const settingsBacked = canUseScopedSettings(requirement.feature);
37
40
  const hasGenerator = typeof descriptor31.generators[requirement.generator] === "function";
38
- const hasSettingsEmitter = canUseScopedSettings(requirement.feature) && typeof descriptor31.emitScopedSettings === "function";
39
- if (hasGenerator || hasSettingsEmitter) continue;
41
+ const hasSettingsEmitter = settingsBacked && typeof descriptor31.emitScopedSettings === "function";
42
+ const hasScopeExtrasEmitter = settingsBacked && hasScopeExtras;
43
+ if (hasGenerator || hasSettingsEmitter || hasScopeExtrasEmitter) continue;
44
+ const settingsHint = settingsBacked ? isGlobalScope ? " or emitScopedSettings or globalSupport.scopeExtras" : " or emitScopedSettings" : "";
40
45
  ctx.addIssue({
41
46
  code: "custom",
42
47
  path: [...pathPrefix, requirement.feature],
43
- message: `Capability "${requirement.feature}" is "${level}" but generators.${requirement.generator}` + (canUseScopedSettings(requirement.feature) ? " or emitScopedSettings" : "") + " is missing."
48
+ message: `Capability "${requirement.feature}" is "${level}" but generators.${requirement.generator}${settingsHint} is missing.`
44
49
  });
45
50
  }
46
51
  }
@@ -1413,13 +1418,14 @@ var init_embedded_skill = __esm({
1413
1418
  });
1414
1419
 
1415
1420
  // src/targets/aider/constants.ts
1416
- var AIDER_TARGET, AIDER_CONVENTIONS, AIDER_SKILLS_DIR, AIDER_IGNORE, AIDER_GLOBAL_CONVENTIONS, AIDER_GLOBAL_SKILLS_DIR, AIDER_GLOBAL_IGNORE, AIDER_CANONICAL_RULES_DIR, AIDER_CANONICAL_IGNORE;
1421
+ var AIDER_TARGET, AIDER_CONVENTIONS, AIDER_SKILLS_DIR, AIDER_IGNORE, AIDER_CONF_FILE, AIDER_GLOBAL_CONVENTIONS, AIDER_GLOBAL_SKILLS_DIR, AIDER_GLOBAL_IGNORE, AIDER_CANONICAL_RULES_DIR, AIDER_CANONICAL_IGNORE;
1417
1422
  var init_constants = __esm({
1418
1423
  "src/targets/aider/constants.ts"() {
1419
1424
  AIDER_TARGET = "aider";
1420
1425
  AIDER_CONVENTIONS = "CONVENTIONS.md";
1421
1426
  AIDER_SKILLS_DIR = ".aider/skills";
1422
1427
  AIDER_IGNORE = ".aiderignore";
1428
+ AIDER_CONF_FILE = ".aider.conf.yml";
1423
1429
  AIDER_GLOBAL_CONVENTIONS = "CONVENTIONS.md";
1424
1430
  AIDER_GLOBAL_SKILLS_DIR = ".aider/skills";
1425
1431
  AIDER_GLOBAL_IGNORE = ".aiderignore";
@@ -1427,8 +1433,6 @@ var init_constants = __esm({
1427
1433
  AIDER_CANONICAL_IGNORE = ".agentsmesh/ignore";
1428
1434
  }
1429
1435
  });
1430
-
1431
- // src/targets/aider/generator.ts
1432
1436
  function generateRules(canonical) {
1433
1437
  const root = canonical.rules.find((rule) => rule.root);
1434
1438
  const nonRootRules = canonical.rules.filter((rule) => {
@@ -1438,7 +1442,10 @@ function generateRules(canonical) {
1438
1442
  const rootBody = root?.body.trim() ?? "";
1439
1443
  const content = appendEmbeddedRulesBlock(rootBody, nonRootRules);
1440
1444
  if (!content) return [];
1441
- return [{ path: AIDER_CONVENTIONS, content }];
1445
+ return [
1446
+ { path: AIDER_CONVENTIONS, content },
1447
+ { path: AIDER_CONF_FILE, content: stringify({ read: [AIDER_CONVENTIONS] }) }
1448
+ ];
1442
1449
  }
1443
1450
  function generateSkills(canonical) {
1444
1451
  return generateEmbeddedSkills(canonical, AIDER_SKILLS_DIR);
@@ -3312,7 +3319,7 @@ var init_antigravity = __esm({
3312
3319
  });
3313
3320
 
3314
3321
  // src/targets/augment-code/constants.ts
3315
- var AUGMENT_CODE_TARGET, AUGMENT_CODE_DIR, AUGMENT_CODE_RULES_DIR, AUGMENT_CODE_COMMANDS_DIR, AUGMENT_CODE_AGENTS_DIR, AUGMENT_CODE_SKILLS_DIR, AUGMENT_CODE_SETTINGS_FILE, AUGMENT_CODE_IGNORE_FILE, AUGMENT_CODE_GLOBAL_DIR, AUGMENT_CODE_GLOBAL_RULES_DIR, AUGMENT_CODE_GLOBAL_COMMANDS_DIR, AUGMENT_CODE_GLOBAL_AGENTS_DIR, AUGMENT_CODE_GLOBAL_SKILLS_DIR, AUGMENT_CODE_GLOBAL_SETTINGS_FILE, AUGMENT_CODE_CANONICAL_RULES_DIR, AUGMENT_CODE_CANONICAL_AGENTS_DIR, AUGMENT_CODE_CANONICAL_MCP, AUGMENT_CODE_CANONICAL_HOOKS, AUGMENT_CODE_CANONICAL_IGNORE;
3322
+ var AUGMENT_CODE_TARGET, AUGMENT_CODE_DIR, AUGMENT_CODE_RULES_DIR, AUGMENT_CODE_COMMANDS_DIR, AUGMENT_CODE_AGENTS_DIR, AUGMENT_CODE_SKILLS_DIR, AUGMENT_CODE_SETTINGS_FILE, AUGMENT_CODE_IGNORE_FILE, AUGMENT_CODE_GLOBAL_DIR, AUGMENT_CODE_GLOBAL_RULES_DIR, AUGMENT_CODE_GLOBAL_COMMANDS_DIR, AUGMENT_CODE_GLOBAL_AGENTS_DIR, AUGMENT_CODE_GLOBAL_SKILLS_DIR, AUGMENT_CODE_GLOBAL_SETTINGS_FILE, AUGMENT_CODE_CANONICAL_RULES_DIR, AUGMENT_CODE_CANONICAL_AGENTS_DIR, AUGMENT_CODE_CANONICAL_MCP, AUGMENT_CODE_CANONICAL_HOOKS, AUGMENT_CODE_CANONICAL_IGNORE, AUGMENT_CODE_CANONICAL_PERMISSIONS;
3316
3323
  var init_constants6 = __esm({
3317
3324
  "src/targets/augment-code/constants.ts"() {
3318
3325
  AUGMENT_CODE_TARGET = "augment-code";
@@ -3334,6 +3341,7 @@ var init_constants6 = __esm({
3334
3341
  AUGMENT_CODE_CANONICAL_MCP = ".agentsmesh/mcp.json";
3335
3342
  AUGMENT_CODE_CANONICAL_HOOKS = ".agentsmesh/hooks.yaml";
3336
3343
  AUGMENT_CODE_CANONICAL_IGNORE = ".agentsmesh/ignore";
3344
+ AUGMENT_CODE_CANONICAL_PERMISSIONS = ".agentsmesh/permissions.yaml";
3337
3345
  }
3338
3346
  });
3339
3347
 
@@ -3546,7 +3554,7 @@ var init_codex_cli = __esm({
3546
3554
  });
3547
3555
 
3548
3556
  // src/targets/continue/constants.ts
3549
- var CONTINUE_TARGET, CONTINUE_RULES_DIR, CONTINUE_PROMPTS_DIR, CONTINUE_MCP_DIR, CONTINUE_MCP_FILE, CONTINUE_ROOT_RULE, CONTINUE_ROOT_RULE_LEGACY, CONTINUE_SKILLS_DIR, CONTINUE_GLOBAL_AGENTS_MD, CONTINUE_GLOBAL_CONFIG, CONTINUE_CANONICAL_RULES_DIR, CONTINUE_CANONICAL_COMMANDS_DIR, CONTINUE_CANONICAL_MCP;
3557
+ var CONTINUE_TARGET, CONTINUE_RULES_DIR, CONTINUE_PROMPTS_DIR, CONTINUE_MCP_DIR, CONTINUE_MCP_FILE, CONTINUE_ROOT_RULE, CONTINUE_ROOT_RULE_LEGACY, CONTINUE_SKILLS_DIR, CONTINUE_GLOBAL_AGENTS_MD, CONTINUE_GLOBAL_CONFIG, CONTINUE_GLOBAL_PERMISSIONS, CONTINUE_CANONICAL_RULES_DIR, CONTINUE_CANONICAL_COMMANDS_DIR, CONTINUE_CANONICAL_MCP, CONTINUE_CANONICAL_PERMISSIONS;
3550
3558
  var init_constants9 = __esm({
3551
3559
  "src/targets/continue/constants.ts"() {
3552
3560
  CONTINUE_TARGET = "continue";
@@ -3559,9 +3567,11 @@ var init_constants9 = __esm({
3559
3567
  CONTINUE_SKILLS_DIR = ".continue/skills";
3560
3568
  CONTINUE_GLOBAL_AGENTS_MD = ".continue/AGENTS.md";
3561
3569
  CONTINUE_GLOBAL_CONFIG = ".continue/config.yaml";
3570
+ CONTINUE_GLOBAL_PERMISSIONS = ".continue/permissions.yaml";
3562
3571
  CONTINUE_CANONICAL_RULES_DIR = ".agentsmesh/rules";
3563
3572
  CONTINUE_CANONICAL_COMMANDS_DIR = ".agentsmesh/commands";
3564
3573
  CONTINUE_CANONICAL_MCP = ".agentsmesh/mcp.json";
3574
+ CONTINUE_CANONICAL_PERMISSIONS = ".agentsmesh/permissions.yaml";
3565
3575
  }
3566
3576
  });
3567
3577
  async function buildContinueImportPaths(refs, projectRoot, scope = "project") {
@@ -3778,21 +3788,26 @@ var init_deepagents_cli = __esm({
3778
3788
  });
3779
3789
 
3780
3790
  // src/targets/factory-droid/constants.ts
3781
- var FACTORY_DROID_TARGET, FACTORY_DROID_ROOT_FILE, FACTORY_DROID_SKILLS_DIR, FACTORY_DROID_DROIDS_DIR, FACTORY_DROID_MCP_FILE, FACTORY_DROID_GLOBAL_ROOT_FILE, FACTORY_DROID_GLOBAL_SKILLS_DIR, FACTORY_DROID_GLOBAL_DROIDS_DIR, FACTORY_DROID_GLOBAL_MCP_FILE, FACTORY_DROID_HOOKS_FILE, FACTORY_DROID_GLOBAL_HOOKS_FILE, FACTORY_DROID_CANONICAL_RULES_DIR;
3791
+ var FACTORY_DROID_TARGET, FACTORY_DROID_ROOT_FILE, FACTORY_DROID_SKILLS_DIR, FACTORY_DROID_COMMANDS_DIR, FACTORY_DROID_DROIDS_DIR, FACTORY_DROID_MCP_FILE, FACTORY_DROID_GLOBAL_ROOT_FILE, FACTORY_DROID_GLOBAL_SKILLS_DIR, FACTORY_DROID_GLOBAL_COMMANDS_DIR, FACTORY_DROID_GLOBAL_DROIDS_DIR, FACTORY_DROID_GLOBAL_MCP_FILE, FACTORY_DROID_HOOKS_FILE, FACTORY_DROID_GLOBAL_HOOKS_FILE, FACTORY_DROID_CANONICAL_RULES_DIR, FACTORY_DROID_CANONICAL_AGENTS_DIR, FACTORY_DROID_CANONICAL_COMMANDS_DIR, FACTORY_DROID_CANONICAL_HOOKS;
3782
3792
  var init_constants13 = __esm({
3783
3793
  "src/targets/factory-droid/constants.ts"() {
3784
3794
  FACTORY_DROID_TARGET = "factory-droid";
3785
3795
  FACTORY_DROID_ROOT_FILE = "AGENTS.md";
3786
3796
  FACTORY_DROID_SKILLS_DIR = ".factory/skills";
3797
+ FACTORY_DROID_COMMANDS_DIR = ".factory/commands";
3787
3798
  FACTORY_DROID_DROIDS_DIR = ".factory/droids";
3788
3799
  FACTORY_DROID_MCP_FILE = ".factory/mcp.json";
3789
3800
  FACTORY_DROID_GLOBAL_ROOT_FILE = ".factory/AGENTS.md";
3790
3801
  FACTORY_DROID_GLOBAL_SKILLS_DIR = ".factory/skills";
3802
+ FACTORY_DROID_GLOBAL_COMMANDS_DIR = ".factory/commands";
3791
3803
  FACTORY_DROID_GLOBAL_DROIDS_DIR = ".factory/droids";
3792
3804
  FACTORY_DROID_GLOBAL_MCP_FILE = ".factory/mcp.json";
3793
3805
  FACTORY_DROID_HOOKS_FILE = ".factory/hooks.json";
3794
3806
  FACTORY_DROID_GLOBAL_HOOKS_FILE = ".factory/hooks.json";
3795
3807
  FACTORY_DROID_CANONICAL_RULES_DIR = ".agentsmesh/rules";
3808
+ FACTORY_DROID_CANONICAL_AGENTS_DIR = ".agentsmesh/agents";
3809
+ FACTORY_DROID_CANONICAL_COMMANDS_DIR = ".agentsmesh/commands";
3810
+ FACTORY_DROID_CANONICAL_HOOKS = ".agentsmesh/hooks.yaml";
3796
3811
  }
3797
3812
  });
3798
3813
 
@@ -3800,6 +3815,9 @@ var init_constants13 = __esm({
3800
3815
  async function buildFactoryDroidImportPaths(refs, projectRoot, scope = "project") {
3801
3816
  if (scope === "global") {
3802
3817
  refs.set(FACTORY_DROID_GLOBAL_ROOT_FILE, `${AB_RULES2}/_root.md`);
3818
+ for (const absPath of await listFiles(projectRoot, FACTORY_DROID_GLOBAL_COMMANDS_DIR)) {
3819
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS3, ".md");
3820
+ }
3803
3821
  for (const absPath of await listFiles(projectRoot, FACTORY_DROID_GLOBAL_DROIDS_DIR)) {
3804
3822
  addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_AGENTS3, ".md");
3805
3823
  }
@@ -3810,6 +3828,9 @@ async function buildFactoryDroidImportPaths(refs, projectRoot, scope = "project"
3810
3828
  return;
3811
3829
  }
3812
3830
  refs.set(FACTORY_DROID_ROOT_FILE, `${AB_RULES2}/_root.md`);
3831
+ for (const absPath of await listFiles(projectRoot, FACTORY_DROID_COMMANDS_DIR)) {
3832
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS3, ".md");
3833
+ }
3813
3834
  for (const absPath of await listFiles(projectRoot, FACTORY_DROID_DROIDS_DIR)) {
3814
3835
  addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_AGENTS3, ".md");
3815
3836
  }
@@ -3856,7 +3877,7 @@ var init_gemini_cli = __esm({
3856
3877
  });
3857
3878
 
3858
3879
  // src/targets/goose/constants.ts
3859
- var GOOSE_TARGET, GOOSE_ROOT_FILE, GOOSE_SKILLS_DIR, GOOSE_IGNORE, GOOSE_GLOBAL_DIR, GOOSE_GLOBAL_ROOT_FILE, GOOSE_GLOBAL_IGNORE, GOOSE_GLOBAL_CONFIG, GOOSE_GLOBAL_SKILLS_DIR, GOOSE_CANONICAL_RULES_DIR, GOOSE_CANONICAL_IGNORE;
3880
+ var GOOSE_TARGET, GOOSE_ROOT_FILE, GOOSE_SKILLS_DIR, GOOSE_IGNORE, GOOSE_GLOBAL_DIR, GOOSE_GLOBAL_ROOT_FILE, GOOSE_GLOBAL_IGNORE, GOOSE_GLOBAL_CONFIG, GOOSE_GLOBAL_SKILLS_DIR, GOOSE_GLOBAL_PERMISSIONS, GOOSE_HOOKS_FILE, GOOSE_CANONICAL_RULES_DIR, GOOSE_CANONICAL_IGNORE, GOOSE_CANONICAL_HOOKS, GOOSE_CANONICAL_PERMISSIONS;
3860
3881
  var init_constants14 = __esm({
3861
3882
  "src/targets/goose/constants.ts"() {
3862
3883
  GOOSE_TARGET = "goose";
@@ -3868,8 +3889,12 @@ var init_constants14 = __esm({
3868
3889
  GOOSE_GLOBAL_IGNORE = `${GOOSE_GLOBAL_DIR}/.gooseignore`;
3869
3890
  GOOSE_GLOBAL_CONFIG = `${GOOSE_GLOBAL_DIR}/config.yaml`;
3870
3891
  GOOSE_GLOBAL_SKILLS_DIR = ".agents/skills";
3892
+ GOOSE_GLOBAL_PERMISSIONS = `${GOOSE_GLOBAL_DIR}/permission.yaml`;
3893
+ GOOSE_HOOKS_FILE = ".agents/plugins/agentsmesh/hooks/hooks.json";
3871
3894
  GOOSE_CANONICAL_RULES_DIR = ".agentsmesh/rules";
3872
3895
  GOOSE_CANONICAL_IGNORE = ".agentsmesh/ignore";
3896
+ GOOSE_CANONICAL_HOOKS = ".agentsmesh/hooks.yaml";
3897
+ GOOSE_CANONICAL_PERMISSIONS = ".agentsmesh/permissions.yaml";
3873
3898
  }
3874
3899
  });
3875
3900
 
@@ -4210,16 +4235,19 @@ var init_opencode = __esm({
4210
4235
  });
4211
4236
 
4212
4237
  // src/targets/pi-agent/constants.ts
4213
- var PI_AGENT_TARGET, PI_AGENT_ROOT_FILE, PI_AGENT_SKILLS_DIR, PI_AGENT_GLOBAL_DIR, PI_AGENT_GLOBAL_ROOT_FILE, PI_AGENT_GLOBAL_SKILLS_DIR, PI_AGENT_CANONICAL_RULES_DIR;
4238
+ var PI_AGENT_TARGET, PI_AGENT_ROOT_FILE, PI_AGENT_SKILLS_DIR, PI_AGENT_COMMANDS_DIR, PI_AGENT_GLOBAL_DIR, PI_AGENT_GLOBAL_ROOT_FILE, PI_AGENT_GLOBAL_SKILLS_DIR, PI_AGENT_GLOBAL_COMMANDS_DIR, PI_AGENT_CANONICAL_RULES_DIR, PI_AGENT_CANONICAL_COMMANDS_DIR;
4214
4239
  var init_constants20 = __esm({
4215
4240
  "src/targets/pi-agent/constants.ts"() {
4216
4241
  PI_AGENT_TARGET = "pi-agent";
4217
4242
  PI_AGENT_ROOT_FILE = "AGENTS.md";
4218
4243
  PI_AGENT_SKILLS_DIR = ".pi/skills";
4244
+ PI_AGENT_COMMANDS_DIR = ".pi/prompts";
4219
4245
  PI_AGENT_GLOBAL_DIR = ".pi/agent";
4220
4246
  PI_AGENT_GLOBAL_ROOT_FILE = `${PI_AGENT_GLOBAL_DIR}/AGENTS.md`;
4221
4247
  PI_AGENT_GLOBAL_SKILLS_DIR = `${PI_AGENT_GLOBAL_DIR}/skills`;
4248
+ PI_AGENT_GLOBAL_COMMANDS_DIR = `${PI_AGENT_GLOBAL_DIR}/prompts`;
4222
4249
  PI_AGENT_CANONICAL_RULES_DIR = ".agentsmesh/rules";
4250
+ PI_AGENT_CANONICAL_COMMANDS_DIR = ".agentsmesh/commands";
4223
4251
  }
4224
4252
  });
4225
4253
 
@@ -4227,12 +4255,18 @@ var init_constants20 = __esm({
4227
4255
  async function buildPiAgentImportPaths(refs, projectRoot, scope = "project") {
4228
4256
  if (scope === "global") {
4229
4257
  refs.set(PI_AGENT_GLOBAL_ROOT_FILE, `${AB_RULES2}/_root.md`);
4258
+ for (const absPath of await listFiles(projectRoot, PI_AGENT_GLOBAL_COMMANDS_DIR)) {
4259
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS3, ".md");
4260
+ }
4230
4261
  for (const absPath of await listFiles(projectRoot, PI_AGENT_GLOBAL_SKILLS_DIR)) {
4231
4262
  addSkillLikeMapping(refs, rel(projectRoot, absPath), PI_AGENT_GLOBAL_SKILLS_DIR);
4232
4263
  }
4233
4264
  return;
4234
4265
  }
4235
4266
  refs.set(PI_AGENT_ROOT_FILE, `${AB_RULES2}/_root.md`);
4267
+ for (const absPath of await listFiles(projectRoot, PI_AGENT_COMMANDS_DIR)) {
4268
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS3, ".md");
4269
+ }
4236
4270
  for (const absPath of await listFiles(projectRoot, PI_AGENT_SKILLS_DIR)) {
4237
4271
  addSkillLikeMapping(refs, rel(projectRoot, absPath), PI_AGENT_SKILLS_DIR);
4238
4272
  }
@@ -4338,7 +4372,7 @@ var init_replit_agent = __esm({
4338
4372
  });
4339
4373
 
4340
4374
  // src/targets/roo-code/constants.ts
4341
- var ROO_CODE_TARGET, ROO_CODE_DIR, ROO_CODE_ROOT_RULE, ROO_CODE_ROOT_RULE_FALLBACK, ROO_CODE_RULES_DIR, ROO_CODE_COMMANDS_DIR, ROO_CODE_SKILLS_DIR, ROO_CODE_MCP_FILE, ROO_CODE_IGNORE, ROO_CODE_MODES_FILE, ROO_CODE_GLOBAL_MODES_FILE, ROO_CODE_GLOBAL_DIR, ROO_CODE_GLOBAL_RULES_DIR, ROO_CODE_GLOBAL_COMMANDS_DIR, ROO_CODE_GLOBAL_SKILLS_DIR, ROO_CODE_GLOBAL_MCP_FILE, ROO_CODE_GLOBAL_IGNORE, ROO_CODE_GLOBAL_AGENTS_MD, ROO_CODE_GLOBAL_AGENTS_SKILLS_DIR, ROO_CODE_CANONICAL_RULES_DIR, ROO_CODE_CANONICAL_COMMANDS_DIR, ROO_CODE_CANONICAL_MCP, ROO_CODE_CANONICAL_IGNORE;
4375
+ var ROO_CODE_TARGET, ROO_CODE_DIR, ROO_CODE_ROOT_RULE, ROO_CODE_ROOT_RULE_FALLBACK, ROO_CODE_RULES_DIR, ROO_CODE_COMMANDS_DIR, ROO_CODE_SKILLS_DIR, ROO_CODE_MCP_FILE, ROO_CODE_IGNORE, ROO_CODE_MODES_FILE, ROO_CODE_GLOBAL_MODES_FILE, ROO_CODE_GLOBAL_DIR, ROO_CODE_GLOBAL_RULES_DIR, ROO_CODE_GLOBAL_COMMANDS_DIR, ROO_CODE_GLOBAL_SKILLS_DIR, ROO_CODE_GLOBAL_MCP_FILE, ROO_CODE_GLOBAL_IGNORE, ROO_CODE_GLOBAL_AGENTS_MD, ROO_CODE_GLOBAL_AGENTS_SKILLS_DIR, ROO_CODE_CANONICAL_RULES_DIR, ROO_CODE_CANONICAL_AGENTS_DIR, ROO_CODE_CANONICAL_COMMANDS_DIR, ROO_CODE_CANONICAL_MCP, ROO_CODE_CANONICAL_IGNORE;
4342
4376
  var init_constants23 = __esm({
4343
4377
  "src/targets/roo-code/constants.ts"() {
4344
4378
  ROO_CODE_TARGET = "roo-code";
@@ -4361,6 +4395,7 @@ var init_constants23 = __esm({
4361
4395
  ROO_CODE_GLOBAL_AGENTS_MD = `${ROO_CODE_GLOBAL_DIR}/AGENTS.md`;
4362
4396
  ROO_CODE_GLOBAL_AGENTS_SKILLS_DIR = ".agents/skills";
4363
4397
  ROO_CODE_CANONICAL_RULES_DIR = ".agentsmesh/rules";
4398
+ ROO_CODE_CANONICAL_AGENTS_DIR = ".agentsmesh/agents";
4364
4399
  ROO_CODE_CANONICAL_COMMANDS_DIR = ".agentsmesh/commands";
4365
4400
  ROO_CODE_CANONICAL_MCP = ".agentsmesh/mcp.json";
4366
4401
  ROO_CODE_CANONICAL_IGNORE = ".agentsmesh/ignore";
@@ -4650,8 +4685,26 @@ var init_import_map_builders = __esm({
4650
4685
  init_import_maps();
4651
4686
  }
4652
4687
  });
4653
-
4654
- // src/targets/aider/index.ts
4688
+ function mergeAiderConf(existing, newContent) {
4689
+ if (existing === null) return newContent;
4690
+ let parsed;
4691
+ try {
4692
+ parsed = parse(existing);
4693
+ } catch {
4694
+ return newContent;
4695
+ }
4696
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return newContent;
4697
+ const base = parsed;
4698
+ const reads = /* @__PURE__ */ new Set();
4699
+ const existingRead = base.read;
4700
+ if (typeof existingRead === "string") reads.add(existingRead);
4701
+ else if (Array.isArray(existingRead)) {
4702
+ for (const entry of existingRead) if (typeof entry === "string") reads.add(entry);
4703
+ }
4704
+ reads.add(AIDER_CONVENTIONS);
4705
+ base.read = [...reads];
4706
+ return stringify(base);
4707
+ }
4655
4708
  var target, project, globalLayout, capabilities, descriptor;
4656
4709
  var init_aider2 = __esm({
4657
4710
  "src/targets/aider/index.ts"() {
@@ -4678,7 +4731,7 @@ var init_aider2 = __esm({
4678
4731
  skillDir: AIDER_SKILLS_DIR,
4679
4732
  managedOutputs: {
4680
4733
  dirs: [AIDER_SKILLS_DIR],
4681
- files: [AIDER_CONVENTIONS, AIDER_IGNORE]
4734
+ files: [AIDER_CONVENTIONS, AIDER_CONF_FILE, AIDER_IGNORE]
4682
4735
  },
4683
4736
  paths: {
4684
4737
  rulePath(_slug) {
@@ -4702,6 +4755,7 @@ var init_aider2 = __esm({
4702
4755
  rewriteGeneratedPath(path) {
4703
4756
  if (path === AIDER_CONVENTIONS) return AIDER_GLOBAL_CONVENTIONS;
4704
4757
  if (path === AIDER_IGNORE) return AIDER_GLOBAL_IGNORE;
4758
+ if (path === AIDER_CONF_FILE) return null;
4705
4759
  if (path.startsWith(`${AIDER_SKILLS_DIR}/`)) {
4706
4760
  return path.replace(`${AIDER_SKILLS_DIR}/`, `${AIDER_GLOBAL_SKILLS_DIR}/`);
4707
4761
  }
@@ -4777,6 +4831,10 @@ var init_aider2 = __esm({
4777
4831
  canonicalFilename: AIDER_CANONICAL_IGNORE
4778
4832
  }
4779
4833
  },
4834
+ mergeGeneratedOutputContent(existing, _pending, newContent, resolvedPath) {
4835
+ if (resolvedPath === AIDER_CONF_FILE) return mergeAiderConf(existing, newContent);
4836
+ return null;
4837
+ },
4780
4838
  buildImportPaths: buildAiderImportPaths,
4781
4839
  detectionPaths: [AIDER_CONVENTIONS, AIDER_IGNORE]
4782
4840
  };
@@ -4801,7 +4859,7 @@ function generateAgents2(canonical) {
4801
4859
  {
4802
4860
  name: agent.name,
4803
4861
  ...agent.description ? { description: agent.description } : {},
4804
- systemPrompt: agent.body.trim(),
4862
+ prompt: agent.body.trim(),
4805
4863
  ...agent.tools.length > 0 ? { allowedTools: agent.tools } : {}
4806
4864
  },
4807
4865
  null,
@@ -4900,7 +4958,7 @@ async function amazonQAgentMapper(ctx) {
4900
4958
  const name = typeof raw.name === "string" ? raw.name : agentName;
4901
4959
  const description = typeof raw.description === "string" ? raw.description : "";
4902
4960
  const tools = Array.isArray(raw.allowedTools) ? raw.allowedTools.filter((t) => typeof t === "string") : [];
4903
- const body = typeof raw.systemPrompt === "string" ? raw.systemPrompt : "";
4961
+ const body = typeof raw.prompt === "string" ? raw.prompt : typeof raw.systemPrompt === "string" ? raw.systemPrompt : "";
4904
4962
  const content = await serializeImportedAgentWithFallback(
4905
4963
  destPath,
4906
4964
  { name, description, tools },
@@ -4960,7 +5018,7 @@ var init_capabilities2 = __esm({
4960
5018
  "src/targets/amazon-q/capabilities.ts"() {
4961
5019
  projectCapabilities = {
4962
5020
  rules: "native",
4963
- additionalRules: "none",
5021
+ additionalRules: "native",
4964
5022
  commands: "none",
4965
5023
  agents: "native",
4966
5024
  skills: "none",
@@ -5923,16 +5981,13 @@ var init_antigravity2 = __esm({
5923
5981
  });
5924
5982
  function ruleFrontmatter(rule) {
5925
5983
  const fm = {};
5926
- if (rule.description) {
5927
- fm.description = rule.description;
5928
- }
5929
5984
  if (rule.globs.length > 0 || rule.trigger === "manual" || rule.trigger === "model_decision") {
5930
- fm.agent_requested = true;
5931
- if (rule.globs.length > 0) {
5932
- fm.globs = rule.globs;
5933
- }
5985
+ fm.type = "agent_requested";
5986
+ if (rule.description) fm.description = rule.description;
5987
+ if (rule.globs.length > 0) fm.globs = rule.globs;
5934
5988
  } else {
5935
- fm.always_apply = true;
5989
+ fm.type = "always_apply";
5990
+ if (rule.description) fm.description = rule.description;
5936
5991
  }
5937
5992
  return fm;
5938
5993
  }
@@ -5948,7 +6003,7 @@ function generateRules5(canonical) {
5948
6003
  for (const rule of canonical.rules) {
5949
6004
  if (rule.targets.length > 0 && !rule.targets.includes(AUGMENT_CODE_TARGET)) continue;
5950
6005
  if (rule.root) {
5951
- const fm = { always_apply: true };
6006
+ const fm = { type: "always_apply" };
5952
6007
  if (rule.description) fm.description = rule.description;
5953
6008
  outputs.push({
5954
6009
  path: `${AUGMENT_CODE_RULES_DIR}/_root.md`,
@@ -6000,6 +6055,27 @@ var init_generator5 = __esm({
6000
6055
  init_constants6();
6001
6056
  }
6002
6057
  });
6058
+ function parseToolPermissions(raw) {
6059
+ if (!Array.isArray(raw)) return null;
6060
+ const allow = [];
6061
+ const deny = [];
6062
+ const ask = [];
6063
+ for (const entry of raw) {
6064
+ if (!entry || typeof entry !== "object") continue;
6065
+ const e = entry;
6066
+ const toolName = typeof e.toolName === "string" ? e.toolName : void 0;
6067
+ const permission = e.permission;
6068
+ if (!toolName || !permission || typeof permission !== "object") continue;
6069
+ if (e.shellInputRegex !== void 0) continue;
6070
+ if (permission.type === "allow") allow.push(toolName);
6071
+ else if (permission.type === "deny") deny.push(toolName);
6072
+ else if (permission.type === "ask-user") ask.push(toolName);
6073
+ }
6074
+ if (allow.length === 0 && deny.length === 0 && ask.length === 0) return null;
6075
+ const permissions = { allow, deny };
6076
+ if (ask.length > 0) permissions.ask = ask;
6077
+ return permissions;
6078
+ }
6003
6079
  function augmentHooksToCanonical(hooks) {
6004
6080
  const result = {};
6005
6081
  for (const [event, entries] of Object.entries(hooks)) {
@@ -6022,7 +6098,7 @@ function augmentHooksToCanonical(hooks) {
6022
6098
  }
6023
6099
  return result;
6024
6100
  }
6025
- async function importAugmentSettings(projectRoot, settingsPath, results) {
6101
+ async function importAugmentSettings(projectRoot, settingsPath, results, options = {}) {
6026
6102
  const content = await readFileSafe(join(projectRoot, settingsPath));
6027
6103
  if (content === null) return;
6028
6104
  let settings;
@@ -6056,6 +6132,20 @@ async function importAugmentSettings(projectRoot, settingsPath, results) {
6056
6132
  });
6057
6133
  }
6058
6134
  }
6135
+ if (options.includePermissions) {
6136
+ const permissions = parseToolPermissions(settings.toolPermissions);
6137
+ if (permissions) {
6138
+ const destPath = join(projectRoot, AUGMENT_CODE_CANONICAL_PERMISSIONS);
6139
+ await mkdirp(dirname(destPath));
6140
+ await writeFileAtomic(destPath, stringify(permissions));
6141
+ results.push({
6142
+ fromTool: AUGMENT_CODE_TARGET,
6143
+ fromPath: join(projectRoot, settingsPath),
6144
+ toPath: AUGMENT_CODE_CANONICAL_PERMISSIONS,
6145
+ feature: "permissions"
6146
+ });
6147
+ }
6148
+ }
6059
6149
  }
6060
6150
  async function importAugmentIgnore(projectRoot, ignorePath, results) {
6061
6151
  const content = await readFileSafe(join(projectRoot, ignorePath));
@@ -6085,7 +6175,7 @@ function canonicalRuleMeta(frontmatter, isRoot) {
6085
6175
  description: typeof frontmatter.description === "string" ? frontmatter.description : void 0,
6086
6176
  globs: Array.isArray(frontmatter.globs) ? frontmatter.globs : []
6087
6177
  };
6088
- if (frontmatter.agent_requested === true) {
6178
+ if (frontmatter.type === "agent_requested" || frontmatter.agent_requested === true) {
6089
6179
  meta.trigger = "model_decision";
6090
6180
  }
6091
6181
  return meta;
@@ -6180,7 +6270,9 @@ async function importFromAugmentCode(projectRoot, options = {}) {
6180
6270
  const skillsDir = scope === "global" ? AUGMENT_CODE_GLOBAL_SKILLS_DIR : AUGMENT_CODE_SKILLS_DIR;
6181
6271
  await importEmbeddedSkills(projectRoot, skillsDir, AUGMENT_CODE_TARGET, results, normalize);
6182
6272
  const settingsFile = scope === "global" ? AUGMENT_CODE_GLOBAL_SETTINGS_FILE : AUGMENT_CODE_SETTINGS_FILE;
6183
- await importAugmentSettings(projectRoot, settingsFile, results);
6273
+ await importAugmentSettings(projectRoot, settingsFile, results, {
6274
+ includePermissions: scope === "global"
6275
+ });
6184
6276
  if (scope === "project") {
6185
6277
  await importAugmentIgnore(projectRoot, AUGMENT_CODE_IGNORE_FILE, results);
6186
6278
  }
@@ -6238,12 +6330,12 @@ var init_lint5 = __esm({
6238
6330
  }
6239
6331
  });
6240
6332
 
6241
- // src/targets/augment-code/index.ts
6333
+ // src/targets/augment-code/settings-build.ts
6242
6334
  function serializeHooksForSettings(hooks) {
6243
6335
  const result = {};
6244
6336
  for (const [event, entries] of Object.entries(hooks)) {
6245
6337
  if (!entries || entries.length === 0) continue;
6246
- const serialized = entries.map((entry) => ({
6338
+ result[event] = entries.map((entry) => ({
6247
6339
  matcher: entry.matcher,
6248
6340
  hooks: [
6249
6341
  {
@@ -6253,10 +6345,38 @@ function serializeHooksForSettings(hooks) {
6253
6345
  }
6254
6346
  ]
6255
6347
  }));
6256
- result[event] = serialized;
6257
6348
  }
6258
6349
  return result;
6259
6350
  }
6351
+ function serializeToolPermissions(permissions) {
6352
+ if (!permissions) return void 0;
6353
+ const entries = [];
6354
+ for (const toolName of permissions.allow ?? []) {
6355
+ entries.push({ toolName, permission: { type: "allow" } });
6356
+ }
6357
+ for (const toolName of permissions.deny ?? []) {
6358
+ entries.push({ toolName, permission: { type: "deny" } });
6359
+ }
6360
+ for (const toolName of permissions.ask ?? []) {
6361
+ entries.push({ toolName, permission: { type: "ask-user" } });
6362
+ }
6363
+ return entries.length > 0 ? entries : void 0;
6364
+ }
6365
+ function buildSettingsContent(canonical, enabledFeatures, scope) {
6366
+ const settings = {};
6367
+ if (enabledFeatures.has("mcp") && canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
6368
+ settings.mcpServers = canonical.mcp.mcpServers;
6369
+ }
6370
+ if (enabledFeatures.has("hooks") && canonical.hooks && Object.keys(canonical.hooks).length > 0) {
6371
+ settings.hooks = serializeHooksForSettings(canonical.hooks);
6372
+ }
6373
+ if (scope === "global" && enabledFeatures.has("permissions")) {
6374
+ const toolPermissions = serializeToolPermissions(canonical.permissions);
6375
+ if (toolPermissions) settings.toolPermissions = toolPermissions;
6376
+ }
6377
+ if (Object.keys(settings).length === 0) return null;
6378
+ return JSON.stringify(settings, null, 2);
6379
+ }
6260
6380
  function mergeAugmentSettings(existing, newContent) {
6261
6381
  if (existing === null) return newContent;
6262
6382
  let base;
@@ -6271,19 +6391,15 @@ function mergeAugmentSettings(existing, newContent) {
6271
6391
  const overlay = incoming;
6272
6392
  if (overlay.mcpServers !== void 0) base.mcpServers = overlay.mcpServers;
6273
6393
  if (overlay.hooks !== void 0) base.hooks = overlay.hooks;
6394
+ if (overlay.toolPermissions !== void 0) base.toolPermissions = overlay.toolPermissions;
6274
6395
  return JSON.stringify(base, null, 2);
6275
6396
  }
6276
- function buildSettingsContent(canonical, enabledFeatures) {
6277
- const settings = {};
6278
- if (enabledFeatures.has("mcp") && canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
6279
- settings.mcpServers = canonical.mcp.mcpServers;
6280
- }
6281
- if (enabledFeatures.has("hooks") && canonical.hooks && Object.keys(canonical.hooks).length > 0) {
6282
- settings.hooks = serializeHooksForSettings(canonical.hooks);
6397
+ var init_settings_build = __esm({
6398
+ "src/targets/augment-code/settings-build.ts"() {
6283
6399
  }
6284
- if (Object.keys(settings).length === 0) return null;
6285
- return JSON.stringify(settings, null, 2);
6286
- }
6400
+ });
6401
+
6402
+ // src/targets/augment-code/index.ts
6287
6403
  var target5, project5, globalLayout5, capabilities3, globalCapabilities3, descriptor5;
6288
6404
  var init_augment_code2 = __esm({
6289
6405
  "src/targets/augment-code/index.ts"() {
@@ -6292,6 +6408,7 @@ var init_augment_code2 = __esm({
6292
6408
  init_linter5();
6293
6409
  init_lint5();
6294
6410
  init_import_map_builders();
6411
+ init_settings_build();
6295
6412
  init_constants6();
6296
6413
  target5 = {
6297
6414
  name: AUGMENT_CODE_TARGET,
@@ -6305,7 +6422,12 @@ var init_augment_code2 = __esm({
6305
6422
  project5 = {
6306
6423
  skillDir: AUGMENT_CODE_SKILLS_DIR,
6307
6424
  managedOutputs: {
6308
- dirs: [AUGMENT_CODE_RULES_DIR, AUGMENT_CODE_COMMANDS_DIR, AUGMENT_CODE_AGENTS_DIR, AUGMENT_CODE_SKILLS_DIR],
6425
+ dirs: [
6426
+ AUGMENT_CODE_RULES_DIR,
6427
+ AUGMENT_CODE_COMMANDS_DIR,
6428
+ AUGMENT_CODE_AGENTS_DIR,
6429
+ AUGMENT_CODE_SKILLS_DIR
6430
+ ],
6309
6431
  files: [AUGMENT_CODE_SETTINGS_FILE, AUGMENT_CODE_IGNORE_FILE]
6310
6432
  },
6311
6433
  paths: {
@@ -6381,7 +6503,7 @@ var init_augment_code2 = __esm({
6381
6503
  mcp: "native",
6382
6504
  hooks: "none",
6383
6505
  ignore: "none",
6384
- permissions: "none"
6506
+ permissions: "native"
6385
6507
  };
6386
6508
  descriptor5 = {
6387
6509
  id: AUGMENT_CODE_TARGET,
@@ -6409,8 +6531,8 @@ var init_augment_code2 = __esm({
6409
6531
  ],
6410
6532
  layout: globalLayout5
6411
6533
  },
6412
- emitScopedSettings(canonical, _scope, enabledFeatures) {
6413
- const content = buildSettingsContent(canonical, enabledFeatures);
6534
+ emitScopedSettings(canonical, scope, enabledFeatures) {
6535
+ const content = buildSettingsContent(canonical, enabledFeatures, scope);
6414
6536
  if (content === null) return [];
6415
6537
  return [{ path: AUGMENT_CODE_SETTINGS_FILE, content }];
6416
6538
  },
@@ -8369,30 +8491,79 @@ var init_mcp = __esm({
8369
8491
  init_constants28();
8370
8492
  }
8371
8493
  });
8372
-
8373
- // src/targets/codex-cli/generator/hooks.ts
8374
- function generateHooks4(canonical) {
8494
+ function buildWrappedCommandHooks(canonical, hooksFilePath) {
8375
8495
  if (!canonical.hooks) return [];
8376
8496
  const hooks = {};
8377
8497
  for (const [event, entries] of Object.entries(canonical.hooks)) {
8378
8498
  if (!Array.isArray(entries)) continue;
8379
8499
  const mapped = entries.flatMap((entry) => {
8380
8500
  if (!hasHookCommand(entry) || entry.type === "prompt") return [];
8381
- const hook = {
8382
- type: "command",
8383
- command: getHookCommand(entry)
8384
- };
8501
+ const hook = { type: "command", command: getHookCommand(entry) };
8385
8502
  if (entry.timeout !== void 0) hook.timeout = entry.timeout;
8386
8503
  return [{ matcher: entry.matcher, hooks: [hook] }];
8387
8504
  });
8388
8505
  if (mapped.length > 0) hooks[event] = mapped;
8389
8506
  }
8390
8507
  if (Object.keys(hooks).length === 0) return [];
8391
- return [{ path: CODEX_HOOKS_FILE, content: JSON.stringify({ hooks }, null, 2) }];
8508
+ return [{ path: hooksFilePath, content: JSON.stringify({ hooks }, null, 2) }];
8509
+ }
8510
+ async function importWrappedCommandHooks(options) {
8511
+ const { projectRoot, hooksFile, canonicalHooksPath, targetName, results } = options;
8512
+ const srcPath = join(projectRoot, hooksFile);
8513
+ const content = await readFileSafe(srcPath);
8514
+ if (content === null) return;
8515
+ let parsed;
8516
+ try {
8517
+ parsed = JSON.parse(content);
8518
+ } catch {
8519
+ return;
8520
+ }
8521
+ if (!parsed || typeof parsed !== "object") return;
8522
+ const rawHooks = parsed.hooks;
8523
+ if (!rawHooks || typeof rawHooks !== "object" || Array.isArray(rawHooks)) return;
8524
+ const hooks = {};
8525
+ for (const [event, groups] of Object.entries(rawHooks)) {
8526
+ if (!Array.isArray(groups)) continue;
8527
+ for (const group of groups) {
8528
+ if (!group || typeof group !== "object") continue;
8529
+ const record = group;
8530
+ const matcher = typeof record.matcher === "string" ? record.matcher : "*";
8531
+ if (!Array.isArray(record.hooks)) continue;
8532
+ for (const raw of record.hooks) {
8533
+ if (!raw || typeof raw !== "object") continue;
8534
+ const hook = raw;
8535
+ if (hook.type !== "command" || typeof hook.command !== "string") continue;
8536
+ const imported = { matcher, command: hook.command, type: "command" };
8537
+ if (typeof hook.timeout === "number") imported.timeout = hook.timeout;
8538
+ (hooks[event] ??= []).push(imported);
8539
+ }
8540
+ }
8541
+ }
8542
+ if (Object.keys(hooks).length === 0) return;
8543
+ const destPath = join(projectRoot, canonicalHooksPath);
8544
+ await mkdirp(dirname(destPath));
8545
+ await writeFileAtomic(destPath, stringify(hooks));
8546
+ results.push({
8547
+ fromTool: targetName,
8548
+ fromPath: srcPath,
8549
+ toPath: canonicalHooksPath,
8550
+ feature: "hooks"
8551
+ });
8552
+ }
8553
+ var init_wrapped_command_hooks = __esm({
8554
+ "src/targets/import/wrapped-command-hooks.ts"() {
8555
+ init_hook_command();
8556
+ init_fs();
8557
+ }
8558
+ });
8559
+
8560
+ // src/targets/codex-cli/generator/hooks.ts
8561
+ function generateHooks4(canonical) {
8562
+ return buildWrappedCommandHooks(canonical, CODEX_HOOKS_FILE);
8392
8563
  }
8393
8564
  var init_hooks = __esm({
8394
8565
  "src/targets/codex-cli/generator/hooks.ts"() {
8395
- init_hook_command();
8566
+ init_wrapped_command_hooks();
8396
8567
  init_constants28();
8397
8568
  }
8398
8569
  });
@@ -8783,51 +8954,20 @@ var init_importer_rules2 = __esm({
8783
8954
  init_instruction_mirror();
8784
8955
  }
8785
8956
  });
8957
+
8958
+ // src/targets/codex-cli/importer-hooks.ts
8786
8959
  async function importCodexHooks(projectRoot, results) {
8787
- const srcPath = join(projectRoot, CODEX_HOOKS_FILE);
8788
- const content = await readFileSafe(srcPath);
8789
- if (content === null) return;
8790
- let parsed;
8791
- try {
8792
- parsed = JSON.parse(content);
8793
- } catch {
8794
- return;
8795
- }
8796
- if (!parsed || typeof parsed !== "object") return;
8797
- const rawHooks = parsed.hooks;
8798
- if (!rawHooks || typeof rawHooks !== "object" || Array.isArray(rawHooks)) return;
8799
- const hooks = {};
8800
- for (const [event, groups] of Object.entries(rawHooks)) {
8801
- if (!Array.isArray(groups)) continue;
8802
- for (const group of groups) {
8803
- if (!group || typeof group !== "object") continue;
8804
- const record = group;
8805
- const matcher = typeof record.matcher === "string" ? record.matcher : "*";
8806
- if (!Array.isArray(record.hooks)) continue;
8807
- for (const raw of record.hooks) {
8808
- if (!raw || typeof raw !== "object") continue;
8809
- const hook = raw;
8810
- if (hook.type !== "command" || typeof hook.command !== "string") continue;
8811
- const imported = { matcher, command: hook.command, type: "command" };
8812
- if (typeof hook.timeout === "number") imported.timeout = hook.timeout;
8813
- (hooks[event] ??= []).push(imported);
8814
- }
8815
- }
8816
- }
8817
- if (Object.keys(hooks).length === 0) return;
8818
- const destPath = join(projectRoot, CODEX_CANONICAL_HOOKS);
8819
- await mkdirp(dirname(destPath));
8820
- await writeFileAtomic(destPath, stringify(hooks));
8821
- results.push({
8822
- fromTool: CODEX_TARGET,
8823
- fromPath: srcPath,
8824
- toPath: CODEX_CANONICAL_HOOKS,
8825
- feature: "hooks"
8960
+ await importWrappedCommandHooks({
8961
+ projectRoot,
8962
+ hooksFile: CODEX_HOOKS_FILE,
8963
+ canonicalHooksPath: CODEX_CANONICAL_HOOKS,
8964
+ targetName: CODEX_TARGET,
8965
+ results
8826
8966
  });
8827
8967
  }
8828
8968
  var init_importer_hooks = __esm({
8829
8969
  "src/targets/codex-cli/importer-hooks.ts"() {
8830
- init_fs();
8970
+ init_wrapped_command_hooks();
8831
8971
  init_constants28();
8832
8972
  }
8833
8973
  });
@@ -9008,7 +9148,7 @@ var init_codex_cli2 = __esm({
9008
9148
  agents: "native",
9009
9149
  skills: "native",
9010
9150
  mcp: "native",
9011
- hooks: "partial",
9151
+ hooks: "native",
9012
9152
  ignore: "none",
9013
9153
  permissions: "none"
9014
9154
  };
@@ -9028,7 +9168,7 @@ var init_codex_cli2 = __esm({
9028
9168
  agents: "native",
9029
9169
  skills: "native",
9030
9170
  mcp: "native",
9031
- hooks: "partial",
9171
+ hooks: "native",
9032
9172
  ignore: "none",
9033
9173
  permissions: "none"
9034
9174
  },
@@ -9184,6 +9324,40 @@ var init_generator10 = __esm({
9184
9324
  init_constants9();
9185
9325
  }
9186
9326
  });
9327
+ function serializeContinuePermissions(permissions) {
9328
+ if (!permissions) return null;
9329
+ const allow = permissions.allow ?? [];
9330
+ const ask = permissions.ask ?? [];
9331
+ const exclude = permissions.deny ?? [];
9332
+ if (allow.length === 0 && ask.length === 0 && exclude.length === 0) return null;
9333
+ const out2 = {};
9334
+ if (allow.length > 0) out2.allow = allow;
9335
+ if (ask.length > 0) out2.ask = ask;
9336
+ if (exclude.length > 0) out2.exclude = exclude;
9337
+ return stringify(out2).trimEnd() + "\n";
9338
+ }
9339
+ function parseContinuePermissions(content) {
9340
+ let parsed;
9341
+ try {
9342
+ parsed = parse(content);
9343
+ } catch {
9344
+ return null;
9345
+ }
9346
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
9347
+ const record = parsed;
9348
+ const allow = toStringArray5(record.allow);
9349
+ const ask = toStringArray5(record.ask);
9350
+ const deny = toStringArray5(record.exclude);
9351
+ if (allow.length === 0 && ask.length === 0 && deny.length === 0) return null;
9352
+ const permissions = { allow, deny };
9353
+ if (ask.length > 0) permissions.ask = ask;
9354
+ return permissions;
9355
+ }
9356
+ var init_permissions = __esm({
9357
+ "src/targets/continue/permissions.ts"() {
9358
+ init_shared_import_helpers();
9359
+ }
9360
+ });
9187
9361
  function readMcpServers(content, extension) {
9188
9362
  const parsed = extension === ".json" ? JSON.parse(content) : parse(content) ?? {};
9189
9363
  const rawServers = parsed.mcpServers;
@@ -9238,12 +9412,29 @@ async function importMcp2(projectRoot, results) {
9238
9412
  });
9239
9413
  }
9240
9414
  }
9241
- async function importFromContinue(projectRoot) {
9415
+ async function importPermissions(projectRoot, results) {
9416
+ const srcPath = join(projectRoot, CONTINUE_GLOBAL_PERMISSIONS);
9417
+ const content = await readFileSafe(srcPath);
9418
+ if (content === null) return;
9419
+ const permissions = parseContinuePermissions(content);
9420
+ if (!permissions) return;
9421
+ const destPath = join(projectRoot, CONTINUE_CANONICAL_PERMISSIONS);
9422
+ await mkdirp(dirname(destPath));
9423
+ await writeFileAtomic(destPath, stringify(permissions).trimEnd() + "\n");
9424
+ results.push({
9425
+ fromTool: CONTINUE_TARGET,
9426
+ fromPath: srcPath,
9427
+ toPath: CONTINUE_CANONICAL_PERMISSIONS,
9428
+ feature: "permissions"
9429
+ });
9430
+ }
9431
+ async function importFromContinue(projectRoot, options = {}) {
9242
9432
  const results = [];
9243
9433
  const normalize = await createImportReferenceNormalizer(CONTINUE_TARGET, projectRoot);
9244
9434
  results.push(...await runDescriptorImport(descriptor9, projectRoot, "project", { normalize }));
9245
9435
  await importEmbeddedSkills(projectRoot, CONTINUE_SKILLS_DIR, CONTINUE_TARGET, results, normalize);
9246
9436
  await importMcp2(projectRoot, results);
9437
+ if (options.scope === "global") await importPermissions(projectRoot, results);
9247
9438
  return results;
9248
9439
  }
9249
9440
  var init_importer9 = __esm({
@@ -9255,6 +9446,7 @@ var init_importer9 = __esm({
9255
9446
  init_mcp_merge();
9256
9447
  init_shared_import_helpers();
9257
9448
  init_constants9();
9449
+ init_permissions();
9258
9450
  init_continue2();
9259
9451
  }
9260
9452
  });
@@ -9420,6 +9612,7 @@ var init_scope_extras = __esm({
9420
9612
  init_fs();
9421
9613
  init_constants9();
9422
9614
  init_global_config();
9615
+ init_permissions();
9423
9616
  generateContinueScopeExtras = async (canonical, projectRoot, scope, enabledFeatures) => {
9424
9617
  const configResults = await generateContinueGlobalConfig(
9425
9618
  canonical,
@@ -9427,21 +9620,36 @@ var init_scope_extras = __esm({
9427
9620
  scope,
9428
9621
  enabledFeatures
9429
9622
  );
9430
- if (scope !== "global" || !enabledFeatures.has("rules")) return configResults;
9431
- const root = canonical.rules.find((r) => r.root);
9432
- if (!root) return configResults;
9433
- const content = root.body.trim();
9434
- const existing = await readFileSafe(join(projectRoot, CONTINUE_GLOBAL_AGENTS_MD));
9435
- return [
9436
- ...configResults,
9437
- {
9438
- target: "continue",
9439
- path: CONTINUE_GLOBAL_AGENTS_MD,
9440
- content,
9441
- currentContent: existing ?? void 0,
9442
- status: computeStatus3(existing, content)
9623
+ if (scope !== "global") return configResults;
9624
+ const results = [...configResults];
9625
+ if (enabledFeatures.has("permissions")) {
9626
+ const content = serializeContinuePermissions(canonical.permissions);
9627
+ if (content) {
9628
+ const existing = await readFileSafe(join(projectRoot, CONTINUE_GLOBAL_PERMISSIONS));
9629
+ results.push({
9630
+ target: "continue",
9631
+ path: CONTINUE_GLOBAL_PERMISSIONS,
9632
+ content,
9633
+ currentContent: existing ?? void 0,
9634
+ status: computeStatus3(existing, content)
9635
+ });
9443
9636
  }
9444
- ];
9637
+ }
9638
+ if (enabledFeatures.has("rules")) {
9639
+ const root = canonical.rules.find((r) => r.root);
9640
+ if (root) {
9641
+ const content = root.body.trim();
9642
+ const existing = await readFileSafe(join(projectRoot, CONTINUE_GLOBAL_AGENTS_MD));
9643
+ results.push({
9644
+ target: "continue",
9645
+ path: CONTINUE_GLOBAL_AGENTS_MD,
9646
+ content,
9647
+ currentContent: existing ?? void 0,
9648
+ status: computeStatus3(existing, content)
9649
+ });
9650
+ }
9651
+ }
9652
+ return results;
9445
9653
  };
9446
9654
  }
9447
9655
  });
@@ -9497,7 +9705,12 @@ var init_continue2 = __esm({
9497
9705
  skillDir: CONTINUE_SKILLS_DIR,
9498
9706
  managedOutputs: {
9499
9707
  dirs: [CONTINUE_RULES_DIR, CONTINUE_PROMPTS_DIR, CONTINUE_SKILLS_DIR, ".agents/skills"],
9500
- files: [CONTINUE_MCP_FILE, CONTINUE_GLOBAL_AGENTS_MD, CONTINUE_GLOBAL_CONFIG]
9708
+ files: [
9709
+ CONTINUE_MCP_FILE,
9710
+ CONTINUE_GLOBAL_AGENTS_MD,
9711
+ CONTINUE_GLOBAL_CONFIG,
9712
+ CONTINUE_GLOBAL_PERMISSIONS
9713
+ ]
9501
9714
  },
9502
9715
  mirrorGlobalPath(path, _activeTargets) {
9503
9716
  if (path.startsWith(`${CONTINUE_SKILLS_DIR}/`)) {
@@ -9526,7 +9739,7 @@ var init_continue2 = __esm({
9526
9739
  mcp: "native",
9527
9740
  hooks: "none",
9528
9741
  ignore: "none",
9529
- permissions: "none"
9742
+ permissions: "native"
9530
9743
  };
9531
9744
  descriptor9 = {
9532
9745
  id: "continue",
@@ -10423,7 +10636,7 @@ var init_capabilities4 = __esm({
10423
10636
  agents: "native",
10424
10637
  skills: "native",
10425
10638
  mcp: "native",
10426
- hooks: "partial",
10639
+ hooks: "native",
10427
10640
  ignore: "none",
10428
10641
  permissions: "none"
10429
10642
  };
@@ -10705,11 +10918,12 @@ async function importFromCrush(projectRoot, options = {}) {
10705
10918
  results.push(...await runDescriptorImport(descriptor11, projectRoot, scope, { normalize }));
10706
10919
  const skillsDir = scope === "global" ? CRUSH_GLOBAL_SKILLS_DIR : CRUSH_SKILLS_DIR;
10707
10920
  await importEmbeddedSkills(projectRoot, skillsDir, CRUSH_TARGET, results, normalize);
10708
- await importCrushConfigJson(projectRoot, results);
10921
+ await importCrushConfigJson(projectRoot, scope, results);
10709
10922
  return results;
10710
10923
  }
10711
- async function importCrushConfigJson(projectRoot, results) {
10712
- const configPath = join(projectRoot, CRUSH_CONFIG_FILE);
10924
+ async function importCrushConfigJson(projectRoot, scope, results) {
10925
+ const configRel = scope === "global" ? CRUSH_GLOBAL_CONFIG_FILE : CRUSH_CONFIG_FILE;
10926
+ const configPath = join(projectRoot, configRel);
10713
10927
  const content = await readFileSafe(configPath);
10714
10928
  if (content === null) return;
10715
10929
  let parsed;
@@ -11212,33 +11426,81 @@ var init_agents2 = __esm({
11212
11426
  function generatePermissions4(_canonical) {
11213
11427
  return [];
11214
11428
  }
11215
- var init_permissions = __esm({
11429
+ var init_permissions2 = __esm({
11216
11430
  "src/targets/cursor/generator/permissions.ts"() {
11217
11431
  }
11218
11432
  });
11219
11433
 
11220
- // src/targets/cursor/generator/hooks.ts
11434
+ // src/targets/cursor/hook-format.ts
11435
+ function unmappedCursorHookEvents(hooks) {
11436
+ return Object.keys(hooks).filter(
11437
+ (event) => Array.isArray(hooks[event]) && hooks[event].length > 0 && !(event in CANONICAL_TO_CURSOR)
11438
+ );
11439
+ }
11221
11440
  function toCursorHooks(hooks) {
11222
11441
  const result = {};
11223
11442
  for (const [event, entries] of Object.entries(hooks)) {
11224
- if (!Array.isArray(entries)) continue;
11225
- const translated = [];
11226
- for (const e of entries) {
11227
- if (!hasHookText(e)) continue;
11228
- const command = getHookCommand(e);
11229
- const prompt = getHookPrompt(e);
11230
- const value = e.type === "prompt" ? prompt || command : command || prompt;
11231
- const hookItem = {
11232
- type: e.type === "prompt" ? "prompt" : "command",
11233
- [e.type === "prompt" ? "prompt" : "command"]: value
11443
+ const cursorEvent = CANONICAL_TO_CURSOR[event];
11444
+ if (!cursorEvent || !Array.isArray(entries)) continue;
11445
+ const flat = [];
11446
+ for (const entry of entries) {
11447
+ if (!hasHookText(entry)) continue;
11448
+ const value = getHookText(entry);
11449
+ const hook = entry.type === "prompt" ? { type: "prompt", prompt: value } : { type: "command", command: value };
11450
+ if (entry.matcher) hook.matcher = entry.matcher;
11451
+ if (entry.timeout !== void 0) hook.timeout = entry.timeout;
11452
+ flat.push(hook);
11453
+ }
11454
+ if (flat.length > 0) result[cursorEvent] = flat;
11455
+ }
11456
+ return result;
11457
+ }
11458
+ function cursorHooksToCanonical(hooks) {
11459
+ const result = {};
11460
+ for (const [cursorEvent, entries] of Object.entries(hooks)) {
11461
+ const canonicalEvent = CURSOR_TO_CANONICAL.get(cursorEvent);
11462
+ if (!canonicalEvent || !Array.isArray(entries)) continue;
11463
+ const list = [];
11464
+ for (const entry of entries) {
11465
+ if (!entry || typeof entry !== "object") continue;
11466
+ const e = entry;
11467
+ const type = e.type === "prompt" ? "prompt" : "command";
11468
+ if (!hasHookText({ ...e, type })) continue;
11469
+ const value = getHookText({ ...e, type });
11470
+ const item = {
11471
+ matcher: typeof e.matcher === "string" ? e.matcher : "",
11472
+ type,
11473
+ command: value
11234
11474
  };
11235
- if (e.timeout !== void 0) hookItem.timeout = e.timeout;
11236
- translated.push({ matcher: e.matcher, hooks: [hookItem] });
11475
+ if (typeof e.timeout === "number") item.timeout = e.timeout;
11476
+ list.push(item);
11237
11477
  }
11238
- if (translated.length > 0) result[event] = translated;
11478
+ if (list.length > 0) result[canonicalEvent] = [...result[canonicalEvent] ?? [], ...list];
11239
11479
  }
11240
11480
  return result;
11241
11481
  }
11482
+ var CANONICAL_TO_CURSOR, CURSOR_TO_CANONICAL;
11483
+ var init_hook_format = __esm({
11484
+ "src/targets/cursor/hook-format.ts"() {
11485
+ init_hook_command();
11486
+ CANONICAL_TO_CURSOR = {
11487
+ PreToolUse: "preToolUse",
11488
+ PostToolUse: "postToolUse",
11489
+ UserPromptSubmit: "beforeSubmitPrompt",
11490
+ SubagentStart: "subagentStart",
11491
+ SubagentStop: "subagentStop",
11492
+ Stop: "stop",
11493
+ SessionStart: "sessionStart",
11494
+ SessionEnd: "sessionEnd",
11495
+ PreCompact: "preCompact"
11496
+ };
11497
+ CURSOR_TO_CANONICAL = new Map(
11498
+ Object.entries(CANONICAL_TO_CURSOR).map(([canonical, cursor]) => [cursor, canonical])
11499
+ );
11500
+ }
11501
+ });
11502
+
11503
+ // src/targets/cursor/generator/hooks.ts
11242
11504
  function generateHooks7(canonical) {
11243
11505
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
11244
11506
  const cursorHooks = toCursorHooks(canonical.hooks);
@@ -11248,8 +11510,8 @@ function generateHooks7(canonical) {
11248
11510
  }
11249
11511
  var init_hooks2 = __esm({
11250
11512
  "src/targets/cursor/generator/hooks.ts"() {
11251
- init_hook_command();
11252
11513
  init_constants11();
11514
+ init_hook_format();
11253
11515
  }
11254
11516
  });
11255
11517
 
@@ -11273,7 +11535,7 @@ var init_generator13 = __esm({
11273
11535
  init_mcp2();
11274
11536
  init_skills2();
11275
11537
  init_agents2();
11276
- init_permissions();
11538
+ init_permissions2();
11277
11539
  init_hooks2();
11278
11540
  init_ignore();
11279
11541
  }
@@ -11451,30 +11713,6 @@ var init_importer_rules3 = __esm({
11451
11713
  init_constants11();
11452
11714
  }
11453
11715
  });
11454
- function cursorHooksToCanonical(hooks) {
11455
- const result = {};
11456
- for (const [event, entries] of Object.entries(hooks)) {
11457
- if (!Array.isArray(entries)) continue;
11458
- const canonical = [];
11459
- for (const entry of entries) {
11460
- if (!entry || typeof entry !== "object") continue;
11461
- const e = entry;
11462
- const matcher = typeof e.matcher === "string" ? e.matcher : "";
11463
- if (!matcher) continue;
11464
- const hookList = Array.isArray(e.hooks) ? e.hooks : [];
11465
- for (const hook of hookList) {
11466
- const type = hook.type === "prompt" ? "prompt" : "command";
11467
- if (!hasHookText({ ...hook, type })) continue;
11468
- const value = type === "prompt" ? getHookPrompt(hook) || getHookCommand(hook) : getHookCommand(hook) || getHookPrompt(hook);
11469
- const item = { matcher, type, command: value };
11470
- if (typeof hook.timeout === "number") item.timeout = hook.timeout;
11471
- canonical.push(item);
11472
- }
11473
- }
11474
- if (canonical.length > 0) result[event] = canonical;
11475
- }
11476
- return result;
11477
- }
11478
11716
  async function importSettings2(projectRoot, results) {
11479
11717
  let hooksImportedFromHooksJson = false;
11480
11718
  const hooksJsonPath = join(projectRoot, CURSOR_HOOKS);
@@ -11576,7 +11814,7 @@ async function importIgnore(projectRoot, results) {
11576
11814
  }
11577
11815
  var init_settings_helpers3 = __esm({
11578
11816
  "src/targets/cursor/settings-helpers.ts"() {
11579
- init_hook_command();
11817
+ init_hook_format();
11580
11818
  init_fs();
11581
11819
  init_constants11();
11582
11820
  }
@@ -11887,6 +12125,18 @@ var init_linter12 = __esm({
11887
12125
  });
11888
12126
 
11889
12127
  // src/targets/cursor/lint.ts
12128
+ function lintHooks6(canonical) {
12129
+ if (!canonical.hooks) return [];
12130
+ const unmapped = unmappedCursorHookEvents(canonical.hooks);
12131
+ if (unmapped.length === 0) return [];
12132
+ return [
12133
+ createWarning(
12134
+ ".agentsmesh/hooks.yaml",
12135
+ "cursor",
12136
+ `Cursor has no equivalent for hook event(s) ${unmapped.join(", ")}; they are not projected to .cursor/hooks.json.`
12137
+ )
12138
+ ];
12139
+ }
11890
12140
  function lintCommands5(canonical) {
11891
12141
  return canonical.commands.filter((command) => command.description.length > 0 || command.allowedTools.length > 0).map(
11892
12142
  (command) => createWarning(
@@ -11931,6 +12181,7 @@ function lintPermissions4(canonical) {
11931
12181
  var init_lint11 = __esm({
11932
12182
  "src/targets/cursor/lint.ts"() {
11933
12183
  init_helpers();
12184
+ init_hook_format();
11934
12185
  }
11935
12186
  });
11936
12187
 
@@ -12035,7 +12286,7 @@ var init_cursor2 = __esm({
12035
12286
  };
12036
12287
  globalCapabilities10 = {
12037
12288
  rules: "native",
12038
- additionalRules: "embedded",
12289
+ additionalRules: "native",
12039
12290
  commands: "native",
12040
12291
  agents: "native",
12041
12292
  skills: "native",
@@ -12055,7 +12306,7 @@ var init_cursor2 = __esm({
12055
12306
  generators: target12,
12056
12307
  capabilities: {
12057
12308
  rules: "native",
12058
- additionalRules: "embedded",
12309
+ additionalRules: "native",
12059
12310
  commands: "native",
12060
12311
  agents: "native",
12061
12312
  skills: "native",
@@ -12069,7 +12320,8 @@ var init_cursor2 = __esm({
12069
12320
  lint: {
12070
12321
  commands: lintCommands5,
12071
12322
  mcp: lintMcp3,
12072
- permissions: lintPermissions4
12323
+ permissions: lintPermissions4,
12324
+ hooks: lintHooks6
12073
12325
  },
12074
12326
  project: project12,
12075
12327
  globalSupport: {
@@ -12440,10 +12692,18 @@ function generateSkills13(canonical) {
12440
12692
  return generateEmbeddedSkills(canonical, FACTORY_DROID_SKILLS_DIR);
12441
12693
  }
12442
12694
  function generateCommands13(canonical) {
12443
- return canonical.commands.map((command) => ({
12444
- path: `${FACTORY_DROID_SKILLS_DIR}/${commandSkillDirName(command.name)}/SKILL.md`,
12445
- content: serializeCommandSkill(command)
12446
- }));
12695
+ return canonical.commands.map((command) => {
12696
+ const frontmatter = {
12697
+ description: command.description || void 0,
12698
+ "allowed-tools": command.allowedTools.length > 0 ? command.allowedTools : void 0
12699
+ };
12700
+ if (frontmatter.description === void 0) delete frontmatter.description;
12701
+ if (frontmatter["allowed-tools"] === void 0) delete frontmatter["allowed-tools"];
12702
+ return {
12703
+ path: `${FACTORY_DROID_COMMANDS_DIR}/${command.name}.md`,
12704
+ content: serializeFrontmatter(frontmatter, command.body.trim() || "")
12705
+ };
12706
+ });
12447
12707
  }
12448
12708
  function generateAgents14(canonical) {
12449
12709
  return canonical.agents.map((agent) => ({
@@ -12452,10 +12712,7 @@ function generateAgents14(canonical) {
12452
12712
  }));
12453
12713
  }
12454
12714
  function generateHooks9(canonical) {
12455
- if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
12456
- const hooks = buildClaudeHooksObjectFromCanonical(canonical);
12457
- if (Object.keys(hooks).length === 0) return [];
12458
- return [{ path: FACTORY_DROID_HOOKS_FILE, content: JSON.stringify(hooks, null, 2) }];
12715
+ return buildWrappedCommandHooks(canonical, FACTORY_DROID_HOOKS_FILE);
12459
12716
  }
12460
12717
  function generateMcp11(canonical) {
12461
12718
  if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
@@ -12470,8 +12727,8 @@ var init_generator16 = __esm({
12470
12727
  "src/targets/factory-droid/generator.ts"() {
12471
12728
  init_embedded_skill();
12472
12729
  init_managed_blocks();
12473
- init_command_skill();
12474
- init_hooks_format();
12730
+ init_markdown();
12731
+ init_wrapped_command_hooks();
12475
12732
  init_droid_serializer();
12476
12733
  init_constants13();
12477
12734
  }
@@ -12524,6 +12781,13 @@ async function importFromFactoryDroid(projectRoot, options = {}) {
12524
12781
  await importEmbeddedSkills(projectRoot, skillsDir, FACTORY_DROID_TARGET, results, normalize);
12525
12782
  const mcpFile = scope === "global" ? FACTORY_DROID_GLOBAL_MCP_FILE : FACTORY_DROID_MCP_FILE;
12526
12783
  await importFactoryDroidMcp(projectRoot, mcpFile, results);
12784
+ await importWrappedCommandHooks({
12785
+ projectRoot,
12786
+ hooksFile: FACTORY_DROID_HOOKS_FILE,
12787
+ canonicalHooksPath: FACTORY_DROID_CANONICAL_HOOKS,
12788
+ targetName: FACTORY_DROID_TARGET,
12789
+ results
12790
+ });
12527
12791
  return results;
12528
12792
  }
12529
12793
  var init_importer14 = __esm({
@@ -12531,6 +12795,7 @@ var init_importer14 = __esm({
12531
12795
  init_import_rewriter();
12532
12796
  init_embedded_skill();
12533
12797
  init_descriptor_import_runner();
12798
+ init_wrapped_command_hooks();
12534
12799
  init_mcp_import2();
12535
12800
  init_constants13();
12536
12801
  init_factory_droid2();
@@ -12593,7 +12858,6 @@ var init_factory_droid2 = __esm({
12593
12858
  init_linter14();
12594
12859
  init_lint13();
12595
12860
  init_import_map_builders();
12596
- init_command_skill();
12597
12861
  target14 = {
12598
12862
  name: FACTORY_DROID_TARGET,
12599
12863
  primaryRootInstructionPath: FACTORY_DROID_ROOT_FILE,
@@ -12609,7 +12873,7 @@ var init_factory_droid2 = __esm({
12609
12873
  rootInstructionPath: FACTORY_DROID_ROOT_FILE,
12610
12874
  skillDir: FACTORY_DROID_SKILLS_DIR,
12611
12875
  managedOutputs: {
12612
- dirs: [FACTORY_DROID_SKILLS_DIR, FACTORY_DROID_DROIDS_DIR],
12876
+ dirs: [FACTORY_DROID_SKILLS_DIR, FACTORY_DROID_COMMANDS_DIR, FACTORY_DROID_DROIDS_DIR],
12613
12877
  files: [FACTORY_DROID_ROOT_FILE, FACTORY_DROID_HOOKS_FILE, FACTORY_DROID_MCP_FILE]
12614
12878
  },
12615
12879
  paths: {
@@ -12617,7 +12881,7 @@ var init_factory_droid2 = __esm({
12617
12881
  return FACTORY_DROID_ROOT_FILE;
12618
12882
  },
12619
12883
  commandPath(name) {
12620
- return `${FACTORY_DROID_SKILLS_DIR}/${commandSkillDirName(name)}/SKILL.md`;
12884
+ return `${FACTORY_DROID_COMMANDS_DIR}/${name}.md`;
12621
12885
  },
12622
12886
  agentPath(name) {
12623
12887
  return `${FACTORY_DROID_DROIDS_DIR}/${name}.md`;
@@ -12628,8 +12892,16 @@ var init_factory_droid2 = __esm({
12628
12892
  rootInstructionPath: FACTORY_DROID_GLOBAL_ROOT_FILE,
12629
12893
  skillDir: FACTORY_DROID_GLOBAL_SKILLS_DIR,
12630
12894
  managedOutputs: {
12631
- dirs: [FACTORY_DROID_GLOBAL_SKILLS_DIR, FACTORY_DROID_GLOBAL_DROIDS_DIR],
12632
- files: [FACTORY_DROID_GLOBAL_ROOT_FILE, FACTORY_DROID_GLOBAL_HOOKS_FILE, FACTORY_DROID_GLOBAL_MCP_FILE]
12895
+ dirs: [
12896
+ FACTORY_DROID_GLOBAL_SKILLS_DIR,
12897
+ FACTORY_DROID_GLOBAL_COMMANDS_DIR,
12898
+ FACTORY_DROID_GLOBAL_DROIDS_DIR
12899
+ ],
12900
+ files: [
12901
+ FACTORY_DROID_GLOBAL_ROOT_FILE,
12902
+ FACTORY_DROID_GLOBAL_HOOKS_FILE,
12903
+ FACTORY_DROID_GLOBAL_MCP_FILE
12904
+ ]
12633
12905
  },
12634
12906
  rewriteGeneratedPath(path) {
12635
12907
  if (path === FACTORY_DROID_ROOT_FILE) return FACTORY_DROID_GLOBAL_ROOT_FILE;
@@ -12647,7 +12919,7 @@ var init_factory_droid2 = __esm({
12647
12919
  return FACTORY_DROID_GLOBAL_ROOT_FILE;
12648
12920
  },
12649
12921
  commandPath(name) {
12650
- return `${FACTORY_DROID_GLOBAL_SKILLS_DIR}/${commandSkillDirName(name)}/SKILL.md`;
12922
+ return `${FACTORY_DROID_GLOBAL_COMMANDS_DIR}/${name}.md`;
12651
12923
  },
12652
12924
  agentPath(name) {
12653
12925
  return `${FACTORY_DROID_GLOBAL_DROIDS_DIR}/${name}.md`;
@@ -12657,7 +12929,7 @@ var init_factory_droid2 = __esm({
12657
12929
  capabilities6 = {
12658
12930
  rules: "native",
12659
12931
  additionalRules: "embedded",
12660
- commands: "none",
12932
+ commands: "native",
12661
12933
  agents: "native",
12662
12934
  skills: "native",
12663
12935
  mcp: "native",
@@ -12681,7 +12953,6 @@ var init_factory_droid2 = __esm({
12681
12953
  permissions: lintPermissions6,
12682
12954
  ignore: lintIgnore3
12683
12955
  },
12684
- supportsConversion: { commands: true },
12685
12956
  project: project14,
12686
12957
  globalSupport: {
12687
12958
  capabilities: capabilities6,
@@ -12703,6 +12974,28 @@ var init_factory_droid2 = __esm({
12703
12974
  canonicalDir: FACTORY_DROID_CANONICAL_RULES_DIR,
12704
12975
  canonicalRootFilename: "_root.md",
12705
12976
  markAsRoot: true
12977
+ },
12978
+ commands: {
12979
+ feature: "commands",
12980
+ mode: "directory",
12981
+ source: {
12982
+ project: [FACTORY_DROID_COMMANDS_DIR],
12983
+ global: [FACTORY_DROID_GLOBAL_COMMANDS_DIR]
12984
+ },
12985
+ canonicalDir: FACTORY_DROID_CANONICAL_COMMANDS_DIR,
12986
+ extensions: [".md"],
12987
+ preset: "command"
12988
+ },
12989
+ agents: {
12990
+ feature: "agents",
12991
+ mode: "directory",
12992
+ source: {
12993
+ project: [FACTORY_DROID_DROIDS_DIR],
12994
+ global: [FACTORY_DROID_GLOBAL_DROIDS_DIR]
12995
+ },
12996
+ canonicalDir: FACTORY_DROID_CANONICAL_AGENTS_DIR,
12997
+ extensions: [".md"],
12998
+ preset: "agent"
12706
12999
  }
12707
13000
  },
12708
13001
  buildImportPaths: buildFactoryDroidImportPaths,
@@ -12712,7 +13005,7 @@ var init_factory_droid2 = __esm({
12712
13005
  });
12713
13006
 
12714
13007
  // src/targets/gemini-cli/constants.ts
12715
- var GEMINI_TARGET, GEMINI_ROOT, GEMINI_COMPAT_AGENTS, GEMINI_RULES_DIR, GEMINI_COMPAT_INNER_ROOT, GEMINI_COMMANDS_DIR, GEMINI_POLICIES_DIR, GEMINI_SETTINGS, GEMINI_IGNORE, GEMINI_SKILLS_DIR, GEMINI_AGENTS_DIR, GEMINI_SYSTEM, GEMINI_DEFAULT_POLICIES_FILE, GEMINI_CANONICAL_RULES_DIR, GEMINI_CANONICAL_COMMANDS_DIR, GEMINI_CANONICAL_AGENTS_DIR, GEMINI_CANONICAL_SKILLS_DIR, GEMINI_CANONICAL_MCP, GEMINI_CANONICAL_HOOKS, GEMINI_CANONICAL_IGNORE, GEMINI_CANONICAL_PERMISSIONS, GEMINI_GLOBAL_ROOT, GEMINI_GLOBAL_COMPAT_AGENTS, GEMINI_GLOBAL_SETTINGS, GEMINI_GLOBAL_COMMANDS_DIR, GEMINI_GLOBAL_SKILLS_DIR, GEMINI_GLOBAL_AGENTS_DIR;
13008
+ var GEMINI_TARGET, GEMINI_ROOT, GEMINI_COMPAT_AGENTS, GEMINI_RULES_DIR, GEMINI_COMPAT_INNER_ROOT, GEMINI_COMMANDS_DIR, GEMINI_POLICIES_DIR, GEMINI_SETTINGS, GEMINI_IGNORE, GEMINI_SKILLS_DIR, GEMINI_AGENTS_DIR, GEMINI_SYSTEM, GEMINI_DEFAULT_POLICIES_FILE, GEMINI_CANONICAL_RULES_DIR, GEMINI_CANONICAL_COMMANDS_DIR, GEMINI_CANONICAL_AGENTS_DIR, GEMINI_CANONICAL_SKILLS_DIR, GEMINI_CANONICAL_MCP, GEMINI_CANONICAL_HOOKS, GEMINI_CANONICAL_IGNORE, GEMINI_CANONICAL_PERMISSIONS, GEMINI_GLOBAL_ROOT, GEMINI_GLOBAL_COMPAT_AGENTS, GEMINI_GLOBAL_SETTINGS, GEMINI_GLOBAL_COMMANDS_DIR, GEMINI_GLOBAL_SKILLS_DIR, GEMINI_GLOBAL_AGENTS_DIR, GEMINI_GLOBAL_POLICIES_FILE;
12716
13009
  var init_constants30 = __esm({
12717
13010
  "src/targets/gemini-cli/constants.ts"() {
12718
13011
  GEMINI_TARGET = "gemini-cli";
@@ -12742,6 +13035,7 @@ var init_constants30 = __esm({
12742
13035
  GEMINI_GLOBAL_COMMANDS_DIR = ".gemini/commands";
12743
13036
  GEMINI_GLOBAL_SKILLS_DIR = ".gemini/skills";
12744
13037
  GEMINI_GLOBAL_AGENTS_DIR = ".gemini/agents";
13038
+ GEMINI_GLOBAL_POLICIES_FILE = ".gemini/policies/permissions.toml";
12745
13039
  }
12746
13040
  });
12747
13041
 
@@ -13635,7 +13929,7 @@ function lintCommands6(canonical) {
13635
13929
  )
13636
13930
  );
13637
13931
  }
13638
- function lintHooks6(canonical) {
13932
+ function lintHooks7(canonical) {
13639
13933
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
13640
13934
  const supported = ["PreToolUse", "PostToolUse", "Notification"];
13641
13935
  const supportedSet = new Set(supported);
@@ -13745,7 +14039,12 @@ var init_gemini_cli2 = __esm({
13745
14039
  skillDir: GEMINI_GLOBAL_SKILLS_DIR,
13746
14040
  managedOutputs: {
13747
14041
  dirs: [GEMINI_GLOBAL_COMMANDS_DIR, GEMINI_GLOBAL_SKILLS_DIR, GEMINI_GLOBAL_AGENTS_DIR],
13748
- files: [GEMINI_GLOBAL_ROOT, GEMINI_GLOBAL_COMPAT_AGENTS, GEMINI_GLOBAL_SETTINGS]
14042
+ files: [
14043
+ GEMINI_GLOBAL_ROOT,
14044
+ GEMINI_GLOBAL_COMPAT_AGENTS,
14045
+ GEMINI_GLOBAL_SETTINGS,
14046
+ GEMINI_GLOBAL_POLICIES_FILE
14047
+ ]
13749
14048
  },
13750
14049
  rewriteGeneratedPath(path) {
13751
14050
  if (path === GEMINI_ROOT) {
@@ -13766,7 +14065,7 @@ var init_gemini_cli2 = __esm({
13766
14065
  if (path.startsWith(`${GEMINI_AGENTS_DIR}/`)) {
13767
14066
  return path.replace(`${GEMINI_AGENTS_DIR}/`, `${GEMINI_GLOBAL_AGENTS_DIR}/`);
13768
14067
  }
13769
- if (path.startsWith(".gemini/policies/") || path === ".geminiignore") {
14068
+ if (path === ".geminiignore") {
13770
14069
  return null;
13771
14070
  }
13772
14071
  return path;
@@ -13801,7 +14100,7 @@ var init_gemini_cli2 = __esm({
13801
14100
  mcp: "native",
13802
14101
  hooks: "partial",
13803
14102
  ignore: "none",
13804
- permissions: "none"
14103
+ permissions: "native"
13805
14104
  };
13806
14105
  descriptor15 = {
13807
14106
  id: "gemini-cli",
@@ -13827,7 +14126,7 @@ var init_gemini_cli2 = __esm({
13827
14126
  lintRules: lintRules15,
13828
14127
  lint: {
13829
14128
  commands: lintCommands6,
13830
- hooks: lintHooks6
14129
+ hooks: lintHooks7
13831
14130
  },
13832
14131
  emitScopedSettings: emitScopedGeminiSettings,
13833
14132
  mergeGeneratedOutputContent(existing, pending, newContent, resolvedPath) {
@@ -13902,6 +14201,9 @@ function generateIgnore8(canonical) {
13902
14201
  if (canonical.ignore.length === 0) return [];
13903
14202
  return [{ path: GOOSE_IGNORE, content: canonical.ignore.join("\n") }];
13904
14203
  }
14204
+ function generateHooks10(canonical) {
14205
+ return buildWrappedCommandHooks(canonical, GOOSE_HOOKS_FILE);
14206
+ }
13905
14207
  function mcpServerToExtension(name, server) {
13906
14208
  const base = {
13907
14209
  bundled: null,
@@ -13935,11 +14237,52 @@ var init_generator19 = __esm({
13935
14237
  init_managed_blocks();
13936
14238
  init_projected_agent_skill();
13937
14239
  init_command_skill();
14240
+ init_wrapped_command_hooks();
13938
14241
  init_constants14();
13939
14242
  }
13940
14243
  });
13941
-
13942
- // src/targets/goose/importer.ts
14244
+ function parseYamlObject(content) {
14245
+ if (content === null) return {};
14246
+ try {
14247
+ const parsed = parse(content);
14248
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
14249
+ return parsed;
14250
+ }
14251
+ } catch {
14252
+ }
14253
+ return {};
14254
+ }
14255
+ function serializeGoosePermissions(permissions, existingContent) {
14256
+ const allow = permissions?.allow ?? [];
14257
+ const ask = permissions?.ask ?? [];
14258
+ const deny = permissions?.deny ?? [];
14259
+ if (allow.length === 0 && ask.length === 0 && deny.length === 0) return null;
14260
+ const user = {};
14261
+ if (allow.length > 0) user.always_allow = allow;
14262
+ if (ask.length > 0) user.ask_before = ask;
14263
+ if (deny.length > 0) user.never_allow = deny;
14264
+ const root = parseYamlObject(existingContent);
14265
+ root.user = user;
14266
+ return stringify(root).trimEnd() + "\n";
14267
+ }
14268
+ function parseGoosePermissions(content) {
14269
+ const root = parseYamlObject(content);
14270
+ const user = root.user;
14271
+ if (!user || typeof user !== "object" || Array.isArray(user)) return null;
14272
+ const block = user;
14273
+ const allow = toStringArray5(block.always_allow);
14274
+ const ask = toStringArray5(block.ask_before);
14275
+ const deny = toStringArray5(block.never_allow);
14276
+ if (allow.length === 0 && ask.length === 0 && deny.length === 0) return null;
14277
+ const permissions = { allow, deny };
14278
+ if (ask.length > 0) permissions.ask = ask;
14279
+ return permissions;
14280
+ }
14281
+ var init_permissions3 = __esm({
14282
+ "src/targets/goose/permissions.ts"() {
14283
+ init_shared_import_helpers();
14284
+ }
14285
+ });
13943
14286
  async function importFromGoose(projectRoot, options = {}) {
13944
14287
  const scope = options.scope ?? "project";
13945
14288
  const results = [];
@@ -13947,14 +14290,41 @@ async function importFromGoose(projectRoot, options = {}) {
13947
14290
  results.push(...await runDescriptorImport(descriptor16, projectRoot, scope, { normalize }));
13948
14291
  const skillsDir = scope === "global" ? GOOSE_GLOBAL_SKILLS_DIR : GOOSE_SKILLS_DIR;
13949
14292
  await importEmbeddedSkills(projectRoot, skillsDir, GOOSE_TARGET, results, normalize);
14293
+ await importWrappedCommandHooks({
14294
+ projectRoot,
14295
+ hooksFile: GOOSE_HOOKS_FILE,
14296
+ canonicalHooksPath: GOOSE_CANONICAL_HOOKS,
14297
+ targetName: GOOSE_TARGET,
14298
+ results
14299
+ });
14300
+ if (scope === "global") await importPermissions2(projectRoot, results);
13950
14301
  return results;
13951
14302
  }
14303
+ async function importPermissions2(projectRoot, results) {
14304
+ const srcPath = join(projectRoot, GOOSE_GLOBAL_PERMISSIONS);
14305
+ const content = await readFileSafe(srcPath);
14306
+ if (content === null) return;
14307
+ const permissions = parseGoosePermissions(content);
14308
+ if (!permissions) return;
14309
+ const destPath = join(projectRoot, GOOSE_CANONICAL_PERMISSIONS);
14310
+ await mkdirp(dirname(destPath));
14311
+ await writeFileAtomic(destPath, stringify(permissions).trimEnd() + "\n");
14312
+ results.push({
14313
+ fromTool: GOOSE_TARGET,
14314
+ fromPath: srcPath,
14315
+ toPath: GOOSE_CANONICAL_PERMISSIONS,
14316
+ feature: "permissions"
14317
+ });
14318
+ }
13952
14319
  var init_importer16 = __esm({
13953
14320
  "src/targets/goose/importer.ts"() {
13954
14321
  init_import_rewriter();
14322
+ init_fs();
13955
14323
  init_embedded_skill();
13956
14324
  init_descriptor_import_runner();
14325
+ init_wrapped_command_hooks();
13957
14326
  init_constants14();
14327
+ init_permissions3();
13958
14328
  init_goose2();
13959
14329
  }
13960
14330
  });
@@ -14080,6 +14450,34 @@ var init_importer_spec3 = __esm({
14080
14450
  };
14081
14451
  }
14082
14452
  });
14453
+ function computeStatus5(existing, content) {
14454
+ if (existing === null) return "created";
14455
+ if (existing !== content) return "updated";
14456
+ return "unchanged";
14457
+ }
14458
+ var generateGooseScopeExtras;
14459
+ var init_scope_extras3 = __esm({
14460
+ "src/targets/goose/scope-extras.ts"() {
14461
+ init_fs();
14462
+ init_constants14();
14463
+ init_permissions3();
14464
+ generateGooseScopeExtras = async (canonical, projectRoot, scope, enabledFeatures) => {
14465
+ if (scope !== "global" || !enabledFeatures.has("permissions")) return [];
14466
+ const existing = await readFileSafe(join(projectRoot, GOOSE_GLOBAL_PERMISSIONS));
14467
+ const content = serializeGoosePermissions(canonical.permissions, existing);
14468
+ if (!content) return [];
14469
+ return [
14470
+ {
14471
+ target: "goose",
14472
+ path: GOOSE_GLOBAL_PERMISSIONS,
14473
+ content,
14474
+ currentContent: existing ?? void 0,
14475
+ status: computeStatus5(existing, content)
14476
+ }
14477
+ ];
14478
+ };
14479
+ }
14480
+ });
14083
14481
 
14084
14482
  // src/targets/goose/linter.ts
14085
14483
  function lintRules16(canonical, projectRoot, projectFiles, options) {
@@ -14098,21 +14496,9 @@ var init_linter16 = __esm({
14098
14496
  });
14099
14497
 
14100
14498
  // src/targets/goose/lint.ts
14101
- function lintHooks7(canonical) {
14102
- if (!canonical.hooks) return [];
14103
- const hasEntries = Object.values(canonical.hooks).some(
14104
- (entries) => Array.isArray(entries) && entries.length > 0
14105
- );
14106
- if (!hasEntries) return [];
14107
- return [
14108
- createWarning(
14109
- ".agentsmesh/hooks.yaml",
14110
- "goose",
14111
- "Goose has no lifecycle hook system; canonical hooks are not projected."
14112
- )
14113
- ];
14114
- }
14115
- function lintPermissions7(canonical) {
14499
+ function lintPermissions7(canonical, options) {
14500
+ const scope = options?.scope;
14501
+ if (scope === "global") return [];
14116
14502
  if (!canonical.permissions) return [];
14117
14503
  const { allow, deny } = canonical.permissions;
14118
14504
  const ask = canonical.permissions.ask ?? [];
@@ -14121,7 +14507,7 @@ function lintPermissions7(canonical) {
14121
14507
  createWarning(
14122
14508
  ".agentsmesh/permissions.yaml",
14123
14509
  "goose",
14124
- "Goose permissions are managed at runtime via permission.yaml in ~/.config/goose/; canonical permissions are not projected."
14510
+ "Goose applies tool permissions only at global scope (~/.config/goose/permission.yaml); project-scope permissions are not projected."
14125
14511
  )
14126
14512
  ];
14127
14513
  }
@@ -14151,6 +14537,7 @@ var init_goose2 = __esm({
14151
14537
  init_skill_mirror();
14152
14538
  init_importer16();
14153
14539
  init_importer_spec3();
14540
+ init_scope_extras3();
14154
14541
  init_linter16();
14155
14542
  init_lint15();
14156
14543
  init_import_map_builders();
@@ -14164,6 +14551,7 @@ var init_goose2 = __esm({
14164
14551
  generateSkills: generateSkills15,
14165
14552
  generateIgnore: generateIgnore8,
14166
14553
  generateMcp: generateMcp12,
14554
+ generateHooks: generateHooks10,
14167
14555
  importFrom: importFromGoose
14168
14556
  };
14169
14557
  project16 = {
@@ -14171,7 +14559,7 @@ var init_goose2 = __esm({
14171
14559
  skillDir: GOOSE_SKILLS_DIR,
14172
14560
  managedOutputs: {
14173
14561
  dirs: [GOOSE_SKILLS_DIR],
14174
- files: [GOOSE_ROOT_FILE, GOOSE_IGNORE]
14562
+ files: [GOOSE_ROOT_FILE, GOOSE_IGNORE, GOOSE_HOOKS_FILE]
14175
14563
  },
14176
14564
  paths: {
14177
14565
  rulePath(_slug) {
@@ -14190,7 +14578,13 @@ var init_goose2 = __esm({
14190
14578
  skillDir: GOOSE_GLOBAL_SKILLS_DIR,
14191
14579
  managedOutputs: {
14192
14580
  dirs: [GOOSE_GLOBAL_SKILLS_DIR],
14193
- files: [GOOSE_GLOBAL_ROOT_FILE, GOOSE_GLOBAL_IGNORE, GOOSE_GLOBAL_CONFIG]
14581
+ files: [
14582
+ GOOSE_GLOBAL_ROOT_FILE,
14583
+ GOOSE_GLOBAL_IGNORE,
14584
+ GOOSE_GLOBAL_CONFIG,
14585
+ GOOSE_HOOKS_FILE,
14586
+ GOOSE_GLOBAL_PERMISSIONS
14587
+ ]
14194
14588
  },
14195
14589
  rewriteGeneratedPath(path) {
14196
14590
  if (path === GOOSE_ROOT_FILE) return GOOSE_GLOBAL_ROOT_FILE;
@@ -14219,7 +14613,7 @@ var init_goose2 = __esm({
14219
14613
  agents: "none",
14220
14614
  skills: "native",
14221
14615
  mcp: "none",
14222
- hooks: "none",
14616
+ hooks: "native",
14223
14617
  ignore: "native",
14224
14618
  permissions: "none"
14225
14619
  };
@@ -14230,9 +14624,9 @@ var init_goose2 = __esm({
14230
14624
  agents: "none",
14231
14625
  skills: "native",
14232
14626
  mcp: "native",
14233
- hooks: "none",
14627
+ hooks: "native",
14234
14628
  ignore: "native",
14235
- permissions: "none"
14629
+ permissions: "native"
14236
14630
  };
14237
14631
  descriptor16 = {
14238
14632
  id: GOOSE_TARGET,
@@ -14247,7 +14641,6 @@ var init_goose2 = __esm({
14247
14641
  emptyImportMessage: "No Goose config found (.goosehints, .agents/skills, or .gooseignore).",
14248
14642
  lintRules: lintRules16,
14249
14643
  lint: {
14250
- hooks: lintHooks7,
14251
14644
  permissions: lintPermissions7,
14252
14645
  mcp: lintMcp4
14253
14646
  },
@@ -14261,7 +14654,8 @@ var init_goose2 = __esm({
14261
14654
  GOOSE_GLOBAL_SKILLS_DIR,
14262
14655
  GOOSE_GLOBAL_CONFIG
14263
14656
  ],
14264
- layout: globalLayout16
14657
+ layout: globalLayout16,
14658
+ scopeExtras: generateGooseScopeExtras
14265
14659
  },
14266
14660
  importer: gooseImporter,
14267
14661
  sharedArtifacts: {
@@ -15563,7 +15957,7 @@ function serializeCanonicalHooks(hooks) {
15563
15957
  return stringify(hooks).trimEnd();
15564
15958
  }
15565
15959
  var CANONICAL_TO_KIRO, KIRO_TO_CANONICAL;
15566
- var init_hook_format = __esm({
15960
+ var init_hook_format2 = __esm({
15567
15961
  "src/targets/kiro/hook-format.ts"() {
15568
15962
  CANONICAL_TO_KIRO = {
15569
15963
  UserPromptSubmit: "promptSubmit",
@@ -15629,7 +16023,7 @@ function generateMcp15(canonical) {
15629
16023
  }
15630
16024
  ];
15631
16025
  }
15632
- function generateHooks10(canonical) {
16026
+ function generateHooks11(canonical) {
15633
16027
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
15634
16028
  return generateKiroHooks(canonical.hooks).map((hook) => ({
15635
16029
  path: `${KIRO_HOOKS_DIR}/${hook.name}`,
@@ -15660,7 +16054,7 @@ var init_generator23 = __esm({
15660
16054
  init_embedded_skill();
15661
16055
  init_command_skill();
15662
16056
  init_markdown();
15663
- init_hook_format();
16057
+ init_hook_format2();
15664
16058
  init_constants18();
15665
16059
  }
15666
16060
  });
@@ -15765,7 +16159,7 @@ var init_importer20 = __esm({
15765
16159
  init_shared_import_helpers();
15766
16160
  init_fs();
15767
16161
  init_markdown();
15768
- init_hook_format();
16162
+ init_hook_format2();
15769
16163
  init_constants18();
15770
16164
  init_kiro2();
15771
16165
  }
@@ -15822,7 +16216,7 @@ var init_kiro2 = __esm({
15822
16216
  generateAgents: generateAgents19,
15823
16217
  generateSkills: generateSkills18,
15824
16218
  generateMcp: generateMcp15,
15825
- generateHooks: generateHooks10,
16219
+ generateHooks: generateHooks11,
15826
16220
  generateIgnore: generateIgnore11,
15827
16221
  importFrom: importFromKiro
15828
16222
  };
@@ -16141,7 +16535,7 @@ async function importMcp4(projectRoot, scope, results) {
16141
16535
  toPath: OPENCODE_CANONICAL_MCP
16142
16536
  });
16143
16537
  }
16144
- async function importPermissions(projectRoot, scope, results) {
16538
+ async function importPermissions3(projectRoot, scope, results) {
16145
16539
  const configFile = scope === "global" ? OPENCODE_GLOBAL_CONFIG_FILE : OPENCODE_CONFIG_FILE;
16146
16540
  const srcPath = join(projectRoot, configFile);
16147
16541
  const content = await readFileSafe(srcPath);
@@ -16179,7 +16573,7 @@ async function importFromOpenCode(projectRoot, options = {}) {
16179
16573
  results.push(...await runDescriptorImport(descriptor21, projectRoot, scope, { normalize }));
16180
16574
  await importEmbeddedSkills(projectRoot, OPENCODE_SKILLS_DIR, OPENCODE_TARGET, results, normalize);
16181
16575
  await importMcp4(projectRoot, scope, results);
16182
- await importPermissions(projectRoot, scope, results);
16576
+ await importPermissions3(projectRoot, scope, results);
16183
16577
  return results;
16184
16578
  }
16185
16579
  var init_importer21 = __esm({
@@ -16527,10 +16921,14 @@ function generateSkills20(canonical) {
16527
16921
  return generateEmbeddedSkills(canonical, PI_AGENT_SKILLS_DIR);
16528
16922
  }
16529
16923
  function generateCommands20(canonical) {
16530
- return canonical.commands.map((command) => ({
16531
- path: `${PI_AGENT_SKILLS_DIR}/${commandSkillDirName(command.name)}/SKILL.md`,
16532
- content: serializeCommandSkill(command)
16533
- }));
16924
+ return canonical.commands.map((command) => {
16925
+ const frontmatter = {};
16926
+ if (command.description) frontmatter.description = command.description;
16927
+ return {
16928
+ path: `${PI_AGENT_COMMANDS_DIR}/${command.name}.md`,
16929
+ content: serializeFrontmatter(frontmatter, command.body.trim() || "")
16930
+ };
16931
+ });
16534
16932
  }
16535
16933
  function generateAgents21(canonical) {
16536
16934
  return canonical.agents.map((agent) => ({
@@ -16542,8 +16940,8 @@ var init_generator25 = __esm({
16542
16940
  "src/targets/pi-agent/generator.ts"() {
16543
16941
  init_embedded_skill();
16544
16942
  init_managed_blocks();
16943
+ init_markdown();
16545
16944
  init_projected_agent_skill();
16546
- init_command_skill();
16547
16945
  init_constants20();
16548
16946
  }
16549
16947
  });
@@ -16642,7 +17040,6 @@ var init_lint21 = __esm({
16642
17040
  var target22, project22, globalLayout21, capabilities11, descriptor22;
16643
17041
  var init_pi_agent2 = __esm({
16644
17042
  "src/targets/pi-agent/index.ts"() {
16645
- init_command_skill();
16646
17043
  init_projected_agent_skill();
16647
17044
  init_generator25();
16648
17045
  init_skill_mirror();
@@ -16664,7 +17061,7 @@ var init_pi_agent2 = __esm({
16664
17061
  rootInstructionPath: PI_AGENT_ROOT_FILE,
16665
17062
  skillDir: PI_AGENT_SKILLS_DIR,
16666
17063
  managedOutputs: {
16667
- dirs: [PI_AGENT_SKILLS_DIR],
17064
+ dirs: [PI_AGENT_SKILLS_DIR, PI_AGENT_COMMANDS_DIR],
16668
17065
  files: [PI_AGENT_ROOT_FILE]
16669
17066
  },
16670
17067
  paths: {
@@ -16672,7 +17069,7 @@ var init_pi_agent2 = __esm({
16672
17069
  return PI_AGENT_ROOT_FILE;
16673
17070
  },
16674
17071
  commandPath(name) {
16675
- return `${PI_AGENT_SKILLS_DIR}/${commandSkillDirName(name)}/SKILL.md`;
17072
+ return `${PI_AGENT_COMMANDS_DIR}/${name}.md`;
16676
17073
  },
16677
17074
  agentPath(name) {
16678
17075
  return `${PI_AGENT_SKILLS_DIR}/${projectedAgentSkillDirName(name)}/SKILL.md`;
@@ -16683,11 +17080,14 @@ var init_pi_agent2 = __esm({
16683
17080
  rootInstructionPath: PI_AGENT_GLOBAL_ROOT_FILE,
16684
17081
  skillDir: PI_AGENT_GLOBAL_SKILLS_DIR,
16685
17082
  managedOutputs: {
16686
- dirs: [PI_AGENT_GLOBAL_SKILLS_DIR],
17083
+ dirs: [PI_AGENT_GLOBAL_SKILLS_DIR, PI_AGENT_GLOBAL_COMMANDS_DIR],
16687
17084
  files: [PI_AGENT_GLOBAL_ROOT_FILE]
16688
17085
  },
16689
17086
  rewriteGeneratedPath(path) {
16690
17087
  if (path === PI_AGENT_ROOT_FILE) return PI_AGENT_GLOBAL_ROOT_FILE;
17088
+ if (path.startsWith(`${PI_AGENT_COMMANDS_DIR}/`)) {
17089
+ return path.replace(`${PI_AGENT_COMMANDS_DIR}/`, `${PI_AGENT_GLOBAL_COMMANDS_DIR}/`);
17090
+ }
16691
17091
  if (path.startsWith(`${PI_AGENT_SKILLS_DIR}/`)) {
16692
17092
  return path.replace(`${PI_AGENT_SKILLS_DIR}/`, `${PI_AGENT_GLOBAL_SKILLS_DIR}/`);
16693
17093
  }
@@ -16701,7 +17101,7 @@ var init_pi_agent2 = __esm({
16701
17101
  return PI_AGENT_GLOBAL_ROOT_FILE;
16702
17102
  },
16703
17103
  commandPath(name) {
16704
- return `${PI_AGENT_GLOBAL_SKILLS_DIR}/${commandSkillDirName(name)}/SKILL.md`;
17104
+ return `${PI_AGENT_GLOBAL_COMMANDS_DIR}/${name}.md`;
16705
17105
  },
16706
17106
  agentPath(name) {
16707
17107
  return `${PI_AGENT_GLOBAL_SKILLS_DIR}/${projectedAgentSkillDirName(name)}/SKILL.md`;
@@ -16711,7 +17111,7 @@ var init_pi_agent2 = __esm({
16711
17111
  capabilities11 = {
16712
17112
  rules: "native",
16713
17113
  additionalRules: "embedded",
16714
- commands: "none",
17114
+ commands: "native",
16715
17115
  agents: "none",
16716
17116
  skills: "native",
16717
17117
  mcp: "none",
@@ -16724,7 +17124,7 @@ var init_pi_agent2 = __esm({
16724
17124
  metadata: {
16725
17125
  displayName: "Pi Agent",
16726
17126
  category: "cli",
16727
- officialUrl: "https://github.com/pi-labs/pi-agent",
17127
+ officialUrl: "https://github.com/earendil-works/pi",
16728
17128
  shortDescription: "Pi coding agent"
16729
17129
  },
16730
17130
  generators: target22,
@@ -16737,7 +17137,7 @@ var init_pi_agent2 = __esm({
16737
17137
  ignore: lintIgnore6,
16738
17138
  mcp: lintMcp7
16739
17139
  },
16740
- supportsConversion: { commands: true, agents: true },
17140
+ supportsConversion: { agents: true },
16741
17141
  project: project22,
16742
17142
  globalSupport: {
16743
17143
  capabilities: capabilities11,
@@ -16755,6 +17155,17 @@ var init_pi_agent2 = __esm({
16755
17155
  canonicalDir: PI_AGENT_CANONICAL_RULES_DIR,
16756
17156
  canonicalRootFilename: "_root.md",
16757
17157
  markAsRoot: true
17158
+ },
17159
+ commands: {
17160
+ feature: "commands",
17161
+ mode: "directory",
17162
+ source: {
17163
+ project: [PI_AGENT_COMMANDS_DIR],
17164
+ global: [PI_AGENT_GLOBAL_COMMANDS_DIR]
17165
+ },
17166
+ canonicalDir: PI_AGENT_CANONICAL_COMMANDS_DIR,
17167
+ extensions: [".md"],
17168
+ preset: "command"
16758
17169
  }
16759
17170
  },
16760
17171
  sharedArtifacts: {
@@ -16844,7 +17255,7 @@ function generateIgnore12(canonical) {
16844
17255
  if (!canonical.ignore || canonical.ignore.length === 0) return [];
16845
17256
  return [{ path: QWEN_IGNORE, content: canonical.ignore.join("\n") }];
16846
17257
  }
16847
- function generateHooks11(canonical) {
17258
+ function generateHooks12(canonical) {
16848
17259
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
16849
17260
  const hooks = buildClaudeHooksObjectFromCanonical(canonical);
16850
17261
  if (Object.keys(hooks).length === 0) return [];
@@ -17018,7 +17429,7 @@ var init_qwen_code2 = __esm({
17018
17429
  generateSkills: generateSkills21,
17019
17430
  generateMcp: generateMcp17,
17020
17431
  generateIgnore: generateIgnore12,
17021
- generateHooks: generateHooks11,
17432
+ generateHooks: generateHooks12,
17022
17433
  generatePermissions: generatePermissions8,
17023
17434
  importFrom: importFromQwenCode
17024
17435
  };
@@ -17489,6 +17900,43 @@ var init_import_mappers9 = __esm({
17489
17900
  };
17490
17901
  }
17491
17902
  });
17903
+ async function importRooModes(projectRoot, results, normalize) {
17904
+ const srcPath = join(projectRoot, ROO_CODE_MODES_FILE);
17905
+ const content = await readFileSafe(srcPath);
17906
+ if (content === null) return;
17907
+ let parsed;
17908
+ try {
17909
+ parsed = parse(content);
17910
+ } catch {
17911
+ return;
17912
+ }
17913
+ const modes = parsed?.customModes;
17914
+ if (!Array.isArray(modes)) return;
17915
+ const destDir = join(projectRoot, ROO_CODE_CANONICAL_AGENTS_DIR);
17916
+ for (const mode of modes) {
17917
+ if (!mode || typeof mode !== "object") continue;
17918
+ const m = mode;
17919
+ const slug = typeof m.slug === "string" && m.slug ? m.slug : typeof m.name === "string" && m.name ? m.name : null;
17920
+ if (!slug) continue;
17921
+ const name = typeof m.name === "string" ? m.name : slug;
17922
+ const description = typeof m.description === "string" ? m.description : "";
17923
+ const body = typeof m.roleDefinition === "string" ? m.roleDefinition : "";
17924
+ const destPath = join(destDir, `${slug}.md`);
17925
+ const fileContent = await serializeImportedAgentWithFallback(
17926
+ destPath,
17927
+ { name, description, tools: [] },
17928
+ normalize(body, srcPath, destPath)
17929
+ );
17930
+ await mkdirp(dirname(destPath));
17931
+ await writeFileAtomic(destPath, fileContent);
17932
+ results.push({
17933
+ fromTool: ROO_CODE_TARGET,
17934
+ fromPath: srcPath,
17935
+ toPath: `${ROO_CODE_CANONICAL_AGENTS_DIR}/${slug}.md`,
17936
+ feature: "agents"
17937
+ });
17938
+ }
17939
+ }
17492
17940
  async function importPerModeRules(projectRoot, results, normalize) {
17493
17941
  const rooDir = join(projectRoot, ROO_CODE_DIR);
17494
17942
  let entries;
@@ -17528,15 +17976,18 @@ async function importFromRooCode(projectRoot, options = {}) {
17528
17976
  const normalize = await createImportReferenceNormalizer(ROO_CODE_TARGET, projectRoot, scope);
17529
17977
  results.push(...await runDescriptorImport(descriptor25, projectRoot, scope, { normalize }));
17530
17978
  await importPerModeRules(projectRoot, results, normalize);
17979
+ if (scope === "project") await importRooModes(projectRoot, results, normalize);
17531
17980
  await importEmbeddedSkills(projectRoot, ROO_CODE_SKILLS_DIR, ROO_CODE_TARGET, results, normalize);
17532
17981
  return results;
17533
17982
  }
17534
17983
  var init_importer25 = __esm({
17535
17984
  "src/targets/roo-code/importer.ts"() {
17536
17985
  init_import_rewriter();
17986
+ init_fs();
17537
17987
  init_embedded_skill();
17538
17988
  init_import_orchestrator();
17539
17989
  init_descriptor_import_runner();
17990
+ init_import_metadata();
17540
17991
  init_import_mappers9();
17541
17992
  init_constants23();
17542
17993
  init_roo_code2();
@@ -17578,7 +18029,7 @@ var init_lint23 = __esm({
17578
18029
  init_helpers();
17579
18030
  }
17580
18031
  });
17581
- function computeStatus5(existing, content) {
18032
+ function computeStatus6(existing, content) {
17582
18033
  if (existing === null) return "created";
17583
18034
  if (existing !== content) return "updated";
17584
18035
  return "unchanged";
@@ -17644,7 +18095,7 @@ var init_roo_code2 = __esm({
17644
18095
  path: ROO_CODE_GLOBAL_MODES_FILE,
17645
18096
  content,
17646
18097
  currentContent: existing ?? void 0,
17647
- status: computeStatus5(existing, content)
18098
+ status: computeStatus6(existing, content)
17648
18099
  }
17649
18100
  ];
17650
18101
  };
@@ -17728,7 +18179,7 @@ var init_roo_code2 = __esm({
17728
18179
  rules: "native",
17729
18180
  additionalRules: "native",
17730
18181
  commands: "native",
17731
- agents: "partial",
18182
+ agents: "native",
17732
18183
  skills: "native",
17733
18184
  mcp: "native",
17734
18185
  hooks: "none",
@@ -18871,7 +19322,7 @@ function toWindsurfHooks(hooks) {
18871
19322
  }
18872
19323
  return result;
18873
19324
  }
18874
- function generateHooks12(canonical) {
19325
+ function generateHooks13(canonical) {
18875
19326
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
18876
19327
  const hooks = toWindsurfHooks(canonical.hooks);
18877
19328
  if (Object.keys(hooks).length === 0) return [];
@@ -19335,7 +19786,7 @@ var init_windsurf2 = __esm({
19335
19786
  generateAgents: generateAgents27,
19336
19787
  generateSkills: generateSkills27,
19337
19788
  generateMcp: generateMcp22,
19338
- generateHooks: generateHooks12,
19789
+ generateHooks: generateHooks13,
19339
19790
  generateIgnore: generateIgnore15,
19340
19791
  importFrom: importFromWindsurf
19341
19792
  };
@@ -20808,7 +21259,7 @@ function refreshResultStatus(result) {
20808
21259
  init_fs();
20809
21260
  init_builtin_targets();
20810
21261
  init_registry();
20811
- function computeStatus6(existing, content) {
21262
+ function computeStatus7(existing, content) {
20812
21263
  if (existing === null) return "created";
20813
21264
  if (existing !== content) return "updated";
20814
21265
  return "unchanged";
@@ -20838,7 +21289,7 @@ async function emitGeneratedOutput(results, target31, out2, projectRoot, scope,
20838
21289
  path: resolvedPath,
20839
21290
  content,
20840
21291
  currentContent: existing ?? void 0,
20841
- status: computeStatus6(existing, content)
21292
+ status: computeStatus7(existing, content)
20842
21293
  });
20843
21294
  return resolvedPath;
20844
21295
  }
@@ -20869,7 +21320,7 @@ async function generateFeature(results, targets, canonical, projectRoot, enabled
20869
21320
  path: mirrorPath,
20870
21321
  content: out2.content,
20871
21322
  currentContent: existingMirror ?? void 0,
20872
- status: computeStatus6(existingMirror, out2.content)
21323
+ status: computeStatus7(existingMirror, out2.content)
20873
21324
  });
20874
21325
  }
20875
21326
  }