agentsmesh 0.26.0 → 0.27.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/index.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
  }
@@ -1415,13 +1420,14 @@ var init_embedded_skill = __esm({
1415
1420
  });
1416
1421
 
1417
1422
  // src/targets/aider/constants.ts
1418
- 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;
1423
+ 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;
1419
1424
  var init_constants = __esm({
1420
1425
  "src/targets/aider/constants.ts"() {
1421
1426
  AIDER_TARGET = "aider";
1422
1427
  AIDER_CONVENTIONS = "CONVENTIONS.md";
1423
1428
  AIDER_SKILLS_DIR = ".aider/skills";
1424
1429
  AIDER_IGNORE = ".aiderignore";
1430
+ AIDER_CONF_FILE = ".aider.conf.yml";
1425
1431
  AIDER_GLOBAL_CONVENTIONS = "CONVENTIONS.md";
1426
1432
  AIDER_GLOBAL_SKILLS_DIR = ".aider/skills";
1427
1433
  AIDER_GLOBAL_IGNORE = ".aiderignore";
@@ -1429,8 +1435,6 @@ var init_constants = __esm({
1429
1435
  AIDER_CANONICAL_IGNORE = ".agentsmesh/ignore";
1430
1436
  }
1431
1437
  });
1432
-
1433
- // src/targets/aider/generator.ts
1434
1438
  function generateRules(canonical) {
1435
1439
  const root = canonical.rules.find((rule) => rule.root);
1436
1440
  const nonRootRules = canonical.rules.filter((rule) => {
@@ -1440,7 +1444,10 @@ function generateRules(canonical) {
1440
1444
  const rootBody = root?.body.trim() ?? "";
1441
1445
  const content = appendEmbeddedRulesBlock(rootBody, nonRootRules);
1442
1446
  if (!content) return [];
1443
- return [{ path: AIDER_CONVENTIONS, content }];
1447
+ return [
1448
+ { path: AIDER_CONVENTIONS, content },
1449
+ { path: AIDER_CONF_FILE, content: stringify({ read: [AIDER_CONVENTIONS] }) }
1450
+ ];
1444
1451
  }
1445
1452
  function generateSkills(canonical) {
1446
1453
  return generateEmbeddedSkills(canonical, AIDER_SKILLS_DIR);
@@ -3314,7 +3321,7 @@ var init_antigravity = __esm({
3314
3321
  });
3315
3322
 
3316
3323
  // src/targets/augment-code/constants.ts
3317
- 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;
3324
+ 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;
3318
3325
  var init_constants6 = __esm({
3319
3326
  "src/targets/augment-code/constants.ts"() {
3320
3327
  AUGMENT_CODE_TARGET = "augment-code";
@@ -3336,6 +3343,7 @@ var init_constants6 = __esm({
3336
3343
  AUGMENT_CODE_CANONICAL_MCP = ".agentsmesh/mcp.json";
3337
3344
  AUGMENT_CODE_CANONICAL_HOOKS = ".agentsmesh/hooks.yaml";
3338
3345
  AUGMENT_CODE_CANONICAL_IGNORE = ".agentsmesh/ignore";
3346
+ AUGMENT_CODE_CANONICAL_PERMISSIONS = ".agentsmesh/permissions.yaml";
3339
3347
  }
3340
3348
  });
3341
3349
 
@@ -3548,7 +3556,7 @@ var init_codex_cli = __esm({
3548
3556
  });
3549
3557
 
3550
3558
  // src/targets/continue/constants.ts
3551
- 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;
3559
+ 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;
3552
3560
  var init_constants9 = __esm({
3553
3561
  "src/targets/continue/constants.ts"() {
3554
3562
  CONTINUE_TARGET = "continue";
@@ -3561,9 +3569,11 @@ var init_constants9 = __esm({
3561
3569
  CONTINUE_SKILLS_DIR = ".continue/skills";
3562
3570
  CONTINUE_GLOBAL_AGENTS_MD = ".continue/AGENTS.md";
3563
3571
  CONTINUE_GLOBAL_CONFIG = ".continue/config.yaml";
3572
+ CONTINUE_GLOBAL_PERMISSIONS = ".continue/permissions.yaml";
3564
3573
  CONTINUE_CANONICAL_RULES_DIR = ".agentsmesh/rules";
3565
3574
  CONTINUE_CANONICAL_COMMANDS_DIR = ".agentsmesh/commands";
3566
3575
  CONTINUE_CANONICAL_MCP = ".agentsmesh/mcp.json";
3576
+ CONTINUE_CANONICAL_PERMISSIONS = ".agentsmesh/permissions.yaml";
3567
3577
  }
3568
3578
  });
3569
3579
  async function buildContinueImportPaths(refs, projectRoot, scope = "project") {
@@ -3780,21 +3790,26 @@ var init_deepagents_cli = __esm({
3780
3790
  });
3781
3791
 
3782
3792
  // src/targets/factory-droid/constants.ts
3783
- 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;
3793
+ 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;
3784
3794
  var init_constants13 = __esm({
3785
3795
  "src/targets/factory-droid/constants.ts"() {
3786
3796
  FACTORY_DROID_TARGET = "factory-droid";
3787
3797
  FACTORY_DROID_ROOT_FILE = "AGENTS.md";
3788
3798
  FACTORY_DROID_SKILLS_DIR = ".factory/skills";
3799
+ FACTORY_DROID_COMMANDS_DIR = ".factory/commands";
3789
3800
  FACTORY_DROID_DROIDS_DIR = ".factory/droids";
3790
3801
  FACTORY_DROID_MCP_FILE = ".factory/mcp.json";
3791
3802
  FACTORY_DROID_GLOBAL_ROOT_FILE = ".factory/AGENTS.md";
3792
3803
  FACTORY_DROID_GLOBAL_SKILLS_DIR = ".factory/skills";
3804
+ FACTORY_DROID_GLOBAL_COMMANDS_DIR = ".factory/commands";
3793
3805
  FACTORY_DROID_GLOBAL_DROIDS_DIR = ".factory/droids";
3794
3806
  FACTORY_DROID_GLOBAL_MCP_FILE = ".factory/mcp.json";
3795
3807
  FACTORY_DROID_HOOKS_FILE = ".factory/hooks.json";
3796
3808
  FACTORY_DROID_GLOBAL_HOOKS_FILE = ".factory/hooks.json";
3797
3809
  FACTORY_DROID_CANONICAL_RULES_DIR = ".agentsmesh/rules";
3810
+ FACTORY_DROID_CANONICAL_AGENTS_DIR = ".agentsmesh/agents";
3811
+ FACTORY_DROID_CANONICAL_COMMANDS_DIR = ".agentsmesh/commands";
3812
+ FACTORY_DROID_CANONICAL_HOOKS = ".agentsmesh/hooks.yaml";
3798
3813
  }
3799
3814
  });
3800
3815
 
@@ -3802,6 +3817,9 @@ var init_constants13 = __esm({
3802
3817
  async function buildFactoryDroidImportPaths(refs, projectRoot, scope = "project") {
3803
3818
  if (scope === "global") {
3804
3819
  refs.set(FACTORY_DROID_GLOBAL_ROOT_FILE, `${AB_RULES2}/_root.md`);
3820
+ for (const absPath of await listFiles(projectRoot, FACTORY_DROID_GLOBAL_COMMANDS_DIR)) {
3821
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS3, ".md");
3822
+ }
3805
3823
  for (const absPath of await listFiles(projectRoot, FACTORY_DROID_GLOBAL_DROIDS_DIR)) {
3806
3824
  addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_AGENTS3, ".md");
3807
3825
  }
@@ -3812,6 +3830,9 @@ async function buildFactoryDroidImportPaths(refs, projectRoot, scope = "project"
3812
3830
  return;
3813
3831
  }
3814
3832
  refs.set(FACTORY_DROID_ROOT_FILE, `${AB_RULES2}/_root.md`);
3833
+ for (const absPath of await listFiles(projectRoot, FACTORY_DROID_COMMANDS_DIR)) {
3834
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS3, ".md");
3835
+ }
3815
3836
  for (const absPath of await listFiles(projectRoot, FACTORY_DROID_DROIDS_DIR)) {
3816
3837
  addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_AGENTS3, ".md");
3817
3838
  }
@@ -3858,7 +3879,7 @@ var init_gemini_cli = __esm({
3858
3879
  });
3859
3880
 
3860
3881
  // src/targets/goose/constants.ts
3861
- 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;
3882
+ 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;
3862
3883
  var init_constants14 = __esm({
3863
3884
  "src/targets/goose/constants.ts"() {
3864
3885
  GOOSE_TARGET = "goose";
@@ -3870,8 +3891,12 @@ var init_constants14 = __esm({
3870
3891
  GOOSE_GLOBAL_IGNORE = `${GOOSE_GLOBAL_DIR}/.gooseignore`;
3871
3892
  GOOSE_GLOBAL_CONFIG = `${GOOSE_GLOBAL_DIR}/config.yaml`;
3872
3893
  GOOSE_GLOBAL_SKILLS_DIR = ".agents/skills";
3894
+ GOOSE_GLOBAL_PERMISSIONS = `${GOOSE_GLOBAL_DIR}/permission.yaml`;
3895
+ GOOSE_HOOKS_FILE = ".agents/plugins/agentsmesh/hooks/hooks.json";
3873
3896
  GOOSE_CANONICAL_RULES_DIR = ".agentsmesh/rules";
3874
3897
  GOOSE_CANONICAL_IGNORE = ".agentsmesh/ignore";
3898
+ GOOSE_CANONICAL_HOOKS = ".agentsmesh/hooks.yaml";
3899
+ GOOSE_CANONICAL_PERMISSIONS = ".agentsmesh/permissions.yaml";
3875
3900
  }
3876
3901
  });
3877
3902
 
@@ -4212,16 +4237,19 @@ var init_opencode = __esm({
4212
4237
  });
4213
4238
 
4214
4239
  // src/targets/pi-agent/constants.ts
4215
- 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;
4240
+ 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;
4216
4241
  var init_constants20 = __esm({
4217
4242
  "src/targets/pi-agent/constants.ts"() {
4218
4243
  PI_AGENT_TARGET = "pi-agent";
4219
4244
  PI_AGENT_ROOT_FILE = "AGENTS.md";
4220
4245
  PI_AGENT_SKILLS_DIR = ".pi/skills";
4246
+ PI_AGENT_COMMANDS_DIR = ".pi/prompts";
4221
4247
  PI_AGENT_GLOBAL_DIR = ".pi/agent";
4222
4248
  PI_AGENT_GLOBAL_ROOT_FILE = `${PI_AGENT_GLOBAL_DIR}/AGENTS.md`;
4223
4249
  PI_AGENT_GLOBAL_SKILLS_DIR = `${PI_AGENT_GLOBAL_DIR}/skills`;
4250
+ PI_AGENT_GLOBAL_COMMANDS_DIR = `${PI_AGENT_GLOBAL_DIR}/prompts`;
4224
4251
  PI_AGENT_CANONICAL_RULES_DIR = ".agentsmesh/rules";
4252
+ PI_AGENT_CANONICAL_COMMANDS_DIR = ".agentsmesh/commands";
4225
4253
  }
4226
4254
  });
4227
4255
 
@@ -4229,12 +4257,18 @@ var init_constants20 = __esm({
4229
4257
  async function buildPiAgentImportPaths(refs, projectRoot, scope = "project") {
4230
4258
  if (scope === "global") {
4231
4259
  refs.set(PI_AGENT_GLOBAL_ROOT_FILE, `${AB_RULES2}/_root.md`);
4260
+ for (const absPath of await listFiles(projectRoot, PI_AGENT_GLOBAL_COMMANDS_DIR)) {
4261
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS3, ".md");
4262
+ }
4232
4263
  for (const absPath of await listFiles(projectRoot, PI_AGENT_GLOBAL_SKILLS_DIR)) {
4233
4264
  addSkillLikeMapping(refs, rel(projectRoot, absPath), PI_AGENT_GLOBAL_SKILLS_DIR);
4234
4265
  }
4235
4266
  return;
4236
4267
  }
4237
4268
  refs.set(PI_AGENT_ROOT_FILE, `${AB_RULES2}/_root.md`);
4269
+ for (const absPath of await listFiles(projectRoot, PI_AGENT_COMMANDS_DIR)) {
4270
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS3, ".md");
4271
+ }
4238
4272
  for (const absPath of await listFiles(projectRoot, PI_AGENT_SKILLS_DIR)) {
4239
4273
  addSkillLikeMapping(refs, rel(projectRoot, absPath), PI_AGENT_SKILLS_DIR);
4240
4274
  }
@@ -4340,7 +4374,7 @@ var init_replit_agent = __esm({
4340
4374
  });
4341
4375
 
4342
4376
  // src/targets/roo-code/constants.ts
4343
- 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;
4377
+ 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;
4344
4378
  var init_constants23 = __esm({
4345
4379
  "src/targets/roo-code/constants.ts"() {
4346
4380
  ROO_CODE_TARGET = "roo-code";
@@ -4363,6 +4397,7 @@ var init_constants23 = __esm({
4363
4397
  ROO_CODE_GLOBAL_AGENTS_MD = `${ROO_CODE_GLOBAL_DIR}/AGENTS.md`;
4364
4398
  ROO_CODE_GLOBAL_AGENTS_SKILLS_DIR = ".agents/skills";
4365
4399
  ROO_CODE_CANONICAL_RULES_DIR = ".agentsmesh/rules";
4400
+ ROO_CODE_CANONICAL_AGENTS_DIR = ".agentsmesh/agents";
4366
4401
  ROO_CODE_CANONICAL_COMMANDS_DIR = ".agentsmesh/commands";
4367
4402
  ROO_CODE_CANONICAL_MCP = ".agentsmesh/mcp.json";
4368
4403
  ROO_CODE_CANONICAL_IGNORE = ".agentsmesh/ignore";
@@ -4652,8 +4687,26 @@ var init_import_map_builders = __esm({
4652
4687
  init_import_maps();
4653
4688
  }
4654
4689
  });
4655
-
4656
- // src/targets/aider/index.ts
4690
+ function mergeAiderConf(existing, newContent) {
4691
+ if (existing === null) return newContent;
4692
+ let parsed;
4693
+ try {
4694
+ parsed = parse(existing);
4695
+ } catch {
4696
+ return newContent;
4697
+ }
4698
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return newContent;
4699
+ const base = parsed;
4700
+ const reads = /* @__PURE__ */ new Set();
4701
+ const existingRead = base.read;
4702
+ if (typeof existingRead === "string") reads.add(existingRead);
4703
+ else if (Array.isArray(existingRead)) {
4704
+ for (const entry of existingRead) if (typeof entry === "string") reads.add(entry);
4705
+ }
4706
+ reads.add(AIDER_CONVENTIONS);
4707
+ base.read = [...reads];
4708
+ return stringify(base);
4709
+ }
4657
4710
  var target, project, globalLayout, capabilities, descriptor;
4658
4711
  var init_aider2 = __esm({
4659
4712
  "src/targets/aider/index.ts"() {
@@ -4680,7 +4733,7 @@ var init_aider2 = __esm({
4680
4733
  skillDir: AIDER_SKILLS_DIR,
4681
4734
  managedOutputs: {
4682
4735
  dirs: [AIDER_SKILLS_DIR],
4683
- files: [AIDER_CONVENTIONS, AIDER_IGNORE]
4736
+ files: [AIDER_CONVENTIONS, AIDER_CONF_FILE, AIDER_IGNORE]
4684
4737
  },
4685
4738
  paths: {
4686
4739
  rulePath(_slug) {
@@ -4704,6 +4757,7 @@ var init_aider2 = __esm({
4704
4757
  rewriteGeneratedPath(path) {
4705
4758
  if (path === AIDER_CONVENTIONS) return AIDER_GLOBAL_CONVENTIONS;
4706
4759
  if (path === AIDER_IGNORE) return AIDER_GLOBAL_IGNORE;
4760
+ if (path === AIDER_CONF_FILE) return null;
4707
4761
  if (path.startsWith(`${AIDER_SKILLS_DIR}/`)) {
4708
4762
  return path.replace(`${AIDER_SKILLS_DIR}/`, `${AIDER_GLOBAL_SKILLS_DIR}/`);
4709
4763
  }
@@ -4779,6 +4833,10 @@ var init_aider2 = __esm({
4779
4833
  canonicalFilename: AIDER_CANONICAL_IGNORE
4780
4834
  }
4781
4835
  },
4836
+ mergeGeneratedOutputContent(existing, _pending, newContent, resolvedPath) {
4837
+ if (resolvedPath === AIDER_CONF_FILE) return mergeAiderConf(existing, newContent);
4838
+ return null;
4839
+ },
4782
4840
  buildImportPaths: buildAiderImportPaths,
4783
4841
  detectionPaths: [AIDER_CONVENTIONS, AIDER_IGNORE]
4784
4842
  };
@@ -4803,7 +4861,7 @@ function generateAgents2(canonical) {
4803
4861
  {
4804
4862
  name: agent.name,
4805
4863
  ...agent.description ? { description: agent.description } : {},
4806
- systemPrompt: agent.body.trim(),
4864
+ prompt: agent.body.trim(),
4807
4865
  ...agent.tools.length > 0 ? { allowedTools: agent.tools } : {}
4808
4866
  },
4809
4867
  null,
@@ -4902,7 +4960,7 @@ async function amazonQAgentMapper(ctx) {
4902
4960
  const name = typeof raw.name === "string" ? raw.name : agentName;
4903
4961
  const description = typeof raw.description === "string" ? raw.description : "";
4904
4962
  const tools = Array.isArray(raw.allowedTools) ? raw.allowedTools.filter((t) => typeof t === "string") : [];
4905
- const body = typeof raw.systemPrompt === "string" ? raw.systemPrompt : "";
4963
+ const body = typeof raw.prompt === "string" ? raw.prompt : typeof raw.systemPrompt === "string" ? raw.systemPrompt : "";
4906
4964
  const content = await serializeImportedAgentWithFallback(
4907
4965
  destPath,
4908
4966
  { name, description, tools },
@@ -4962,7 +5020,7 @@ var init_capabilities2 = __esm({
4962
5020
  "src/targets/amazon-q/capabilities.ts"() {
4963
5021
  projectCapabilities = {
4964
5022
  rules: "native",
4965
- additionalRules: "none",
5023
+ additionalRules: "native",
4966
5024
  commands: "none",
4967
5025
  agents: "native",
4968
5026
  skills: "none",
@@ -5925,16 +5983,13 @@ var init_antigravity2 = __esm({
5925
5983
  });
5926
5984
  function ruleFrontmatter(rule) {
5927
5985
  const fm = {};
5928
- if (rule.description) {
5929
- fm.description = rule.description;
5930
- }
5931
5986
  if (rule.globs.length > 0 || rule.trigger === "manual" || rule.trigger === "model_decision") {
5932
- fm.agent_requested = true;
5933
- if (rule.globs.length > 0) {
5934
- fm.globs = rule.globs;
5935
- }
5987
+ fm.type = "agent_requested";
5988
+ if (rule.description) fm.description = rule.description;
5989
+ if (rule.globs.length > 0) fm.globs = rule.globs;
5936
5990
  } else {
5937
- fm.always_apply = true;
5991
+ fm.type = "always_apply";
5992
+ if (rule.description) fm.description = rule.description;
5938
5993
  }
5939
5994
  return fm;
5940
5995
  }
@@ -5950,7 +6005,7 @@ function generateRules5(canonical) {
5950
6005
  for (const rule of canonical.rules) {
5951
6006
  if (rule.targets.length > 0 && !rule.targets.includes(AUGMENT_CODE_TARGET)) continue;
5952
6007
  if (rule.root) {
5953
- const fm = { always_apply: true };
6008
+ const fm = { type: "always_apply" };
5954
6009
  if (rule.description) fm.description = rule.description;
5955
6010
  outputs.push({
5956
6011
  path: `${AUGMENT_CODE_RULES_DIR}/_root.md`,
@@ -6002,6 +6057,27 @@ var init_generator5 = __esm({
6002
6057
  init_constants6();
6003
6058
  }
6004
6059
  });
6060
+ function parseToolPermissions(raw) {
6061
+ if (!Array.isArray(raw)) return null;
6062
+ const allow = [];
6063
+ const deny = [];
6064
+ const ask = [];
6065
+ for (const entry of raw) {
6066
+ if (!entry || typeof entry !== "object") continue;
6067
+ const e = entry;
6068
+ const toolName = typeof e.toolName === "string" ? e.toolName : void 0;
6069
+ const permission = e.permission;
6070
+ if (!toolName || !permission || typeof permission !== "object") continue;
6071
+ if (e.shellInputRegex !== void 0) continue;
6072
+ if (permission.type === "allow") allow.push(toolName);
6073
+ else if (permission.type === "deny") deny.push(toolName);
6074
+ else if (permission.type === "ask-user") ask.push(toolName);
6075
+ }
6076
+ if (allow.length === 0 && deny.length === 0 && ask.length === 0) return null;
6077
+ const permissions = { allow, deny };
6078
+ if (ask.length > 0) permissions.ask = ask;
6079
+ return permissions;
6080
+ }
6005
6081
  function augmentHooksToCanonical(hooks) {
6006
6082
  const result = {};
6007
6083
  for (const [event, entries] of Object.entries(hooks)) {
@@ -6024,7 +6100,7 @@ function augmentHooksToCanonical(hooks) {
6024
6100
  }
6025
6101
  return result;
6026
6102
  }
6027
- async function importAugmentSettings(projectRoot, settingsPath, results) {
6103
+ async function importAugmentSettings(projectRoot, settingsPath, results, options = {}) {
6028
6104
  const content = await readFileSafe(join(projectRoot, settingsPath));
6029
6105
  if (content === null) return;
6030
6106
  let settings;
@@ -6058,6 +6134,20 @@ async function importAugmentSettings(projectRoot, settingsPath, results) {
6058
6134
  });
6059
6135
  }
6060
6136
  }
6137
+ if (options.includePermissions) {
6138
+ const permissions = parseToolPermissions(settings.toolPermissions);
6139
+ if (permissions) {
6140
+ const destPath = join(projectRoot, AUGMENT_CODE_CANONICAL_PERMISSIONS);
6141
+ await mkdirp(dirname(destPath));
6142
+ await writeFileAtomic(destPath, stringify(permissions));
6143
+ results.push({
6144
+ fromTool: AUGMENT_CODE_TARGET,
6145
+ fromPath: join(projectRoot, settingsPath),
6146
+ toPath: AUGMENT_CODE_CANONICAL_PERMISSIONS,
6147
+ feature: "permissions"
6148
+ });
6149
+ }
6150
+ }
6061
6151
  }
6062
6152
  async function importAugmentIgnore(projectRoot, ignorePath, results) {
6063
6153
  const content = await readFileSafe(join(projectRoot, ignorePath));
@@ -6087,7 +6177,7 @@ function canonicalRuleMeta(frontmatter, isRoot) {
6087
6177
  description: typeof frontmatter.description === "string" ? frontmatter.description : void 0,
6088
6178
  globs: Array.isArray(frontmatter.globs) ? frontmatter.globs : []
6089
6179
  };
6090
- if (frontmatter.agent_requested === true) {
6180
+ if (frontmatter.type === "agent_requested" || frontmatter.agent_requested === true) {
6091
6181
  meta.trigger = "model_decision";
6092
6182
  }
6093
6183
  return meta;
@@ -6182,7 +6272,9 @@ async function importFromAugmentCode(projectRoot, options = {}) {
6182
6272
  const skillsDir = scope === "global" ? AUGMENT_CODE_GLOBAL_SKILLS_DIR : AUGMENT_CODE_SKILLS_DIR;
6183
6273
  await importEmbeddedSkills(projectRoot, skillsDir, AUGMENT_CODE_TARGET, results, normalize);
6184
6274
  const settingsFile = scope === "global" ? AUGMENT_CODE_GLOBAL_SETTINGS_FILE : AUGMENT_CODE_SETTINGS_FILE;
6185
- await importAugmentSettings(projectRoot, settingsFile, results);
6275
+ await importAugmentSettings(projectRoot, settingsFile, results, {
6276
+ includePermissions: scope === "global"
6277
+ });
6186
6278
  if (scope === "project") {
6187
6279
  await importAugmentIgnore(projectRoot, AUGMENT_CODE_IGNORE_FILE, results);
6188
6280
  }
@@ -6240,12 +6332,12 @@ var init_lint5 = __esm({
6240
6332
  }
6241
6333
  });
6242
6334
 
6243
- // src/targets/augment-code/index.ts
6335
+ // src/targets/augment-code/settings-build.ts
6244
6336
  function serializeHooksForSettings(hooks) {
6245
6337
  const result = {};
6246
6338
  for (const [event, entries] of Object.entries(hooks)) {
6247
6339
  if (!entries || entries.length === 0) continue;
6248
- const serialized = entries.map((entry) => ({
6340
+ result[event] = entries.map((entry) => ({
6249
6341
  matcher: entry.matcher,
6250
6342
  hooks: [
6251
6343
  {
@@ -6255,10 +6347,38 @@ function serializeHooksForSettings(hooks) {
6255
6347
  }
6256
6348
  ]
6257
6349
  }));
6258
- result[event] = serialized;
6259
6350
  }
6260
6351
  return result;
6261
6352
  }
6353
+ function serializeToolPermissions(permissions) {
6354
+ if (!permissions) return void 0;
6355
+ const entries = [];
6356
+ for (const toolName of permissions.allow ?? []) {
6357
+ entries.push({ toolName, permission: { type: "allow" } });
6358
+ }
6359
+ for (const toolName of permissions.deny ?? []) {
6360
+ entries.push({ toolName, permission: { type: "deny" } });
6361
+ }
6362
+ for (const toolName of permissions.ask ?? []) {
6363
+ entries.push({ toolName, permission: { type: "ask-user" } });
6364
+ }
6365
+ return entries.length > 0 ? entries : void 0;
6366
+ }
6367
+ function buildSettingsContent(canonical, enabledFeatures, scope) {
6368
+ const settings = {};
6369
+ if (enabledFeatures.has("mcp") && canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
6370
+ settings.mcpServers = canonical.mcp.mcpServers;
6371
+ }
6372
+ if (enabledFeatures.has("hooks") && canonical.hooks && Object.keys(canonical.hooks).length > 0) {
6373
+ settings.hooks = serializeHooksForSettings(canonical.hooks);
6374
+ }
6375
+ if (scope === "global" && enabledFeatures.has("permissions")) {
6376
+ const toolPermissions = serializeToolPermissions(canonical.permissions);
6377
+ if (toolPermissions) settings.toolPermissions = toolPermissions;
6378
+ }
6379
+ if (Object.keys(settings).length === 0) return null;
6380
+ return JSON.stringify(settings, null, 2);
6381
+ }
6262
6382
  function mergeAugmentSettings(existing, newContent) {
6263
6383
  if (existing === null) return newContent;
6264
6384
  let base;
@@ -6273,19 +6393,15 @@ function mergeAugmentSettings(existing, newContent) {
6273
6393
  const overlay = incoming;
6274
6394
  if (overlay.mcpServers !== void 0) base.mcpServers = overlay.mcpServers;
6275
6395
  if (overlay.hooks !== void 0) base.hooks = overlay.hooks;
6396
+ if (overlay.toolPermissions !== void 0) base.toolPermissions = overlay.toolPermissions;
6276
6397
  return JSON.stringify(base, null, 2);
6277
6398
  }
6278
- function buildSettingsContent(canonical, enabledFeatures) {
6279
- const settings = {};
6280
- if (enabledFeatures.has("mcp") && canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
6281
- settings.mcpServers = canonical.mcp.mcpServers;
6282
- }
6283
- if (enabledFeatures.has("hooks") && canonical.hooks && Object.keys(canonical.hooks).length > 0) {
6284
- settings.hooks = serializeHooksForSettings(canonical.hooks);
6399
+ var init_settings_build = __esm({
6400
+ "src/targets/augment-code/settings-build.ts"() {
6285
6401
  }
6286
- if (Object.keys(settings).length === 0) return null;
6287
- return JSON.stringify(settings, null, 2);
6288
- }
6402
+ });
6403
+
6404
+ // src/targets/augment-code/index.ts
6289
6405
  var target5, project5, globalLayout5, capabilities3, globalCapabilities3, descriptor5;
6290
6406
  var init_augment_code2 = __esm({
6291
6407
  "src/targets/augment-code/index.ts"() {
@@ -6294,6 +6410,7 @@ var init_augment_code2 = __esm({
6294
6410
  init_linter5();
6295
6411
  init_lint5();
6296
6412
  init_import_map_builders();
6413
+ init_settings_build();
6297
6414
  init_constants6();
6298
6415
  target5 = {
6299
6416
  name: AUGMENT_CODE_TARGET,
@@ -6307,7 +6424,12 @@ var init_augment_code2 = __esm({
6307
6424
  project5 = {
6308
6425
  skillDir: AUGMENT_CODE_SKILLS_DIR,
6309
6426
  managedOutputs: {
6310
- dirs: [AUGMENT_CODE_RULES_DIR, AUGMENT_CODE_COMMANDS_DIR, AUGMENT_CODE_AGENTS_DIR, AUGMENT_CODE_SKILLS_DIR],
6427
+ dirs: [
6428
+ AUGMENT_CODE_RULES_DIR,
6429
+ AUGMENT_CODE_COMMANDS_DIR,
6430
+ AUGMENT_CODE_AGENTS_DIR,
6431
+ AUGMENT_CODE_SKILLS_DIR
6432
+ ],
6311
6433
  files: [AUGMENT_CODE_SETTINGS_FILE, AUGMENT_CODE_IGNORE_FILE]
6312
6434
  },
6313
6435
  paths: {
@@ -6383,7 +6505,7 @@ var init_augment_code2 = __esm({
6383
6505
  mcp: "native",
6384
6506
  hooks: "none",
6385
6507
  ignore: "none",
6386
- permissions: "none"
6508
+ permissions: "native"
6387
6509
  };
6388
6510
  descriptor5 = {
6389
6511
  id: AUGMENT_CODE_TARGET,
@@ -6411,8 +6533,8 @@ var init_augment_code2 = __esm({
6411
6533
  ],
6412
6534
  layout: globalLayout5
6413
6535
  },
6414
- emitScopedSettings(canonical, _scope, enabledFeatures) {
6415
- const content = buildSettingsContent(canonical, enabledFeatures);
6536
+ emitScopedSettings(canonical, scope, enabledFeatures) {
6537
+ const content = buildSettingsContent(canonical, enabledFeatures, scope);
6416
6538
  if (content === null) return [];
6417
6539
  return [{ path: AUGMENT_CODE_SETTINGS_FILE, content }];
6418
6540
  },
@@ -8371,30 +8493,79 @@ var init_mcp = __esm({
8371
8493
  init_constants28();
8372
8494
  }
8373
8495
  });
8374
-
8375
- // src/targets/codex-cli/generator/hooks.ts
8376
- function generateHooks4(canonical) {
8496
+ function buildWrappedCommandHooks(canonical, hooksFilePath) {
8377
8497
  if (!canonical.hooks) return [];
8378
8498
  const hooks = {};
8379
8499
  for (const [event, entries] of Object.entries(canonical.hooks)) {
8380
8500
  if (!Array.isArray(entries)) continue;
8381
8501
  const mapped = entries.flatMap((entry) => {
8382
8502
  if (!hasHookCommand(entry) || entry.type === "prompt") return [];
8383
- const hook = {
8384
- type: "command",
8385
- command: getHookCommand(entry)
8386
- };
8503
+ const hook = { type: "command", command: getHookCommand(entry) };
8387
8504
  if (entry.timeout !== void 0) hook.timeout = entry.timeout;
8388
8505
  return [{ matcher: entry.matcher, hooks: [hook] }];
8389
8506
  });
8390
8507
  if (mapped.length > 0) hooks[event] = mapped;
8391
8508
  }
8392
8509
  if (Object.keys(hooks).length === 0) return [];
8393
- return [{ path: CODEX_HOOKS_FILE, content: JSON.stringify({ hooks }, null, 2) }];
8510
+ return [{ path: hooksFilePath, content: JSON.stringify({ hooks }, null, 2) }];
8511
+ }
8512
+ async function importWrappedCommandHooks(options) {
8513
+ const { projectRoot, hooksFile, canonicalHooksPath, targetName, results } = options;
8514
+ const srcPath = join(projectRoot, hooksFile);
8515
+ const content = await readFileSafe(srcPath);
8516
+ if (content === null) return;
8517
+ let parsed;
8518
+ try {
8519
+ parsed = JSON.parse(content);
8520
+ } catch {
8521
+ return;
8522
+ }
8523
+ if (!parsed || typeof parsed !== "object") return;
8524
+ const rawHooks = parsed.hooks;
8525
+ if (!rawHooks || typeof rawHooks !== "object" || Array.isArray(rawHooks)) return;
8526
+ const hooks = {};
8527
+ for (const [event, groups] of Object.entries(rawHooks)) {
8528
+ if (!Array.isArray(groups)) continue;
8529
+ for (const group of groups) {
8530
+ if (!group || typeof group !== "object") continue;
8531
+ const record = group;
8532
+ const matcher = typeof record.matcher === "string" ? record.matcher : "*";
8533
+ if (!Array.isArray(record.hooks)) continue;
8534
+ for (const raw of record.hooks) {
8535
+ if (!raw || typeof raw !== "object") continue;
8536
+ const hook = raw;
8537
+ if (hook.type !== "command" || typeof hook.command !== "string") continue;
8538
+ const imported = { matcher, command: hook.command, type: "command" };
8539
+ if (typeof hook.timeout === "number") imported.timeout = hook.timeout;
8540
+ (hooks[event] ??= []).push(imported);
8541
+ }
8542
+ }
8543
+ }
8544
+ if (Object.keys(hooks).length === 0) return;
8545
+ const destPath = join(projectRoot, canonicalHooksPath);
8546
+ await mkdirp(dirname(destPath));
8547
+ await writeFileAtomic(destPath, stringify(hooks));
8548
+ results.push({
8549
+ fromTool: targetName,
8550
+ fromPath: srcPath,
8551
+ toPath: canonicalHooksPath,
8552
+ feature: "hooks"
8553
+ });
8554
+ }
8555
+ var init_wrapped_command_hooks = __esm({
8556
+ "src/targets/import/wrapped-command-hooks.ts"() {
8557
+ init_hook_command();
8558
+ init_fs();
8559
+ }
8560
+ });
8561
+
8562
+ // src/targets/codex-cli/generator/hooks.ts
8563
+ function generateHooks4(canonical) {
8564
+ return buildWrappedCommandHooks(canonical, CODEX_HOOKS_FILE);
8394
8565
  }
8395
8566
  var init_hooks = __esm({
8396
8567
  "src/targets/codex-cli/generator/hooks.ts"() {
8397
- init_hook_command();
8568
+ init_wrapped_command_hooks();
8398
8569
  init_constants28();
8399
8570
  }
8400
8571
  });
@@ -8785,51 +8956,20 @@ var init_importer_rules2 = __esm({
8785
8956
  init_instruction_mirror();
8786
8957
  }
8787
8958
  });
8959
+
8960
+ // src/targets/codex-cli/importer-hooks.ts
8788
8961
  async function importCodexHooks(projectRoot, results) {
8789
- const srcPath = join(projectRoot, CODEX_HOOKS_FILE);
8790
- const content = await readFileSafe(srcPath);
8791
- if (content === null) return;
8792
- let parsed;
8793
- try {
8794
- parsed = JSON.parse(content);
8795
- } catch {
8796
- return;
8797
- }
8798
- if (!parsed || typeof parsed !== "object") return;
8799
- const rawHooks = parsed.hooks;
8800
- if (!rawHooks || typeof rawHooks !== "object" || Array.isArray(rawHooks)) return;
8801
- const hooks = {};
8802
- for (const [event, groups] of Object.entries(rawHooks)) {
8803
- if (!Array.isArray(groups)) continue;
8804
- for (const group of groups) {
8805
- if (!group || typeof group !== "object") continue;
8806
- const record = group;
8807
- const matcher = typeof record.matcher === "string" ? record.matcher : "*";
8808
- if (!Array.isArray(record.hooks)) continue;
8809
- for (const raw of record.hooks) {
8810
- if (!raw || typeof raw !== "object") continue;
8811
- const hook = raw;
8812
- if (hook.type !== "command" || typeof hook.command !== "string") continue;
8813
- const imported = { matcher, command: hook.command, type: "command" };
8814
- if (typeof hook.timeout === "number") imported.timeout = hook.timeout;
8815
- (hooks[event] ??= []).push(imported);
8816
- }
8817
- }
8818
- }
8819
- if (Object.keys(hooks).length === 0) return;
8820
- const destPath = join(projectRoot, CODEX_CANONICAL_HOOKS);
8821
- await mkdirp(dirname(destPath));
8822
- await writeFileAtomic(destPath, stringify(hooks));
8823
- results.push({
8824
- fromTool: CODEX_TARGET,
8825
- fromPath: srcPath,
8826
- toPath: CODEX_CANONICAL_HOOKS,
8827
- feature: "hooks"
8962
+ await importWrappedCommandHooks({
8963
+ projectRoot,
8964
+ hooksFile: CODEX_HOOKS_FILE,
8965
+ canonicalHooksPath: CODEX_CANONICAL_HOOKS,
8966
+ targetName: CODEX_TARGET,
8967
+ results
8828
8968
  });
8829
8969
  }
8830
8970
  var init_importer_hooks = __esm({
8831
8971
  "src/targets/codex-cli/importer-hooks.ts"() {
8832
- init_fs();
8972
+ init_wrapped_command_hooks();
8833
8973
  init_constants28();
8834
8974
  }
8835
8975
  });
@@ -9010,7 +9150,7 @@ var init_codex_cli2 = __esm({
9010
9150
  agents: "native",
9011
9151
  skills: "native",
9012
9152
  mcp: "native",
9013
- hooks: "partial",
9153
+ hooks: "native",
9014
9154
  ignore: "none",
9015
9155
  permissions: "none"
9016
9156
  };
@@ -9030,7 +9170,7 @@ var init_codex_cli2 = __esm({
9030
9170
  agents: "native",
9031
9171
  skills: "native",
9032
9172
  mcp: "native",
9033
- hooks: "partial",
9173
+ hooks: "native",
9034
9174
  ignore: "none",
9035
9175
  permissions: "none"
9036
9176
  },
@@ -9186,6 +9326,40 @@ var init_generator10 = __esm({
9186
9326
  init_constants9();
9187
9327
  }
9188
9328
  });
9329
+ function serializeContinuePermissions(permissions) {
9330
+ if (!permissions) return null;
9331
+ const allow = permissions.allow ?? [];
9332
+ const ask = permissions.ask ?? [];
9333
+ const exclude = permissions.deny ?? [];
9334
+ if (allow.length === 0 && ask.length === 0 && exclude.length === 0) return null;
9335
+ const out2 = {};
9336
+ if (allow.length > 0) out2.allow = allow;
9337
+ if (ask.length > 0) out2.ask = ask;
9338
+ if (exclude.length > 0) out2.exclude = exclude;
9339
+ return stringify(out2).trimEnd() + "\n";
9340
+ }
9341
+ function parseContinuePermissions(content) {
9342
+ let parsed;
9343
+ try {
9344
+ parsed = parse(content);
9345
+ } catch {
9346
+ return null;
9347
+ }
9348
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
9349
+ const record = parsed;
9350
+ const allow = toStringArray5(record.allow);
9351
+ const ask = toStringArray5(record.ask);
9352
+ const deny = toStringArray5(record.exclude);
9353
+ if (allow.length === 0 && ask.length === 0 && deny.length === 0) return null;
9354
+ const permissions = { allow, deny };
9355
+ if (ask.length > 0) permissions.ask = ask;
9356
+ return permissions;
9357
+ }
9358
+ var init_permissions = __esm({
9359
+ "src/targets/continue/permissions.ts"() {
9360
+ init_shared_import_helpers();
9361
+ }
9362
+ });
9189
9363
  function readMcpServers(content, extension) {
9190
9364
  const parsed = extension === ".json" ? JSON.parse(content) : parse(content) ?? {};
9191
9365
  const rawServers = parsed.mcpServers;
@@ -9240,12 +9414,29 @@ async function importMcp2(projectRoot, results) {
9240
9414
  });
9241
9415
  }
9242
9416
  }
9243
- async function importFromContinue(projectRoot) {
9417
+ async function importPermissions(projectRoot, results) {
9418
+ const srcPath = join(projectRoot, CONTINUE_GLOBAL_PERMISSIONS);
9419
+ const content = await readFileSafe(srcPath);
9420
+ if (content === null) return;
9421
+ const permissions = parseContinuePermissions(content);
9422
+ if (!permissions) return;
9423
+ const destPath = join(projectRoot, CONTINUE_CANONICAL_PERMISSIONS);
9424
+ await mkdirp(dirname(destPath));
9425
+ await writeFileAtomic(destPath, stringify(permissions).trimEnd() + "\n");
9426
+ results.push({
9427
+ fromTool: CONTINUE_TARGET,
9428
+ fromPath: srcPath,
9429
+ toPath: CONTINUE_CANONICAL_PERMISSIONS,
9430
+ feature: "permissions"
9431
+ });
9432
+ }
9433
+ async function importFromContinue(projectRoot, options = {}) {
9244
9434
  const results = [];
9245
9435
  const normalize = await createImportReferenceNormalizer(CONTINUE_TARGET, projectRoot);
9246
9436
  results.push(...await runDescriptorImport(descriptor9, projectRoot, "project", { normalize }));
9247
9437
  await importEmbeddedSkills(projectRoot, CONTINUE_SKILLS_DIR, CONTINUE_TARGET, results, normalize);
9248
9438
  await importMcp2(projectRoot, results);
9439
+ if (options.scope === "global") await importPermissions(projectRoot, results);
9249
9440
  return results;
9250
9441
  }
9251
9442
  var init_importer9 = __esm({
@@ -9257,6 +9448,7 @@ var init_importer9 = __esm({
9257
9448
  init_mcp_merge();
9258
9449
  init_shared_import_helpers();
9259
9450
  init_constants9();
9451
+ init_permissions();
9260
9452
  init_continue2();
9261
9453
  }
9262
9454
  });
@@ -9422,6 +9614,7 @@ var init_scope_extras = __esm({
9422
9614
  init_fs();
9423
9615
  init_constants9();
9424
9616
  init_global_config();
9617
+ init_permissions();
9425
9618
  generateContinueScopeExtras = async (canonical, projectRoot, scope, enabledFeatures) => {
9426
9619
  const configResults = await generateContinueGlobalConfig(
9427
9620
  canonical,
@@ -9429,21 +9622,36 @@ var init_scope_extras = __esm({
9429
9622
  scope,
9430
9623
  enabledFeatures
9431
9624
  );
9432
- if (scope !== "global" || !enabledFeatures.has("rules")) return configResults;
9433
- const root = canonical.rules.find((r) => r.root);
9434
- if (!root) return configResults;
9435
- const content = root.body.trim();
9436
- const existing = await readFileSafe(join(projectRoot, CONTINUE_GLOBAL_AGENTS_MD));
9437
- return [
9438
- ...configResults,
9439
- {
9440
- target: "continue",
9441
- path: CONTINUE_GLOBAL_AGENTS_MD,
9442
- content,
9443
- currentContent: existing ?? void 0,
9444
- status: computeStatus3(existing, content)
9625
+ if (scope !== "global") return configResults;
9626
+ const results = [...configResults];
9627
+ if (enabledFeatures.has("permissions")) {
9628
+ const content = serializeContinuePermissions(canonical.permissions);
9629
+ if (content) {
9630
+ const existing = await readFileSafe(join(projectRoot, CONTINUE_GLOBAL_PERMISSIONS));
9631
+ results.push({
9632
+ target: "continue",
9633
+ path: CONTINUE_GLOBAL_PERMISSIONS,
9634
+ content,
9635
+ currentContent: existing ?? void 0,
9636
+ status: computeStatus3(existing, content)
9637
+ });
9445
9638
  }
9446
- ];
9639
+ }
9640
+ if (enabledFeatures.has("rules")) {
9641
+ const root = canonical.rules.find((r) => r.root);
9642
+ if (root) {
9643
+ const content = root.body.trim();
9644
+ const existing = await readFileSafe(join(projectRoot, CONTINUE_GLOBAL_AGENTS_MD));
9645
+ results.push({
9646
+ target: "continue",
9647
+ path: CONTINUE_GLOBAL_AGENTS_MD,
9648
+ content,
9649
+ currentContent: existing ?? void 0,
9650
+ status: computeStatus3(existing, content)
9651
+ });
9652
+ }
9653
+ }
9654
+ return results;
9447
9655
  };
9448
9656
  }
9449
9657
  });
@@ -9499,7 +9707,12 @@ var init_continue2 = __esm({
9499
9707
  skillDir: CONTINUE_SKILLS_DIR,
9500
9708
  managedOutputs: {
9501
9709
  dirs: [CONTINUE_RULES_DIR, CONTINUE_PROMPTS_DIR, CONTINUE_SKILLS_DIR, ".agents/skills"],
9502
- files: [CONTINUE_MCP_FILE, CONTINUE_GLOBAL_AGENTS_MD, CONTINUE_GLOBAL_CONFIG]
9710
+ files: [
9711
+ CONTINUE_MCP_FILE,
9712
+ CONTINUE_GLOBAL_AGENTS_MD,
9713
+ CONTINUE_GLOBAL_CONFIG,
9714
+ CONTINUE_GLOBAL_PERMISSIONS
9715
+ ]
9503
9716
  },
9504
9717
  mirrorGlobalPath(path, _activeTargets) {
9505
9718
  if (path.startsWith(`${CONTINUE_SKILLS_DIR}/`)) {
@@ -9528,7 +9741,7 @@ var init_continue2 = __esm({
9528
9741
  mcp: "native",
9529
9742
  hooks: "none",
9530
9743
  ignore: "none",
9531
- permissions: "none"
9744
+ permissions: "native"
9532
9745
  };
9533
9746
  descriptor9 = {
9534
9747
  id: "continue",
@@ -10425,7 +10638,7 @@ var init_capabilities4 = __esm({
10425
10638
  agents: "native",
10426
10639
  skills: "native",
10427
10640
  mcp: "native",
10428
- hooks: "partial",
10641
+ hooks: "native",
10429
10642
  ignore: "none",
10430
10643
  permissions: "none"
10431
10644
  };
@@ -10707,11 +10920,12 @@ async function importFromCrush(projectRoot, options = {}) {
10707
10920
  results.push(...await runDescriptorImport(descriptor11, projectRoot, scope, { normalize }));
10708
10921
  const skillsDir = scope === "global" ? CRUSH_GLOBAL_SKILLS_DIR : CRUSH_SKILLS_DIR;
10709
10922
  await importEmbeddedSkills(projectRoot, skillsDir, CRUSH_TARGET, results, normalize);
10710
- await importCrushConfigJson(projectRoot, results);
10923
+ await importCrushConfigJson(projectRoot, scope, results);
10711
10924
  return results;
10712
10925
  }
10713
- async function importCrushConfigJson(projectRoot, results) {
10714
- const configPath = join(projectRoot, CRUSH_CONFIG_FILE);
10926
+ async function importCrushConfigJson(projectRoot, scope, results) {
10927
+ const configRel = scope === "global" ? CRUSH_GLOBAL_CONFIG_FILE : CRUSH_CONFIG_FILE;
10928
+ const configPath = join(projectRoot, configRel);
10715
10929
  const content = await readFileSafe(configPath);
10716
10930
  if (content === null) return;
10717
10931
  let parsed;
@@ -11214,33 +11428,81 @@ var init_agents2 = __esm({
11214
11428
  function generatePermissions4(_canonical) {
11215
11429
  return [];
11216
11430
  }
11217
- var init_permissions = __esm({
11431
+ var init_permissions2 = __esm({
11218
11432
  "src/targets/cursor/generator/permissions.ts"() {
11219
11433
  }
11220
11434
  });
11221
11435
 
11222
- // src/targets/cursor/generator/hooks.ts
11436
+ // src/targets/cursor/hook-format.ts
11437
+ function unmappedCursorHookEvents(hooks) {
11438
+ return Object.keys(hooks).filter(
11439
+ (event) => Array.isArray(hooks[event]) && hooks[event].length > 0 && !(event in CANONICAL_TO_CURSOR)
11440
+ );
11441
+ }
11223
11442
  function toCursorHooks(hooks) {
11224
11443
  const result = {};
11225
11444
  for (const [event, entries] of Object.entries(hooks)) {
11226
- if (!Array.isArray(entries)) continue;
11227
- const translated = [];
11228
- for (const e of entries) {
11229
- if (!hasHookText(e)) continue;
11230
- const command = getHookCommand(e);
11231
- const prompt = getHookPrompt(e);
11232
- const value = e.type === "prompt" ? prompt || command : command || prompt;
11233
- const hookItem = {
11234
- type: e.type === "prompt" ? "prompt" : "command",
11235
- [e.type === "prompt" ? "prompt" : "command"]: value
11445
+ const cursorEvent = CANONICAL_TO_CURSOR[event];
11446
+ if (!cursorEvent || !Array.isArray(entries)) continue;
11447
+ const flat = [];
11448
+ for (const entry of entries) {
11449
+ if (!hasHookText(entry)) continue;
11450
+ const value = getHookText(entry);
11451
+ const hook = entry.type === "prompt" ? { type: "prompt", prompt: value } : { type: "command", command: value };
11452
+ if (entry.matcher) hook.matcher = entry.matcher;
11453
+ if (entry.timeout !== void 0) hook.timeout = entry.timeout;
11454
+ flat.push(hook);
11455
+ }
11456
+ if (flat.length > 0) result[cursorEvent] = flat;
11457
+ }
11458
+ return result;
11459
+ }
11460
+ function cursorHooksToCanonical(hooks) {
11461
+ const result = {};
11462
+ for (const [cursorEvent, entries] of Object.entries(hooks)) {
11463
+ const canonicalEvent = CURSOR_TO_CANONICAL.get(cursorEvent);
11464
+ if (!canonicalEvent || !Array.isArray(entries)) continue;
11465
+ const list = [];
11466
+ for (const entry of entries) {
11467
+ if (!entry || typeof entry !== "object") continue;
11468
+ const e = entry;
11469
+ const type = e.type === "prompt" ? "prompt" : "command";
11470
+ if (!hasHookText({ ...e, type })) continue;
11471
+ const value = getHookText({ ...e, type });
11472
+ const item = {
11473
+ matcher: typeof e.matcher === "string" ? e.matcher : "",
11474
+ type,
11475
+ command: value
11236
11476
  };
11237
- if (e.timeout !== void 0) hookItem.timeout = e.timeout;
11238
- translated.push({ matcher: e.matcher, hooks: [hookItem] });
11477
+ if (typeof e.timeout === "number") item.timeout = e.timeout;
11478
+ list.push(item);
11239
11479
  }
11240
- if (translated.length > 0) result[event] = translated;
11480
+ if (list.length > 0) result[canonicalEvent] = [...result[canonicalEvent] ?? [], ...list];
11241
11481
  }
11242
11482
  return result;
11243
11483
  }
11484
+ var CANONICAL_TO_CURSOR, CURSOR_TO_CANONICAL;
11485
+ var init_hook_format = __esm({
11486
+ "src/targets/cursor/hook-format.ts"() {
11487
+ init_hook_command();
11488
+ CANONICAL_TO_CURSOR = {
11489
+ PreToolUse: "preToolUse",
11490
+ PostToolUse: "postToolUse",
11491
+ UserPromptSubmit: "beforeSubmitPrompt",
11492
+ SubagentStart: "subagentStart",
11493
+ SubagentStop: "subagentStop",
11494
+ Stop: "stop",
11495
+ SessionStart: "sessionStart",
11496
+ SessionEnd: "sessionEnd",
11497
+ PreCompact: "preCompact"
11498
+ };
11499
+ CURSOR_TO_CANONICAL = new Map(
11500
+ Object.entries(CANONICAL_TO_CURSOR).map(([canonical, cursor]) => [cursor, canonical])
11501
+ );
11502
+ }
11503
+ });
11504
+
11505
+ // src/targets/cursor/generator/hooks.ts
11244
11506
  function generateHooks7(canonical) {
11245
11507
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
11246
11508
  const cursorHooks = toCursorHooks(canonical.hooks);
@@ -11250,8 +11512,8 @@ function generateHooks7(canonical) {
11250
11512
  }
11251
11513
  var init_hooks2 = __esm({
11252
11514
  "src/targets/cursor/generator/hooks.ts"() {
11253
- init_hook_command();
11254
11515
  init_constants11();
11516
+ init_hook_format();
11255
11517
  }
11256
11518
  });
11257
11519
 
@@ -11275,7 +11537,7 @@ var init_generator13 = __esm({
11275
11537
  init_mcp2();
11276
11538
  init_skills2();
11277
11539
  init_agents2();
11278
- init_permissions();
11540
+ init_permissions2();
11279
11541
  init_hooks2();
11280
11542
  init_ignore();
11281
11543
  }
@@ -11453,30 +11715,6 @@ var init_importer_rules3 = __esm({
11453
11715
  init_constants11();
11454
11716
  }
11455
11717
  });
11456
- function cursorHooksToCanonical(hooks) {
11457
- const result = {};
11458
- for (const [event, entries] of Object.entries(hooks)) {
11459
- if (!Array.isArray(entries)) continue;
11460
- const canonical = [];
11461
- for (const entry of entries) {
11462
- if (!entry || typeof entry !== "object") continue;
11463
- const e = entry;
11464
- const matcher = typeof e.matcher === "string" ? e.matcher : "";
11465
- if (!matcher) continue;
11466
- const hookList = Array.isArray(e.hooks) ? e.hooks : [];
11467
- for (const hook of hookList) {
11468
- const type = hook.type === "prompt" ? "prompt" : "command";
11469
- if (!hasHookText({ ...hook, type })) continue;
11470
- const value = type === "prompt" ? getHookPrompt(hook) || getHookCommand(hook) : getHookCommand(hook) || getHookPrompt(hook);
11471
- const item = { matcher, type, command: value };
11472
- if (typeof hook.timeout === "number") item.timeout = hook.timeout;
11473
- canonical.push(item);
11474
- }
11475
- }
11476
- if (canonical.length > 0) result[event] = canonical;
11477
- }
11478
- return result;
11479
- }
11480
11718
  async function importSettings2(projectRoot, results) {
11481
11719
  let hooksImportedFromHooksJson = false;
11482
11720
  const hooksJsonPath = join(projectRoot, CURSOR_HOOKS);
@@ -11578,7 +11816,7 @@ async function importIgnore(projectRoot, results) {
11578
11816
  }
11579
11817
  var init_settings_helpers3 = __esm({
11580
11818
  "src/targets/cursor/settings-helpers.ts"() {
11581
- init_hook_command();
11819
+ init_hook_format();
11582
11820
  init_fs();
11583
11821
  init_constants11();
11584
11822
  }
@@ -11889,6 +12127,18 @@ var init_linter12 = __esm({
11889
12127
  });
11890
12128
 
11891
12129
  // src/targets/cursor/lint.ts
12130
+ function lintHooks6(canonical) {
12131
+ if (!canonical.hooks) return [];
12132
+ const unmapped = unmappedCursorHookEvents(canonical.hooks);
12133
+ if (unmapped.length === 0) return [];
12134
+ return [
12135
+ createWarning(
12136
+ ".agentsmesh/hooks.yaml",
12137
+ "cursor",
12138
+ `Cursor has no equivalent for hook event(s) ${unmapped.join(", ")}; they are not projected to .cursor/hooks.json.`
12139
+ )
12140
+ ];
12141
+ }
11892
12142
  function lintCommands5(canonical) {
11893
12143
  return canonical.commands.filter((command) => command.description.length > 0 || command.allowedTools.length > 0).map(
11894
12144
  (command) => createWarning(
@@ -11933,6 +12183,7 @@ function lintPermissions4(canonical) {
11933
12183
  var init_lint11 = __esm({
11934
12184
  "src/targets/cursor/lint.ts"() {
11935
12185
  init_helpers();
12186
+ init_hook_format();
11936
12187
  }
11937
12188
  });
11938
12189
 
@@ -12037,7 +12288,7 @@ var init_cursor2 = __esm({
12037
12288
  };
12038
12289
  globalCapabilities10 = {
12039
12290
  rules: "native",
12040
- additionalRules: "embedded",
12291
+ additionalRules: "native",
12041
12292
  commands: "native",
12042
12293
  agents: "native",
12043
12294
  skills: "native",
@@ -12057,7 +12308,7 @@ var init_cursor2 = __esm({
12057
12308
  generators: target12,
12058
12309
  capabilities: {
12059
12310
  rules: "native",
12060
- additionalRules: "embedded",
12311
+ additionalRules: "native",
12061
12312
  commands: "native",
12062
12313
  agents: "native",
12063
12314
  skills: "native",
@@ -12071,7 +12322,8 @@ var init_cursor2 = __esm({
12071
12322
  lint: {
12072
12323
  commands: lintCommands5,
12073
12324
  mcp: lintMcp3,
12074
- permissions: lintPermissions4
12325
+ permissions: lintPermissions4,
12326
+ hooks: lintHooks6
12075
12327
  },
12076
12328
  project: project12,
12077
12329
  globalSupport: {
@@ -12442,10 +12694,18 @@ function generateSkills13(canonical) {
12442
12694
  return generateEmbeddedSkills(canonical, FACTORY_DROID_SKILLS_DIR);
12443
12695
  }
12444
12696
  function generateCommands13(canonical) {
12445
- return canonical.commands.map((command) => ({
12446
- path: `${FACTORY_DROID_SKILLS_DIR}/${commandSkillDirName(command.name)}/SKILL.md`,
12447
- content: serializeCommandSkill(command)
12448
- }));
12697
+ return canonical.commands.map((command) => {
12698
+ const frontmatter = {
12699
+ description: command.description || void 0,
12700
+ "allowed-tools": command.allowedTools.length > 0 ? command.allowedTools : void 0
12701
+ };
12702
+ if (frontmatter.description === void 0) delete frontmatter.description;
12703
+ if (frontmatter["allowed-tools"] === void 0) delete frontmatter["allowed-tools"];
12704
+ return {
12705
+ path: `${FACTORY_DROID_COMMANDS_DIR}/${command.name}.md`,
12706
+ content: serializeFrontmatter(frontmatter, command.body.trim() || "")
12707
+ };
12708
+ });
12449
12709
  }
12450
12710
  function generateAgents14(canonical) {
12451
12711
  return canonical.agents.map((agent) => ({
@@ -12454,10 +12714,7 @@ function generateAgents14(canonical) {
12454
12714
  }));
12455
12715
  }
12456
12716
  function generateHooks9(canonical) {
12457
- if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
12458
- const hooks = buildClaudeHooksObjectFromCanonical(canonical);
12459
- if (Object.keys(hooks).length === 0) return [];
12460
- return [{ path: FACTORY_DROID_HOOKS_FILE, content: JSON.stringify(hooks, null, 2) }];
12717
+ return buildWrappedCommandHooks(canonical, FACTORY_DROID_HOOKS_FILE);
12461
12718
  }
12462
12719
  function generateMcp11(canonical) {
12463
12720
  if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
@@ -12472,8 +12729,8 @@ var init_generator16 = __esm({
12472
12729
  "src/targets/factory-droid/generator.ts"() {
12473
12730
  init_embedded_skill();
12474
12731
  init_managed_blocks();
12475
- init_command_skill();
12476
- init_hooks_format();
12732
+ init_markdown();
12733
+ init_wrapped_command_hooks();
12477
12734
  init_droid_serializer();
12478
12735
  init_constants13();
12479
12736
  }
@@ -12526,6 +12783,13 @@ async function importFromFactoryDroid(projectRoot, options = {}) {
12526
12783
  await importEmbeddedSkills(projectRoot, skillsDir, FACTORY_DROID_TARGET, results, normalize);
12527
12784
  const mcpFile = scope === "global" ? FACTORY_DROID_GLOBAL_MCP_FILE : FACTORY_DROID_MCP_FILE;
12528
12785
  await importFactoryDroidMcp(projectRoot, mcpFile, results);
12786
+ await importWrappedCommandHooks({
12787
+ projectRoot,
12788
+ hooksFile: FACTORY_DROID_HOOKS_FILE,
12789
+ canonicalHooksPath: FACTORY_DROID_CANONICAL_HOOKS,
12790
+ targetName: FACTORY_DROID_TARGET,
12791
+ results
12792
+ });
12529
12793
  return results;
12530
12794
  }
12531
12795
  var init_importer14 = __esm({
@@ -12533,6 +12797,7 @@ var init_importer14 = __esm({
12533
12797
  init_import_rewriter();
12534
12798
  init_embedded_skill();
12535
12799
  init_descriptor_import_runner();
12800
+ init_wrapped_command_hooks();
12536
12801
  init_mcp_import2();
12537
12802
  init_constants13();
12538
12803
  init_factory_droid2();
@@ -12595,7 +12860,6 @@ var init_factory_droid2 = __esm({
12595
12860
  init_linter14();
12596
12861
  init_lint13();
12597
12862
  init_import_map_builders();
12598
- init_command_skill();
12599
12863
  target14 = {
12600
12864
  name: FACTORY_DROID_TARGET,
12601
12865
  primaryRootInstructionPath: FACTORY_DROID_ROOT_FILE,
@@ -12611,7 +12875,7 @@ var init_factory_droid2 = __esm({
12611
12875
  rootInstructionPath: FACTORY_DROID_ROOT_FILE,
12612
12876
  skillDir: FACTORY_DROID_SKILLS_DIR,
12613
12877
  managedOutputs: {
12614
- dirs: [FACTORY_DROID_SKILLS_DIR, FACTORY_DROID_DROIDS_DIR],
12878
+ dirs: [FACTORY_DROID_SKILLS_DIR, FACTORY_DROID_COMMANDS_DIR, FACTORY_DROID_DROIDS_DIR],
12615
12879
  files: [FACTORY_DROID_ROOT_FILE, FACTORY_DROID_HOOKS_FILE, FACTORY_DROID_MCP_FILE]
12616
12880
  },
12617
12881
  paths: {
@@ -12619,7 +12883,7 @@ var init_factory_droid2 = __esm({
12619
12883
  return FACTORY_DROID_ROOT_FILE;
12620
12884
  },
12621
12885
  commandPath(name) {
12622
- return `${FACTORY_DROID_SKILLS_DIR}/${commandSkillDirName(name)}/SKILL.md`;
12886
+ return `${FACTORY_DROID_COMMANDS_DIR}/${name}.md`;
12623
12887
  },
12624
12888
  agentPath(name) {
12625
12889
  return `${FACTORY_DROID_DROIDS_DIR}/${name}.md`;
@@ -12630,8 +12894,16 @@ var init_factory_droid2 = __esm({
12630
12894
  rootInstructionPath: FACTORY_DROID_GLOBAL_ROOT_FILE,
12631
12895
  skillDir: FACTORY_DROID_GLOBAL_SKILLS_DIR,
12632
12896
  managedOutputs: {
12633
- dirs: [FACTORY_DROID_GLOBAL_SKILLS_DIR, FACTORY_DROID_GLOBAL_DROIDS_DIR],
12634
- files: [FACTORY_DROID_GLOBAL_ROOT_FILE, FACTORY_DROID_GLOBAL_HOOKS_FILE, FACTORY_DROID_GLOBAL_MCP_FILE]
12897
+ dirs: [
12898
+ FACTORY_DROID_GLOBAL_SKILLS_DIR,
12899
+ FACTORY_DROID_GLOBAL_COMMANDS_DIR,
12900
+ FACTORY_DROID_GLOBAL_DROIDS_DIR
12901
+ ],
12902
+ files: [
12903
+ FACTORY_DROID_GLOBAL_ROOT_FILE,
12904
+ FACTORY_DROID_GLOBAL_HOOKS_FILE,
12905
+ FACTORY_DROID_GLOBAL_MCP_FILE
12906
+ ]
12635
12907
  },
12636
12908
  rewriteGeneratedPath(path) {
12637
12909
  if (path === FACTORY_DROID_ROOT_FILE) return FACTORY_DROID_GLOBAL_ROOT_FILE;
@@ -12649,7 +12921,7 @@ var init_factory_droid2 = __esm({
12649
12921
  return FACTORY_DROID_GLOBAL_ROOT_FILE;
12650
12922
  },
12651
12923
  commandPath(name) {
12652
- return `${FACTORY_DROID_GLOBAL_SKILLS_DIR}/${commandSkillDirName(name)}/SKILL.md`;
12924
+ return `${FACTORY_DROID_GLOBAL_COMMANDS_DIR}/${name}.md`;
12653
12925
  },
12654
12926
  agentPath(name) {
12655
12927
  return `${FACTORY_DROID_GLOBAL_DROIDS_DIR}/${name}.md`;
@@ -12659,7 +12931,7 @@ var init_factory_droid2 = __esm({
12659
12931
  capabilities6 = {
12660
12932
  rules: "native",
12661
12933
  additionalRules: "embedded",
12662
- commands: "none",
12934
+ commands: "native",
12663
12935
  agents: "native",
12664
12936
  skills: "native",
12665
12937
  mcp: "native",
@@ -12683,7 +12955,6 @@ var init_factory_droid2 = __esm({
12683
12955
  permissions: lintPermissions6,
12684
12956
  ignore: lintIgnore3
12685
12957
  },
12686
- supportsConversion: { commands: true },
12687
12958
  project: project14,
12688
12959
  globalSupport: {
12689
12960
  capabilities: capabilities6,
@@ -12705,6 +12976,28 @@ var init_factory_droid2 = __esm({
12705
12976
  canonicalDir: FACTORY_DROID_CANONICAL_RULES_DIR,
12706
12977
  canonicalRootFilename: "_root.md",
12707
12978
  markAsRoot: true
12979
+ },
12980
+ commands: {
12981
+ feature: "commands",
12982
+ mode: "directory",
12983
+ source: {
12984
+ project: [FACTORY_DROID_COMMANDS_DIR],
12985
+ global: [FACTORY_DROID_GLOBAL_COMMANDS_DIR]
12986
+ },
12987
+ canonicalDir: FACTORY_DROID_CANONICAL_COMMANDS_DIR,
12988
+ extensions: [".md"],
12989
+ preset: "command"
12990
+ },
12991
+ agents: {
12992
+ feature: "agents",
12993
+ mode: "directory",
12994
+ source: {
12995
+ project: [FACTORY_DROID_DROIDS_DIR],
12996
+ global: [FACTORY_DROID_GLOBAL_DROIDS_DIR]
12997
+ },
12998
+ canonicalDir: FACTORY_DROID_CANONICAL_AGENTS_DIR,
12999
+ extensions: [".md"],
13000
+ preset: "agent"
12708
13001
  }
12709
13002
  },
12710
13003
  buildImportPaths: buildFactoryDroidImportPaths,
@@ -12714,7 +13007,7 @@ var init_factory_droid2 = __esm({
12714
13007
  });
12715
13008
 
12716
13009
  // src/targets/gemini-cli/constants.ts
12717
- 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;
13010
+ 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;
12718
13011
  var init_constants30 = __esm({
12719
13012
  "src/targets/gemini-cli/constants.ts"() {
12720
13013
  GEMINI_TARGET = "gemini-cli";
@@ -12744,6 +13037,7 @@ var init_constants30 = __esm({
12744
13037
  GEMINI_GLOBAL_COMMANDS_DIR = ".gemini/commands";
12745
13038
  GEMINI_GLOBAL_SKILLS_DIR = ".gemini/skills";
12746
13039
  GEMINI_GLOBAL_AGENTS_DIR = ".gemini/agents";
13040
+ GEMINI_GLOBAL_POLICIES_FILE = ".gemini/policies/permissions.toml";
12747
13041
  }
12748
13042
  });
12749
13043
 
@@ -13637,7 +13931,7 @@ function lintCommands6(canonical) {
13637
13931
  )
13638
13932
  );
13639
13933
  }
13640
- function lintHooks6(canonical) {
13934
+ function lintHooks7(canonical) {
13641
13935
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
13642
13936
  const supported = ["PreToolUse", "PostToolUse", "Notification"];
13643
13937
  const supportedSet = new Set(supported);
@@ -13747,7 +14041,12 @@ var init_gemini_cli2 = __esm({
13747
14041
  skillDir: GEMINI_GLOBAL_SKILLS_DIR,
13748
14042
  managedOutputs: {
13749
14043
  dirs: [GEMINI_GLOBAL_COMMANDS_DIR, GEMINI_GLOBAL_SKILLS_DIR, GEMINI_GLOBAL_AGENTS_DIR],
13750
- files: [GEMINI_GLOBAL_ROOT, GEMINI_GLOBAL_COMPAT_AGENTS, GEMINI_GLOBAL_SETTINGS]
14044
+ files: [
14045
+ GEMINI_GLOBAL_ROOT,
14046
+ GEMINI_GLOBAL_COMPAT_AGENTS,
14047
+ GEMINI_GLOBAL_SETTINGS,
14048
+ GEMINI_GLOBAL_POLICIES_FILE
14049
+ ]
13751
14050
  },
13752
14051
  rewriteGeneratedPath(path) {
13753
14052
  if (path === GEMINI_ROOT) {
@@ -13768,7 +14067,7 @@ var init_gemini_cli2 = __esm({
13768
14067
  if (path.startsWith(`${GEMINI_AGENTS_DIR}/`)) {
13769
14068
  return path.replace(`${GEMINI_AGENTS_DIR}/`, `${GEMINI_GLOBAL_AGENTS_DIR}/`);
13770
14069
  }
13771
- if (path.startsWith(".gemini/policies/") || path === ".geminiignore") {
14070
+ if (path === ".geminiignore") {
13772
14071
  return null;
13773
14072
  }
13774
14073
  return path;
@@ -13803,7 +14102,7 @@ var init_gemini_cli2 = __esm({
13803
14102
  mcp: "native",
13804
14103
  hooks: "partial",
13805
14104
  ignore: "none",
13806
- permissions: "none"
14105
+ permissions: "native"
13807
14106
  };
13808
14107
  descriptor15 = {
13809
14108
  id: "gemini-cli",
@@ -13829,7 +14128,7 @@ var init_gemini_cli2 = __esm({
13829
14128
  lintRules: lintRules15,
13830
14129
  lint: {
13831
14130
  commands: lintCommands6,
13832
- hooks: lintHooks6
14131
+ hooks: lintHooks7
13833
14132
  },
13834
14133
  emitScopedSettings: emitScopedGeminiSettings,
13835
14134
  mergeGeneratedOutputContent(existing, pending, newContent, resolvedPath) {
@@ -13904,6 +14203,9 @@ function generateIgnore8(canonical) {
13904
14203
  if (canonical.ignore.length === 0) return [];
13905
14204
  return [{ path: GOOSE_IGNORE, content: canonical.ignore.join("\n") }];
13906
14205
  }
14206
+ function generateHooks10(canonical) {
14207
+ return buildWrappedCommandHooks(canonical, GOOSE_HOOKS_FILE);
14208
+ }
13907
14209
  function mcpServerToExtension(name, server) {
13908
14210
  const base = {
13909
14211
  bundled: null,
@@ -13937,11 +14239,52 @@ var init_generator19 = __esm({
13937
14239
  init_managed_blocks();
13938
14240
  init_projected_agent_skill();
13939
14241
  init_command_skill();
14242
+ init_wrapped_command_hooks();
13940
14243
  init_constants14();
13941
14244
  }
13942
14245
  });
13943
-
13944
- // src/targets/goose/importer.ts
14246
+ function parseYamlObject(content) {
14247
+ if (content === null) return {};
14248
+ try {
14249
+ const parsed = parse(content);
14250
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
14251
+ return parsed;
14252
+ }
14253
+ } catch {
14254
+ }
14255
+ return {};
14256
+ }
14257
+ function serializeGoosePermissions(permissions, existingContent) {
14258
+ const allow = permissions?.allow ?? [];
14259
+ const ask = permissions?.ask ?? [];
14260
+ const deny = permissions?.deny ?? [];
14261
+ if (allow.length === 0 && ask.length === 0 && deny.length === 0) return null;
14262
+ const user = {};
14263
+ if (allow.length > 0) user.always_allow = allow;
14264
+ if (ask.length > 0) user.ask_before = ask;
14265
+ if (deny.length > 0) user.never_allow = deny;
14266
+ const root = parseYamlObject(existingContent);
14267
+ root.user = user;
14268
+ return stringify(root).trimEnd() + "\n";
14269
+ }
14270
+ function parseGoosePermissions(content) {
14271
+ const root = parseYamlObject(content);
14272
+ const user = root.user;
14273
+ if (!user || typeof user !== "object" || Array.isArray(user)) return null;
14274
+ const block = user;
14275
+ const allow = toStringArray5(block.always_allow);
14276
+ const ask = toStringArray5(block.ask_before);
14277
+ const deny = toStringArray5(block.never_allow);
14278
+ if (allow.length === 0 && ask.length === 0 && deny.length === 0) return null;
14279
+ const permissions = { allow, deny };
14280
+ if (ask.length > 0) permissions.ask = ask;
14281
+ return permissions;
14282
+ }
14283
+ var init_permissions3 = __esm({
14284
+ "src/targets/goose/permissions.ts"() {
14285
+ init_shared_import_helpers();
14286
+ }
14287
+ });
13945
14288
  async function importFromGoose(projectRoot, options = {}) {
13946
14289
  const scope = options.scope ?? "project";
13947
14290
  const results = [];
@@ -13949,14 +14292,41 @@ async function importFromGoose(projectRoot, options = {}) {
13949
14292
  results.push(...await runDescriptorImport(descriptor16, projectRoot, scope, { normalize }));
13950
14293
  const skillsDir = scope === "global" ? GOOSE_GLOBAL_SKILLS_DIR : GOOSE_SKILLS_DIR;
13951
14294
  await importEmbeddedSkills(projectRoot, skillsDir, GOOSE_TARGET, results, normalize);
14295
+ await importWrappedCommandHooks({
14296
+ projectRoot,
14297
+ hooksFile: GOOSE_HOOKS_FILE,
14298
+ canonicalHooksPath: GOOSE_CANONICAL_HOOKS,
14299
+ targetName: GOOSE_TARGET,
14300
+ results
14301
+ });
14302
+ if (scope === "global") await importPermissions2(projectRoot, results);
13952
14303
  return results;
13953
14304
  }
14305
+ async function importPermissions2(projectRoot, results) {
14306
+ const srcPath = join(projectRoot, GOOSE_GLOBAL_PERMISSIONS);
14307
+ const content = await readFileSafe(srcPath);
14308
+ if (content === null) return;
14309
+ const permissions = parseGoosePermissions(content);
14310
+ if (!permissions) return;
14311
+ const destPath = join(projectRoot, GOOSE_CANONICAL_PERMISSIONS);
14312
+ await mkdirp(dirname(destPath));
14313
+ await writeFileAtomic(destPath, stringify(permissions).trimEnd() + "\n");
14314
+ results.push({
14315
+ fromTool: GOOSE_TARGET,
14316
+ fromPath: srcPath,
14317
+ toPath: GOOSE_CANONICAL_PERMISSIONS,
14318
+ feature: "permissions"
14319
+ });
14320
+ }
13954
14321
  var init_importer16 = __esm({
13955
14322
  "src/targets/goose/importer.ts"() {
13956
14323
  init_import_rewriter();
14324
+ init_fs();
13957
14325
  init_embedded_skill();
13958
14326
  init_descriptor_import_runner();
14327
+ init_wrapped_command_hooks();
13959
14328
  init_constants14();
14329
+ init_permissions3();
13960
14330
  init_goose2();
13961
14331
  }
13962
14332
  });
@@ -14082,6 +14452,34 @@ var init_importer_spec3 = __esm({
14082
14452
  };
14083
14453
  }
14084
14454
  });
14455
+ function computeStatus5(existing, content) {
14456
+ if (existing === null) return "created";
14457
+ if (existing !== content) return "updated";
14458
+ return "unchanged";
14459
+ }
14460
+ var generateGooseScopeExtras;
14461
+ var init_scope_extras3 = __esm({
14462
+ "src/targets/goose/scope-extras.ts"() {
14463
+ init_fs();
14464
+ init_constants14();
14465
+ init_permissions3();
14466
+ generateGooseScopeExtras = async (canonical, projectRoot, scope, enabledFeatures) => {
14467
+ if (scope !== "global" || !enabledFeatures.has("permissions")) return [];
14468
+ const existing = await readFileSafe(join(projectRoot, GOOSE_GLOBAL_PERMISSIONS));
14469
+ const content = serializeGoosePermissions(canonical.permissions, existing);
14470
+ if (!content) return [];
14471
+ return [
14472
+ {
14473
+ target: "goose",
14474
+ path: GOOSE_GLOBAL_PERMISSIONS,
14475
+ content,
14476
+ currentContent: existing ?? void 0,
14477
+ status: computeStatus5(existing, content)
14478
+ }
14479
+ ];
14480
+ };
14481
+ }
14482
+ });
14085
14483
 
14086
14484
  // src/targets/goose/linter.ts
14087
14485
  function lintRules16(canonical, projectRoot, projectFiles, options) {
@@ -14100,21 +14498,9 @@ var init_linter16 = __esm({
14100
14498
  });
14101
14499
 
14102
14500
  // src/targets/goose/lint.ts
14103
- function lintHooks7(canonical) {
14104
- if (!canonical.hooks) return [];
14105
- const hasEntries = Object.values(canonical.hooks).some(
14106
- (entries) => Array.isArray(entries) && entries.length > 0
14107
- );
14108
- if (!hasEntries) return [];
14109
- return [
14110
- createWarning(
14111
- ".agentsmesh/hooks.yaml",
14112
- "goose",
14113
- "Goose has no lifecycle hook system; canonical hooks are not projected."
14114
- )
14115
- ];
14116
- }
14117
- function lintPermissions7(canonical) {
14501
+ function lintPermissions7(canonical, options) {
14502
+ const scope = options?.scope;
14503
+ if (scope === "global") return [];
14118
14504
  if (!canonical.permissions) return [];
14119
14505
  const { allow, deny } = canonical.permissions;
14120
14506
  const ask = canonical.permissions.ask ?? [];
@@ -14123,7 +14509,7 @@ function lintPermissions7(canonical) {
14123
14509
  createWarning(
14124
14510
  ".agentsmesh/permissions.yaml",
14125
14511
  "goose",
14126
- "Goose permissions are managed at runtime via permission.yaml in ~/.config/goose/; canonical permissions are not projected."
14512
+ "Goose applies tool permissions only at global scope (~/.config/goose/permission.yaml); project-scope permissions are not projected."
14127
14513
  )
14128
14514
  ];
14129
14515
  }
@@ -14153,6 +14539,7 @@ var init_goose2 = __esm({
14153
14539
  init_skill_mirror();
14154
14540
  init_importer16();
14155
14541
  init_importer_spec3();
14542
+ init_scope_extras3();
14156
14543
  init_linter16();
14157
14544
  init_lint15();
14158
14545
  init_import_map_builders();
@@ -14166,6 +14553,7 @@ var init_goose2 = __esm({
14166
14553
  generateSkills: generateSkills15,
14167
14554
  generateIgnore: generateIgnore8,
14168
14555
  generateMcp: generateMcp12,
14556
+ generateHooks: generateHooks10,
14169
14557
  importFrom: importFromGoose
14170
14558
  };
14171
14559
  project16 = {
@@ -14173,7 +14561,7 @@ var init_goose2 = __esm({
14173
14561
  skillDir: GOOSE_SKILLS_DIR,
14174
14562
  managedOutputs: {
14175
14563
  dirs: [GOOSE_SKILLS_DIR],
14176
- files: [GOOSE_ROOT_FILE, GOOSE_IGNORE]
14564
+ files: [GOOSE_ROOT_FILE, GOOSE_IGNORE, GOOSE_HOOKS_FILE]
14177
14565
  },
14178
14566
  paths: {
14179
14567
  rulePath(_slug) {
@@ -14192,7 +14580,13 @@ var init_goose2 = __esm({
14192
14580
  skillDir: GOOSE_GLOBAL_SKILLS_DIR,
14193
14581
  managedOutputs: {
14194
14582
  dirs: [GOOSE_GLOBAL_SKILLS_DIR],
14195
- files: [GOOSE_GLOBAL_ROOT_FILE, GOOSE_GLOBAL_IGNORE, GOOSE_GLOBAL_CONFIG]
14583
+ files: [
14584
+ GOOSE_GLOBAL_ROOT_FILE,
14585
+ GOOSE_GLOBAL_IGNORE,
14586
+ GOOSE_GLOBAL_CONFIG,
14587
+ GOOSE_HOOKS_FILE,
14588
+ GOOSE_GLOBAL_PERMISSIONS
14589
+ ]
14196
14590
  },
14197
14591
  rewriteGeneratedPath(path) {
14198
14592
  if (path === GOOSE_ROOT_FILE) return GOOSE_GLOBAL_ROOT_FILE;
@@ -14221,7 +14615,7 @@ var init_goose2 = __esm({
14221
14615
  agents: "none",
14222
14616
  skills: "native",
14223
14617
  mcp: "none",
14224
- hooks: "none",
14618
+ hooks: "native",
14225
14619
  ignore: "native",
14226
14620
  permissions: "none"
14227
14621
  };
@@ -14232,9 +14626,9 @@ var init_goose2 = __esm({
14232
14626
  agents: "none",
14233
14627
  skills: "native",
14234
14628
  mcp: "native",
14235
- hooks: "none",
14629
+ hooks: "native",
14236
14630
  ignore: "native",
14237
- permissions: "none"
14631
+ permissions: "native"
14238
14632
  };
14239
14633
  descriptor16 = {
14240
14634
  id: GOOSE_TARGET,
@@ -14249,7 +14643,6 @@ var init_goose2 = __esm({
14249
14643
  emptyImportMessage: "No Goose config found (.goosehints, .agents/skills, or .gooseignore).",
14250
14644
  lintRules: lintRules16,
14251
14645
  lint: {
14252
- hooks: lintHooks7,
14253
14646
  permissions: lintPermissions7,
14254
14647
  mcp: lintMcp4
14255
14648
  },
@@ -14263,7 +14656,8 @@ var init_goose2 = __esm({
14263
14656
  GOOSE_GLOBAL_SKILLS_DIR,
14264
14657
  GOOSE_GLOBAL_CONFIG
14265
14658
  ],
14266
- layout: globalLayout16
14659
+ layout: globalLayout16,
14660
+ scopeExtras: generateGooseScopeExtras
14267
14661
  },
14268
14662
  importer: gooseImporter,
14269
14663
  sharedArtifacts: {
@@ -15565,7 +15959,7 @@ function serializeCanonicalHooks(hooks) {
15565
15959
  return stringify(hooks).trimEnd();
15566
15960
  }
15567
15961
  var CANONICAL_TO_KIRO, KIRO_TO_CANONICAL;
15568
- var init_hook_format = __esm({
15962
+ var init_hook_format2 = __esm({
15569
15963
  "src/targets/kiro/hook-format.ts"() {
15570
15964
  CANONICAL_TO_KIRO = {
15571
15965
  UserPromptSubmit: "promptSubmit",
@@ -15631,7 +16025,7 @@ function generateMcp15(canonical) {
15631
16025
  }
15632
16026
  ];
15633
16027
  }
15634
- function generateHooks10(canonical) {
16028
+ function generateHooks11(canonical) {
15635
16029
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
15636
16030
  return generateKiroHooks(canonical.hooks).map((hook) => ({
15637
16031
  path: `${KIRO_HOOKS_DIR}/${hook.name}`,
@@ -15662,7 +16056,7 @@ var init_generator23 = __esm({
15662
16056
  init_embedded_skill();
15663
16057
  init_command_skill();
15664
16058
  init_markdown();
15665
- init_hook_format();
16059
+ init_hook_format2();
15666
16060
  init_constants18();
15667
16061
  }
15668
16062
  });
@@ -15767,7 +16161,7 @@ var init_importer20 = __esm({
15767
16161
  init_shared_import_helpers();
15768
16162
  init_fs();
15769
16163
  init_markdown();
15770
- init_hook_format();
16164
+ init_hook_format2();
15771
16165
  init_constants18();
15772
16166
  init_kiro2();
15773
16167
  }
@@ -15824,7 +16218,7 @@ var init_kiro2 = __esm({
15824
16218
  generateAgents: generateAgents19,
15825
16219
  generateSkills: generateSkills18,
15826
16220
  generateMcp: generateMcp15,
15827
- generateHooks: generateHooks10,
16221
+ generateHooks: generateHooks11,
15828
16222
  generateIgnore: generateIgnore11,
15829
16223
  importFrom: importFromKiro
15830
16224
  };
@@ -16143,7 +16537,7 @@ async function importMcp4(projectRoot, scope, results) {
16143
16537
  toPath: OPENCODE_CANONICAL_MCP
16144
16538
  });
16145
16539
  }
16146
- async function importPermissions(projectRoot, scope, results) {
16540
+ async function importPermissions3(projectRoot, scope, results) {
16147
16541
  const configFile = scope === "global" ? OPENCODE_GLOBAL_CONFIG_FILE : OPENCODE_CONFIG_FILE;
16148
16542
  const srcPath = join(projectRoot, configFile);
16149
16543
  const content = await readFileSafe(srcPath);
@@ -16181,7 +16575,7 @@ async function importFromOpenCode(projectRoot, options = {}) {
16181
16575
  results.push(...await runDescriptorImport(descriptor21, projectRoot, scope, { normalize }));
16182
16576
  await importEmbeddedSkills(projectRoot, OPENCODE_SKILLS_DIR, OPENCODE_TARGET, results, normalize);
16183
16577
  await importMcp4(projectRoot, scope, results);
16184
- await importPermissions(projectRoot, scope, results);
16578
+ await importPermissions3(projectRoot, scope, results);
16185
16579
  return results;
16186
16580
  }
16187
16581
  var init_importer21 = __esm({
@@ -16529,10 +16923,14 @@ function generateSkills20(canonical) {
16529
16923
  return generateEmbeddedSkills(canonical, PI_AGENT_SKILLS_DIR);
16530
16924
  }
16531
16925
  function generateCommands20(canonical) {
16532
- return canonical.commands.map((command) => ({
16533
- path: `${PI_AGENT_SKILLS_DIR}/${commandSkillDirName(command.name)}/SKILL.md`,
16534
- content: serializeCommandSkill(command)
16535
- }));
16926
+ return canonical.commands.map((command) => {
16927
+ const frontmatter = {};
16928
+ if (command.description) frontmatter.description = command.description;
16929
+ return {
16930
+ path: `${PI_AGENT_COMMANDS_DIR}/${command.name}.md`,
16931
+ content: serializeFrontmatter(frontmatter, command.body.trim() || "")
16932
+ };
16933
+ });
16536
16934
  }
16537
16935
  function generateAgents21(canonical) {
16538
16936
  return canonical.agents.map((agent) => ({
@@ -16544,8 +16942,8 @@ var init_generator25 = __esm({
16544
16942
  "src/targets/pi-agent/generator.ts"() {
16545
16943
  init_embedded_skill();
16546
16944
  init_managed_blocks();
16945
+ init_markdown();
16547
16946
  init_projected_agent_skill();
16548
- init_command_skill();
16549
16947
  init_constants20();
16550
16948
  }
16551
16949
  });
@@ -16644,7 +17042,6 @@ var init_lint21 = __esm({
16644
17042
  var target22, project22, globalLayout21, capabilities11, descriptor22;
16645
17043
  var init_pi_agent2 = __esm({
16646
17044
  "src/targets/pi-agent/index.ts"() {
16647
- init_command_skill();
16648
17045
  init_projected_agent_skill();
16649
17046
  init_generator25();
16650
17047
  init_skill_mirror();
@@ -16666,7 +17063,7 @@ var init_pi_agent2 = __esm({
16666
17063
  rootInstructionPath: PI_AGENT_ROOT_FILE,
16667
17064
  skillDir: PI_AGENT_SKILLS_DIR,
16668
17065
  managedOutputs: {
16669
- dirs: [PI_AGENT_SKILLS_DIR],
17066
+ dirs: [PI_AGENT_SKILLS_DIR, PI_AGENT_COMMANDS_DIR],
16670
17067
  files: [PI_AGENT_ROOT_FILE]
16671
17068
  },
16672
17069
  paths: {
@@ -16674,7 +17071,7 @@ var init_pi_agent2 = __esm({
16674
17071
  return PI_AGENT_ROOT_FILE;
16675
17072
  },
16676
17073
  commandPath(name) {
16677
- return `${PI_AGENT_SKILLS_DIR}/${commandSkillDirName(name)}/SKILL.md`;
17074
+ return `${PI_AGENT_COMMANDS_DIR}/${name}.md`;
16678
17075
  },
16679
17076
  agentPath(name) {
16680
17077
  return `${PI_AGENT_SKILLS_DIR}/${projectedAgentSkillDirName(name)}/SKILL.md`;
@@ -16685,11 +17082,14 @@ var init_pi_agent2 = __esm({
16685
17082
  rootInstructionPath: PI_AGENT_GLOBAL_ROOT_FILE,
16686
17083
  skillDir: PI_AGENT_GLOBAL_SKILLS_DIR,
16687
17084
  managedOutputs: {
16688
- dirs: [PI_AGENT_GLOBAL_SKILLS_DIR],
17085
+ dirs: [PI_AGENT_GLOBAL_SKILLS_DIR, PI_AGENT_GLOBAL_COMMANDS_DIR],
16689
17086
  files: [PI_AGENT_GLOBAL_ROOT_FILE]
16690
17087
  },
16691
17088
  rewriteGeneratedPath(path) {
16692
17089
  if (path === PI_AGENT_ROOT_FILE) return PI_AGENT_GLOBAL_ROOT_FILE;
17090
+ if (path.startsWith(`${PI_AGENT_COMMANDS_DIR}/`)) {
17091
+ return path.replace(`${PI_AGENT_COMMANDS_DIR}/`, `${PI_AGENT_GLOBAL_COMMANDS_DIR}/`);
17092
+ }
16693
17093
  if (path.startsWith(`${PI_AGENT_SKILLS_DIR}/`)) {
16694
17094
  return path.replace(`${PI_AGENT_SKILLS_DIR}/`, `${PI_AGENT_GLOBAL_SKILLS_DIR}/`);
16695
17095
  }
@@ -16703,7 +17103,7 @@ var init_pi_agent2 = __esm({
16703
17103
  return PI_AGENT_GLOBAL_ROOT_FILE;
16704
17104
  },
16705
17105
  commandPath(name) {
16706
- return `${PI_AGENT_GLOBAL_SKILLS_DIR}/${commandSkillDirName(name)}/SKILL.md`;
17106
+ return `${PI_AGENT_GLOBAL_COMMANDS_DIR}/${name}.md`;
16707
17107
  },
16708
17108
  agentPath(name) {
16709
17109
  return `${PI_AGENT_GLOBAL_SKILLS_DIR}/${projectedAgentSkillDirName(name)}/SKILL.md`;
@@ -16713,7 +17113,7 @@ var init_pi_agent2 = __esm({
16713
17113
  capabilities11 = {
16714
17114
  rules: "native",
16715
17115
  additionalRules: "embedded",
16716
- commands: "none",
17116
+ commands: "native",
16717
17117
  agents: "none",
16718
17118
  skills: "native",
16719
17119
  mcp: "none",
@@ -16726,7 +17126,7 @@ var init_pi_agent2 = __esm({
16726
17126
  metadata: {
16727
17127
  displayName: "Pi Agent",
16728
17128
  category: "cli",
16729
- officialUrl: "https://github.com/pi-labs/pi-agent",
17129
+ officialUrl: "https://github.com/earendil-works/pi",
16730
17130
  shortDescription: "Pi coding agent"
16731
17131
  },
16732
17132
  generators: target22,
@@ -16739,7 +17139,7 @@ var init_pi_agent2 = __esm({
16739
17139
  ignore: lintIgnore6,
16740
17140
  mcp: lintMcp7
16741
17141
  },
16742
- supportsConversion: { commands: true, agents: true },
17142
+ supportsConversion: { agents: true },
16743
17143
  project: project22,
16744
17144
  globalSupport: {
16745
17145
  capabilities: capabilities11,
@@ -16757,6 +17157,17 @@ var init_pi_agent2 = __esm({
16757
17157
  canonicalDir: PI_AGENT_CANONICAL_RULES_DIR,
16758
17158
  canonicalRootFilename: "_root.md",
16759
17159
  markAsRoot: true
17160
+ },
17161
+ commands: {
17162
+ feature: "commands",
17163
+ mode: "directory",
17164
+ source: {
17165
+ project: [PI_AGENT_COMMANDS_DIR],
17166
+ global: [PI_AGENT_GLOBAL_COMMANDS_DIR]
17167
+ },
17168
+ canonicalDir: PI_AGENT_CANONICAL_COMMANDS_DIR,
17169
+ extensions: [".md"],
17170
+ preset: "command"
16760
17171
  }
16761
17172
  },
16762
17173
  sharedArtifacts: {
@@ -16846,7 +17257,7 @@ function generateIgnore12(canonical) {
16846
17257
  if (!canonical.ignore || canonical.ignore.length === 0) return [];
16847
17258
  return [{ path: QWEN_IGNORE, content: canonical.ignore.join("\n") }];
16848
17259
  }
16849
- function generateHooks11(canonical) {
17260
+ function generateHooks12(canonical) {
16850
17261
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
16851
17262
  const hooks = buildClaudeHooksObjectFromCanonical(canonical);
16852
17263
  if (Object.keys(hooks).length === 0) return [];
@@ -17020,7 +17431,7 @@ var init_qwen_code2 = __esm({
17020
17431
  generateSkills: generateSkills21,
17021
17432
  generateMcp: generateMcp17,
17022
17433
  generateIgnore: generateIgnore12,
17023
- generateHooks: generateHooks11,
17434
+ generateHooks: generateHooks12,
17024
17435
  generatePermissions: generatePermissions8,
17025
17436
  importFrom: importFromQwenCode
17026
17437
  };
@@ -17491,6 +17902,43 @@ var init_import_mappers9 = __esm({
17491
17902
  };
17492
17903
  }
17493
17904
  });
17905
+ async function importRooModes(projectRoot, results, normalize) {
17906
+ const srcPath = join(projectRoot, ROO_CODE_MODES_FILE);
17907
+ const content = await readFileSafe(srcPath);
17908
+ if (content === null) return;
17909
+ let parsed;
17910
+ try {
17911
+ parsed = parse(content);
17912
+ } catch {
17913
+ return;
17914
+ }
17915
+ const modes = parsed?.customModes;
17916
+ if (!Array.isArray(modes)) return;
17917
+ const destDir = join(projectRoot, ROO_CODE_CANONICAL_AGENTS_DIR);
17918
+ for (const mode of modes) {
17919
+ if (!mode || typeof mode !== "object") continue;
17920
+ const m = mode;
17921
+ const slug = typeof m.slug === "string" && m.slug ? m.slug : typeof m.name === "string" && m.name ? m.name : null;
17922
+ if (!slug) continue;
17923
+ const name = typeof m.name === "string" ? m.name : slug;
17924
+ const description = typeof m.description === "string" ? m.description : "";
17925
+ const body = typeof m.roleDefinition === "string" ? m.roleDefinition : "";
17926
+ const destPath = join(destDir, `${slug}.md`);
17927
+ const fileContent = await serializeImportedAgentWithFallback(
17928
+ destPath,
17929
+ { name, description, tools: [] },
17930
+ normalize(body, srcPath, destPath)
17931
+ );
17932
+ await mkdirp(dirname(destPath));
17933
+ await writeFileAtomic(destPath, fileContent);
17934
+ results.push({
17935
+ fromTool: ROO_CODE_TARGET,
17936
+ fromPath: srcPath,
17937
+ toPath: `${ROO_CODE_CANONICAL_AGENTS_DIR}/${slug}.md`,
17938
+ feature: "agents"
17939
+ });
17940
+ }
17941
+ }
17494
17942
  async function importPerModeRules(projectRoot, results, normalize) {
17495
17943
  const rooDir = join(projectRoot, ROO_CODE_DIR);
17496
17944
  let entries;
@@ -17530,15 +17978,18 @@ async function importFromRooCode(projectRoot, options = {}) {
17530
17978
  const normalize = await createImportReferenceNormalizer(ROO_CODE_TARGET, projectRoot, scope);
17531
17979
  results.push(...await runDescriptorImport(descriptor25, projectRoot, scope, { normalize }));
17532
17980
  await importPerModeRules(projectRoot, results, normalize);
17981
+ if (scope === "project") await importRooModes(projectRoot, results, normalize);
17533
17982
  await importEmbeddedSkills(projectRoot, ROO_CODE_SKILLS_DIR, ROO_CODE_TARGET, results, normalize);
17534
17983
  return results;
17535
17984
  }
17536
17985
  var init_importer25 = __esm({
17537
17986
  "src/targets/roo-code/importer.ts"() {
17538
17987
  init_import_rewriter();
17988
+ init_fs();
17539
17989
  init_embedded_skill();
17540
17990
  init_import_orchestrator();
17541
17991
  init_descriptor_import_runner();
17992
+ init_import_metadata();
17542
17993
  init_import_mappers9();
17543
17994
  init_constants23();
17544
17995
  init_roo_code2();
@@ -17580,7 +18031,7 @@ var init_lint23 = __esm({
17580
18031
  init_helpers();
17581
18032
  }
17582
18033
  });
17583
- function computeStatus5(existing, content) {
18034
+ function computeStatus6(existing, content) {
17584
18035
  if (existing === null) return "created";
17585
18036
  if (existing !== content) return "updated";
17586
18037
  return "unchanged";
@@ -17646,7 +18097,7 @@ var init_roo_code2 = __esm({
17646
18097
  path: ROO_CODE_GLOBAL_MODES_FILE,
17647
18098
  content,
17648
18099
  currentContent: existing ?? void 0,
17649
- status: computeStatus5(existing, content)
18100
+ status: computeStatus6(existing, content)
17650
18101
  }
17651
18102
  ];
17652
18103
  };
@@ -17730,7 +18181,7 @@ var init_roo_code2 = __esm({
17730
18181
  rules: "native",
17731
18182
  additionalRules: "native",
17732
18183
  commands: "native",
17733
- agents: "partial",
18184
+ agents: "native",
17734
18185
  skills: "native",
17735
18186
  mcp: "native",
17736
18187
  hooks: "none",
@@ -18873,7 +19324,7 @@ function toWindsurfHooks(hooks) {
18873
19324
  }
18874
19325
  return result;
18875
19326
  }
18876
- function generateHooks12(canonical) {
19327
+ function generateHooks13(canonical) {
18877
19328
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
18878
19329
  const hooks = toWindsurfHooks(canonical.hooks);
18879
19330
  if (Object.keys(hooks).length === 0) return [];
@@ -19337,7 +19788,7 @@ var init_windsurf2 = __esm({
19337
19788
  generateAgents: generateAgents27,
19338
19789
  generateSkills: generateSkills27,
19339
19790
  generateMcp: generateMcp22,
19340
- generateHooks: generateHooks12,
19791
+ generateHooks: generateHooks13,
19341
19792
  generateIgnore: generateIgnore15,
19342
19793
  importFrom: importFromWindsurf
19343
19794
  };
@@ -20810,7 +21261,7 @@ function refreshResultStatus(result) {
20810
21261
  init_fs();
20811
21262
  init_builtin_targets();
20812
21263
  init_registry();
20813
- function computeStatus6(existing, content) {
21264
+ function computeStatus7(existing, content) {
20814
21265
  if (existing === null) return "created";
20815
21266
  if (existing !== content) return "updated";
20816
21267
  return "unchanged";
@@ -20840,7 +21291,7 @@ async function emitGeneratedOutput(results, target31, out2, projectRoot, scope,
20840
21291
  path: resolvedPath,
20841
21292
  content,
20842
21293
  currentContent: existing ?? void 0,
20843
- status: computeStatus6(existing, content)
21294
+ status: computeStatus7(existing, content)
20844
21295
  });
20845
21296
  return resolvedPath;
20846
21297
  }
@@ -20871,7 +21322,7 @@ async function generateFeature(results, targets, canonical, projectRoot, enabled
20871
21322
  path: mirrorPath,
20872
21323
  content: out2.content,
20873
21324
  currentContent: existingMirror ?? void 0,
20874
- status: computeStatus6(existingMirror, out2.content)
21325
+ status: computeStatus7(existingMirror, out2.content)
20875
21326
  });
20876
21327
  }
20877
21328
  }